LLVM 19.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"

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.
 
void setLastLocalValue (MachineInstr *I)
 Update the position of the last instruction emitted for materializing constants for use in the current block.
 
void startNewBlock ()
 Set the current block to which generated machine instructions will be appended.
 
void finishBasicBlock ()
 Flush the local value map.
 
DebugLoc getCurDebugLoc () const
 Return current debug location information.
 
bool lowerArguments ()
 Do "fast" instruction selection for function arguments and append the machine instructions to the current block.
 
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.
 
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.
 
Register getRegForValue (const Value *V)
 Create a virtual register and arrange for it to be assigned the value for the given LLVM value.
 
Register lookUpRegForValue (const Value *V)
 Look up the value to see if its value is already cached in a register.
 
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.
 
bool tryToFoldLoad (const LoadInst *LI, const Instruction *FoldInst)
 We're checking to see if we can fold LI into FoldInst.
 
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.
 
void recomputeInsertPt ()
 Reset InsertPt to prepare for inserting instructions into the current block.
 
void removeDeadCode (MachineBasicBlock::iterator I, MachineBasicBlock::iterator E)
 Remove all dead instructions between the I and E.
 
SavePoint enterLocalValueArea ()
 Prepare InsertPt to begin inserting instructions into the local value area and return the old insert position.
 
void leaveLocalValueArea (SavePoint Old)
 Reset InsertPt to the given old insert position.
 
void handleDbgInfo (const Instruction *II)
 Target-independent lowering of non-instruction debug info associated with this instruction.
 

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.
 
virtual bool fastLowerArguments ()
 This method is called by target-independent code to do target- specific argument lowering.
 
virtual bool fastLowerCall (CallLoweringInfo &CLI)
 This method is called by target-independent code to do target- specific call lowering.
 
virtual bool fastLowerIntrinsicCall (const IntrinsicInst *II)
 This method is called by target-independent code to do target- specific intrinsic lowering.
 
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.
 
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.
 
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.
 
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.
 
Register fastEmit_ri_ (MVT VT, unsigned Opcode, unsigned Op0, uint64_t Imm, MVT ImmType)
 This method is a wrapper of fastEmit_ri.
 
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.
 
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.
 
Register fastEmitInst_ (unsigned MachineInstOpcode, const TargetRegisterClass *RC)
 Emit a MachineInstr with no operands and a result register in the given register class.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
Register fastEmitZExtFromI1 (MVT VT, unsigned Op0)
 Emit MachineInstrs to compute the value of Op with all but the least significant bit set to zero.
 
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.
 
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.
 
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.
 
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.
 
virtual unsigned fastMaterializeConstant (const Constant *C)
 Emit a constant in a register using target-specific logic, such as constant pool loads.
 
virtual unsigned fastMaterializeAlloca (const AllocaInst *C)
 Emit an alloca address in a register using target-specific logic.
 
virtual unsigned fastMaterializeFloatZero (const ConstantFP *CF)
 Emit the floating-point constant +0.0 in a register using target- specific logic.
 
bool canFoldAddIntoGEP (const User *GEP, const Value *Add)
 Check if Add is an add that can be safely folded into GEP.
 
MachineMemOperandcreateMachineMemOperandFor (const Instruction *I) const
 Create a machine mem operand from the given instruction.
 
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.
 
bool selectFNeg (const User *I, const Value *In)
 Emit an FNeg operation.
 
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
 
virtual bool lowerDbgValue (const Value *V, DIExpression *Expr, DILocalVariable *Var, const DebugLoc &DL)
 Target-independent lowering of debug information.
 
virtual bool lowerDbgDeclare (const Value *V, DIExpression *Expr, DILocalVariable *Var, const DebugLoc &DL)
 Target-independent lowering of debug information.
 

Protected Attributes

DenseMap< const Value *, RegisterLocalValueMap
 
FunctionLoweringInfoFuncInfo
 
MachineFunctionMF
 
MachineRegisterInfoMRI
 
MachineFrameInfoMFI
 
MachineConstantPoolMCP
 
MIMetadata MIMD
 
const TargetMachineTM
 
const DataLayoutDL
 
const TargetInstrInfoTII
 
const TargetLoweringTLI
 
const TargetRegisterInfoTRI
 
const TargetLibraryInfoLibInfo
 
bool SkipTargetIndependentISel
 
MachineInstrLastLocalValue = nullptr
 The position of the last instruction for materializing constants for use in the current block.
 
MachineInstrEmitStartPt = nullptr
 The top most instruction in the current block that is allowed for emitting local variables.
 

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 66 of file FastISel.h.

Member Typedef Documentation

◆ ArgListEntry

Definition at line 68 of file FastISel.h.

◆ ArgListTy

Definition at line 69 of file FastISel.h.

◆ SavePoint

Definition at line 313 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 1931 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 2376 of file FastISel.cpp.

References llvm::Add, 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 430 of file FastISel.cpp.

References FuncInfo, llvm::FunctionLoweringInfo::InsertPt, and recomputeInsertPt().

