LLVM  14.0.0git
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::FastISel Class Referenceabstract

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"

Collaboration diagram for llvm::FastISel:
Collaboration graph
[legend]

Classes

struct  CallLoweringInfo
 

Public Types

using ArgListEntry = TargetLoweringBase::ArgListEntry
 
using ArgListTy = TargetLoweringBase::ArgListTy
 
using SavePoint = MachineBasicBlock::iterator
 

Public Member Functions

virtual ~FastISel ()
 
MachineInstrgetLastLocalValue ()
 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...
 

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...
 
MachineMemOperandcreateMachineMemOperandFor (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 *, RegisterLocalValueMap
 
FunctionLoweringInfoFuncInfo
 
MachineFunctionMF
 
MachineRegisterInfoMRI
 
MachineFrameInfoMFI
 
MachineConstantPoolMCP
 
DebugLoc DbgLoc
 
const TargetMachineTM
 
const DataLayoutDL
 
const TargetInstrInfoTII
 
const TargetLoweringTLI
 
const TargetRegisterInfoTRI
 
const TargetLibraryInfoLibInfo
 
bool SkipTargetIndependentISel
 
MachineInstrLastLocalValue
 The position of the last instruction for materializing constants for use in the current block. More...
 
MachineInstrEmitStartPt
 The top most instruction in the current block that is allowed for emitting local variables. More...
 

Detailed Description

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.

Member Typedef Documentation

◆ ArgListEntry

Definition at line 67 of file FastISel.h.

◆ ArgListTy

Definition at line 68 of file FastISel.h.

◆ SavePoint

Definition at line 312 of file FastISel.h.

Constructor & Destructor Documentation

◆ ~FastISel()

FastISel::~FastISel ( )
virtualdefault

◆ FastISel()

FastISel::FastISel ( FunctionLoweringInfo FuncInfo,
const TargetLibraryInfo LibInfo,
bool  SkipTargetIndependentISel = false 
)
explicitprotected

Definition at line 1826 of file FastISel.cpp.

Member Function Documentation

◆ canFoldAddIntoGEP()

bool FastISel::canFoldAddIntoGEP ( const User GEP,
const Value Add 
)
protected

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, and
  • Add has a constant operand.

Definition at line 2262 of file FastISel.cpp.

References DL, FuncInfo, GEP, llvm::DataLayout::getTypeSizeInBits(), llvm::FunctionLoweringInfo::MBB, and llvm::FunctionLoweringInfo::MBBMap.

◆ constrainOperandRegClass()

Register FastISel::constrainOperandRegClass ( const MCInstrDesc II,
Register  Op,
unsigned  OpNum 
)
protected

◆ createMachineMemOperandFor()

MachineMemOperand * FastISel::createMachineMemOperandFor ( const Instruction I) const
protected

◆ createResultReg()

Register FastISel::createResultReg ( const TargetRegisterClass RC)
protected

◆ enterLocalValueArea()

FastISel::SavePoint FastISel::enterLocalValueArea ( )

Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position.

Definition at line 438 of file FastISel.cpp.

◆ fastEmit_()

unsigned FastISel::fastEmit_ ( MVT  VT,
MVT  RetVT,
unsigned  Opcode 
)
protectedvirtual

This method is called by target-independent code to request that an instruction with the given type and opcode be emitted.

Definition at line 1848 of file FastISel.cpp.

◆ fastEmit_f()

unsigned FastISel::fastEmit_f ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
const ConstantFP FPImm 
)
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 1863 of file FastISel.cpp.

◆ fastEmit_i()

unsigned FastISel::fastEmit_i ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
uint64_t  Imm 
)
protectedvirtual

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 1859 of file FastISel.cpp.

Referenced by fastEmit_ri_().

◆ fastEmit_r()

unsigned FastISel::fastEmit_r ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
unsigned  Op0 
)
protectedvirtual

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 1850 of file FastISel.cpp.

◆ fastEmit_ri()

unsigned FastISel::fastEmit_ri ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
unsigned  Op0,
uint64_t  Imm 
)
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 1868 of file FastISel.cpp.

Referenced by fastEmit_ri_(), and fastEmitZExtFromI1().

◆ fastEmit_ri_()

Register FastISel::fastEmit_ri_ ( MVT  VT,
unsigned  Opcode,
unsigned  Op0,
uint64_t  Imm,
MVT  ImmType 
)
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 1877 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::isPowerOf2_64(), llvm::Log2_64(), llvm::ISD::MUL, llvm::ISD::SHL, llvm::ISD::SRA, llvm::ISD::SRL, and llvm::ISD::UDIV.

