LLVM: llvm::SelectionDAGBuilder Class Reference (original) (raw)

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

#include "[CodeGen/SelectionDAG/SelectionDAGBuilder.h](SelectionDAGBuilder%5F8h%5Fsource.html)"

Public Member Functions
SelectionDAGBuilder (SelectionDAG &dag, FunctionLoweringInfo &funcinfo, SwiftErrorValueTracking &swifterror, CodeGenOptLevel ol)
void init (GCFunctionInfo *gfi, BatchAAResults *BatchAA, AssumptionCache *AC, const TargetLibraryInfo *li, const TargetTransformInfo &TTI)
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 getFPOperationRoot (fp::ExceptionBehavior EB)
Return the current virtual root of the Selection DAG, flushing PendingConstrainedFP or PendingConstrainedFPStrict items if the new exception behavior (specified by EB) differs from that of the pending instructions.
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, Register Reg, ISD::NodeType ExtendType=ISD::ANY_EXTEND)
void visit (const Instruction &I)
void visitDbgInfo (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 (SmallVectorImpl< Value * > &Values, DILocalVariable *Var, DIExpression *Expr, bool IsVariadic, DebugLoc DL, unsigned Order)
Register a dbg_value which relies on a Value which we have not yet seen.
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 (const Value *V, 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 handleDebugDeclare (Value *Address, DILocalVariable *Variable, DIExpression *Expression, DebugLoc DL)
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)
bool shouldKeepJumpConditionsTogether (const FunctionLoweringInfo &FuncInfo, const BranchInst &I, Instruction::BinaryOps Opc, const Value *Lhs, const Value *Rhs, TargetLoweringBase::CondMergingParams Params) const
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, const TargetLowering::PtrAuthInfo *PAI=nullptr)
bool canTailCall (const CallBase &CB) const
SDValue lowerRangeToAssertZExt (SelectionDAG &DAG, const Instruction &I, SDValue Op)
SDValue lowerNoFPClassToAssertNoFPClass (SelectionDAG &DAG, const Instruction &I, SDValue Op)
void populateCallLoweringInfo (TargetLowering::CallLoweringInfo &CLI, const CallBase *Call, unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy, AttributeSet RetAttrs, bool IsPatchPoint)
Populate a CallLowerinInfo (into CLI) based on the properties of the call being lowered.
std::pair< SDValue, SDValue > lowerInvokable (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)
void LowerCallSiteWithPtrAuthBundle (const CallBase &CB, const BasicBlock *EHPadBB)
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, Register 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).
SelectionDAG & DAG
BatchAAResults * BatchAA = nullptr
AssumptionCache * AC = nullptr
const TargetLibraryInfo * LibInfo = nullptr
const TargetTransformInfo * TTI = nullptr
std::unique_ptr< SDAGSwitchLowering > SL
StackProtectorDescriptor SPDescriptor
A StackProtectorDescriptor structure used to communicate stack protector information in between SelectBasicBlock and FinishBasicBlock.
DenseMap< const Constant *, Register > ConstantsOut
FunctionLoweringInfo & FuncInfo
Information about the function as a whole.
SwiftErrorValueTracking & SwiftError
Information about the swifterror values used throughout the function.
GCFunctionInfo * GFI = 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.
LLVMContext * Context = nullptr
Static Public Attributes
static const unsigned LowestSDNodeOrder = 1
Lowest valid SDNodeOrder.

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

Definition at line 96 of file SelectionDAGBuilder.h.

addDanglingDebugInfo()

canTailCall()

clear()

void SelectionDAGBuilder::clear ( )

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 1128 of file SelectionDAGBuilder.cpp.

Referenced by resolveOrClearDbgInfo().

CopyToExportRegsIfNeeded()

void SelectionDAGBuilder::CopyToExportRegsIfNeeded ( const Value * V )

CopyValueToVirtualRegister()

dropDanglingDebugInfo()

EmitBranchForMergedCondition()

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 2453 of file SelectionDAGBuilder.cpp.