Referenced by getRegForValue().

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

Referenced by selectOperator().

◆ 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 1967 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 1963 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 1954 of file FastISel.cpp.

Referenced by getRegForGEPIndex(), selectBitCast(), selectCast(), and selectFNeg().

◆ 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 1972 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 1981 of file FastISel.cpp.

References llvm::ISD::Constant, fastEmit_i(), fastEmit_ri(), fastEmit_rr(), llvm::FunctionLoweringInfo::Fn, FuncInfo, llvm::IntegerType::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.

Referenced by selectBinaryOp(), selectFNeg(), and selectGetElementPtr().

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

Referenced by fastEmit_ri_(), selectBinaryOp(), and selectGetElementPtr().

◆ fastEmitBranch()

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

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

References llvm::BuildMI(), createResultReg(), FuncInfo, llvm::MCInstrInfo::get(), llvm::FunctionLoweringInfo::InsertPt, llvm::FunctionLoweringInfo::MBB, MIMD, 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 2243 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 1944 of file FastISel.cpp.

Referenced by lowerArguments().

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

Referenced by lowerCallTo().

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

Referenced by selectIntrinsicCall().

◆ fastMaterializeAlloca()

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

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

Definition at line 476 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 473 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 480 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.

Referenced by selectInstruction().

◆ finishBasicBlock()

void FastISel::finishBasicBlock ( )

Flush the local value map.

Definition at line 136 of file FastISel.cpp.

◆ finishCondBranch()

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

◆ getCurDebugLoc()

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

Return current debug location information.

Definition at line 250 of file FastISel.h.

References llvm::MIMetadata::getDL(), and MIMD.

◆ 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 233 of file FastISel.h.

References LastLocalValue.

Referenced by recomputeInsertPt(), and selectInstruction().

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

References llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), DL, fastEmit_r(), llvm::EVT::getEVT(), llvm::TargetLoweringBase::getPointerTy(), getRegForValue(), llvm::EVT::getSimpleVT(), Idx, llvm::ISD::SIGN_EXTEND, TLI, and llvm::ISD::TRUNCATE.

Referenced by selectGetElementPtr().

◆ getRegForValue()

Register FastISel::getRegForValue ( const Value V)

◆ handleDbgInfo()

void FastISel::handleDbgInfo ( const Instruction II)

◆ leaveLocalValueArea()

void FastISel::leaveLocalValueArea ( SavePoint  Old)

Reset InsertPt to the given old insert position.

Definition at line 436 of file FastISel.cpp.

References llvm::MachineBasicBlock::begin(), FuncInfo, llvm::FunctionLoweringInfo::InsertPt, LastLocalValue, and llvm::FunctionLoweringInfo::MBB.

Referenced by getRegForValue().

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

References FuncInfo, I, LocalValueMap, and llvm::FunctionLoweringInfo::ValueMap.

Referenced by getRegForValue(), lowerDbgDeclare(), and lowerDbgValue().

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

References llvm::Function::arg_begin(), llvm::Function::arg_end(), assert(), llvm::FunctionLoweringInfo::CanLowerReturn, fastLowerArguments(), llvm::FunctionLoweringInfo::Fn, FuncInfo, I, LocalValueMap, and llvm::FunctionLoweringInfo::ValueMap.

◆ lowerCall()

bool FastISel::lowerCall ( const CallInst I)
protected

◆ lowerCallTo() [1/3]

bool FastISel::lowerCallTo ( CallLoweringInfo CLI)
protected

Definition at line 994 of file FastISel.cpp.

References llvm::ISD::InputArg::ArgVT, assert(), llvm::FastISel::CallLoweringInfo::Call, llvm::FastISel::CallLoweringInfo::CallConv, llvm::TargetLowering::CanLowerReturn(), llvm::FastISel::CallLoweringInfo::CB, llvm::FastISel::CallLoweringInfo::clearIns(), llvm::FastISel::CallLoweringInfo::clearOuts(), llvm::ComputeValueVTs(), DL, fastLowerCall(), llvm::ISD::InputArg::Flags, FuncInfo, llvm::TargetLowering::functionArgumentNeedsConsecutiveRegisters(), llvm::DataLayout::getABITypeAlign(), llvm::FastISel::CallLoweringInfo::getArgs(), llvm::TargetLoweringBase::getByValTypeAlignment(), llvm::Type::getContext(), llvm::Instruction::getMetadata(), llvm::TargetLoweringBase::getNumRegisters(), llvm::TargetLoweringBase::getRegisterType(), getReturnAttrs(), llvm::GetReturnInfo(), llvm::DataLayout::getTypeAllocSize(), llvm::FastISel::CallLoweringInfo::InRegs, llvm::FastISel::CallLoweringInfo::Ins, llvm::FastISel::CallLoweringInfo::IsInReg, llvm::FastISel::CallLoweringInfo::IsReturnValueUsed, llvm::FastISel::CallLoweringInfo::IsVarArg, MF, llvm::FunctionLoweringInfo::MF, 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::MachineInstr::setHeapAllocMarker(), llvm::ISD::ArgFlagsTy::setInReg(), llvm::MachineInstr::setPhysRegsDeadExcept(), llvm::ISD::ArgFlagsTy::setSExt(), llvm::ISD::ArgFlagsTy::setZExt(), TLI, TRI, updateValueMap(), 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

◆ lowerDbgDeclare()

bool FastISel::lowerDbgDeclare ( const Value V,
DIExpression Expr,
DILocalVariable Var,
const DebugLoc DL 
)
protectedvirtual

◆ lowerDbgValue()

bool FastISel::lowerDbgValue ( const Value V,
DIExpression Expr,
DILocalVariable Var,
const DebugLoc DL 
)
protectedvirtual

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

References FuncInfo, llvm::MachineBasicBlock::getFirstNonPHI(), getLastLocalValue(), llvm::FunctionLoweringInfo::InsertPt, and llvm::FunctionLoweringInfo::MBB.

Referenced by enterLocalValueArea(), handleDbgInfo(), removeDeadCode(), and selectInstruction().

◆ removeDeadCode()

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

Remove all dead instructions between the I and E.

Definition at line 410 of file FastISel.cpp.

References assert(), EmitStartPt, I, llvm::MachineInstrBundleIterator< Ty, IsReverse >::isValid(), LastLocalValue, and recomputeInsertPt().

Referenced by selectInstruction().

◆ selectBinaryOp()

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

◆ 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

◆ 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

◆ selectInstruction()

bool FastISel::selectInstruction ( const Instruction I)

◆ 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 237 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 123 of file FastISel.cpp.

References assert(), llvm::MachineBasicBlock::back(), EmitStartPt, llvm::MachineBasicBlock::empty(), FuncInfo, LastLocalValue, LocalValueMap, and llvm::FunctionLoweringInfo::MBB.

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

References assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), FuncInfo, llvm::MachineRegisterInfo::defusechain_iterator< ReturnUses, ReturnDefs, SkipDebug, ByOperand, ByInstr, ByBundle >::getOperandNo(), llvm::MachineOperand::getParent(), llvm::Instruction::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().

◆ 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 300 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 362 of file FastISel.cpp.

References FuncInfo, I, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), LocalValueMap, llvm::FunctionLoweringInfo::RegFixups, llvm::FunctionLoweringInfo::RegsWithFixups, and llvm::FunctionLoweringInfo::ValueMap.

Referenced by lowerCallTo(), selectBinaryOp(), selectBitCast(), selectCast(), selectExtractValue(), selectFNeg(), selectFreeze(), selectGetElementPtr(), selectIntrinsicCall(), selectOperator(), and selectPatchpoint().

Member Data Documentation

◆ DL

const DataLayout& llvm::FastISel::DL
protected

◆ EmitStartPt

MachineInstr* llvm::FastISel::EmitStartPt = nullptr
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 removeDeadCode(), setLastLocalValue(), and startNewBlock().

◆ FuncInfo

FunctionLoweringInfo& llvm::FastISel::FuncInfo
protected

◆ LastLocalValue

MachineInstr* llvm::FastISel::LastLocalValue = nullptr
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(), leaveLocalValueArea(), removeDeadCode(), setLastLocalValue(), and startNewBlock().

◆ LibInfo

const TargetLibraryInfo* llvm::FastISel::LibInfo
protected

Definition at line 214 of file FastISel.h.

Referenced by selectInstruction().

◆ LocalValueMap

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

Definition at line 202 of file FastISel.h.

Referenced by lookUpRegForValue(), lowerArguments(), startNewBlock(), and updateValueMap().

◆ MCP

MachineConstantPool& llvm::FastISel::MCP
protected

Definition at line 207 of file FastISel.h.

◆ MF

MachineFunction* llvm::FastISel::MF
protected

Definition at line 204 of file FastISel.h.

Referenced by lowerCall(), lowerCallTo(), and shouldOptForSize().

◆ MFI

MachineFrameInfo& llvm::FastISel::MFI
protected

Definition at line 206 of file FastISel.h.

◆ MIMD

MIMetadata llvm::FastISel::MIMD
protected

◆ MRI

MachineRegisterInfo& llvm::FastISel::MRI
protected

◆ SkipTargetIndependentISel

bool llvm::FastISel::SkipTargetIndependentISel
protected

Definition at line 215 of file FastISel.h.

Referenced by selectInstruction().

◆ TII

const TargetInstrInfo& llvm::FastISel::TII
protected

◆ TLI

const TargetLowering& llvm::FastISel::TLI
protected

◆ TM

const TargetMachine& llvm::FastISel::TM
protected

Definition at line 209 of file FastISel.h.

Referenced by lowerCall(), selectOperator(), selectXRayCustomEvent(), and selectXRayTypedEvent().

◆ TRI

const TargetRegisterInfo& llvm::FastISel::TRI
protected

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