LLVM 19.0.0git
Classes | Namespaces | Macros | Functions | Variables
SelectionDAGISel.cpp File Reference
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "ScheduleDAGSDNodes.h"
#include "SelectionDAGBuilder.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/LazyBlockFrequencyInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/UniformityAnalysis.h"
#include "llvm/CodeGen/AssignmentTrackingAnalysis.h"
#include "llvm/CodeGen/CodeGenCommonISel.h"
#include "llvm/CodeGen/FastISel.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachinePassRegistry.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/CodeGen/StackProtector.h"
#include "llvm/CodeGen/SwiftErrorValueTracking.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/PrintPasses.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Pass.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  llvm::OptLevelChanger
 This class is used by SelectionDAGISel to temporarily override the optimization level on a per-function basis. More...
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "isel"
 
#define ISEL_DUMP_DEBUG_TYPE   DEBUG_TYPE "-dump"
 
#define ISEL_DUMP(X)
 

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)
 
ScheduleDAGSDNodesllvm::createDefaultScheduler (SelectionDAGISel *IS, CodeGenOptLevel OptLevel)
 createDefaultScheduler - This creates an instruction scheduler appropriate for the target.
 
static void computeUsesMSVCFloatingPoint (const Triple &TT, const Function &F, MachineModuleInfo &MMI)
 
static void reportFastISelFailure (MachineFunction &MF, OptimizationRemarkEmitter &ORE, OptimizationRemarkMissed &R, bool ShouldAbort)
 
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 SDNodefindGlueUse (SDNode *N)
 findGlueUse - Return use of MVT::Glue value produced by the specified SDNode.
 
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 SDValue HandleMergeInputChains (SmallVectorImpl< SDNode * > &ChainNodesMatched, 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, SDNode *N)
 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< boolEnableFastISelFallbackReport ("fast-isel-report-on-fallback", cl::Hidden, cl::desc("Emit a diagnostic when \"fast\" instruction selection " "falls back to SelectionDAG."))
 
static cl::opt< boolUseMBPI ("use-mbpi", cl::desc("use Machine Branch Probability Info"), cl::init(true), cl::Hidden)
 
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< boolViewDAGCombine1 ("view-dag-combine1-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the first " "dag combine pass"))
 
static cl::opt< boolViewLegalizeTypesDAGs ("view-legalize-types-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize types"))
 
static cl::opt< boolViewDAGCombineLT ("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< boolViewLegalizeDAGs ("view-legalize-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize"))
 
static cl::opt< boolViewDAGCombine2 ("view-dag-combine2-dags", cl::Hidden, cl::desc("Pop up a window to show dags before the second " "dag combine pass"))
 
static cl::opt< boolViewISelDAGs ("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected"))
 
static cl::opt< boolViewSchedDAGs ("view-sched-dags", cl::Hidden, cl::desc("Pop up a window to show sched dags as they are processed"))
 
static cl::opt< boolViewSUnitDAGs ("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)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "isel"

Definition at line 116 of file SelectionDAGISel.cpp.

◆ ISEL_DUMP

#define ISEL_DUMP (   X)
Value:
do { \
if (llvm::DebugFlag && \
(isCurrentDebugType(ISEL_DUMP_DEBUG_TYPE) && MatchFilterFuncName))) { \
X; \
} \
} while (false)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
#define ISEL_DUMP_DEBUG_TYPE
#define DEBUG_TYPE
bool DebugFlag
This boolean is set to true if the '-debug' command line option is specified.
Definition: Debug.cpp:45
bool isCurrentDebugType(const char *Type)
isCurrentDebugType - Return true if the specified string is the debug type specified on the command l...
Definition: Debug.cpp:52

Definition at line 186 of file SelectionDAGISel.cpp.

◆ ISEL_DUMP_DEBUG_TYPE

#define ISEL_DUMP_DEBUG_TYPE   DEBUG_TYPE "-dump"

Definition at line 117 of file SelectionDAGISel.cpp.

Function Documentation

◆ CheckAndImm()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckAndImm ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const SelectionDAGISel SDISel 
)
static

◆ CheckChild2CondCode()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChild2CondCode ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N 
)
static

Definition at line 2773 of file SelectionDAGISel.cpp.

References N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckChildInteger()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildInteger ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N,
unsigned  ChildNo 
)
static

Definition at line 2817 of file SelectionDAGISel.cpp.

