LLVM 17.0.0git
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
llvm::SelectionDAGBuilder Class Reference

SelectionDAGBuilder - This is the common target-independent lowering implementation that is parameterized by a TargetLowering object. More...

#include "CodeGen/SelectionDAG/SelectionDAGBuilder.h"

Classes

class  SDAGSwitchLowering
 
struct  StatepointLoweringInfo
 Describes a gc.statepoint or a gc.statepoint like thing for the purposes of lowering into a STATEPOINT node. More...
 

Public Member Functions

 SelectionDAGBuilder (SelectionDAG &dag, FunctionLoweringInfo &funcinfo, SwiftErrorValueTracking &swifterror, CodeGenOpt::Level ol)
 
void init (GCFunctionInfo *gfi, AAResults *AA, AssumptionCache *AC, const TargetLibraryInfo *li)
 
void clear ()
 Clear out the current SelectionDAG and the associated state and prepare this SelectionDAGBuilder object to be used for a new block.
 
void clearDanglingDebugInfo ()
 Clear the dangling debug information map.
 
SDValue getMemoryRoot ()
 Return the current virtual root of the Selection DAG, flushing any PendingLoad items.
 
SDValue getRoot ()
 Similar to getMemoryRoot, but also flushes PendingConstrainedFP(Strict) items.
 
SDValue getControlRoot ()
 Similar to getRoot, but instead of flushing all the PendingLoad items, flush all the PendingExports (and PendingConstrainedFPStrict) items.
 
SDLoc getCurSDLoc () const
 
DebugLoc getCurDebugLoc () const
 
void CopyValueToVirtualRegister (const Value *V, unsigned Reg, ISD::NodeType ExtendType=ISD::ANY_EXTEND)
 
void visit (const Instruction &I)
 
void visit (unsigned Opcode, const User &I)
 
SDValue getCopyFromRegs (const Value *V, Type *Ty)
 If there was virtual register allocated for the value V emit CopyFromReg of the specified type Ty.
 
void addDanglingDebugInfo (const DbgValueInst *DI, unsigned Order)
 Register a dbg_value which relies on a Value which we have not yet seen.
 
void addDanglingDebugInfo (const VarLocInfo *VarLoc, unsigned Order)
 
void dropDanglingDebugInfo (const DILocalVariable *Variable, const DIExpression *Expr)
 If we have dangling debug info that describes Variable, or an overlapping part of variable considering the Expr, then this method will drop that debug info as it isn't valid any longer.
 
void resolveDanglingDebugInfo (const Value *V, SDValue Val)
 If we saw an earlier dbg_value referring to V, generate the debug data structures now that we've seen its definition.
 
void salvageUnresolvedDbgValue (DanglingDebugInfo &DDI)
 For the given dangling debuginfo record, perform last-ditch efforts to resolve the debuginfo to something that is represented in this DAG.
 
bool handleDebugValue (ArrayRef< const Value * > Values, DILocalVariable *Var, DIExpression *Expr, DebugLoc DbgLoc, unsigned Order, bool IsVariadic)
 For a given list of Values, attempt to create and record a SDDbgValue in the SelectionDAG.
 
void handleKillDebugValue (DILocalVariable *Var, DIExpression *Expr, DebugLoc DbgLoc, unsigned Order)
 Create a record for a kill location debug intrinsic.
 
void resolveOrClearDbgInfo ()
 Evict any dangling debug information, attempting to salvage it first.
 
SDValue getValue (const Value *V)
 getValue - Return an SDValue for the given Value.
 
SDValue getNonRegisterValue (const Value *V)
 getNonRegisterValue - Return an SDValue for the given Value, but don't look in FuncInfo.ValueMap for a virtual register.
 
SDValue getValueImpl (const Value *V)
 getValueImpl - Helper function for getValue and getNonRegisterValue.
 
void setValue (const Value *V, SDValue NewN)
 
void setUnusedArgValue (const Value *V, SDValue NewN)
 
void FindMergedConditions (const Value *Cond, MachineBasicBlock *TBB, MachineBasicBlock *FBB, MachineBasicBlock *CurBB, MachineBasicBlock *SwitchBB, Instruction::BinaryOps Opc, BranchProbability TProb, BranchProbability FProb, bool InvertCond)
 
void EmitBranchForMergedCondition (const Value *Cond, MachineBasicBlock *TBB, MachineBasicBlock *FBB, MachineBasicBlock *CurBB, MachineBasicBlock *SwitchBB, BranchProbability TProb, BranchProbability FProb, bool InvertCond)
 EmitBranchForMergedCondition - Helper method for FindMergedConditions.
 
bool ShouldEmitAsBranches (const std::vector< SwitchCG::CaseBlock > &Cases)
 If the set of cases should be emitted as a series of branches, return true.
 
bool isExportableFromCurrentBlock (const Value *V, const BasicBlock *FromBB)
 
