LLVM: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp File Reference (original) (raw)

Go to the source code of this file.

Namespaces
namespace llvm
This is an optimization pass for GlobalISel generic memory operations.
Functions
STATISTIC (NumFastIselFailures, "Number of instructions fast isel failed on")
STATISTIC (NumFastIselSuccess, "Number of instructions fast isel selected")
STATISTIC (NumFastIselBlocks, "Number of blocks selected entirely by fast isel")
STATISTIC (NumDAGBlocks, "Number of blocks selected using DAG")
STATISTIC (NumDAGIselRetries,"Number of times dag isel has to try another path")
STATISTIC (NumEntryBlocks, "Number of entry blocks encountered")
STATISTIC (NumFastIselFailLowerArguments, "Number of entry blocks where fast isel failed to lower arguments")
static bool dontUseFastISelFor (const Function &Fn)
static bool maintainPGOProfile (const TargetMachine &TM, CodeGenOptLevel OptLevel)
LLVM_ABI ScheduleDAGSDNodes * llvm::createDefaultScheduler (SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
createDefaultScheduler - This creates an instruction scheduler appropriate for the target.
static void reportFastISelFailure (MachineFunction &MF, OptimizationRemarkEmitter &ORE, OptimizationRemarkMissed &R, bool ShouldAbort)
static void preserveFakeUses (BasicBlock::iterator Begin, BasicBlock::iterator End)
static bool hasExceptionPointerOrCodeUser (const CatchPadInst *CPI)
static void mapWasmLandingPadIndex (MachineBasicBlock *MBB, const CatchPadInst *CPI)
static bool isFoldedOrDeadInstruction (const Instruction *I, const FunctionLoweringInfo &FuncInfo)
isFoldedOrDeadInstruction - Return true if the specified instruction is side-effect free and is either dead or folded into a generated instruction.
static bool processIfEntryValueDbgDeclare (FunctionLoweringInfo &FuncInfo, const Value *Arg, DIExpression *Expr, DILocalVariable *Var, DebugLoc DbgLoc)
static bool processDbgDeclare (FunctionLoweringInfo &FuncInfo, const Value *Address, DIExpression *Expr, DILocalVariable *Var, DebugLoc DbgLoc)
static void processDbgDeclares (FunctionLoweringInfo &FuncInfo)
Collect llvm.dbg.declare information.
static void processSingleLocVars (FunctionLoweringInfo &FuncInfo, FunctionVarLocs const *FnVarLocs)
Collect single location variable information generated with assignment tracking.
static bool findNonImmUse (SDNode *Root, SDNode *Def, SDNode *ImmedUse, bool IgnoreChains)
findNonImmUse - Return true if "Def" is a predecessor of "Root" via a path beyond "ImmedUse".
static LLVM_ATTRIBUTE_ALWAYS_INLINE uint64_t GetVBR (uint64_t Val, const unsigned char *MatcherTable, unsigned &Idx)
GetVBR - decode a vbr encoding whose top bit is set.
static LLVM_ATTRIBUTE_ALWAYS_INLINE MVT::SimpleValueType getSimpleVT (const unsigned char *MatcherTable, unsigned &MatcherIndex)
getSimpleVT - Decode a value in MatcherTable, if it's a VBR encoded value, use GetVBR to decode it.
static SDValue HandleMergeInputChains (const SmallVectorImpl< SDNode * > &ChainNodesMatched, SDValue InputGlue, SelectionDAG *CurDAG)
HandleMergeInputChains - This implements the OPC_EmitMergeInputChains operation for when the pattern matched at least one node with a chains.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckSame (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SmallVectorImpl< std::pair< SDValue, SDNode * > > &RecordedNodes)
CheckSame - Implements OP_CheckSame.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildSame (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SmallVectorImpl< std::pair< SDValue, SDNode * > > &RecordedNodes, unsigned ChildNo)
CheckChildSame - Implements OP_CheckChildXSame.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckPatternPredicate (unsigned Opcode, const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel)
CheckPatternPredicate - Implements OP_CheckPatternPredicate.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckNodePredicate (unsigned Opcode, const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel, SDValue Op)
CheckNodePredicate - Implements OP_CheckNodePredicate.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOpcode (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDNode *N)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckType (MVT::SimpleValueType VT, SDValue N, const TargetLowering *TLI, const DataLayout &DL)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildType (MVT::SimpleValueType VT, SDValue N, const TargetLowering *TLI, const DataLayout &DL, unsigned ChildNo)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckCondCode (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChild2CondCode (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckValueType (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL)
static uint64_t decodeSignRotatedValue (uint64_t V)
Decode a signed value stored with the sign bit in the LSB for dense VBR encoding.
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckInteger (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildInteger (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, unsigned ChildNo)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckAndImm (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SelectionDAGISel &SDISel)
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOrImm (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const SelectionDAGISel &SDISel)
static unsigned IsPredicateKnownToFail (const unsigned char *Table, unsigned Index, SDValue N, bool &Result, const SelectionDAGISel &SDISel, SmallVectorImpl< std::pair< SDValue, SDNode * > > &RecordedNodes)
IsPredicateKnownToFail - If we know how and can do so without pushing a scope, evaluate the current node.
Variables
static cl::opt< int > EnableFastISelAbort ("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection " "fails to lower an instruction: 0 disable the abort, 1 will " "abort but for args, calls and terminators, 2 will also " "abort for argument lowering, and 3 will never fallback " "to SelectionDAG."))
static cl::opt< bool > EnableFastISelFallbackReport ("fast-isel-report-on-fallback", cl::Hidden, cl::desc("Emit a diagnostic when \"fast\" instruction selection " "falls back to SelectionDAG."))
static cl::opt< bool > UseMBPI ("use-mbpi", cl::desc("use Machine Branch Probability Info"), cl::init(true), cl::Hidden)
static cl::opt< bool > DumpSortedDAG ("dump-sorted-dags", cl::Hidden, cl::desc("Print DAGs with sorted nodes in debug dump"), cl::init(false))
static cl::opt< std::string > FilterDAGBasicBlockName ("filter-view-dags", cl::Hidden, cl::desc("Only display the basic block whose name " "matches this for all view-*-dags options"))
static cl::opt< bool > ViewDAGCombine1 ("view-dag-combine1-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the first " "dag combine pass"))
static cl::opt< bool > ViewLegalizeTypesDAGs ("view-legalize-types-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize types"))
static cl::opt< bool > ViewDAGCombineLT ("view-dag-combine-lt-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the post " "legalize types dag combine pass"))
static cl::opt< bool > ViewLegalizeDAGs ("view-legalize-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize"))
static cl::opt< bool > ViewDAGCombine2 ("view-dag-combine2-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the second " "dag combine pass"))
static cl::opt< bool > ViewISelDAGs ("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected"))
static cl::opt< bool > ViewSchedDAGs ("view-sched-dags", cl::Hidden, cl::desc("Pop up a window to show sched dags as they are processed"))
static cl::opt< bool > ViewSUnitDAGs ("view-sunit-dags", cl::Hidden, cl::desc("Pop up a window to show SUnit dags after they are processed"))
static cl::opt< RegisterScheduler::FunctionPassCtor, false, RegisterPassParser< RegisterScheduler > > ISHeuristic ("pre-RA-sched", cl::init(&createDefaultScheduler), cl::Hidden, cl::desc("Instruction schedulers available (before register" " allocation):"))
ISHeuristic command line option for instruction schedulers.
static RegisterScheduler defaultListDAGScheduler ("default", "Best scheduler for the target", createDefaultScheduler)