References N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckChildSame()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildSame ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const SmallVectorImpl< std::pair< SDValue, SDNode * > > &  RecordedNodes,
unsigned  ChildNo 
)
static

CheckChildSame - Implements OP_CheckChildXSame.

Definition at line 2702 of file SelectionDAGISel.cpp.

References N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckChildType()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildType ( MVT::SimpleValueType  VT,
SDValue  N,
const TargetLowering TLI,
const DataLayout DL,
unsigned  ChildNo 
)
static

Definition at line 2758 of file SelectionDAGISel.cpp.

References DL, and N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckCondCode()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckCondCode ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N 
)
static

Definition at line 2766 of file SelectionDAGISel.cpp.

References N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckInteger()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckInteger ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N 
)
static

◆ CheckNodePredicate()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckNodePredicate ( unsigned  Opcode,
const unsigned char MatcherTable,
unsigned MatcherIndex,
const SelectionDAGISel SDISel,
SDNode N 
)
static

CheckNodePredicate - Implements OP_CheckNodePredicate.

Definition at line 2729 of file SelectionDAGISel.cpp.

References llvm::SelectionDAGISel::CheckNodePredicate(), N, llvm::SelectionDAGISel::OPC_CheckPredicate, and llvm::SelectionDAGISel::OPC_CheckPredicate0.

Referenced by IsPredicateKnownToFail().

◆ CheckOpcode()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOpcode ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDNode N 
)
static

Definition at line 2739 of file SelectionDAGISel.cpp.

References N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckOrImm()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOrImm ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const SelectionDAGISel SDISel 
)
static

◆ CheckPatternPredicate()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckPatternPredicate ( unsigned  Opcode,
const unsigned char MatcherTable,
unsigned MatcherIndex,
const SelectionDAGISel SDISel 
)
static

◆ CheckSame()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckSame ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const SmallVectorImpl< std::pair< SDValue, SDNode * > > &  RecordedNodes 
)
static

CheckSame - Implements OP_CheckSame.

Definition at line 2693 of file SelectionDAGISel.cpp.

References assert(), and N.