void CopyToExportRegsIfNeeded (const Value *V)
 CopyToExportRegsIfNeeded - If the given value has virtual registers created for it, emit nodes to copy the value into the virtual registers.
 
void ExportFromCurrentBlock (const Value *V)
 ExportFromCurrentBlock - If this condition isn't known to be exported from the current basic block, add it to ValueMap now so that we'll get a CopyTo/FromReg.
 
void LowerCallTo (const CallBase &CB, SDValue Callee, bool IsTailCall, bool IsMustTailCall, const BasicBlock *EHPadBB=nullptr)
 
SDValue lowerRangeToAssertZExt (SelectionDAG &DAG, const Instruction &I, SDValue Op)
 
void populateCallLoweringInfo (TargetLowering::CallLoweringInfo &CLI, const CallBase *Call, unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy, bool IsPatchPoint)
 Populate a CallLowerinInfo (into CLI) based on the properties of the call being lowered.
 
std::pair< SDValue, SDValuelowerInvokable (TargetLowering::CallLoweringInfo &CLI, const BasicBlock *EHPadBB=nullptr)
 
void UpdateSplitBlock (MachineBasicBlock *First, MachineBasicBlock *Last)
 When an MBB was split during scheduling, update the references that need to refer to the last resulting block.
 
SDValue LowerAsSTATEPOINT (StatepointLoweringInfo &SI)
 Lower SLI into a STATEPOINT instruction.
 
void LowerStatepoint (const GCStatepointInst &I, const BasicBlock *EHPadBB=nullptr)
 
void LowerCallSiteWithDeoptBundle (const CallBase *Call, SDValue Callee, const BasicBlock *EHPadBB)
 
void LowerDeoptimizeCall (const CallInst *CI)
 
void LowerDeoptimizingReturn ()
 
void LowerCallSiteWithDeoptBundleImpl (const CallBase *Call, SDValue Callee, const BasicBlock *EHPadBB, bool VarArgDisallowed, bool ForceVoidReturnTy)
 
MVT getFrameIndexTy ()
 Returns the type of FrameIndex and TargetFrameIndex nodes.
 
void visitSwitchCase (SwitchCG::CaseBlock &CB, MachineBasicBlock *SwitchBB)
 visitSwitchCase - Emits the necessary code to represent a single node in the binary search tree resulting from lowering a switch instruction.
 
void visitSPDescriptorParent (StackProtectorDescriptor &SPD, MachineBasicBlock *ParentBB)
 Codegen a new tail for a stack protector check ParentMBB which has had its tail spliced into a stack protector check success bb.
 
void visitSPDescriptorFailure (StackProtectorDescriptor &SPD)
 Codegen the failure basic block for a stack protector check.
 
void visitBitTestHeader (SwitchCG::BitTestBlock &B, MachineBasicBlock *SwitchBB)
 visitBitTestHeader - This function emits necessary code to produce value suitable for "bit tests"
 
void visitBitTestCase (SwitchCG::BitTestBlock &BB, MachineBasicBlock *NextMBB, BranchProbability BranchProbToNext, unsigned Reg, SwitchCG::BitTestCase &B, MachineBasicBlock *SwitchBB)
 visitBitTestCase - this function produces one "bit test"
 
void visitJumpTable (SwitchCG::JumpTable &JT)
 visitJumpTable - Emit JumpTable node in the current MBB
 
void visitJumpTableHeader (SwitchCG::JumpTable &JT, SwitchCG::JumpTableHeader &JTH, MachineBasicBlock *SwitchBB)
 visitJumpTableHeader - This function emits necessary code to produce index in the JumpTable from switch case.
 

Public Attributes

SmallVector< SDValue, 8 > PendingLoads
 Loads are not emitted to the program immediately.
 
StatepointLoweringState StatepointLowering
 State used while lowering a statepoint sequence (gc_statepoint, gc_relocate, and gc_result).
 
SelectionDAGDAG
 
AAResultsAA = nullptr
 
AssumptionCacheAC = nullptr
 
const TargetLibraryInfoLibInfo = nullptr
 
std::unique_ptr< SDAGSwitchLoweringSL
 
StackProtectorDescriptor SPDescriptor
 A StackProtectorDescriptor structure used to communicate stack protector information in between SelectBasicBlock and FinishBasicBlock.
 
DenseMap< const Constant *, unsignedConstantsOut
 
FunctionLoweringInfoFuncInfo
 Information about the function as a whole.
 
SwiftErrorValueTrackingSwiftError
 Information about the swifterror values used throughout the function.
 
GCFunctionInfoGFI = nullptr
 Garbage collection metadata for the function.
 
DenseMap< MachineBasicBlock *, SmallVector< unsigned, 4 > > LPadToCallSiteMap
 Map a landing pad to the call site indexes.
 
bool HasTailCall = false
 This is set to true if a call in the current block has been translated as a tail call.
 
LLVMContextContext = nullptr
 

Static Public Attributes

static const unsigned LowestSDNodeOrder = 1
 Lowest valid SDNodeOrder.
 