DEBUG_TYPE

#define DEBUG_TYPE "isel"

ISEL_DUMP

Value:

do { \

} \

} while (false)

#define ISEL_DUMP_DEBUG_TYPE

static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")

LLVM_ABI bool isCurrentDebugType(const char *Type, int Level=0)

isCurrentDebugType - Return true if the specified string is the debug type specified on the command l...

LLVM_ABI bool DebugFlag

This boolean is set to true if the '-debug' command line option is specified.

Definition at line 191 of file SelectionDAGISel.cpp.

Referenced by llvm::SelectionDAGISel::runOnMachineFunction().

ISEL_DUMP_DEBUG_TYPE

CheckAndImm()

CheckChild2CondCode()

CheckChildInteger()

CheckChildSame()

CheckChildType()

CheckCondCode()

CheckInteger()

CheckNodePredicate()

CheckOpcode()

CheckOrImm()

CheckPatternPredicate()

CheckSame()

CheckType()

CheckValueType()

decodeSignRotatedValue()

dontUseFastISelFor()

findNonImmUse()

getSimpleVT()

GetVBR()

HandleMergeInputChains()

HandleMergeInputChains - This implements the OPC_EmitMergeInputChains operation for when the pattern matched at least one node with a chains.

The input vector contains a list of all of the chained nodes that we match. We must determine if this is a valid thing to cover (i.e. matching it won't induce cycles in the DAG) and if so, creating a TokenFactor node. that will be used as the input node chain for the generated nodes.

Definition at line 2781 of file SelectionDAGISel.cpp.

References llvm::SmallPtrSetImplBase::clear(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::ISD::EntryToken, llvm::SelectionDAG::getEntryNode(), llvm::SDValue::getNode(), llvm::SelectionDAG::getNode(), llvm::SDNode::hasPredecessorHelper(), llvm::SmallPtrSetImpl< PtrType >::insert(), N, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), SDValue(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::ISD::TokenFactor.

Referenced by llvm::SelectionDAGISel::SelectCodeCommon().

hasExceptionPointerOrCodeUser()

isFoldedOrDeadInstruction()

IsPredicateKnownToFail()

IsPredicateKnownToFail - If we know how and can do so without pushing a scope, evaluate the current node.

If the current predicate is known to fail, set Result=true and return anything. If the current predicate is known to pass, set Result=false and return the MatcherIndex to continue with. If the current predicate is unknown, set Result=false and return the MatcherIndex to continue with.

Definition at line 3072 of file SelectionDAGISel.cpp.

References CheckAndImm(), CheckChild2CondCode(), CheckChildInteger(), CheckChildSame(), CheckChildType(), CheckCondCode(), CheckInteger(), CheckNodePredicate(), CheckOpcode(), CheckOrImm(), CheckPatternPredicate(), CheckSame(), CheckType(), CheckValueType(), llvm::SelectionDAGISel::CurDAG, llvm::SelectionDAG::getDataLayout(), getSimpleVT(), N, llvm::SelectionDAGISel::OPC_CheckAndImm, llvm::SelectionDAGISel::OPC_CheckChild0Integer, llvm::SelectionDAGISel::OPC_CheckChild0Same, llvm::SelectionDAGISel::OPC_CheckChild0Type, llvm::SelectionDAGISel::OPC_CheckChild0TypeI32, llvm::SelectionDAGISel::OPC_CheckChild0TypeI64, llvm::SelectionDAGISel::OPC_CheckChild1Integer, llvm::SelectionDAGISel::OPC_CheckChild1Same, llvm::SelectionDAGISel::OPC_CheckChild1Type, llvm::SelectionDAGISel::OPC_CheckChild1TypeI32, llvm::SelectionDAGISel::OPC_CheckChild1TypeI64, llvm::SelectionDAGISel::OPC_CheckChild2CondCode, llvm::SelectionDAGISel::OPC_CheckChild2Integer, llvm::SelectionDAGISel::OPC_CheckChild2Same, llvm::SelectionDAGISel::OPC_CheckChild2Type, llvm::SelectionDAGISel::OPC_CheckChild2TypeI32, llvm::SelectionDAGISel::OPC_CheckChild2TypeI64, llvm::SelectionDAGISel::OPC_CheckChild3Integer, llvm::SelectionDAGISel::OPC_CheckChild3Same, llvm::SelectionDAGISel::OPC_CheckChild3Type, llvm::SelectionDAGISel::OPC_CheckChild3TypeI32, llvm::SelectionDAGISel::OPC_CheckChild3TypeI64, llvm::SelectionDAGISel::OPC_CheckChild4Integer, llvm::SelectionDAGISel::OPC_CheckChild4Type, llvm::SelectionDAGISel::OPC_CheckChild4TypeI32, llvm::SelectionDAGISel::OPC_CheckChild4TypeI64, llvm::SelectionDAGISel::OPC_CheckChild5Type, llvm::SelectionDAGISel::OPC_CheckChild5TypeI32, llvm::SelectionDAGISel::OPC_CheckChild5TypeI64, llvm::SelectionDAGISel::OPC_CheckChild6Type, llvm::SelectionDAGISel::OPC_CheckChild6TypeI32, llvm::SelectionDAGISel::OPC_CheckChild6TypeI64, llvm::SelectionDAGISel::OPC_CheckChild7Type, llvm::SelectionDAGISel::OPC_CheckChild7TypeI32, llvm::SelectionDAGISel::OPC_CheckChild7TypeI64, llvm::SelectionDAGISel::OPC_CheckCondCode, llvm::SelectionDAGISel::OPC_CheckInteger, llvm::SelectionDAGISel::OPC_CheckOpcode, llvm::SelectionDAGISel::OPC_CheckOrImm, llvm::SelectionDAGISel::OPC_CheckPatternPredicate, llvm::SelectionDAGISel::OPC_CheckPatternPredicate0, llvm::SelectionDAGISel::OPC_CheckPatternPredicate1, llvm::SelectionDAGISel::OPC_CheckPatternPredicate2, llvm::SelectionDAGISel::OPC_CheckPatternPredicate3, llvm::SelectionDAGISel::OPC_CheckPatternPredicate4, llvm::SelectionDAGISel::OPC_CheckPatternPredicate5, llvm::SelectionDAGISel::OPC_CheckPatternPredicate6, llvm::SelectionDAGISel::OPC_CheckPatternPredicate7, llvm::SelectionDAGISel::OPC_CheckPatternPredicateTwoByte, llvm::SelectionDAGISel::OPC_CheckPredicate, llvm::SelectionDAGISel::OPC_CheckPredicate0, llvm::SelectionDAGISel::OPC_CheckPredicate1, llvm::SelectionDAGISel::OPC_CheckPredicate2, llvm::SelectionDAGISel::OPC_CheckPredicate3, llvm::SelectionDAGISel::OPC_CheckPredicate4, llvm::SelectionDAGISel::OPC_CheckPredicate5, llvm::SelectionDAGISel::OPC_CheckPredicate6, llvm::SelectionDAGISel::OPC_CheckPredicate7, llvm::SelectionDAGISel::OPC_CheckSame, llvm::SelectionDAGISel::OPC_CheckType, llvm::SelectionDAGISel::OPC_CheckTypeI32, llvm::SelectionDAGISel::OPC_CheckTypeI64, llvm::SelectionDAGISel::OPC_CheckTypeRes, llvm::SelectionDAGISel::OPC_CheckValueType, and llvm::SelectionDAGISel::TLI.

Referenced by llvm::SelectionDAGISel::SelectCodeCommon().

maintainPGOProfile()

mapWasmLandingPadIndex()

preserveFakeUses()

processDbgDeclare()

Definition at line 1555 of file SelectionDAGISel.cpp.

References llvm::DIExpression::ApplyOffset, assert(), llvm::dbgs(), DL, llvm::dyn_cast(), llvm::FunctionLoweringInfo::getArgumentFrameIndex(), llvm::MachineFunction::getDataLayout(), LLVM_DEBUG, llvm::FunctionLoweringInfo::MF, llvm::Offset, llvm::DIExpression::prepend(), processIfEntryValueDbgDeclare(), llvm::MachineFunction::setVariableDbgInfo(), and llvm::FunctionLoweringInfo::StaticAllocaMap.

Referenced by processDbgDeclares(), and processSingleLocVars().

processDbgDeclares()

processIfEntryValueDbgDeclare()

processSingleLocVars()

reportFastISelFailure()

STATISTIC() [1/7]

STATISTIC ( NumDAGBlocks ,
"Number of blocks selected using DAG" )

STATISTIC() [2/7]

STATISTIC ( NumDAGIselRetries ,
"Number of times dag isel has to try another path" )

STATISTIC() [3/7]

STATISTIC ( NumEntryBlocks ,
"Number of entry blocks encountered" )

STATISTIC() [4/7]

STATISTIC ( NumFastIselBlocks ,
"Number of blocks selected entirely by fast isel" )

STATISTIC() [5/7]

STATISTIC ( NumFastIselFailLowerArguments ,
"Number of entry blocks where fast isel failed to lower arguments" )

STATISTIC() [6/7]

STATISTIC ( NumFastIselFailures ,
"Number of instructions fast isel failed on" )

STATISTIC() [7/7]

defaultListDAGScheduler

RegisterScheduler defaultListDAGScheduler("default", "Best scheduler for the target", createDefaultScheduler) ( "default" , "Best scheduler for the target" , createDefaultScheduler ) static

DumpSortedDAG

cl::opt< bool > DumpSortedDAG("dump-sorted-dags", cl::Hidden, cl::desc("Print DAGs with sorted nodes in debug dump"), cl::init(false)) ( "dump-sorted-dags" , cl::Hidden , cl::desc("Print DAGs with sorted nodes in debug dump") , cl::init(false) ) static

EnableFastISelAbort

cl::opt< int > EnableFastISelAbort("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection " "fails to lower an instruction: 0 disable the abort, 1 will " "abort but for args, calls and terminators, 2 will also " "abort for argument lowering, and 3 will never fallback " "to SelectionDAG.")) ( "fast-isel-abort" , cl::Hidden , cl::desc("Enable abort calls when \"fast\" instruction selection " "fails to lower an instruction: 0 disable the abort, 1 will " "abort but for args, calls and terminators, 2 will also " "abort for argument lowering, and 3 will never fallback " "to SelectionDAG.") ) static

EnableFastISelFallbackReport

cl::opt< bool > EnableFastISelFallbackReport("fast-isel-report-on-fallback", cl::Hidden, cl::desc("Emit a diagnostic when \"fast\" instruction selection " "falls back to SelectionDAG.")) ( "fast-isel-report-on-fallback" , cl::Hidden , cl::desc("Emit a diagnostic when \"fast\" instruction selection " "falls back to SelectionDAG.") ) static

FilterDAGBasicBlockName

cl::opt< std::string > FilterDAGBasicBlockName("filter-view-dags", cl::Hidden, cl::desc("Only display the basic block whose name " "matches this for all view-*-dags options")) ( "filter-view-dags" , cl::Hidden , cl::desc("Only display the basic block whose name " "matches this for all view-*-dags options") ) static

ISHeuristic

ISHeuristic command line option for instruction schedulers.

UseMBPI

cl::opt< bool > UseMBPI("use-mbpi", cl::desc("use Machine Branch Probability Info"), cl::init(true), cl::Hidden) ( "use-mbpi" , cl::desc("use Machine Branch Probability Info") , cl::init(true) , cl::Hidden ) static

ViewDAGCombine1

cl::opt< bool > ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the first " "dag combine pass")) ( "view-dag-combine1-dags" , cl::Hidden , cl::desc("Pop up a window to show dags before the first " "dag combine pass") ) static

ViewDAGCombine2

cl::opt< bool > ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the second " "dag combine pass")) ( "view-dag-combine2-dags" , cl::Hidden , cl::desc("Pop up a window to show dags before the second " "dag combine pass") ) static

ViewDAGCombineLT

cl::opt< bool > ViewDAGCombineLT("view-dag-combine-lt-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the post " "legalize types dag combine pass")) ( "view-dag-combine-lt-dags" , cl::Hidden , cl::desc("Pop up a window to show dags before the post " "legalize types dag combine pass") ) static