Referenced by IsPredicateKnownToFail(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ CheckType()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckType ( MVT::SimpleValueType  VT,
SDValue  N,
const TargetLowering TLI,
const DataLayout DL 
)
static

◆ CheckValueType()

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckValueType ( const unsigned char MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const TargetLowering TLI,
const DataLayout DL 
)
static

◆ computeUsesMSVCFloatingPoint()

static void computeUsesMSVCFloatingPoint ( const Triple TT,
const Function F,
MachineModuleInfo MMI 
)
static

◆ decodeSignRotatedValue()

uint64_t BitcodeReader::decodeSignRotatedValue ( uint64_t  V)
static

Decode a signed value stored with the sign bit in the LSB for dense VBR encoding.

Definition at line 2794 of file SelectionDAGISel.cpp.

Referenced by CheckInteger(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ dontUseFastISelFor()

static bool dontUseFastISelFor ( const Function Fn)
static

Definition at line 222 of file SelectionDAGISel.cpp.

References llvm::any_of(), and llvm::Function::args().

Referenced by llvm::OptLevelChanger::OptLevelChanger().

◆ findGlueUse()

static SDNode * findGlueUse ( SDNode N)
static

findGlueUse - Return use of MVT::Glue value produced by the specified SDNode.

Definition at line 2175 of file SelectionDAGISel.cpp.

References llvm::Use::getUser(), I, and N.

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

◆ findNonImmUse()

static bool findNonImmUse ( SDNode Root,
SDNode Def,
SDNode ImmedUse,
bool  IgnoreChains 
)
static

findNonImmUse - Return true if "Def" is a predecessor of "Root" via a path beyond "ImmedUse".

We may ignore chains as they are checked separately.

Definition at line 2187 of file SelectionDAGISel.cpp.

References llvm::SDNode::hasPredecessorHelper(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SDNode::isOnlyUserOf(), N, llvm::SDNode::op_values(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

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

◆ GetVBR()

static LLVM_ATTRIBUTE_ALWAYS_INLINE uint64_t GetVBR ( uint64_t  Val,
const unsigned char MatcherTable,
unsigned Idx 
)
static

GetVBR - decode a vbr encoding whose top bit is set.

Definition at line 2489 of file SelectionDAGISel.cpp.

References assert(), and Idx.

Referenced by CheckAndImm(), CheckInteger(), CheckOrImm(), and llvm::SelectionDAGISel::SelectCodeCommon().

◆ HandleMergeInputChains()

static SDValue HandleMergeInputChains ( SmallVectorImpl< SDNode * > &  ChainNodesMatched,
SelectionDAG CurDAG 
)
static

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 2572 of file SelectionDAGISel.cpp.

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

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

◆ hasExceptionPointerOrCodeUser()

static bool hasExceptionPointerOrCodeUser ( const CatchPadInst CPI)
static

Definition at line 1226 of file SelectionDAGISel.cpp.

References llvm::Value::users().

◆ isFoldedOrDeadInstruction()

static bool isFoldedOrDeadInstruction ( const Instruction I,
const FunctionLoweringInfo FuncInfo 
)
static

isFoldedOrDeadInstruction - Return true if the specified instruction is side-effect free and is either dead or folded into a generated instruction.

Return false if it needs to be emitted.

Definition at line 1373 of file SelectionDAGISel.cpp.

References I, and llvm::FunctionLoweringInfo::isExportedInst().

◆ IsPredicateKnownToFail()

static unsigned IsPredicateKnownToFail ( const unsigned char Table,
unsigned  Index,
SDValue  N,
bool Result,
const SelectionDAGISel SDISel,
SmallVectorImpl< std::pair< SDValue, SDNode * > > &  RecordedNodes 
)
static

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 2856 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(), 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().

◆ mapWasmLandingPadIndex()

static void mapWasmLandingPadIndex ( MachineBasicBlock MBB,
const CatchPadInst CPI 
)
static

◆ processDbgDeclare()

static bool processDbgDeclare ( FunctionLoweringInfo FuncInfo,
const Value Address,
DIExpression Expr,
DILocalVariable Var,
DebugLoc  DbgLoc 
)
static

◆ processDbgDeclares()

static void processDbgDeclares ( FunctionLoweringInfo FuncInfo)
static

Collect llvm.dbg.declare information.

This is done after argument lowering in case the declarations refer to arguments.

Definition at line 1458 of file SelectionDAGISel.cpp.

References llvm::DbgVariableRecord::Declare, llvm::filterDbgVars(), llvm::FunctionLoweringInfo::Fn, I, instructions, llvm::FunctionLoweringInfo::PreprocessedDbgDeclares, llvm::FunctionLoweringInfo::PreprocessedDVRDeclares, and processDbgDeclare().

◆ processIfEntryValueDbgDeclare()

static bool processIfEntryValueDbgDeclare ( FunctionLoweringInfo FuncInfo,
const Value Arg,
DIExpression Expr,
DILocalVariable Var,
DebugLoc  DbgLoc 
)
static

◆ processSingleLocVars()

static void processSingleLocVars ( FunctionLoweringInfo FuncInfo,
FunctionVarLocs const FnVarLocs 
)
static

Collect single location variable information generated with assignment tracking.

This is done after argument lowering in case the declarations refer to arguments.

Definition at line 1477 of file SelectionDAGISel.cpp.

References assert(), End, llvm::FunctionVarLocs::getDILocalVariable(), processDbgDeclare(), llvm::FunctionVarLocs::single_locs_begin(), and llvm::FunctionVarLocs::single_locs_end().

◆ reportFastISelFailure()

static void reportFastISelFailure ( MachineFunction MF,
OptimizationRemarkEmitter ORE,
OptimizationRemarkMissed R,
bool  ShouldAbort 
)
static

◆ 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]

STATISTIC ( NumFastIselSuccess  ,
"Number of instructions fast isel selected"   
)

Variable Documentation

◆ defaultListDAGScheduler

RegisterScheduler defaultListDAGScheduler("default", "Best scheduler for the target", createDefaultScheduler) ( "default"  ,
"Best scheduler for the target"  ,
createDefaultScheduler   
)
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

cl::opt< RegisterScheduler::FunctionPassCtor, false, RegisterPassParser< RegisterScheduler > > ISHeuristic("pre-RA-sched", cl::init(&createDefaultScheduler), cl::Hidden, cl::desc("Instruction schedulers available (before register" " allocation):")) ( "pre-RA-sched"  ,
cl::init &  createDefaultScheduler,
cl::Hidden  ,
cl::desc("Instruction schedulers available (before register" " allocation):")   
)
static

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