Detailed Description

SelectionDAGBuilder - This is the common target-independent lowering implementation that is parameterized by a TargetLowering object.

Definition at line 97 of file SelectionDAGBuilder.h.

Constructor & Destructor Documentation

◆ SelectionDAGBuilder()

llvm::SelectionDAGBuilder::SelectionDAGBuilder ( SelectionDAG dag,
FunctionLoweringInfo funcinfo,
SwiftErrorValueTracking swifterror,
CodeGenOpt::Level  ol 
)
inline

Definition at line 297 of file SelectionDAGBuilder.h.

References TM.

Member Function Documentation

◆ addDanglingDebugInfo() [1/2]

void SelectionDAGBuilder::addDanglingDebugInfo ( const DbgValueInst DI,
unsigned  Order 
)

◆ addDanglingDebugInfo() [2/2]

void SelectionDAGBuilder::addDanglingDebugInfo ( const VarLocInfo VarLoc,
unsigned  Order 
)

◆ clear()

void SelectionDAGBuilder::clear ( )

Clear out the current SelectionDAG and the associated state and prepare this SelectionDAGBuilder object to be used for a new block.

This doesn't clear out information about additional blocks that are needed to complete switch lowering or PHI node updating; that information is cleared out as it is consumed.

Definition at line 1058 of file SelectionDAGBuilder.cpp.

References llvm::StatepointLoweringState::clear(), HasTailCall, LowestSDNodeOrder, PendingLoads, and StatepointLowering.

◆ clearDanglingDebugInfo()

void SelectionDAGBuilder::clearDanglingDebugInfo ( )

Clear the dangling debug information map.

This function is separated from the clear so that debug information that is dangling in a basic block can be properly resolved in a different basic block. This allows the SelectionDAG to resolve dangling debug information attached to PHI nodes.

Definition at line 1071 of file SelectionDAGBuilder.cpp.

Referenced by resolveOrClearDbgInfo().

◆ CopyToExportRegsIfNeeded()

void SelectionDAGBuilder::CopyToExportRegsIfNeeded ( const Value V)

CopyToExportRegsIfNeeded - If the given value has virtual registers created for it, emit nodes to copy the value into the virtual registers.

Definition at line 2157 of file SelectionDAGBuilder.cpp.

References assert(), and CopyValueToVirtualRegister().

Referenced by visit().

◆ CopyValueToVirtualRegister()

void SelectionDAGBuilder::CopyValueToVirtualRegister ( const Value V,
unsigned  Reg,
ISD::NodeType  ExtendType = ISD::ANY_EXTEND 
)

◆ dropDanglingDebugInfo()

void SelectionDAGBuilder::dropDanglingDebugInfo ( const DILocalVariable Variable,
const DIExpression Expr 
)

If we have dangling debug info that describes Variable, or an overlapping part of variable considering the Expr, then this method will drop that debug info as it isn't valid any longer.

Definition at line 1267 of file SelectionDAGBuilder.cpp.

References DAG, llvm::dbgs(), llvm::erase_if(), llvm::DIExpression::fragmentsOverlap(), llvm::SelectionDAG::getFunctionVarLocs(), LLVM_DEBUG, and salvageUnresolvedDbgValue().

Referenced by visit().

◆ EmitBranchForMergedCondition()

void SelectionDAGBuilder::EmitBranchForMergedCondition ( const Value Cond,
MachineBasicBlock TBB,
MachineBasicBlock FBB,
MachineBasicBlock CurBB,
MachineBasicBlock SwitchBB,
BranchProbability  TProb,
BranchProbability  FProb,
bool  InvertCond 
)

EmitBranchForMergedCondition - Helper method for FindMergedConditions.

This function emits a branch and is used at the leaves of an OR or an AND operator tree.

Definition at line 2249 of file SelectionDAGBuilder.cpp.

References Cond, DAG, llvm::MachineBasicBlock::getBasicBlock(), llvm::SelectionDAG::getContext(), getCurSDLoc(), llvm::getFCmpCodeWithoutNaN(), llvm::getFCmpCondCode(), llvm::getICmpCondCode(), llvm::ConstantInt::getTrue(), isExportableFromCurrentBlock(), llvm::TargetOptions::NoNaNsFPMath, llvm::TargetMachine::Options, llvm::ISD::SETEQ, llvm::ISD::SETNE, SL, and TBB.

Referenced by FindMergedConditions().

◆ ExportFromCurrentBlock()

void SelectionDAGBuilder::ExportFromCurrentBlock ( const Value V)

ExportFromCurrentBlock - If this condition isn't known to be exported from the current basic block, add it to ValueMap now so that we'll get a CopyTo/FromReg.

Definition at line 2173 of file SelectionDAGBuilder.cpp.

References CopyValueToVirtualRegister().

Referenced by LowerAsSTATEPOINT().

◆ FindMergedConditions()

