LLVM
15.0.0git
|
This is a fast-path instruction selection class that generates poor code and doesn't support illegal types or non-trivial lowering, but runs quickly. More...
#include "llvm/CodeGen/FastISel.h"
Classes | |
struct | CallLoweringInfo |
Public Types | |
using | ArgListEntry = TargetLoweringBase::ArgListEntry |
using | ArgListTy = TargetLoweringBase::ArgListTy |
using | SavePoint = MachineBasicBlock::iterator |
Public Member Functions | |
virtual | ~FastISel () |
MachineInstr * | getLastLocalValue () |
Return the position of the last instruction emitted for materializing constants for use in the current block. More... | |
void | setLastLocalValue (MachineInstr *I) |
Update the position of the last instruction emitted for materializing constants for use in the current block. More... | |
void | startNewBlock () |
Set the current block to which generated machine instructions will be appended. More... | |
void | finishBasicBlock () |
Flush the local value map. More... | |
DebugLoc | getCurDebugLoc () const |
Return current debug location information. More... | |
bool | lowerArguments () |
Do "fast" instruction selection for function arguments and append the machine instructions to the current block. More... | |
bool | selectInstruction (const Instruction *I) |
Do "fast" instruction selection for the given LLVM IR instruction and append the generated machine instructions to the current block. More... | |
bool | selectOperator (const User *I, unsigned Opcode) |
Do "fast" instruction selection for the given LLVM IR operator (Instruction or ConstantExpr), and append generated machine instructions to the current block. More... | |
Register | getRegForValue (const Value *V) |
Create a virtual register and arrange for it to be assigned the value for the given LLVM value. More... | |
Register | lookUpRegForValue (const Value *V) |
Look up the value to see if its value is already cached in a register. More... | |
Register | getRegForGEPIndex (const Value *Idx) |
This is a wrapper around getRegForValue that also takes care of truncating or sign-extending the given getelementptr index value. More... | |
bool | tryToFoldLoad (const LoadInst *LI, const Instruction *FoldInst) |
We're checking to see if we can fold LI into FoldInst . More... | |
virtual bool | tryToFoldLoadIntoMI (MachineInstr *, unsigned, const LoadInst *) |
The specified machine instr operand is a vreg, and that vreg is being provided by the specified load instruction. More... | |
void | recomputeInsertPt () |
Reset InsertPt to prepare for inserting instructions into the current block. More... | |
void | removeDeadCode (MachineBasicBlock::iterator I, MachineBasicBlock::iterator E) |
Remove all dead instructions between the I and E. More... | |
SavePoint | enterLocalValueArea () |
Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position. More... | |
void | leaveLocalValueArea (SavePoint Old) |
Reset InsertPt to the given old insert position. More... | |
void | useInstrRefDebugInfo (bool Flag) |
Signal whether instruction referencing variable locations are desired for this function's debug-info. More... | |
Protected Member Functions | |
FastISel (FunctionLoweringInfo &FuncInfo, const TargetLibraryInfo *LibInfo, bool SkipTargetIndependentISel=false) | |
virtual bool | fastSelectInstruction (const Instruction *I)=0 |
This method is called by target-independent code when the normal FastISel process fails to select an instruction. More... | |
virtual bool | fastLowerArguments () |
This method is called by target-independent code to do target- specific argument lowering. More... | |
virtual bool | fastLowerCall (CallLoweringInfo &CLI) |
This method is called by target-independent code to do target- specific call lowering. More... | |
virtual bool | fastLowerIntrinsicCall (const IntrinsicInst *II) |
This method is called by target-independent code to do target- specific intrinsic lowering. More... | |
virtual unsigned | fastEmit_ (MVT VT, MVT RetVT, unsigned Opcode) |
This method is called by target-independent code to request that an instruction with the given type and opcode be emitted. More... | |
virtual unsigned | fastEmit_r (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0) |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register operand be emitted. More... | |
virtual unsigned | fastEmit_rr (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, unsigned Op1) |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register operands be emitted. More... | |
virtual unsigned | fastEmit_ri (MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, uint64_t Imm) |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register and immediate operands be emitted. More... | |
Register | fastEmit_ri_ (MVT VT, unsigned Opcode, unsigned Op0, uint64_t Imm, MVT ImmType) |
This method is a wrapper of fastEmit_ri. More... | |
virtual unsigned | fastEmit_i (MVT VT, MVT RetVT, unsigned Opcode, uint64_t Imm) |
This method is called by target-independent code to request that an instruction with the given type, opcode, and immediate operand be emitted. More... | |
virtual unsigned | fastEmit_f (MVT VT, MVT RetVT, unsigned Opcode, const ConstantFP *FPImm) |
This method is called by target-independent code to request that an instruction with the given type, opcode, and floating-point immediate operand be emitted. More... | |
Register | fastEmitInst_ (unsigned MachineInstOpcode, const TargetRegisterClass *RC) |
Emit a MachineInstr with no operands and a result register in the given register class. More... | |
Register | fastEmitInst_r (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0) |
Emit a MachineInstr with one register operand and a result register in the given register class. More... | |
Register | fastEmitInst_rr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, unsigned Op1) |
Emit a MachineInstr with two register operands and a result register in the given register class. More... | |
Register | fastEmitInst_rrr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, unsigned Op1, unsigned Op2) |
Emit a MachineInstr with three register operands and a result register in the given register class. More... | |
Register | fastEmitInst_ri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, uint64_t Imm) |
Emit a MachineInstr with a register operand, an immediate, and a result register in the given register class. More... | |
Register | fastEmitInst_rii (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, uint64_t Imm1, uint64_t Imm2) |
Emit a MachineInstr with one register operand and two immediate operands. More... | |
Register | fastEmitInst_f (unsigned MachineInstOpcode, const TargetRegisterClass *RC, const ConstantFP *FPImm) |
Emit a MachineInstr with a floating point immediate, and a result register in the given register class. More... | |
Register | fastEmitInst_rri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, unsigned Op1, uint64_t Imm) |
Emit a MachineInstr with two register operands, an immediate, and a result register in the given register class. More... | |
Register | fastEmitInst_i (unsigned MachineInstOpcode, const TargetRegisterClass *RC, uint64_t Imm) |
Emit a MachineInstr with a single immediate operand, and a result register in the given register class. More... | |
Register | fastEmitInst_extractsubreg (MVT RetVT, unsigned Op0, uint32_t Idx) |
Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified type. More... | |
Register | fastEmitZExtFromI1 (MVT VT, unsigned Op0) |
Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero. More... | |
void | fastEmitBranch (MachineBasicBlock *MSucc, const DebugLoc &DbgLoc) |
Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor, and update the CFG. More... | |
void | finishCondBranch (const BasicBlock *BranchBB, MachineBasicBlock *TrueMBB, MachineBasicBlock *FalseMBB) |
Emit an unconditional branch to FalseMBB , obtains the branch weight and adds TrueMBB and FalseMBB to the successor list. More... | |
void | updateValueMap (const Value *I, Register Reg, unsigned NumRegs=1) |
Update the value map to include the new mapping for this instruction, or insert an extra copy to get the result in a previous determined register. More... | |
Register | createResultReg (const TargetRegisterClass *RC) |
Register | constrainOperandRegClass (const MCInstrDesc &II, Register Op, unsigned OpNum) |
Try to constrain Op so that it is usable by argument OpNum of the provided MCInstrDesc. More... | |
virtual unsigned | fastMaterializeConstant (const Constant *C) |
Emit a constant in a register using target-specific logic, such as constant pool loads. More... | |
virtual unsigned | fastMaterializeAlloca (const AllocaInst *C) |
Emit an alloca address in a register using target-specific logic. More... | |
virtual unsigned | fastMaterializeFloatZero (const ConstantFP *CF) |
Emit the floating-point constant +0.0 in a register using target- specific logic. More... | |
bool | canFoldAddIntoGEP (const User *GEP, const Value *Add) |
Check if Add is an add that can be safely folded into GEP . More... | |
MachineMemOperand * | createMachineMemOperandFor (const Instruction *I) const |
Create a machine mem operand from the given instruction. More... | |
CmpInst::Predicate | optimizeCmpPredicate (const CmpInst *CI) const |
bool | lowerCallTo (const CallInst *CI, MCSymbol *Symbol, unsigned NumArgs) |
bool | lowerCallTo (const CallInst *CI, const char *SymName, unsigned NumArgs) |
bool | lowerCallTo (CallLoweringInfo &CLI) |
bool | lowerCall (const CallInst *I) |
bool | selectBinaryOp (const User *I, unsigned ISDOpcode) |
Select and emit code for a binary operator instruction, which has an opcode which directly corresponds to the given ISD opcode. More... | |
bool | selectFNeg (const User *I, const Value *In) |
Emit an FNeg operation. More... | |
bool | selectGetElementPtr (const User *I) |
bool | selectStackmap (const CallInst *I) |
bool | selectPatchpoint (const CallInst *I) |
bool | selectCall (const User *I) |
bool | selectIntrinsicCall (const IntrinsicInst *II) |
bool | selectBitCast (const User *I) |
bool | selectFreeze (const User *I) |
bool | selectCast (const User *I, unsigned Opcode) |
bool | selectExtractValue (const User *U) |
bool | selectXRayCustomEvent (const CallInst *II) |
bool | selectXRayTypedEvent (const CallInst *II) |
bool | shouldOptForSize (const MachineFunction *MF) const |
Protected Attributes | |
DenseMap< const Value *, Register > | LocalValueMap |
FunctionLoweringInfo & | FuncInfo |
MachineFunction * | MF |
MachineRegisterInfo & | MRI |
MachineFrameInfo & | MFI |
MachineConstantPool & | MCP |
DebugLoc | DbgLoc |
const TargetMachine & | TM |
const DataLayout & | DL |
const TargetInstrInfo & | TII |
const TargetLowering & | TLI |
const TargetRegisterInfo & | TRI |
const TargetLibraryInfo * | LibInfo |
bool | SkipTargetIndependentISel |
bool | UseInstrRefDebugInfo = false |
MachineInstr * | LastLocalValue = nullptr |
The position of the last instruction for materializing constants for use in the current block. More... | |
MachineInstr * | EmitStartPt = nullptr |
The top most instruction in the current block that is allowed for emitting local variables. More... | |
This is a fast-path instruction selection class that generates poor code and doesn't support illegal types or non-trivial lowering, but runs quickly.
Definition at line 65 of file FastISel.h.
Definition at line 67 of file FastISel.h.
Definition at line 68 of file FastISel.h.
Definition at line 313 of file FastISel.h.
|
virtualdefault |
|
explicitprotected |
Definition at line 1811 of file FastISel.cpp.
Check if Add
is an add that can be safely folded into GEP
.
Add
can be folded into GEP
if:
Add
is an add,Add's
size matches GEP's
,Add
is in the same basic block as GEP
, andAdd
has a constant operand. Definition at line 2251 of file FastISel.cpp.
References DL, FuncInfo, GEP, llvm::DataLayout::getTypeSizeInBits(), llvm::FunctionLoweringInfo::MBB, and llvm::FunctionLoweringInfo::MBBMap.
|
protected |
Try to constrain Op so that it is usable by argument OpNum of the provided MCInstrDesc.
If this fails, create a new virtual register in the correct class and COPY the value there.
Definition at line 1900 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineRegisterInfo::constrainRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::TargetInstrInfo::getRegClass(), llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, llvm::FunctionLoweringInfo::MF, MRI, TII, and TRI.
Referenced by fastEmitInst_r(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), and fastEmitInst_rrr().
|
protected |
Create a machine mem operand from the given instruction.
Definition at line 2268 of file FastISel.cpp.
References DL, FuncInfo, llvm::DataLayout::getABITypeAlign(), llvm::MachineFunction::getMachineMemOperand(), llvm::DataLayout::getTypeStoreSize(), I, llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile, llvm::FunctionLoweringInfo::MF, llvm::MachineMemOperand::MODereferenceable, llvm::MachineMemOperand::MOInvariant, llvm::MachineMemOperand::MOLoad, llvm::MachineMemOperand::MONonTemporal, llvm::MachineMemOperand::MOStore, llvm::MachineMemOperand::MOVolatile, and SI.
|
protected |
Definition at line 1896 of file FastISel.cpp.
References llvm::MachineRegisterInfo::createVirtualRegister(), and MRI.
Referenced by constrainOperandRegClass(), fastEmitInst_(), fastEmitInst_extractsubreg(), fastEmitInst_f(), fastEmitInst_i(), fastEmitInst_r(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), and fastEmitInst_rrr().
FastISel::SavePoint FastISel::enterLocalValueArea | ( | ) |
Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position.
Definition at line 435 of file FastISel.cpp.
This method is called by target-independent code to request that an instruction with the given type and opcode be emitted.
Definition at line 1832 of file FastISel.cpp.
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and floating-point immediate operand be emitted.
Definition at line 1847 of file FastISel.cpp.
This method is called by target-independent code to request that an instruction with the given type, opcode, and immediate operand be emitted.
Definition at line 1843 of file FastISel.cpp.
Referenced by fastEmit_ri_().
This method is called by target-independent code to request that an instruction with the given type, opcode, and register operand be emitted.
Definition at line 1834 of file FastISel.cpp.
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register and immediate operands be emitted.
Definition at line 1852 of file FastISel.cpp.
Referenced by fastEmit_ri_(), and fastEmitZExtFromI1().
|
protected |
This method is a wrapper of fastEmit_ri.
It first tries to emit an instruction with an immediate operand using fastEmit_ri. If that fails, it materializes the immediate into a register and try fastEmit_rr instead.
Definition at line 1861 of file FastISel.cpp.
References llvm::ISD::Constant, fastEmit_i(), fastEmit_ri(), fastEmit_rr(), llvm::FunctionLoweringInfo::Fn, FuncInfo, llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::Function::getContext(), getRegForValue(), llvm::MVT::getSizeInBits(), llvm::RISCVMatInt::Imm, llvm::isPowerOf2_64(), llvm::Log2_64(), llvm::ISD::MUL, llvm::ISD::SHL, llvm::ISD::SRA, llvm::ISD::SRL, and llvm::ISD::UDIV.
|
protectedvirtual |
This method is called by target-independent code to request that an instruction with the given type, opcode, and register operands be emitted.
Definition at line 1838 of file FastISel.cpp.
Referenced by fastEmit_ri_().
|
protected |
Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor, and update the CFG.
Definition at line 1561 of file FastISel.cpp.
References llvm::MachineBasicBlock::getBasicBlock(), llvm::HexagonInstrInfo::insertBranch(), and TII.
|
protected |
Emit a MachineInstr with no operands and a result register in the given register class.
Definition at line 1917 of file FastISel.cpp.
References llvm::BuildMI(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified type.
Definition at line 2101 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::MachineRegisterInfo::constrainRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetLoweringBase::getRegClassFor(), llvm::TargetRegisterInfo::getSubClassWithSubReg(), llvm::FunctionLoweringInfo::InsertPt, llvm::Register::isVirtualRegister(), llvm::FunctionLoweringInfo::MBB, MRI, TII, TLI, and TRI.
|
protected |
Emit a MachineInstr with a floating point immediate, and a result register in the given register class.
Definition at line 2041 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with a single immediate operand, and a result register in the given register class.
Definition at line 2085 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::RISCVMatInt::Imm, llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with one register operand and a result register in the given register class.
Definition at line 1926 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with a register operand, an immediate, and a result register in the given register class.
Definition at line 1995 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::RISCVMatInt::Imm, llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with one register operand and two immediate operands.
Definition at line 2017 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with two register operands and a result register in the given register class.
Definition at line 1946 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with two register operands, an immediate, and a result register in the given register class.
Definition at line 2060 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::RISCVMatInt::Imm, llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
|
protected |
Emit a MachineInstr with three register operands and a result register in the given register class.
Definition at line 1969 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), constrainOperandRegClass(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::ImplicitDefs, llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.
Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.
Definition at line 2115 of file FastISel.cpp.
References llvm::ISD::AND, and fastEmit_ri().
|
protectedvirtual |
This method is called by target-independent code to do target- specific argument lowering.
It returns true if it was successful.
Definition at line 1824 of file FastISel.cpp.
|
protectedvirtual |
This method is called by target-independent code to do target- specific call lowering.
It returns true if it was successful.
Definition at line 1826 of file FastISel.cpp.
|
protectedvirtual |
This method is called by target-independent code to do target- specific intrinsic lowering.
It returns true if it was successful.
Definition at line 1828 of file FastISel.cpp.
|
inlineprotectedvirtual |
Emit an alloca address in a register using target-specific logic.
Definition at line 478 of file FastISel.h.
|
inlineprotectedvirtual |
Emit a constant in a register using target-specific logic, such as constant pool loads.
Definition at line 475 of file FastISel.h.
|
inlineprotectedvirtual |
Emit the floating-point constant +0.0 in a register using target- specific logic.
Definition at line 482 of file FastISel.h.
|
protectedpure virtual |
void FastISel::finishBasicBlock | ( | ) |
Flush the local value map.
Definition at line 136 of file FastISel.cpp.
|
protected |
Emit an unconditional branch to FalseMBB
, obtains the branch weight and adds TrueMBB and FalseMBB to the successor list.
Definition at line 1581 of file FastISel.cpp.
References llvm::MachineBasicBlock::getBasicBlock().
|
inline |
Return current debug location information.
Definition at line 250 of file FastISel.h.
References DbgLoc.
|
inline |
Return the position of the last instruction emitted for materializing constants for use in the current block.
Definition at line 233 of file FastISel.h.
References LastLocalValue.
This is a wrapper around getRegForValue that also takes care of truncating or sign-extending the given getelementptr index value.
Definition at line 383 of file FastISel.cpp.
References llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), DL, llvm::EVT::getEVT(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::ISD::SIGN_EXTEND, and llvm::ISD::TRUNCATE.
Create a virtual register and arrange for it to be assigned the value for the given LLVM value.
Definition at line 238 of file FastISel.cpp.
References DL, llvm::Value::getContext(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::MVT::i1, llvm::MVT::i16, llvm::MVT::i8, and llvm::EVT::isSimple().
Referenced by fastEmit_ri_(), and tryToFoldLoad().
void FastISel::leaveLocalValueArea | ( | SavePoint | Old | ) |
Reset InsertPt to the given old insert position.
Definition at line 441 of file FastISel.cpp.
Look up the value to see if its value is already cached in a register.
It may be defined by instructions across blocks or defined locally.
Definition at line 351 of file FastISel.cpp.
References I.
bool FastISel::lowerArguments | ( | ) |
Definition at line 1114 of file FastISel.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::CallBase::getFunctionType(), and llvm::Value::getType().
|
protected |
Definition at line 993 of file FastISel.cpp.
References Align, Arg, llvm::ISD::InputArg::ArgVT, assert(), llvm::FastISel::CallLoweringInfo::Call, llvm::FastISel::CallLoweringInfo::CallConv, llvm::FastISel::CallLoweringInfo::CB, llvm::FastISel::CallLoweringInfo::clearIns(), llvm::FastISel::CallLoweringInfo::clearOuts(), llvm::ComputeValueVTs(), DL, E, llvm::ISD::InputArg::Flags, llvm::FastISel::CallLoweringInfo::getArgs(), llvm::Type::getContext(), llvm::Instruction::getMetadata(), getReturnAttrs(), llvm::GetReturnInfo(), i, I, llvm::FastISel::CallLoweringInfo::InRegs, llvm::FastISel::CallLoweringInfo::Ins, llvm::FastISel::CallLoweringInfo::IsInReg, llvm::FastISel::CallLoweringInfo::IsReturnValueUsed, llvm::FastISel::CallLoweringInfo::IsVarArg, llvm::FastISel::CallLoweringInfo::NumResultRegs, llvm::FastISel::CallLoweringInfo::OutFlags, llvm::FastISel::CallLoweringInfo::OutVals, llvm::FastISel::CallLoweringInfo::ResultReg, llvm::FastISel::CallLoweringInfo::RetSExt, llvm::FastISel::CallLoweringInfo::RetTy, llvm::FastISel::CallLoweringInfo::RetZExt, llvm::ISD::ArgFlagsTy::setByVal(), llvm::ISD::ArgFlagsTy::setByValSize(), llvm::ISD::ArgFlagsTy::setCFGuardTarget(), llvm::MachineInstr::setHeapAllocMarker(), llvm::ISD::ArgFlagsTy::setInAlloca(), llvm::ISD::ArgFlagsTy::setInConsecutiveRegs(), llvm::ISD::ArgFlagsTy::setInReg(), llvm::ISD::ArgFlagsTy::setMemAlign(), llvm::ISD::ArgFlagsTy::setNest(), llvm::ISD::ArgFlagsTy::setOrigAlign(), llvm::MachineInstr::setPhysRegsDeadExcept(), llvm::ISD::ArgFlagsTy::setPreallocated(), llvm::ISD::ArgFlagsTy::setSExt(), llvm::ISD::ArgFlagsTy::setSRet(), llvm::ISD::ArgFlagsTy::setSwiftAsync(), llvm::ISD::ArgFlagsTy::setSwiftError(), llvm::ISD::ArgFlagsTy::setSwiftSelf(), llvm::ISD::ArgFlagsTy::setZExt(), TRI, llvm::ISD::InputArg::Used, and llvm::ISD::InputArg::VT.
|
protected |
Definition at line 955 of file FastISel.cpp.
References DL, llvm::Mangler::getNameWithPrefix(), and llvm::MCContext::getOrCreateSymbol().
Definition at line 964 of file FastISel.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::CallBase::getFunctionType(), llvm::User::getOperand(), llvm::Value::getType(), and llvm::Type::isEmptyTy().
|
protected |
Definition at line 2315 of file FastISel.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and llvm_unreachable.
void FastISel::recomputeInsertPt | ( | ) |
Reset InsertPt to prepare for inserting instructions into the current block.
Definition at line 401 of file FastISel.cpp.
References llvm::ISD::EH_LABEL.
void FastISel::removeDeadCode | ( | MachineBasicBlock::iterator | I, |
MachineBasicBlock::iterator | E | ||
) |
Remove all dead instructions between the I and E.
Definition at line 415 of file FastISel.cpp.
References assert(), llvm::RegState::Dead, E, and I.
Select and emit code for a binary operator instruction, which has an opcode which directly corresponds to the given ISD opcode.
Definition at line 449 of file FastISel.cpp.
References llvm::ISD::AND, llvm::EVT::getEVT(), llvm::EVT::getSimpleVT(), I, llvm::MVT::i1, llvm::RISCVMatInt::Imm, isCommutative(), llvm::isPowerOf2_64(), llvm::EVT::isSimple(), llvm::Log2_64(), llvm::ISD::OR, llvm::MVT::Other, llvm::ISD::SDIV, llvm::ISD::SRA, llvm::ISD::UREM, and llvm::ISD::XOR.
Definition at line 1408 of file FastISel.cpp.
References llvm::ISD::BITCAST, DL, llvm::EVT::getSimpleVT(), I, and llvm::MVT::Other.
Definition at line 1156 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addExternalSymbol(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMetadata(), llvm::BuildMI(), llvm::InlineAsm::Extra_AsmDialect, llvm::InlineAsm::Extra_HasSideEffects, llvm::InlineAsm::Extra_IsAlignStack, llvm::InlineAsm::Extra_IsConvergent, I, llvm::ISD::INLINEASM, and TII.
Definition at line 1377 of file FastISel.cpp.
References DL, llvm::EVT::getSimpleVT(), I, llvm::EVT::isSimple(), and llvm::MVT::Other.
Definition at line 1642 of file FastISel.cpp.
References llvm::ComputeLinearIndex(), llvm::ComputeValueVTs(), DL, llvm::ExtractValueInst::getIndices(), llvm::User::getOperand(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), i, I, llvm::MVT::i1, and llvm::EVT::isSimple().
Emit an FNeg operation.
Definition at line 1600 of file FastISel.cpp.
References llvm::ISD::BITCAST, DL, llvm::ISD::FNEG, llvm::EVT::getIntegerVT(), llvm::EVT::getSimpleVT(), llvm::EVT::getSizeInBits(), I, llvm::tgtok::In, and llvm::ISD::XOR.
Definition at line 1437 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), DL, llvm::EVT::getSimpleVT(), I, llvm::MVT::Other, and TII.
Definition at line 537 of file FastISel.cpp.
References llvm::ISD::ADD, DL, E, llvm::gep_type_begin(), llvm::gep_type_end(), I, llvm::ISD::MUL, and N.
bool FastISel::selectInstruction | ( | const Instruction * | I | ) |
Do "fast" instruction selection for the given LLVM IR instruction and append the generated machine instructions to the current block.
Returns true if selection was successful.
Definition at line 1477 of file FastISel.cpp.
References llvm::numbers::e, F, i, I, and llvm::LLVMContext::OB_funclet.
|
protected |
Definition at line 1193 of file FastISel.cpp.
References llvm::MachineInstrBuilder::addCImm(), llvm::MachineInstrBuilder::addFPImm(), llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMetadata(), Arg, assert(), Builder, llvm::BuildMI(), llvm::DIExpression::constantFold(), llvm::MachineOperand::CreateReg(), llvm::dbgs(), llvm::DIExpression::DerefBefore, llvm::DbgDeclareInst::getAddress(), llvm::CallBase::getArgOperand(), llvm::DbgVariableIntrinsic::getExpression(), llvm::IntrinsicInst::getIntrinsicID(), llvm::DbgLabelInst::getLabel(), llvm::DbgValueInst::getValue(), llvm::DbgVariableIntrinsic::getVariable(), llvm::DbgVariableIntrinsic::hasArgList(), llvm::DILocalVariable::isValidLocationForIntrinsic(), LLVM_DEBUG, llvm_unreachable, llvm::DIExpression::prepend(), and TII.
Do "fast" instruction selection for the given LLVM IR operator (Instruction or ConstantExpr), and append generated machine instructions to the current block.
Return true if selection was successful.
Definition at line 1682 of file FastISel.cpp.
References llvm::MCID::Add, llvm::ISD::ADD, llvm::ISD::AND, llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), llvm::MCID::Call, DL, llvm::ISD::FADD, llvm::ISD::FDIV, llvm::ISD::FMUL, llvm::ISD::FP_TO_SINT, llvm::ISD::FREM, llvm::ISD::FSUB, llvm::Instruction::getDebugLoc(), llvm::BranchInst::getSuccessor(), I, llvm::BranchInst::isUnconditional(), llvm_unreachable, Mul, llvm::ISD::MUL, llvm::ISD::OR, llvm::MVT::Other, llvm::ISD::SDIV, selectBinaryOp(), llvm::ISD::SHL, llvm::ISD::SIGN_EXTEND, llvm::ISD::SINT_TO_FP, llvm::ISD::SRA, llvm::ISD::SREM, llvm::ISD::SRL, llvm::ISD::SUB, TM, llvm::ISD::TRAP, llvm::ISD::TRUNCATE, llvm::ISD::UDIV, llvm::ISD::UREM, llvm::ISD::XOR, and llvm::ISD::ZERO_EXTEND.
Definition at line 762 of file FastISel.cpp.
References llvm::MachineInstrBuilder::add(), addStackMapLiveVars(), llvm::CallingConv::AnyReg, assert(), llvm::BuildMI(), llvm::FastISel::CallLoweringInfo::Call, Callee, llvm::PatchPointOpers::CCPos, llvm::MachineOperand::CreateGA(), llvm::MachineOperand::CreateImm(), llvm::MachineOperand::CreateReg(), llvm::MachineOperand::CreateRegMask(), llvm::numbers::e, llvm::MachineInstr::eraseFromParent(), llvm::TargetRegisterInfo::getCallPreservedMask(), i, I, llvm::MVT::i64, llvm::PatchPointOpers::IDPos, llvm::FastISel::CallLoweringInfo::InRegs, llvm_unreachable, llvm::PatchPointOpers::NArgPos, llvm::PatchPointOpers::NBytesPos, llvm::FastISel::CallLoweringInfo::NumResultRegs, llvm::FastISel::CallLoweringInfo::OutRegs, llvm::FastISel::CallLoweringInfo::ResultReg, llvm::FastISel::CallLoweringInfo::setIsPatchPoint(), llvm::MachineInstr::setPhysRegsDeadExcept(), llvm::PatchPointOpers::TargetPos, TII, and TRI.
Definition at line 650 of file FastISel.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addImm(), addStackMapLiveVars(), assert(), Builder, llvm::BuildMI(), llvm::MachineOperand::CreateImm(), llvm::MachineOperand::CreateReg(), E, llvm::MachineFunction::getFrameInfo(), llvm::MCInstrDesc::getNumOperands(), i, I, llvm::PatchPointOpers::IDPos, llvm::PatchPointOpers::NBytesPos, llvm::MachineFrameInfo::setHasStackMap(), and TII.
Definition at line 900 of file FastISel.cpp.
References llvm::MachineInstrBuilder::add(), llvm::BuildMI(), llvm::MachineOperand::CreateReg(), llvm::Triple::getArch(), I, llvm::Triple::isOSLinux(), TII, TM, and llvm::Triple::x86_64.
Definition at line 919 of file FastISel.cpp.
References llvm::MachineInstrBuilder::add(), llvm::BuildMI(), llvm::MachineOperand::CreateReg(), llvm::Triple::getArch(), I, llvm::Triple::isOSLinux(), TII, TM, and llvm::Triple::x86_64.
|
inline |
Update the position of the last instruction emitted for materializing constants for use in the current block.
Definition at line 237 of file FastISel.h.
References EmitStartPt, I, and LastLocalValue.
|
inlineprotected |
Definition at line 522 of file FastISel.h.
References llvm::MachineFunction::getFunction(), llvm::Function::hasOptSize(), and MF.
void FastISel::startNewBlock | ( | ) |
Set the current block to which generated machine instructions will be appended.
Definition at line 123 of file FastISel.cpp.
References assert().
bool FastISel::tryToFoldLoad | ( | const LoadInst * | LI, |
const Instruction * | FoldInst | ||
) |
We're checking to see if we can fold LI
into FoldInst
.
Note that we could have a sequence where multiple LLVM IR instructions are folded into the same machineinstr. For example we could have:
A: x = load i32 *P B: y = icmp A, 42 C: br y, ...
In this scenario, LI
is "A", and FoldInst
is "C". We know about "B" (and any other folded instructions) because it is between A and C.
If we succeed folding, return true.
Definition at line 2190 of file FastISel.cpp.
References assert(), FuncInfo, llvm::MachineRegisterInfo::defusechain_iterator< ReturnUses, ReturnDefs, SkipDebug, ByOperand, ByInstr, ByBundle >::getOperandNo(), llvm::Instruction::getParent(), llvm::MachineOperand::getParent(), getRegForValue(), llvm::Value::hasOneUse(), llvm::MachineRegisterInfo::hasOneUse(), llvm::FunctionLoweringInfo::InsertPt, llvm::LoadInst::isVolatile(), llvm::FunctionLoweringInfo::MBB, MRI, llvm::MachineRegisterInfo::reg_begin(), llvm::FunctionLoweringInfo::RegsWithFixups, tryToFoldLoadIntoMI(), and llvm::Instruction::user_back().
|
inlinevirtual |
The specified machine instr operand is a vreg, and that vreg is being provided by the specified load instruction.
If possible, try to fold the load as an operand to the instruction, returning true if possible.
This method should be implemented by targets.
Definition at line 300 of file FastISel.h.
Referenced by tryToFoldLoad().
Update the value map to include the new mapping for this instruction, or insert an extra copy to get the result in a previous determined register.
NOTE: This is only necessary because we might select a block that uses a value before we select the block that defines the value. It might be possible to fix this by selecting blocks in reverse postorder.
Definition at line 362 of file FastISel.cpp.
|
inline |
Signal whether instruction referencing variable locations are desired for this function's debug-info.
Definition at line 324 of file FastISel.h.
References UseInstrRefDebugInfo.
|
protected |
Definition at line 207 of file FastISel.h.
Referenced by constrainOperandRegClass(), fastEmitInst_(), fastEmitInst_extractsubreg(), fastEmitInst_f(), fastEmitInst_i(), fastEmitInst_r(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), fastEmitInst_rrr(), and getCurDebugLoc().
|
protected |
Definition at line 209 of file FastISel.h.
Referenced by canFoldAddIntoGEP(), and createMachineMemOperandFor().
|
protected |
The top most instruction in the current block that is allowed for emitting local variables.
LastLocalValue resets to EmitStartPt when it makes sense (for example, on function calls)
Definition at line 226 of file FastISel.h.
Referenced by setLastLocalValue().
|
protected |
Definition at line 202 of file FastISel.h.
Referenced by canFoldAddIntoGEP(), constrainOperandRegClass(), createMachineMemOperandFor(), fastEmit_ri_(), fastEmitInst_(), fastEmitInst_extractsubreg(), fastEmitInst_f(), fastEmitInst_i(), fastEmitInst_r(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), fastEmitInst_rrr(), and tryToFoldLoad().
|
protected |
The position of the last instruction for materializing constants for use in the current block.
It resets to EmitStartPt when it makes sense (for example, it's usually profitable to avoid function calls between the definition and the use)
Definition at line 221 of file FastISel.h.
Referenced by getLastLocalValue(), and setLastLocalValue().
|
protected |
Definition at line 213 of file FastISel.h.
Definition at line 201 of file FastISel.h.
|
protected |
Definition at line 206 of file FastISel.h.
|
protected |
Definition at line 203 of file FastISel.h.
Referenced by shouldOptForSize().
|
protected |
Definition at line 205 of file FastISel.h.
|
protected |
Definition at line 204 of file FastISel.h.
Referenced by constrainOperandRegClass(), createResultReg(), fastEmitInst_extractsubreg(), and tryToFoldLoad().
|
protected |
Definition at line 214 of file FastISel.h.
|
protected |
Definition at line 210 of file FastISel.h.
Referenced by constrainOperandRegClass(), fastEmitInst_(), fastEmitInst_extractsubreg(), fastEmitInst_f(), fastEmitInst_i(), fastEmitInst_r(), fastEmitInst_ri(), fastEmitInst_rii(), fastEmitInst_rr(), fastEmitInst_rri(), and fastEmitInst_rrr().
|
protected |
Definition at line 211 of file FastISel.h.
Referenced by fastEmitInst_extractsubreg().
|
protected |
Definition at line 208 of file FastISel.h.
|
protected |
Definition at line 212 of file FastISel.h.
Referenced by constrainOperandRegClass(), and fastEmitInst_extractsubreg().
|
protected |
Definition at line 215 of file FastISel.h.
Referenced by useInstrRefDebugInfo().