◆ fastEmit_rr()

unsigned FastISel::fastEmit_rr ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
unsigned  Op0,
unsigned  Op1 
)
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 1854 of file FastISel.cpp.

Referenced by fastEmit_ri_().

◆ fastEmitBranch()

void FastISel::fastEmitBranch ( MachineBasicBlock MSucc,
const DebugLoc DbgLoc 
)
protected

Emit an unconditional branch to the given block, unless it is the immediate (fall-through) successor, and update the CFG.

Definition at line 1577 of file FastISel.cpp.

References llvm::MachineBasicBlock::getBasicBlock(), llvm::HexagonInstrInfo::insertBranch(), and TII.

◆ fastEmitInst_()

Register FastISel::fastEmitInst_ ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC 
)
protected

Emit a MachineInstr with no operands and a result register in the given register class.

Definition at line 1933 of file FastISel.cpp.

References llvm::BuildMI(), createResultReg(), DbgLoc, FuncInfo, llvm::MCInstrInfo::get(), llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, and TII.

◆ fastEmitInst_extractsubreg()

Register FastISel::fastEmitInst_extractsubreg ( MVT  RetVT,
unsigned  Op0,
uint32_t  Idx 
)
protected

◆ fastEmitInst_f()

Register FastISel::fastEmitInst_f ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
const ConstantFP FPImm 
)
protected

◆ fastEmitInst_i()

Register FastISel::fastEmitInst_i ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
uint64_t  Imm 
)
protected

◆ fastEmitInst_r()

Register FastISel::fastEmitInst_r ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0 
)
protected

◆ fastEmitInst_ri()

Register FastISel::fastEmitInst_ri ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
uint64_t  Imm 
)
protected

◆ fastEmitInst_rii()

Register FastISel::fastEmitInst_rii ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
uint64_t  Imm1,
uint64_t  Imm2 
)
protected

◆ fastEmitInst_rr()

Register FastISel::fastEmitInst_rr ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
unsigned  Op1 
)
protected

◆ fastEmitInst_rri()

Register FastISel::fastEmitInst_rri ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
unsigned  Op1,
uint64_t  Imm 
)
protected

◆ fastEmitInst_rrr()

Register FastISel::fastEmitInst_rrr ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
unsigned  Op1,
unsigned  Op2 
)
protected

◆ fastEmitZExtFromI1()

Register FastISel::fastEmitZExtFromI1 ( MVT  VT,
unsigned  Op0 
)
protected

Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.

Definition at line 2131 of file FastISel.cpp.

References llvm::ISD::AND, and fastEmit_ri().

◆ fastLowerArguments()

bool FastISel::fastLowerArguments ( )
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 1840 of file FastISel.cpp.

◆ fastLowerCall()

bool FastISel::fastLowerCall ( CallLoweringInfo CLI)
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 1842 of file FastISel.cpp.

◆ fastLowerIntrinsicCall()

bool FastISel::fastLowerIntrinsicCall ( const IntrinsicInst II)
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 1844 of file FastISel.cpp.

◆ fastMaterializeAlloca()

virtual unsigned llvm::FastISel::fastMaterializeAlloca ( const AllocaInst C)
inlineprotectedvirtual

Emit an alloca address in a register using target-specific logic.

Definition at line 471 of file FastISel.h.

◆ fastMaterializeConstant()

virtual unsigned llvm::FastISel::fastMaterializeConstant ( const Constant C)
inlineprotectedvirtual

Emit a constant in a register using target-specific logic, such as constant pool loads.

Definition at line 468 of file FastISel.h.

◆ fastMaterializeFloatZero()

virtual unsigned llvm::FastISel::fastMaterializeFloatZero ( const ConstantFP CF)
inlineprotectedvirtual

Emit the floating-point constant +0.0 in a register using target- specific logic.

Definition at line 475 of file FastISel.h.

◆ fastSelectInstruction()

virtual bool llvm::FastISel::fastSelectInstruction ( const Instruction I)
protectedpure virtual

This method is called by target-independent code when the normal FastISel process fails to select an instruction.

This gives targets a chance to emit code for anything that doesn't fit into FastISel's framework. It returns true if it was successful.

◆ finishBasicBlock()

void FastISel::finishBasicBlock ( )

Flush the local value map.

Definition at line 137 of file FastISel.cpp.

◆ finishCondBranch()

void FastISel::finishCondBranch ( const BasicBlock BranchBB,
MachineBasicBlock TrueMBB,
MachineBasicBlock FalseMBB 
)
protected

