25 #define DEBUG_TYPE "instruction-select"
31 "Select target instructions out of generic instructions",
49 std::string ErrStorage;
51 Err << Message <<
":\nIn function: " << MF.
getName() <<
'\n';
67 assert(ISel &&
"Cannot work without InstructionSelector");
91 const size_t NumBlocks = MF.size();
100 bool ReachedBegin =
false;
101 for (
auto MII = std::prev(MBB->end()), Begin = MBB->begin();
105 const auto AfterIt = std::next(MII);
118 if (!ISel->select(MI)) {
119 if (TPC.isGlobalISelAbortEnabled())
130 auto InsertedBegin = ReachedBegin ? MBB->begin() : std::next(MII);
132 for (
auto &InsertedMI :
make_range(InsertedBegin, AfterIt))
133 dbgs() <<
" " << InsertedMI;
143 unsigned VReg = VRegToType.first;
149 if (TPC.isGlobalISelAbortEnabled())
155 if (VRegToType.second.isValid() &&
156 VRegToType.second.getSizeInBits() > (RC->getSize() * 8)) {
157 if (TPC.isGlobalISelAbortEnabled())
159 MI,
"VReg has explicit size different from class size");
167 if (!TPC.isGlobalISelAbortEnabled() && (Failed || MF.size() != NumBlocks)) {
171 assert(MF.size() == NumBlocks &&
"Inserting blocks is not supported yet");
static void reportSelectionError(const MachineInstr *MI, const Twine &Message)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool hasProperty(Property P) const
void initializeInstructionSelectPass(PassRegistry &)
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...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const MachineFunctionProperties & getProperties() const
Get the function properties.
Target-Independent Code Generator Pass Configuration Options.
static def_instr_iterator def_instr_end()
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...
const MachineBasicBlock * getParent() const
unsigned const MachineRegisterInfo * MRI
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)
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
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.
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())
A raw_ostream that writes to an std::string.
virtual const LegalizerInfo * getLegalizerInfo() const
inst_range instructions(Function *F)
StringRef getName() const
getName - Return the name of the corresponding LLVM function.