30 #define DEBUG_TYPE "instruction-select"
36 "Select target instructions out of generic instructions",
57 auto ClearVRegTypesOnReturn =
69 assert(ISel &&
"Cannot work without InstructionSelector");
89 "instruction is not legal",
MI);
96 const size_t NumBlocks = MF.size();
104 bool ReachedBegin =
false;
105 for (
auto MII = std::prev(MBB->end()), Begin = MBB->begin();
109 const auto AfterIt = std::next(MII);
130 if (!ISel->select(MI)) {
139 auto InsertedBegin = ReachedBegin ? MBB->begin() : std::next(MII);
141 for (
auto &InsertedMI :
make_range(InsertedBegin, AfterIt))
142 dbgs() <<
" " << InsertedMI;
154 unsigned VReg = VRegToType.first;
164 "VReg has no regclass after selection", *MI);
169 if (VRegToType.second.isValid() &&
172 "VReg has explicit size different from class size",
178 if (MF.size() != NumBlocks) {
180 MF.getFunction()->getSubprogram(),
182 R <<
"inserting blocks is not supported yet";
187 auto &TLI = *MF.getSubtarget().getTargetLowering();
188 TLI.finalizeLowering(MF);
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool hasProperty(Property P) const
void initializeInstructionSelectPass(PassRegistry &)
unsigned getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
LLVM_NODISCARD detail::scope_exit< typename std::decay< Callable >::type > make_scope_exit(Callable &&F)
VRegToTypeMap & getVRegToType() const
Accessor for VRegToType.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
use_instr_iterator use_instr_begin(unsigned RegNo) const
const MachineFunctionProperties & getProperties() const
Get the function properties.
Target-Independent Code Generator Pass Configuration Options.
void eraseFromParentAndMarkDBGValuesForRemoval()
Unlink 'this' from the containing basic block and delete it.
virtual const InstructionSelector * getInstructionSelector() const
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
unsigned const MachineRegisterInfo * MRI
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
iterator_range< po_iterator< T > > post_order(const T &G)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
This pass is responsible for selecting generic machine instructions to target-specific instructions...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel...
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Provides the logic to select generic machine instructions.
bool isTriviallyDead(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Check whether an instruction MI is dead: it only defines dead virtual registers, and doesn't have oth...
Representation of each machine instruction.
def_instr_iterator def_instr_begin(unsigned RegNo) const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
INITIALIZE_PASS_BEGIN(InstructionSelect, DEBUG_TYPE,"Select target instructions out of generic instructions", false, false) INITIALIZE_PASS_END(InstructionSelect
Select target instructions out of generic false
const TargetRegisterClass * getRegClassOrNull(unsigned Reg) const
Return the register class of Reg, or null if Reg has not been assigned a register class yet...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual const LegalizerInfo * getLegalizerInfo() const
bool def_empty(unsigned RegNo) const
def_empty - Return true if there are no instructions defining the specified register (it may be live-...
inst_range instructions(Function *F)
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void reportGISelFailure(MachineFunction &MF, const TargetPassConfig &TPC, MachineOptimizationRemarkEmitter &MORE, MachineOptimizationRemarkMissed &R)
Report an ISel error as a missed optimization remark to the LLVMContext's diagnostic stream...
This file describes how to lower LLVM code to machine code.
bool use_empty(unsigned RegNo) const
use_empty - Return true if there are no instructions using the specified register.