void SelectionDAGBuilder::FindMergedConditions ( const Value Cond,
MachineBasicBlock TBB,
MachineBasicBlock FBB,
MachineBasicBlock CurBB,
MachineBasicBlock SwitchBB,
Instruction::BinaryOps  Opc,
BranchProbability  TProb,
BranchProbability  FProb,
bool  InvertCond 
)

◆ getControlRoot()

SDValue SelectionDAGBuilder::getControlRoot ( )

Similar to getRoot, but instead of flushing all the PendingLoad items, flush all the PendingExports (and PendingConstrainedFPStrict) items.

It is necessary to do this before emitting a terminator instruction.

Definition at line 1126 of file SelectionDAGBuilder.cpp.

Referenced by LowerAsSTATEPOINT(), lowerInvokable(), visitBitTestCase(), visitBitTestHeader(), visitJumpTable(), visitJumpTableHeader(), and visitSwitchCase().

◆ getCopyFromRegs()

SDValue SelectionDAGBuilder::getCopyFromRegs ( const Value V,
Type Ty 
)

If there was virtual register allocated for the value V emit CopyFromReg of the specified type Ty.

getCopyFromRegs - If there was virtual register allocated for the value V emit CopyFromReg of the specified type Ty.

Return empty SDValue() otherwise.

Definition at line 1565 of file SelectionDAGBuilder.cpp.

References DAG, llvm::SelectionDAG::getContext(), llvm::RegsForValue::getCopyFromRegs(), getCurSDLoc(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getEntryNode(), llvm::SelectionDAG::getTargetLoweringInfo(), and resolveDanglingDebugInfo().

Referenced by getValue().

◆ getCurDebugLoc()

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

Definition at line 339 of file SelectionDAGBuilder.h.

References llvm::Instruction::getDebugLoc().

◆ getCurSDLoc()

SDLoc llvm::SelectionDAGBuilder::getCurSDLoc ( ) const
inline

◆ getFrameIndexTy()

MVT llvm::SelectionDAGBuilder::getFrameIndexTy ( )
inline

Returns the type of FrameIndex and TargetFrameIndex nodes.

Definition at line 503 of file SelectionDAGBuilder.h.

References DAG, llvm::SelectionDAG::getDataLayout(), llvm::TargetLoweringBase::getFrameIndexTy(), and llvm::SelectionDAG::getTargetLoweringInfo().

◆ getMemoryRoot()

SDValue SelectionDAGBuilder::getMemoryRoot ( )

Return the current virtual root of the Selection DAG, flushing any PendingLoad items.

This must be done before emitting a store or any other memory node that may need to be ordered after any prior load instructions.

Definition at line 1106 of file SelectionDAGBuilder.cpp.

References PendingLoads.

Referenced by getRoot().

◆ getNonRegisterValue()

SDValue SelectionDAGBuilder::getNonRegisterValue ( const Value V)

getNonRegisterValue - Return an SDValue for the given Value, but don't look in FuncInfo.ValueMap for a virtual register.

Definition at line 1606 of file SelectionDAGBuilder.cpp.

References getValueImpl(), llvm::isIntOrFPConstant(), N, and resolveDanglingDebugInfo().

Referenced by CopyValueToVirtualRegister().

◆ getRoot()

SDValue SelectionDAGBuilder::getRoot ( )

Similar to getMemoryRoot, but also flushes PendingConstrainedFP(Strict) items.

This must be done before emitting any call other any other node that may need to be ordered after FP instructions due to other side effects.

Definition at line 1110 of file SelectionDAGBuilder.cpp.

References getMemoryRoot(), and PendingLoads.

Referenced by LowerAsSTATEPOINT(), LowerCallTo(), lowerInvokable(), and populateCallLoweringInfo().

◆ getValue()

SDValue SelectionDAGBuilder::getValue ( const Value V)

◆ getValueImpl()

SDValue SelectionDAGBuilder::getValueImpl ( const Value V)

◆ handleDebugValue()

bool SelectionDAGBuilder::handleDebugValue ( ArrayRef< const Value * >  Values,
DILocalVariable Var,
DIExpression Expr,
DebugLoc  DbgLoc,
unsigned  Order,
bool  IsVariadic 
)

◆ handleKillDebugValue()

void SelectionDAGBuilder::handleKillDebugValue ( DILocalVariable Var,
DIExpression Expr,
DebugLoc  DbgLoc,
unsigned  Order 
)

Create a record for a kill location debug intrinsic.

Definition at line 1412 of file SelectionDAGBuilder.cpp.

References Context, llvm::DIExpression::convertToUndefExpression(), llvm::PoisonValue::get(), llvm::Type::getInt1Ty(), and handleDebugValue().

Referenced by visit().

◆ init()

void SelectionDAGBuilder::init ( GCFunctionInfo gfi,
AAResults AA,
AssumptionCache AC,
const TargetLibraryInfo li 
)

◆ isExportableFromCurrentBlock()

bool SelectionDAGBuilder::isExportableFromCurrentBlock ( const Value V,
const BasicBlock FromBB 
)

Definition at line 2184 of file SelectionDAGBuilder.cpp.

References llvm::BasicBlock::isEntryBlock(), and VI.

Referenced by EmitBranchForMergedCondition().

◆ LowerAsSTATEPOINT()

SDValue SelectionDAGBuilder::LowerAsSTATEPOINT ( SelectionDAGBuilder::StatepointLoweringInfo SI)

Lower SLI into a STATEPOINT instruction.

Definition at line 705 of file StatepointLowering.cpp.

References llvm::append_range(), assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), DAG, llvm::dbgs(), llvm::SelectionDAG::DeleteNode(), llvm::SmallVectorTemplateCommon< T, typename >::end(), ExportFromCurrentBlock(), Flags, llvm::ISD::GC_TRANSITION_END, llvm::ISD::GC_TRANSITION_START, llvm::GCTransition, llvm::SelectionDAG::getContext(), getControlRoot(), llvm::RegsForValue::getCopyToRegs(), getCurSDLoc(), llvm::SelectionDAG::getDataLayout(), llvm::GCRelocateInst::getDerivedPtr(), llvm::SDNode::getGluedNode(), llvm::StatepointLoweringState::getLocation(), llvm::SelectionDAG::getMachineNode(), llvm::SDValue::getNode(), llvm::SelectionDAG::getNode(), llvm::SDNode::getNumOperands(), llvm::SDNode::getNumValues(), llvm::SDNode::getOperand(), llvm::Instruction::getParent(), getRoot(), llvm::SelectionDAG::getRoot(), llvm::SelectionDAG::getSrcValue(), llvm::SelectionDAG::getTargetConstant(), llvm::SelectionDAG::getTargetLoweringInfo(), getValue(), llvm::SDValue::getValue(), llvm::SelectionDAG::getVTList(), GFI, llvm::SmallVectorImpl< T >::insert(), LLVM_DEBUG, lowerCallFromStatepointLoweringInfo(), lowerStatepointMetaArgs(), llvm::MaskAll, llvm::FunctionLoweringInfo::StatepointRelocationRecord::NoRelocate, llvm::SDNode::op_begin(), llvm::SDNode::op_end(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), pushStackMapConstant(), llvm::SelectionDAG::ReplaceAllUsesWith(), RetTy, llvm::StatepointLoweringState::scheduleRelocCall(), llvm::FunctionLoweringInfo::StatepointRelocationRecord::SDValueNode, llvm::StatepointLoweringState::setLocation(), llvm::SelectionDAG::setNodeMemRefs(), SI, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::SmallVectorBase< Size_T >::size(), llvm::FunctionLoweringInfo::StatepointRelocationRecord::Spill, llvm::StatepointLoweringState::startNewStatepoint(), StatepointLowering, and llvm::FunctionLoweringInfo::StatepointRelocationRecord::VReg.