Emit an unconditional branch to FalseMBB, obtains the branch weight and adds TrueMBB and FalseMBB to the successor list.

Definition at line 1597 of file FastISel.cpp.

References llvm::MachineBasicBlock::getBasicBlock().

◆ getCurDebugLoc()

DebugLoc llvm::FastISel::getCurDebugLoc ( ) const
inline

Return current debug location information.

Definition at line 249 of file FastISel.h.

References DbgLoc.

◆ getLastLocalValue()

MachineInstr* llvm::FastISel::getLastLocalValue ( )
inline

Return the position of the last instruction emitted for materializing constants for use in the current block.

Definition at line 232 of file FastISel.h.

References LastLocalValue.

◆ getRegForGEPIndex()

Register FastISel::getRegForGEPIndex ( const Value Idx)

This is a wrapper around getRegForValue that also takes care of truncating or sign-extending the given getelementptr index value.

Definition at line 386 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.

◆ getRegForValue()

Register FastISel::getRegForValue ( const Value V)

Create a virtual register and arrange for it to be assigned the value for the given LLVM value.

Definition at line 241 of file FastISel.cpp.

References DL, llvm::Value::getContext(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::MVT::i1, llvm::MVT::i16, llvm::MVT::i8, llvm::EVT::isSimple(), and Reg.

Referenced by fastEmit_ri_(), and tryToFoldLoad().

◆ leaveLocalValueArea()

void FastISel::leaveLocalValueArea ( SavePoint  Old)

Reset InsertPt to the given old insert position.

Definition at line 444 of file FastISel.cpp.

◆ lookUpRegForValue()

Register FastISel::lookUpRegForValue ( const Value V)

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 354 of file FastISel.cpp.

References I.

◆ lowerArguments()

bool FastISel::lowerArguments ( )

Do "fast" instruction selection for function arguments and append the machine instructions to the current block.

Returns true when successful.

Definition at line 139 of file FastISel.cpp.

References assert(), E, I, and VI.

◆ lowerCall()

bool FastISel::lowerCall ( const CallInst I)
protected

◆ lowerCallTo() [1/3]

bool FastISel::lowerCallTo ( CallLoweringInfo CLI)
protected

Definition at line 996 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.

◆ lowerCallTo() [2/3]

bool FastISel::lowerCallTo ( const CallInst CI,
const char *  SymName,
unsigned  NumArgs 
)
protected

◆ lowerCallTo() [3/3]

bool FastISel::lowerCallTo ( const CallInst CI,
MCSymbol Symbol,
unsigned  NumArgs 
)
protected

◆ optimizeCmpPredicate()

CmpInst::Predicate FastISel::optimizeCmpPredicate ( const CmpInst CI) const
protected

◆ recomputeInsertPt()

void FastISel::recomputeInsertPt ( )

Reset InsertPt to prepare for inserting instructions into the current block.

Definition at line 404 of file FastISel.cpp.

References llvm::ISD::EH_LABEL.

◆ removeDeadCode()

void FastISel::removeDeadCode ( MachineBasicBlock::iterator  I,
MachineBasicBlock::iterator  E 
)

Remove all dead instructions between the I and E.

Definition at line 418 of file FastISel.cpp.

References assert(), llvm::RegState::Dead, E, and I.

◆ selectBinaryOp()

bool FastISel::selectBinaryOp ( const User I,
unsigned  ISDOpcode 
)
protected

Select and emit code for a binary operator instruction, which has an opcode which directly corresponds to the given ISD opcode.

Definition at line 452 of file FastISel.cpp.

References llvm::ISD::AND, llvm::EVT::getEVT(), llvm::EVT::getSimpleVT(), I, llvm::MVT::i1, 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.

◆ selectBitCast()

bool FastISel::selectBitCast ( const User I)
protected

◆ selectCall()

bool FastISel::selectCall ( const User I)
protected

◆ selectCast()

bool FastISel::selectCast ( const User I,
unsigned  Opcode 
)
protected

Definition at line 1374 of file FastISel.cpp.

References DL, llvm::EVT::getSimpleVT(), I, llvm::EVT::isSimple(), and llvm::MVT::Other.

◆ selectExtractValue()

bool FastISel::selectExtractValue ( const User U)
protected

◆ selectFNeg()

bool FastISel::selectFNeg ( const User I,
const Value In 
)
protected

◆ selectFreeze()

bool FastISel::selectFreeze ( const User I)
protected

◆ selectGetElementPtr()

bool FastISel::selectGetElementPtr ( const User I)
protected

Definition at line 540 of file FastISel.cpp.

References llvm::ISD::ADD, DL, E, llvm::gep_type_begin(), llvm::gep_type_end(), I, llvm::ISD::MUL, and N.

◆ selectInstruction()

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 1493 of file FastISel.cpp.

References llvm::numbers::e, F, i, I, and llvm::LLVMContext::OB_funclet.

◆ selectIntrinsicCall()

bool FastISel::selectIntrinsicCall ( const IntrinsicInst II)
protected

◆ selectOperator()

bool FastISel::selectOperator ( const User I,
unsigned  Opcode 
)

◆ selectPatchpoint()

bool FastISel::selectPatchpoint ( const CallInst I)
protected

◆ selectStackmap()

bool FastISel::selectStackmap ( const CallInst I)
protected

◆ selectXRayCustomEvent()

bool FastISel::selectXRayCustomEvent ( const CallInst II)
protected

◆ selectXRayTypedEvent()

bool FastISel::selectXRayTypedEvent ( const CallInst II)
protected

◆ setLastLocalValue()

void llvm::FastISel::setLastLocalValue ( MachineInstr I)
inline

Update the position of the last instruction emitted for materializing constants for use in the current block.

Definition at line 236 of file FastISel.h.

References EmitStartPt, I, and LastLocalValue.

◆ shouldOptForSize()

bool llvm::FastISel::shouldOptForSize ( const MachineFunction MF) const
inlineprotected

◆ startNewBlock()

void FastISel::startNewBlock ( )

Set the current block to which generated machine instructions will be appended.

Definition at line 124 of file FastISel.cpp.

References assert().

◆ tryToFoldLoad()

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 2206 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(), tryToFoldLoadIntoMI(), and llvm::Instruction::user_back().

◆ tryToFoldLoadIntoMI()

virtual bool llvm::FastISel::tryToFoldLoadIntoMI ( MachineInstr ,
unsigned  ,
const LoadInst  
)
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 299 of file FastISel.h.

Referenced by tryToFoldLoad().

◆ updateValueMap()

void FastISel::updateValueMap ( const Value I,
Register  Reg,
unsigned  NumRegs = 1 
)
protected

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 365 of file FastISel.cpp.

References i, I, and Reg.

Member Data Documentation

◆ DbgLoc

DebugLoc llvm::FastISel::DbgLoc
protected

◆ DL

const DataLayout& llvm::FastISel::DL
protected

Definition at line 209 of file FastISel.h.

Referenced by canFoldAddIntoGEP(), and createMachineMemOperandFor().

◆ EmitStartPt

MachineInstr* llvm::FastISel::EmitStartPt
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 225 of file FastISel.h.

Referenced by setLastLocalValue().

◆ FuncInfo

FunctionLoweringInfo& llvm::FastISel::FuncInfo
protected

◆ LastLocalValue

MachineInstr* llvm::FastISel::LastLocalValue
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 220 of file FastISel.h.

Referenced by getLastLocalValue(), and setLastLocalValue().

◆ LibInfo

const TargetLibraryInfo* llvm::FastISel::LibInfo
protected

Definition at line 213 of file FastISel.h.

◆ LocalValueMap

DenseMap<const Value *, Register> llvm::FastISel::LocalValueMap
protected

Definition at line 201 of file FastISel.h.

◆ MCP

MachineConstantPool& llvm::FastISel::MCP
protected

Definition at line 206 of file FastISel.h.

◆ MF

MachineFunction* llvm::FastISel::MF
protected

Definition at line 203 of file FastISel.h.

Referenced by shouldOptForSize().

◆ MFI

MachineFrameInfo& llvm::FastISel::MFI
protected

Definition at line 205 of file FastISel.h.

◆ MRI

MachineRegisterInfo& llvm::FastISel::MRI
protected

◆ SkipTargetIndependentISel

bool llvm::FastISel::SkipTargetIndependentISel
protected

Definition at line 214 of file FastISel.h.

◆ TII

const TargetInstrInfo& llvm::FastISel::TII
protected

◆ TLI

const TargetLowering& llvm::FastISel::TLI
protected

Definition at line 211 of file FastISel.h.

Referenced by fastEmitInst_extractsubreg().

◆ TM

const TargetMachine& llvm::FastISel::TM
protected

Definition at line 208 of file FastISel.h.

◆ TRI

const TargetRegisterInfo& llvm::FastISel::TRI
protected

Definition at line 212 of file FastISel.h.

Referenced by constrainOperandRegClass(), and fastEmitInst_extractsubreg().


The documentation for this class was generated from the following files: