LLVM  8.0.0svn
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
 
struct  SavePoint
 

Public Types

using ArgListEntry = TargetLoweringBase::ArgListEntry
 
using ArgListTy = TargetLoweringBase::ArgListTy
 

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 and sink local values if possible. 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...
 
unsigned getRegForValue (const Value *V)
 Create a virtual register and arrange for it to be assigned the value for the given LLVM value. More...
 
unsigned lookUpRegForValue (const Value *V)
 Look up the value to see if its value is already cached in a register. More...
 
std::pair< unsigned, boolgetRegForGEPIndex (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, bool Op0IsKill)
 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, bool Op0IsKill, unsigned Op1, bool Op1IsKill)
 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, bool Op0IsKill, 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...
 
unsigned fastEmit_ri_ (MVT VT, unsigned Opcode, unsigned Op0, bool Op0IsKill, 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...
 
unsigned fastEmitInst_ (unsigned MachineInstOpcode, const TargetRegisterClass *RC)
 Emit a MachineInstr with no operands and a result register in the given register class. More...
 
unsigned fastEmitInst_r (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill)
 Emit a MachineInstr with one register operand and a result register in the given register class. More...
 
unsigned fastEmitInst_rr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill)
 Emit a MachineInstr with two register operands and a result register in the given register class. More...
 
unsigned fastEmitInst_rrr (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, unsigned Op2, bool Op2IsKill)
 Emit a MachineInstr with three register operands and a result register in the given register class. More...
 
unsigned fastEmitInst_ri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, uint64_t Imm)
 Emit a MachineInstr with a register operand, an immediate, and a result register in the given register class. More...
 
unsigned fastEmitInst_rii (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, uint64_t Imm1, uint64_t Imm2)
 Emit a MachineInstr with one register operand and two immediate operands. More...
 
unsigned 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...
 
unsigned fastEmitInst_rri (unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill, uint64_t Imm)
 Emit a MachineInstr with two register operands, an immediate, and a result register in the given register class. More...
 
unsigned 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...
 
unsigned fastEmitInst_extractsubreg (MVT RetVT, unsigned Op0, bool Op0IsKill, uint32_t Idx)
 Emit a MachineInstr for an extract_subreg from a specified index of a superregister to a specified type. More...
 
unsigned fastEmitZExtFromI1 (MVT VT, unsigned Op0, bool Op0IsKill)
 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, unsigned 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...
 
unsigned createResultReg (const TargetRegisterClass *RC)
 
unsigned constrainOperandRegClass (const MCInstrDesc &II, unsigned 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...
 
bool hasTrivialKill (const Value *V)
 Test whether the given value has exactly one use. 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 isCommutativeIntrinsic (IntrinsicInst const *II)
 
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)
 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 selectCast (const User *I, unsigned Opcode)
 
bool selectExtractValue (const User *U)
 
bool selectInsertValue (const User *I)
 
bool selectXRayCustomEvent (const CallInst *II)
 
bool selectXRayTypedEvent (const CallInst *II)
 

Protected Attributes

DenseMap< const Value *, unsignedLocalValueMap
 
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...
 
MachineBasicBlock::iterator LastFlushPoint
 Last local value flush point. 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 67 of file FastISel.h.

Member Typedef Documentation

◆ ArgListEntry

Definition at line 69 of file FastISel.h.

◆ ArgListTy

Definition at line 70 of file FastISel.h.

Constructor & Destructor Documentation

◆ ~FastISel()

FastISel::~FastISel ( )
virtualdefault

Referenced by FastISel().

◆ FastISel()

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

Definition at line 1906 of file FastISel.cpp.

References ~FastISel().

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

References llvm::MCID::Add, DL, FuncInfo, getParent(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::FunctionLoweringInfo::MBB, and llvm::FunctionLoweringInfo::MBBMap.

Referenced by fastMaterializeFloatZero().

◆ constrainOperandRegClass()

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

◆ createMachineMemOperandFor()

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

◆ createResultReg()

unsigned 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 558 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 1927 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 1944 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 1940 of file FastISel.cpp.

Referenced by fastEmit_ri_().

◆ fastEmit_r()

unsigned FastISel::fastEmit_r ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
unsigned  Op0,
bool  Op0IsKill 
)
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 1929 of file FastISel.cpp.

◆ fastEmit_ri()

unsigned FastISel::fastEmit_ri ( MVT  VT,
MVT  RetVT,
unsigned  Opcode,
unsigned  Op0,
bool  Op0IsKill,
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 1949 of file FastISel.cpp.

Referenced by fastEmit_ri_(), and fastEmitZExtFromI1().

◆ fastEmit_ri_()

unsigned FastISel::fastEmit_ri_ ( MVT  VT,
unsigned  Opcode,
unsigned  Op0,
bool  Op0IsKill,
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 1958 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,
bool  Op0IsKill,
unsigned  Op1,
bool  Op1IsKill 
)
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 1934 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 1665 of file FastISel.cpp.

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

◆ fastEmitInst_()

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

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

◆ fastEmitInst_extractsubreg()

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

◆ fastEmitInst_f()

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

◆ fastEmitInst_i()

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

◆ fastEmitInst_r()

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

◆ fastEmitInst_ri()

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

◆ fastEmitInst_rii()

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

◆ fastEmitInst_rr()

unsigned FastISel::fastEmitInst_rr ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
bool  Op0IsKill,
unsigned  Op1,
bool  Op1IsKill 
)
protected

◆ fastEmitInst_rri()

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

◆ fastEmitInst_rrr()

unsigned FastISel::fastEmitInst_rrr ( unsigned  MachineInstOpcode,
const TargetRegisterClass RC,
unsigned  Op0,
bool  Op0IsKill,
unsigned  Op1,
bool  Op1IsKill,
unsigned  Op2,
bool  Op2IsKill 
)
protected

◆ fastEmitZExtFromI1()

unsigned FastISel::fastEmitZExtFromI1 ( MVT  VT,
unsigned  Op0,
bool  Op0IsKill 
)
protected

◆ 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 1919 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 1921 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 1923 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 485 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 482 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 489 of file FastISel.h.

References llvm::MCID::Add, canFoldAddIntoGEP(), createMachineMemOperandFor(), GEP, hasTrivialKill(), lowerCallTo(), optimizeCmpPredicate(), and llvm::FastISel::CallLoweringInfo::Symbol.

◆ 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 and sink local values if possible.

Flush the local CSE map and sink anything we can.

Definition at line 145 of file FastISel.cpp.

Referenced by setLastLocalValue().

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

References llvm::MachineBasicBlock::getBasicBlock().

◆ getCurDebugLoc()

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

Return current debug location information.

Definition at line 255 of file FastISel.h.

References DbgLoc, getRegForGEPIndex(), getRegForValue(), I, lookUpRegForValue(), lowerArguments(), selectInstruction(), selectOperator(), and tryToFoldLoad().

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

References LastLocalValue.

◆ getRegForGEPIndex()

std::pair< unsigned, bool > 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 508 of file FastISel.cpp.

References llvm::EVT::bitsGT(), llvm::EVT::bitsLT(), llvm::EVT::getEVT(), llvm::EVT::getSimpleVT(), llvm::Value::getType(), llvm::ISD::SIGN_EXTEND, and llvm::ISD::TRUNCATE.

Referenced by getCurDebugLoc().

◆ getRegForValue()

unsigned FastISel::getRegForValue ( const Value V)

◆ hasTrivialKill()

bool FastISel::hasTrivialKill ( const Value V)
protected

Test whether the given value has exactly one use.

Definition at line 331 of file FastISel.cpp.

References llvm::dyn_cast(), GEP, llvm::Instruction::getOpcode(), llvm::Instruction::getParent(), getParent(), llvm::Value::hasOneUse(), I, MRI, Reg, and llvm::Value::user_begin().

Referenced by fastMaterializeFloatZero().

◆ isCommutativeIntrinsic()

bool llvm::FastISel::isCommutativeIntrinsic ( IntrinsicInst const II)
inlineprotected

◆ leaveLocalValueArea()

void FastISel::leaveLocalValueArea ( SavePoint  Old)

Reset InsertPt to the given old insert position.

Definition at line 567 of file FastISel.cpp.

References llvm::FastISel::SavePoint::DL, and llvm::FastISel::SavePoint::InsertPt.

◆ lookUpRegForValue()

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

References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), and I.

Referenced by getCurDebugLoc().

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

References assert(), E, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), I, and VI.

Referenced by getCurDebugLoc().

◆ lowerCall()

bool FastISel::lowerCall ( const CallInst I)
protected

◆ lowerCallTo() [1/3]

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

◆ lowerCallTo() [2/3]

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

◆ lowerCallTo() [3/3]

bool FastISel::lowerCallTo ( CallLoweringInfo CLI)
protected

Definition at line 1128 of file FastISel.cpp.

References Arg, llvm::ISD::InputArg::ArgVT, assert(), llvm::FastISel::CallLoweringInfo::Call, llvm::FastISel::CallLoweringInfo::CallConv, llvm::FastISel::CallLoweringInfo::clearIns(), llvm::FastISel::CallLoweringInfo::clearOuts(), llvm::ComputeValueVTs(), llvm::FastISel::CallLoweringInfo::CS, E, llvm::ISD::InputArg::Flags, llvm::FastISel::CallLoweringInfo::getArgs(), llvm::Type::getContext(), llvm::PointerType::getElementType(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), getReturnAttrs(), llvm::GetReturnInfo(), 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::setByValAlign(), llvm::ISD::ArgFlagsTy::setByValSize(), llvm::ISD::ArgFlagsTy::setInAlloca(), llvm::ISD::ArgFlagsTy::setInConsecutiveRegs(), llvm::ISD::ArgFlagsTy::setInReg(), llvm::ISD::ArgFlagsTy::setNest(), llvm::ISD::ArgFlagsTy::setOrigAlign(), llvm::MachineInstr::setPhysRegsDeadExcept(), llvm::ISD::ArgFlagsTy::setSExt(), llvm::ISD::ArgFlagsTy::setSRet(), llvm::ISD::ArgFlagsTy::setSwiftError(), llvm::ISD::ArgFlagsTy::setSwiftSelf(), llvm::ISD::ArgFlagsTy::setZExt(), llvm::SmallVectorBase::size(), TRI, llvm::ISD::InputArg::Used, and llvm::ISD::InputArg::VT.

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

References llvm::ISD::EH_LABEL.

Referenced by tryToFoldLoadIntoMI().

◆ removeDeadCode()

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

Remove all dead instructions between the I and E.

Definition at line 545 of file FastISel.cpp.

References assert(), llvm::RegState::Dead, llvm::MachineInstr::eraseFromParent(), I, and llvm::MachineInstrBundleIterator< Ty, IsReverse >::isValid().

Referenced by tryToFoldLoadIntoMI().

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

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

Referenced by isCommutativeIntrinsic().

◆ 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)
protected

◆ selectGetElementPtr()

bool FastISel::selectGetElementPtr ( const User I)
protected

◆ selectInsertValue()

bool llvm::FastISel::selectInsertValue ( const User I)
protected

Referenced by isCommutativeIntrinsic().

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

References F(), llvm::Instruction::getDebugLoc(), llvm::Function::getIntrinsicID(), llvm::Value::getName(), llvm::Instruction::getOpcode(), llvm::Instruction::getParent(), llvm::GlobalValue::hasLocalLinkage(), llvm::Value::hasName(), llvm::Instruction::isTerminator(), and llvm::LLVMContext::OB_funclet.

Referenced by getCurDebugLoc().

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

References finishBasicBlock(), I, and startNewBlock().

Referenced by createSwiftErrorEntriesInEntryBlock().

◆ startNewBlock()

void FastISel::startNewBlock ( )

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

Definition at line 131 of file FastISel.cpp.

References assert().

Referenced by setLastLocalValue().

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

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

Referenced by getCurDebugLoc().

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

References E, recomputeInsertPt(), and removeDeadCode().

Referenced by tryToFoldLoad().

◆ updateValueMap()

void FastISel::updateValueMap ( const Value I,
unsigned  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 487 of file FastISel.cpp.

References I, and Reg.

Member Data Documentation

◆ DbgLoc

DebugLoc llvm::FastISel::DbgLoc
protected

◆ DL

const DataLayout& llvm::FastISel::DL
protected

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

◆ FuncInfo

FunctionLoweringInfo& llvm::FastISel::FuncInfo
protected

◆ LastFlushPoint

MachineBasicBlock::iterator llvm::FastISel::LastFlushPoint
protected

Last local value flush point.

On a subsequent flush, no local value will sink past this point.

Definition at line 231 of file FastISel.h.

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

Referenced by getLastLocalValue().

◆ LibInfo

const TargetLibraryInfo* llvm::FastISel::LibInfo
protected

Definition at line 215 of file FastISel.h.

◆ LocalValueMap

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

Definition at line 203 of file FastISel.h.

◆ MCP

MachineConstantPool& llvm::FastISel::MCP
protected

Definition at line 208 of file FastISel.h.

◆ MF

MachineFunction* llvm::FastISel::MF
protected

Definition at line 205 of file FastISel.h.

◆ MFI

MachineFrameInfo& llvm::FastISel::MFI
protected

Definition at line 207 of file FastISel.h.

◆ MRI

MachineRegisterInfo& llvm::FastISel::MRI
protected

◆ SkipTargetIndependentISel

bool llvm::FastISel::SkipTargetIndependentISel
protected

Definition at line 216 of file FastISel.h.

◆ TII

const TargetInstrInfo& llvm::FastISel::TII
protected

◆ TLI

const TargetLowering& llvm::FastISel::TLI
protected

Definition at line 213 of file FastISel.h.

Referenced by fastEmitInst_extractsubreg(), and fastEmitZExtFromI1().

◆ TM

const TargetMachine& llvm::FastISel::TM
protected

Definition at line 210 of file FastISel.h.

◆ TRI

const TargetRegisterInfo& llvm::FastISel::TRI
protected

Definition at line 214 of file FastISel.h.

Referenced by constrainOperandRegClass(), and fastEmitInst_extractsubreg().


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