Referenced by LowerCallSiteWithDeoptBundleImpl(), and LowerStatepoint().

◆ LowerCallSiteWithDeoptBundle()

void SelectionDAGBuilder::LowerCallSiteWithDeoptBundle ( const CallBase Call,
SDValue  Callee,
const BasicBlock EHPadBB 
)

Definition at line 1165 of file StatepointLowering.cpp.

References Callee, and LowerCallSiteWithDeoptBundleImpl().

◆ LowerCallSiteWithDeoptBundleImpl()

void SelectionDAGBuilder::LowerCallSiteWithDeoptBundleImpl ( const CallBase Call,
SDValue  Callee,
const BasicBlock EHPadBB,
bool  VarArgDisallowed,
bool  ForceVoidReturnTy 
)

◆ LowerCallTo()

void SelectionDAGBuilder::LowerCallTo ( const CallBase CB,
SDValue  Callee,
bool  IsTailCall,
bool  IsMustTailCall,
const BasicBlock EHPadBB = nullptr 
)

Definition at line 7974 of file SelectionDAGBuilder.cpp.

References llvm::CallBase::arg_begin(), llvm::CallBase::arg_end(), llvm::CallBase::arg_size(), assert(), Callee, llvm::CallBase::countOperandBundlesOfType(), llvm::TargetLowering::CallLoweringInfo::DAG, DAG, llvm::TargetLowering::CallLoweringInfo::DL, DL, E, llvm::SelectionDAG::getCopyToReg(), getCurSDLoc(), llvm::SelectionDAG::getDataLayout(), llvm::CallBase::getFunctionType(), llvm::CallBase::getOperandBundle(), llvm::SwiftErrorValueTracking::getOrCreateVRegDefAt(), llvm::SwiftErrorValueTracking::getOrCreateVRegUseAt(), llvm::BasicBlock::getParent(), llvm::Instruction::getParent(), llvm::TargetLoweringBase::getPointerTy(), llvm::SelectionDAG::getRegister(), getRoot(), llvm::SelectionDAG::getTarget(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::ConstantInt::getType(), llvm::Value::getType(), getValue(), I, llvm::TargetLowering::CallLoweringInfo::InVals, llvm::CallBase::isConvergent(), llvm::CallBase::isIndirectCall(), llvm::isInTailCallPosition(), llvm::Type::isIntegerTy(), isMustTailCall(), lowerInvokable(), lowerRangeToAssertZExt(), llvm::LLVMContext::OB_cfguardtarget, llvm::LLVMContext::OB_kcfi, llvm::LLVMContext::OB_preallocated, llvm::report_fatal_error(), RetTy, llvm::TargetLowering::CallLoweringInfo::setCallee(), llvm::TargetLowering::CallLoweringInfo::setCFIType(), llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::TargetLowering::CallLoweringInfo::setConvergent(), llvm::TargetLowering::CallLoweringInfo::setDebugLoc(), llvm::TargetLowering::CallLoweringInfo::setIsPreallocated(), llvm::SelectionDAG::setRoot(), llvm::TargetLowering::CallLoweringInfo::setTailCall(), setValue(), llvm::TargetLowering::supportKCFIBundles(), llvm::TargetLowering::supportSwiftError(), and SwiftError.

◆ LowerDeoptimizeCall()

void SelectionDAGBuilder::LowerDeoptimizeCall ( const CallInst CI)

◆ LowerDeoptimizingReturn()

void SelectionDAGBuilder::LowerDeoptimizingReturn ( )

◆ lowerInvokable()

std::pair< SDValue, SDValue > SelectionDAGBuilder::lowerInvokable ( TargetLowering::CallLoweringInfo CLI,
const BasicBlock EHPadBB = nullptr 
)

◆ lowerRangeToAssertZExt()

SDValue SelectionDAGBuilder::lowerRangeToAssertZExt ( SelectionDAG DAG,
const Instruction I,
SDValue  Op 
)

◆ LowerStatepoint()

void SelectionDAGBuilder::LowerStatepoint ( const GCStatepointInst I,
const BasicBlock EHPadBB = nullptr 
)

◆ populateCallLoweringInfo()

void SelectionDAGBuilder::populateCallLoweringInfo ( TargetLowering::CallLoweringInfo CLI,
const CallBase Call,
unsigned  ArgIdx,
unsigned  NumArgs,
SDValue  Callee,
Type ReturnTy,
bool  IsPatchPoint 
)

Populate a CallLowerinInfo (into CLI) based on the properties of the call being lowered.

This is a helper for lowering intrinsics that follow a target calling convention or require stack pointer adjustment. Only a subset of the intrinsic's operands need to participate in the calling convention.

Definition at line 9583 of file SelectionDAGBuilder.cpp.

References assert(), Callee, getCurSDLoc(), getRoot(), getValue(), llvm::LLVMContext::OB_preallocated, llvm::TargetLowering::CallLoweringInfo::setCallee(), llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::TargetLowering::CallLoweringInfo::setDebugLoc(), llvm::TargetLowering::CallLoweringInfo::setDiscardResult(), llvm::TargetLowering::CallLoweringInfo::setIsPatchPoint(), and llvm::TargetLowering::CallLoweringInfo::setIsPreallocated().

Referenced by LowerCallSiteWithDeoptBundleImpl(), and LowerStatepoint().

◆ resolveDanglingDebugInfo()

void SelectionDAGBuilder::resolveDanglingDebugInfo ( const Value V,
SDValue  Val 
)

◆ resolveOrClearDbgInfo()

void SelectionDAGBuilder::resolveOrClearDbgInfo ( )

Evict any dangling debug information, attempting to salvage it first.

Definition at line 1555 of file SelectionDAGBuilder.cpp.

References clearDanglingDebugInfo(), and salvageUnresolvedDbgValue().

◆ salvageUnresolvedDbgValue()

void SelectionDAGBuilder::salvageUnresolvedDbgValue ( DanglingDebugInfo &  DDI)

For the given dangling debuginfo record, perform last-ditch efforts to resolve the debuginfo to something that is represented in this DAG.

If this cannot be done, produce an Undef debug value record.

Definition at line 1347 of file SelectionDAGBuilder.cpp.

References llvm::SelectionDAG::AddDbgValue(), llvm::DIExpression::appendOpsToArg(), assert(), DAG, llvm::dbgs(), DL, llvm::SmallVectorBase< Size_T >::empty(), llvm::UndefValue::get(), llvm::SelectionDAG::getConstantDbgValue(), llvm::SelectionDAG::getFunctionVarLocs(), llvm::DIExpression::getNumLocationOperands(), llvm::Value::getType(), handleDebugValue(), LLVM_DEBUG, and llvm::salvageDebugInfoImpl().

Referenced by dropDanglingDebugInfo(), and resolveOrClearDbgInfo().

◆ setUnusedArgValue()

void llvm::SelectionDAGBuilder::setUnusedArgValue ( const Value V,
SDValue  NewN 
)
inline

Definition at line 397 of file SelectionDAGBuilder.h.

References assert(), and N.

◆ setValue()

void llvm::SelectionDAGBuilder::setValue ( const Value V,
SDValue  NewN 
)
inline

Definition at line 391 of file SelectionDAGBuilder.h.

References assert(), and N.

Referenced by LowerCallSiteWithDeoptBundleImpl(), LowerCallTo(), LowerStatepoint(), and visitSwitchCase().

◆ ShouldEmitAsBranches()

bool SelectionDAGBuilder::ShouldEmitAsBranches ( const std::vector< SwitchCG::CaseBlock > &  Cases)

If the set of cases should be emitted as a series of branches, return true.

If we should emit this as a bunch of and/or'd together conditions, return false.

Definition at line 2427 of file SelectionDAGBuilder.cpp.

References CC, llvm::ISD::SETEQ, and llvm::ISD::SETNE.

◆ UpdateSplitBlock()

void SelectionDAGBuilder::UpdateSplitBlock ( MachineBasicBlock First,
MachineBasicBlock Last 
)

When an MBB was split during scheduling, update the references that need to refer to the last resulting block.

Definition at line 3171 of file SelectionDAGBuilder.cpp.

References llvm::Last, llvm::SwitchCG::BitTestBlock::Parent, and SL.

◆ visit() [1/2]

void SelectionDAGBuilder::visit ( const Instruction I)

◆ visit() [2/2]

void SelectionDAGBuilder::visit ( unsigned  Opcode,
const User I 
)

Definition at line 1204 of file SelectionDAGBuilder.cpp.

References llvm_unreachable.

◆ visitBitTestCase()

void SelectionDAGBuilder::visitBitTestCase ( SwitchCG::BitTestBlock BB,
MachineBasicBlock NextMBB,
BranchProbability  BranchProbToNext,
unsigned  Reg,
SwitchCG::BitTestCase B,
MachineBasicBlock SwitchBB 
)

◆ visitBitTestHeader()

void SelectionDAGBuilder::visitBitTestHeader ( SwitchCG::BitTestBlock B,
MachineBasicBlock SwitchBB 
)

◆ visitJumpTable()

void SelectionDAGBuilder::visitJumpTable ( SwitchCG::JumpTable JT)

◆ visitJumpTableHeader()

void SelectionDAGBuilder::visitJumpTableHeader ( SwitchCG::JumpTable JT,
SwitchCG::JumpTableHeader JTH,
MachineBasicBlock SwitchBB 
)

◆ visitSPDescriptorFailure()

void SelectionDAGBuilder::visitSPDescriptorFailure ( StackProtectorDescriptor SPD)

Codegen the failure basic block for a stack protector check.

A failure stack protector machine basic block consists simply of a call to __stack_chk_fail().

For a high level explanation of how this fits into the stack protector generation see the comment on the declaration of class StackProtectorDescriptor.

Definition at line 2840 of file SelectionDAGBuilder.cpp.

References DAG, getCurSDLoc(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::TargetMachine::getTargetTriple(), llvm::Triple::isPS(), llvm::Triple::isWasm(), llvm::TargetLowering::makeLibCall(), llvm::TargetLowering::MakeLibCallOptions::setDiscardResult(), llvm::SelectionDAG::setRoot(), and llvm::ISD::TRAP.

◆ visitSPDescriptorParent()

void SelectionDAGBuilder::visitSPDescriptorParent ( StackProtectorDescriptor SPD,
MachineBasicBlock ParentBB 
)

Codegen a new tail for a stack protector check ParentMBB which has had its tail spliced into a stack protector check success bb.

For a high level explanation of how this fits into the stack protector generation see the comment on the declaration of class StackProtectorDescriptor.

Definition at line 2745 of file SelectionDAGBuilder.cpp.

References assert(), llvm::ISD::BR, llvm::ISD::BRCOND, DAG, llvm::TargetLowering::emitStackGuardXorFP(), llvm::SelectionDAG::getBasicBlock(), llvm::SelectionDAG::getContext(), getCurSDLoc(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getEntryNode(), llvm::StackProtectorDescriptor::getFailureMBB(), llvm::MachinePointerInfo::getFixedStack(), llvm::SelectionDAG::getFrameIndex(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::Type::getInt8PtrTy(), llvm::SelectionDAG::getLoad(), getLoadStackGuard(), llvm::SelectionDAG::getMachineFunction(), llvm::SelectionDAG::getNode(), llvm::FunctionType::getNumParams(), llvm::SDValue::getOperand(), llvm::FunctionType::getParamType(), llvm::GlobalValue::getParent(), llvm::MachineBasicBlock::getParent(), llvm::TargetLoweringBase::getPointerMemTy(), llvm::TargetLoweringBase::getPointerTy(), llvm::DataLayout::getPrefTypeAlign(), llvm::FunctionType::getReturnType(), llvm::TargetLoweringBase::getSDagStackGuard(), llvm::SelectionDAG::getSetCC(), llvm::TargetLoweringBase::getSetCCResultType(), llvm::TargetLoweringBase::getSSPStackGuardCheck(), llvm::MachineFrameInfo::getStackProtectorIndex(), llvm::StackProtectorDescriptor::getSuccessMBB(), llvm::SelectionDAG::getTargetLoweringInfo(), getValue(), llvm::SDValue::getValueType(), llvm::TargetLowering::LowerCallTo(), llvm::MachineMemOperand::MOVolatile, llvm::TargetLowering::CallLoweringInfo::setCallee(), llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::TargetLowering::CallLoweringInfo::setDebugLoc(), llvm::ISD::SETNE, llvm::SelectionDAG::setRoot(), llvm::TargetLowering::useLoadStackGuardNode(), and llvm::TargetLoweringBase::useStackGuardXorFP().

◆ visitSwitchCase()

void SelectionDAGBuilder::visitSwitchCase ( SwitchCG::CaseBlock CB,
MachineBasicBlock SwitchBB 
)

Member Data Documentation

◆ AA

AAResults* llvm::SelectionDAGBuilder::AA = nullptr

Definition at line 248 of file SelectionDAGBuilder.h.

Referenced by init().

◆ AC

AssumptionCache* llvm::SelectionDAGBuilder::AC = nullptr

Definition at line 249 of file SelectionDAGBuilder.h.

Referenced by init().

◆ ConstantsOut

DenseMap<const Constant *, unsigned> llvm::SelectionDAGBuilder::ConstantsOut

Definition at line 277 of file SelectionDAGBuilder.h.

◆ Context

LLVMContext* llvm::SelectionDAGBuilder::Context = nullptr

Definition at line 295 of file SelectionDAGBuilder.h.

Referenced by handleKillDebugValue(), and init().

◆ DAG

SelectionDAG& llvm::SelectionDAGBuilder::DAG

◆ FuncInfo

FunctionLoweringInfo& llvm::SelectionDAGBuilder::FuncInfo

Information about the function as a whole.

Definition at line 280 of file SelectionDAGBuilder.h.

◆ GFI

GCFunctionInfo* llvm::SelectionDAGBuilder::GFI = nullptr

Garbage collection metadata for the function.

Definition at line 286 of file SelectionDAGBuilder.h.

Referenced by init(), LowerAsSTATEPOINT(), and LowerStatepoint().

◆ HasTailCall

bool llvm::SelectionDAGBuilder::HasTailCall = false

This is set to true if a call in the current block has been translated as a tail call.

In this case, no subsequent DAG nodes should be created.

Definition at line 293 of file SelectionDAGBuilder.h.

Referenced by clear(), lowerInvokable(), and visit().

◆ LibInfo

const TargetLibraryInfo* llvm::SelectionDAGBuilder::LibInfo = nullptr

Definition at line 250 of file SelectionDAGBuilder.h.

Referenced by init().

◆ LowestSDNodeOrder

const unsigned llvm::SelectionDAGBuilder::LowestSDNodeOrder = 1
static

Lowest valid SDNodeOrder.

The special case 0 is reserved for scheduling nodes without a corresponding SDNode.

Definition at line 245 of file SelectionDAGBuilder.h.

Referenced by clear().

◆ LPadToCallSiteMap

DenseMap<MachineBasicBlock *, SmallVector<unsigned, 4> > llvm::SelectionDAGBuilder::LPadToCallSiteMap

Map a landing pad to the call site indexes.

Definition at line 289 of file SelectionDAGBuilder.h.

Referenced by init().

◆ PendingLoads

SmallVector<SDValue, 8> llvm::SelectionDAGBuilder::PendingLoads

Loads are not emitted to the program immediately.

We bunch them up and then emit token factor nodes when possible. This allows us to get simple disambiguation between loads without worrying about alias analysis.

Definition at line 186 of file SelectionDAGBuilder.h.

Referenced by clear(), getMemoryRoot(), and getRoot().

◆ SL

std::unique_ptr<SDAGSwitchLowering> llvm::SelectionDAGBuilder::SL

◆ SPDescriptor

StackProtectorDescriptor llvm::SelectionDAGBuilder::SPDescriptor

A StackProtectorDescriptor structure used to communicate stack protector information in between SelectBasicBlock and FinishBasicBlock.

Definition at line 273 of file SelectionDAGBuilder.h.

◆ StatepointLowering

StatepointLoweringState llvm::SelectionDAGBuilder::StatepointLowering

State used while lowering a statepoint sequence (gc_statepoint, gc_relocate, and gc_result).

See StatepointLowering.hpp/cpp for details.

Definition at line 190 of file SelectionDAGBuilder.h.

Referenced by clear(), and LowerAsSTATEPOINT().

◆ SwiftError

SwiftErrorValueTracking& llvm::SelectionDAGBuilder::SwiftError

Information about the swifterror values used throughout the function.

Definition at line 283 of file SelectionDAGBuilder.h.

Referenced by LowerCallTo().


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