References llvm::cast(), Cond, DAG, llvm::dyn_cast(), llvm::MachineBasicBlock::getBasicBlock(), getCurSDLoc(), llvm::getFCmpCodeWithoutNaN(), llvm::getFCmpCondCode(), llvm::getICmpCondCode(), llvm::ConstantInt::getTrue(), isExportableFromCurrentBlock(), Opc, llvm::ISD::SETEQ, llvm::ISD::SETNE, SL, and TBB.

Referenced by FindMergedConditions().

ExportFromCurrentBlock()

void SelectionDAGBuilder::ExportFromCurrentBlock ( const Value * V )

FindMergedConditions()

Definition at line 2642 of file SelectionDAGBuilder.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), Cond, llvm::MachineFunction::CreateMachineBasicBlock(), DAG, llvm::dyn_cast(), EmitBranchForMergedCondition(), llvm::SmallVectorTemplateCommon< T, typename >::end(), FindMergedConditions(), llvm::MachineBasicBlock::getBasicBlock(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::MachineBasicBlock::getParent(), llvm::Value::hasOneUse(), InBlock(), llvm::MachineFunction::insert(), llvm::PatternMatch::m_LogicalAnd(), llvm::PatternMatch::m_LogicalOr(), llvm::MIPatternMatch::m_Not(), llvm::MIPatternMatch::m_OneUse(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::BranchProbability::normalizeProbabilities(), Opc, and TBB.

Referenced by FindMergedConditions().

getControlRoot()

SDValue SelectionDAGBuilder::getControlRoot ( )

getCopyFromRegs()

getCurDebugLoc()

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

getCurSDLoc()

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

Definition at line 327 of file SelectionDAGBuilder.h.

Referenced by CopyValueToVirtualRegister(), EmitBranchForMergedCondition(), getCopyFromRegs(), getUniformBase(), getValueImpl(), LowerAsSTATEPOINT(), LowerCallTo(), LowerDeoptimizingReturn(), lowerNoFPClassToAssertNoFPClass(), lowerRangeToAssertZExt(), LowerStatepoint(), populateCallLoweringInfo(), visitBitTestCase(), visitBitTestHeader(), visitSPDescriptorFailure(), visitSPDescriptorParent(), and visitSwitchCase().

getFPOperationRoot()

getFrameIndexTy()

MVT llvm::SelectionDAGBuilder::getFrameIndexTy ( ) inline

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 1163 of file SelectionDAGBuilder.cpp.

References PendingLoads.

Referenced by getRoot().

getNonRegisterValue()

getRoot()

SDValue SelectionDAGBuilder::getRoot ( )

getValue()

getValue - Return an SDValue for the given Value.

Definition at line 1796 of file SelectionDAGBuilder.cpp.

References getCopyFromRegs(), getValueImpl(), N, and resolveDanglingDebugInfo().

Referenced by getUniformBase(), getValueImpl(), LowerAsSTATEPOINT(), LowerCallSiteWithPtrAuthBundle(), LowerCallTo(), LowerStatepoint(), populateCallLoweringInfo(), visitBitTestHeader(), visitJumpTableHeader(), visitSPDescriptorFailure(), visitSPDescriptorParent(), and visitSwitchCase().

getValueImpl()

getValueImpl - Helper function for getValue and getNonRegisterValue.

Create an SDValue for the given value.

Definition at line 1840 of file SelectionDAGBuilder.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, assert(), llvm::CallingConv::C, llvm::cast(), llvm::ComputeValueVTs(), DAG, DL, llvm::dyn_cast(), FuncInfo, llvm::RegsForValue::getCopyFromRegs(), getCurSDLoc(), llvm::VectorType::getElementType(), llvm::MVT::getIntegerVT(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), llvm::SDValue::getNode(), llvm::SDNode::getNumValues(), llvm::EVT::getSizeInBits(), getValue(), llvm::TargetLoweringBase::getValueType(), llvm::EVT::getVectorElementType(), llvm::EVT::getVectorVT(), llvm::isa(), llvm::EVT::isFixedLengthVector(), llvm::EVT::isFloatingPoint(), llvm::EVT::isRISCVVectorTuple(), llvm::EVT::isScalableVector(), llvm_unreachable, llvm::PatternMatch::m_VScale(), llvm::PatternMatch::match(), NC, llvm::ISD::PtrAuthGlobalAddress, SDValue(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::ISD::SPLAT_VECTOR, and visit().

Referenced by getNonRegisterValue(), and getValue().

handleDebugDeclare()

handleDebugValue()

For a given list of Values, attempt to create and record a SDDbgValue in the SelectionDAG.

Definition at line 1629 of file SelectionDAGBuilder.cpp.

References assert(), llvm::DIExpression::createFragmentExpression(), DAG, llvm::dyn_cast(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::ArrayRef< T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SDDbgOperand::fromConst(), llvm::SDDbgOperand::fromFrameIdx(), llvm::SDDbgOperand::fromNode(), llvm::SDDbgOperand::fromVReg(), FuncInfo, llvm::DIExpression::getFragmentInfo(), llvm::DebugLoc::getInlinedAt(), llvm::RegsForValue::getRegsAndSizes(), llvm::DIVariable::getSizeInBits(), llvm::isa(), llvm::DILocalVariable::isParameter(), N, llvm::RegsForValue::occupiesMultipleRegs(), llvm::Offset, and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by handleKillDebugValue(), salvageUnresolvedDbgValue(), and visitDbgInfo().

handleKillDebugValue()

init()

Definition at line 1100 of file SelectionDAGBuilder.cpp.

References aa, AC, BatchAA, Context, DAG, GFI, llvm::isAssignmentTrackingEnabled(), LibInfo, LPadToCallSiteMap, SL, and TTI.

isExportableFromCurrentBlock()

LowerAsSTATEPOINT()

Lower SLI into a STATEPOINT instruction.

Definition at line 707 of file StatepointLowering.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::append_range(), assert(), llvm::cast(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), DAG, llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), ExportFromCurrentBlock(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), FuncInfo, llvm::GCTransition, getControlRoot(), llvm::RegsForValue::getCopyToRegs(), getCurSDLoc(), llvm::GCRelocateInst::getDerivedPtr(), llvm::SDNode::getGluedNode(), llvm::SDValue::getNode(), llvm::SDNode::getNumOperands(), llvm::SDNode::getNumValues(), llvm::SDNode::getOperand(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), getRoot(), llvm::SDValue::getValue(), getValue(), GFI, 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(), SDValue(), llvm::FunctionLoweringInfo::StatepointRelocationRecord::SDValueNode, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::FunctionLoweringInfo::StatepointRelocationRecord::Spill, StatepointLowering, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace(), and llvm::FunctionLoweringInfo::StatepointRelocationRecord::VReg.

Referenced by LowerCallSiteWithDeoptBundleImpl(), and LowerStatepoint().

LowerCallSiteWithDeoptBundle()

LowerCallSiteWithDeoptBundleImpl()

Definition at line 1144 of file StatepointLowering.cpp.

References llvm::ArrayRef(), Call, DAG, llvm::dbgs(), llvm::StatepointDirectives::DeoptBundleStatepointID, llvm::Type::getVoidTy(), LLVM_DEBUG, LowerAsSTATEPOINT(), lowerRangeToAssertZExt(), llvm::None, llvm::LLVMContext::OB_deopt, llvm::parseStatepointDirectivesFromAttrs(), populateCallLoweringInfo(), and setValue().

Referenced by LowerCallSiteWithDeoptBundle(), and LowerDeoptimizeCall().

LowerCallSiteWithPtrAuthBundle()

Definition at line 9805 of file SelectionDAGBuilder.cpp.

References assert(), llvm::cast(), DAG, llvm::dyn_cast(), llvm::CallBase::getCalledOperand(), llvm::CallBase::getOperandBundle(), getValue(), llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key, llvm::isa(), llvm::CallBase::isMustTailCall(), llvm::CallBase::isTailCall(), and LowerCallTo().

LowerCallTo()

Definition at line 9080 of file SelectionDAGBuilder.cpp.

References llvm::CallBase::arg_begin(), llvm::CallBase::arg_end(), llvm::CallBase::arg_size(), assert(), canTailCall(), llvm::cast(), llvm::CallBase::countOperandBundlesOfType(), DAG, llvm::TargetLowering::CallLoweringInfo::DAG, DL, llvm::TargetLowering::CallLoweringInfo::DL, FuncInfo, llvm::SelectionDAG::getCopyToReg(), getCurSDLoc(), llvm::CallBase::getFunctionType(), llvm::CallBase::getOperandBundle(), llvm::TargetLoweringBase::getPointerTy(), getRoot(), llvm::Value::getType(), getValue(), I, llvm::TargetLowering::CallLoweringInfo::InVals, llvm::isa(), llvm::CallBase::isConvergent(), llvm::CallBase::isIndirectCall(), llvm::Type::isIntegerTy(), lowerInvokable(), lowerNoFPClassToAssertNoFPClass(), lowerRangeToAssertZExt(), llvm::LLVMContext::OB_cfguardtarget, llvm::LLVMContext::OB_convergencectrl, llvm::LLVMContext::OB_deactivation_symbol, llvm::LLVMContext::OB_kcfi, llvm::LLVMContext::OB_preallocated, llvm::report_fatal_error(), llvm::TargetLowering::CallLoweringInfo::setCallee(), llvm::TargetLowering::CallLoweringInfo::setCFIType(), llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::TargetLowering::CallLoweringInfo::setConvergenceControlToken(), llvm::TargetLowering::CallLoweringInfo::setConvergent(), llvm::TargetLowering::CallLoweringInfo::setDeactivationSymbol(), llvm::TargetLowering::CallLoweringInfo::setDebugLoc(), llvm::TargetLowering::CallLoweringInfo::setIsPreallocated(), llvm::TargetLowering::CallLoweringInfo::setPtrAuth(), llvm::TargetLowering::CallLoweringInfo::setTailCall(), setValue(), llvm::TargetLowering::supportKCFIBundles(), llvm::TargetLowering::supportPtrAuthBundles(), llvm::TargetLowering::supportSwiftError(), and SwiftError.

Referenced by LowerCallSiteWithPtrAuthBundle().

LowerDeoptimizeCall()

void SelectionDAGBuilder::LowerDeoptimizeCall ( const CallInst * CI )

LowerDeoptimizingReturn()

void SelectionDAGBuilder::LowerDeoptimizingReturn ( )

lowerInvokable()

lowerNoFPClassToAssertNoFPClass()

Definition at line 10776 of file SelectionDAGBuilder.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::ISD::AssertNoFPClass, DAG, llvm::fcNone, getCurSDLoc(), getNoFPClass(), llvm::SDValue::getValueType(), I, llvm::ISD::MERGE_VALUES, and SL.

Referenced by LowerCallTo().

lowerRangeToAssertZExt()

Definition at line 10741 of file SelectionDAGBuilder.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::ISD::AssertZext, DAG, getCurSDLoc(), llvm::EVT::getIntegerVT(), llvm::getRange(), llvm::Hi, I, llvm::Lo, llvm::IntegerType::MIN_INT_BITS, and SL.

Referenced by LowerCallSiteWithDeoptBundleImpl(), and LowerCallTo().

LowerStatepoint()

Definition at line 1018 of file StatepointLowering.cpp.

References llvm::CallingConv::AnyReg, llvm::ArrayRef(), assert(), llvm::GCStatepointInst::CallArgsBeginPos, DAG, FuncInfo, llvm::RegsForValue::getCopyToRegs(), getCurSDLoc(), getGCResultLocality(), getValue(), GFI, I, llvm::SmallSet< T, N, C >::insert(), isGCValue(), LowerAsSTATEPOINT(), populateCallLoweringInfo(), and setValue().

populateCallLoweringInfo()

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 10806 of file SelectionDAGBuilder.cpp.

References assert(), Call, 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()

If we saw an earlier dbg_value referring to V, generate the debug data structures now that we've seen its definition.

Definition at line 1498 of file SelectionDAGBuilder.cpp.

References assert(), DAG, llvm::dbgs(), DL, llvm::SDValue::dump(), llvm::PoisonValue::get(), llvm::SDNode::getIROrder(), llvm::SDValue::getNode(), LLVM_DEBUG, and Poison.

Referenced by getCopyFromRegs(), getNonRegisterValue(), and getValue().

resolveOrClearDbgInfo()

void SelectionDAGBuilder::resolveOrClearDbgInfo ( )

salvageUnresolvedDbgValue()

void SelectionDAGBuilder::salvageUnresolvedDbgValue ( const Value * V,
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 1552 of file SelectionDAGBuilder.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::DIExpression::appendOpsToArg(), assert(), llvm::cast(), DAG, llvm::dbgs(), DL, llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::PoisonValue::get(), llvm::DIExpression::getNumLocationOperands(), llvm::Value::getType(), handleDebugValue(), llvm::isa(), LLVM_DEBUG, Poison, and llvm::salvageDebugInfoImpl().

Referenced by dropDanglingDebugInfo(), and resolveOrClearDbgInfo().

setUnusedArgValue()

setValue()

ShouldEmitAsBranches()

shouldKeepJumpConditionsTogether()

Definition at line 2532 of file SelectionDAGBuilder.cpp.

References llvm::TargetLoweringBase::CondMergingParams::BaseCost, collectInstructionDeps(), llvm::MapVector< KeyT, ValueT, MapType, VectorType >::contains(), llvm::dyn_cast(), FuncInfo, I, llvm::BranchProbabilityInfo::isEdgeHot(), llvm::TargetLoweringBase::CondMergingParams::LikelyBias, llvm::SelectionDAG::MaxRecursionDepth, Opc, llvm::TargetTransformInfo::TCK_Latency, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::try_emplace(), TTI, and llvm::TargetLoweringBase::CondMergingParams::UnlikelyBias.

UpdateSplitBlock()

visit() [1/2]

Definition at line 1370 of file SelectionDAGBuilder.cpp.

References assert(), CopyToExportRegsIfNeeded(), DAG, llvm::errs(), HasTailCall, I, llvm::isa(), LLVM_DEBUG, visit(), and visitDbgInfo().

Referenced by getValueImpl(), and visit().

visit() [2/2]

visitBitTestCase()

visitBitTestCase - this function produces one "bit test"

Definition at line 3340 of file SelectionDAGBuilder.cpp.

References llvm::ISD::AND, B(), llvm::countr_one(), llvm::countr_zero(), DAG, getControlRoot(), getCurSDLoc(), llvm::TargetLoweringBase::getSetCCResultType(), llvm::MachineBasicBlock::normalizeSuccProbs(), llvm::popcount(), llvm::SwitchCG::BitTestBlock::Range, llvm::SwitchCG::BitTestBlock::RegVT, llvm::ISD::SETEQ, llvm::ISD::SETNE, and llvm::ISD::SHL.

visitBitTestHeader()

visitBitTestHeader - This function emits necessary code to produce value suitable for "bit tests"

Definition at line 3278 of file SelectionDAGBuilder.cpp.

References B(), DAG, FuncInfo, getControlRoot(), getCurSDLoc(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getSetCCResultType(), llvm::EVT::getSimpleVT(), llvm::EVT::getSizeInBits(), getValue(), llvm::SDValue::getValueType(), llvm::TargetLoweringBase::isTypeLegal(), llvm::isUIntN(), llvm::SwitchCG::BitTestCase::Mask, MBB, llvm::MachineBasicBlock::normalizeSuccProbs(), llvm::ISD::SETUGT, llvm::ISD::SUB, and llvm::Sub.

visitDbgInfo()

Definition at line 1282 of file SelectionDAGBuilder.cpp.

References addDanglingDebugInfo(), llvm::any_of(), assert(), llvm::cast(), DAG, llvm::dbgs(), llvm::DbgVariableRecord::Declare, dropDanglingDebugInfo(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), FuncInfo, llvm::DbgRecord::getDebugLoc(), llvm::DbgVariableRecord::getExpression(), llvm::DbgVariableRecord::getType(), llvm::DbgVariableRecord::getVariable(), llvm::DbgVariableRecord::getVariableLocationOp(), handleDebugDeclare(), handleDebugValue(), handleKillDebugValue(), llvm::DbgVariableRecord::hasArgList(), I, llvm::isa(), LLVM_DEBUG, llvm::DbgVariableRecord::location_ops(), and llvm::SmallVectorTemplateCommon< T, typename >::size().

Referenced by visit().

visitJumpTable()

visitJumpTableHeader()

visitJumpTableHeader - This function emits necessary code to produce index in the JumpTable from switch case.

Definition at line 3018 of file SelectionDAGBuilder.cpp.

References assert(), DAG, llvm::SwitchCG::JumpTableHeader::FallthroughUnreachable, llvm::SwitchCG::JumpTableHeader::First, FuncInfo, getControlRoot(), llvm::TargetLowering::getJumpTableRegTy(), llvm::TargetLoweringBase::getSetCCResultType(), getValue(), llvm::SDValue::getValueType(), llvm::SwitchCG::JumpTableHeader::Last, llvm::ISD::SETUGT, llvm::ISD::SUB, llvm::Sub, and llvm::SwitchCG::JumpTableHeader::SValue.

visitSPDescriptorFailure()

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 3206 of file SelectionDAGBuilder.cpp.

References assert(), DAG, DL, llvm::TargetLowering::emitStackGuardXorFP(), llvm::PointerType::get(), getCurSDLoc(), llvm::MachinePointerInfo::getFixedStack(), llvm::TargetLoweringBase::getFrameIndexTy(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::FunctionType::getNumParams(), llvm::FunctionType::getParamType(), llvm::GlobalValue::getParent(), llvm::MachineBasicBlock::getParent(), llvm::StackProtectorDescriptor::getParentMBB(), llvm::TargetLoweringBase::getPointerMemTy(), llvm::FunctionType::getReturnType(), llvm::TargetLoweringBase::getSSPStackGuardCheck(), llvm::MachineFrameInfo::getStackProtectorIndex(), getValue(), llvm::TargetLowering::LowerCallTo(), llvm::TargetLowering::makeLibCall(), llvm::MachineMemOperand::MOVolatile, llvm::TargetOptions::NoTrapAfterNoreturn, llvm::TargetLowering::CallLoweringInfo::setCallee(), llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::TargetLowering::CallLoweringInfo::setDebugLoc(), llvm::TargetLowering::MakeLibCallOptions::setDiscardResult(), llvm::StackProtectorDescriptor::shouldEmitFunctionBasedCheckStackProtector(), llvm::TargetOptions::TrapUnreachable, and llvm::TargetLoweringBase::useStackGuardXorFP().

visitSPDescriptorParent()

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 3104 of file SelectionDAGBuilder.cpp.

References assert(), DAG, DL, llvm::TargetLowering::emitStackGuardXorFP(), llvm::PointerType::get(), llvm::Function::getCallingConv(), getCurSDLoc(), llvm::StackProtectorDescriptor::getFailureMBB(), llvm::MachinePointerInfo::getFixedStack(), llvm::TargetLoweringBase::getFrameIndexTy(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::Function::getFunctionType(), getLoadStackGuard(), llvm::FunctionType::getNumParams(), llvm::SDValue::getOperand(), llvm::FunctionType::getParamType(), llvm::GlobalValue::getParent(), llvm::MachineBasicBlock::getParent(), llvm::TargetLoweringBase::getPointerMemTy(), llvm::FunctionType::getReturnType(), llvm::TargetLoweringBase::getSDagStackGuard(), llvm::TargetLoweringBase::getSetCCResultType(), llvm::TargetLoweringBase::getSSPStackGuardCheck(), llvm::MachineFrameInfo::getStackProtectorIndex(), llvm::StackProtectorDescriptor::getSuccessMBB(), getValue(), llvm::SDValue::getValueType(), llvm::Function::hasParamAttribute(), llvm::TargetLowering::LowerCallTo(), llvm::MachineMemOperand::MOVolatile, llvm::TargetLowering::CallLoweringInfo::setCallee(), llvm::TargetLowering::CallLoweringInfo::setChain(), llvm::TargetLowering::CallLoweringInfo::setDebugLoc(), llvm::ISD::SETNE, llvm::StackProtectorDescriptor::shouldEmitFunctionBasedCheckStackProtector(), llvm::TargetLowering::useLoadStackGuardNode(), and llvm::TargetLoweringBase::useStackGuardXorFP().

visitSwitchCase()

visitSwitchCase - Emits the necessary code to represent a single node in the binary search tree resulting from lowering a switch instruction.

Definition at line 2908 of file SelectionDAGBuilder.cpp.

References assert(), llvm::cast(), llvm::SwitchCG::CaseBlock::CC, llvm::SwitchCG::CaseBlock::CmpLHS, llvm::SwitchCG::CaseBlock::CmpMHS, llvm::SwitchCG::CaseBlock::CmpRHS, Cond, DAG, llvm::SwitchCG::CaseBlock::DL, llvm::SwitchCG::CaseBlock::FalseBB, llvm::SwitchCG::CaseBlock::FalseProb, getControlRoot(), getCurSDLoc(), llvm::ConstantInt::getFalse(), llvm::TargetLoweringBase::getMemValueType(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), getValue(), llvm::SDValue::getValueType(), High, llvm::SwitchCG::CaseBlock::IsUnpredictable, llvm::Low, llvm::MachineBasicBlock::normalizeSuccProbs(), llvm::ISD::SETEQ, llvm::ISD::SETLE, llvm::ISD::SETTRUE, llvm::ISD::SETULE, llvm::SDNodeFlags::setUnpredictable(), setValue(), llvm::ISD::SUB, std::swap(), llvm::SwitchCG::CaseBlock::TrueBB, llvm::SwitchCG::CaseBlock::TrueProb, and llvm::ISD::XOR.

AC

BatchAA

ConstantsOut

Context

LLVMContext* llvm::SelectionDAGBuilder::Context = nullptr

DAG

Definition at line 231 of file SelectionDAGBuilder.h.

Referenced by addDanglingDebugInfo(), canTailCall(), CopyValueToVirtualRegister(), EmitBranchForMergedCondition(), FindMergedConditions(), getCopyFromRegs(), getFPOperationRoot(), getFrameIndexTy(), getUniformBase(), getValueImpl(), handleDebugDeclare(), handleDebugValue(), init(), LowerAsSTATEPOINT(), LowerCallSiteWithDeoptBundleImpl(), LowerCallSiteWithPtrAuthBundle(), LowerCallTo(), LowerDeoptimizeCall(), LowerDeoptimizingReturn(), lowerInvokable(), lowerNoFPClassToAssertNoFPClass(), lowerRangeToAssertZExt(), LowerStatepoint(), resolveDanglingDebugInfo(), salvageUnresolvedDbgValue(), SelectionDAGBuilder(), llvm::SelectionDAGBuilder::StatepointLoweringInfo::StatepointLoweringInfo(), visit(), visitBitTestCase(), visitBitTestHeader(), visitDbgInfo(), visitJumpTable(), visitJumpTableHeader(), visitSPDescriptorFailure(), visitSPDescriptorParent(), and visitSwitchCase().

FuncInfo

Information about the function as a whole.

Definition at line 265 of file SelectionDAGBuilder.h.

Referenced by CopyToExportRegsIfNeeded(), CopyValueToVirtualRegister(), ExportFromCurrentBlock(), getCopyFromRegs(), getValueImpl(), handleDebugValue(), isExportableFromCurrentBlock(), LowerAsSTATEPOINT(), LowerCallTo(), LowerStatepoint(), SelectionDAGBuilder(), shouldKeepJumpConditionsTogether(), visitBitTestHeader(), visitDbgInfo(), and visitJumpTableHeader().

GFI

HasTailCall

bool llvm::SelectionDAGBuilder::HasTailCall = false

LibInfo

LowestSDNodeOrder

LPadToCallSiteMap

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 171 of file SelectionDAGBuilder.h.

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

SL

SPDescriptor

StatepointLowering

SwiftError

TTI


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