ViewISelDAGs

cl::opt< bool > ViewISelDAGs("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected")) ( "view-isel-dags" , cl::Hidden , cl::desc("Pop up a window to show isel dags as they are selected") ) static

ViewLegalizeDAGs

cl::opt< bool > ViewLegalizeDAGs("view-legalize-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize")) ( "view-legalize-dags" , cl::Hidden , cl::desc("Pop up a window to show dags before legalize") ) static

ViewLegalizeTypesDAGs

cl::opt< bool > ViewLegalizeTypesDAGs("view-legalize-types-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize types")) ( "view-legalize-types-dags" , cl::Hidden , cl::desc("Pop up a window to show dags before legalize types") ) static

ViewSchedDAGs

cl::opt< bool > ViewSchedDAGs("view-sched-dags", cl::Hidden, cl::desc("Pop up a window to show sched dags as they are processed")) ( "view-sched-dags" , cl::Hidden , cl::desc("Pop up a window to show sched dags as they are processed") ) static

ViewSUnitDAGs

cl::opt< bool > ViewSUnitDAGs("view-sunit-dags", cl::Hidden, cl::desc("Pop up a window to show SUnit dags after they are processed")) ( "view-sunit-dags" , cl::Hidden , cl::desc("Pop up a window to show SUnit dags after they are processed") ) static