LLVM  8.0.1
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/None.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.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/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/StackProtector.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/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.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/MachineValueType.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 <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

 llvm
 This class represents lattice values for constants.
 

Macros

#define DEBUG_TYPE   "isel"
 

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")
 
ScheduleDAGSDNodesllvm::createDefaultScheduler (SelectionDAGISel *IS, CodeGenOpt::Level OptLevel)
 createDefaultScheduler - This creates an instruction scheduler appropriate for the target. More...
 
static void SplitCriticalSideEffectEdges (Function &Fn, DominatorTree *DT, LoopInfo *LI)
 SplitCriticalSideEffectEdges - Look for critical edges with a PHI value that may trap on it. More...
 
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, FunctionLoweringInfo *FuncInfo)
 isFoldedOrDeadInstruction - Return true if the specified instruction is side-effect free and is either dead or folded into a generated instruction. More...
 
static void setupSwiftErrorVals (const Function &Fn, const TargetLowering *TLI, FunctionLoweringInfo *FuncInfo)
 Set up SwiftErrorVals by going through the function. More...
 
static void createSwiftErrorEntriesInEntryBlock (FunctionLoweringInfo *FuncInfo, FastISel *FastIS, const TargetLowering *TLI, const TargetInstrInfo *TII, SelectionDAGBuilder *SDB)
 
static void processDbgDeclares (FunctionLoweringInfo *FuncInfo)
 Collect llvm.dbg.declare information. More...
 
static void propagateSwiftErrorVRegs (FunctionLoweringInfo *FuncInfo)
 Propagate swifterror values through the machine function CFG. More...
 
static void preassignSwiftErrorRegs (const TargetLowering *TLI, FunctionLoweringInfo *FuncInfo, BasicBlock::const_iterator Begin, BasicBlock::const_iterator End)
 
static bool MIIsInTerminatorSequence (const MachineInstr &MI)
 Given that the input MI is before a partial terminator sequence TSeq, return true if M + TSeq also a partial terminator sequence. More...
 
static MachineBasicBlock::iterator FindSplitPointForStackProtector (MachineBasicBlock *BB)
 Find the split point at which to splice the end of BB into its success stack protector check machine basic block. More...
 
static SDNodefindGlueUse (SDNode *N)
 findGlueUse - Return use of MVT::Glue value produced by the specified SDNode. More...
 
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". More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckPatternPredicate (const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel)
 CheckPatternPredicate - Implements OP_CheckPatternPredicate. More...
 
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckNodePredicate (const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel, SDNode *N)
 CheckNodePredicate - Implements OP_CheckNodePredicate. More...
 
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOpcode (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDNode *N)
 
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckType (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL)
 
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildType (const unsigned char *MatcherTable, unsigned &MatcherIndex, 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 CheckValueType (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL)
 
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. More...
 

Variables

static cl::opt< int > EnableFastISelAbort ("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \ast\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 \ast\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< 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< 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< 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. More...
 
static RegisterScheduler defaultListDAGScheduler ("default", "Best scheduler for the target", createDefaultScheduler)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "isel"

Definition at line 105 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 
)
inlinestatic

◆ CheckChildInteger()

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

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

◆ CheckChildType()

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

◆ CheckCondCode()

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

◆ CheckInteger()

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

◆ CheckNodePredicate()

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

CheckNodePredicate - Implements OP_CheckNodePredicate.

Definition at line 2690 of file SelectionDAGISel.cpp.

References llvm::SelectionDAGISel::CheckNodePredicate(), and LLVM_ATTRIBUTE_ALWAYS_INLINE.

◆ CheckOpcode()

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

◆ CheckOrImm()

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

◆ CheckPatternPredicate()

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

CheckPatternPredicate - Implements OP_CheckPatternPredicate.

Definition at line 2683 of file SelectionDAGISel.cpp.

References llvm::SelectionDAGISel::CheckPatternPredicate(), and LLVM_ATTRIBUTE_ALWAYS_INLINE.

◆ CheckSame()

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

◆ CheckType()

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

◆ CheckValueType()

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

◆ createSwiftErrorEntriesInEntryBlock()

static void createSwiftErrorEntriesInEntryBlock ( FunctionLoweringInfo FuncInfo,
FastISel FastIS,
const TargetLowering TLI,
const TargetInstrInfo TII,
SelectionDAGBuilder SDB 
)
static

◆ findGlueUse()

static SDNode* findGlueUse ( SDNode N)
static

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

Definition at line 2289 of file SelectionDAGISel.cpp.

References E, llvm::SDNode::getNumValues(), llvm::SDUse::getResNo(), llvm::SDUse::getUser(), I, llvm::SDNode::use_begin(), and llvm::SDNode::use_end().

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

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

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

◆ FindSplitPointForStackProtector()

static MachineBasicBlock::iterator FindSplitPointForStackProtector ( MachineBasicBlock BB)
static

Find the split point at which to splice the end of BB into its success stack protector check machine basic block.

On many platforms, due to ABI constraints, terminators, even before register allocation, use physical registers. This creates an issue for us since physical registers at this point can not travel across basic blocks. Luckily, selectiondag always moves physical registers into vregs when they enter functions and moves them through a sequence of copies back into the physical registers right before the terminator creating a ``Terminator Sequence''. This function is searching for the beginning of the terminator sequence so that we can ensure that we splice off not just the terminator, but additionally the copies that move the vregs into the physical registers.

Definition at line 1873 of file SelectionDAGISel.cpp.

References llvm::MachineBasicBlock::begin(), and llvm::MachineBasicBlock::getFirstTerminator().

◆ GetVBR()

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

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

References llvm::SmallPtrSetImplBase::clear(), llvm::SmallVectorBase::empty(), llvm::ISD::EntryToken, llvm::SelectionDAG::getEntryNode(), llvm::SelectionDAG::getNode(), llvm::SDNode::getOperand(), llvm::SDNode::hasPredecessorHelper(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SDNode::op_values(), llvm::MVT::Other, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), second, llvm::SmallVectorBase::size(), and llvm::ISD::TokenFactor.

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

◆ hasExceptionPointerOrCodeUser()

static bool hasExceptionPointerOrCodeUser ( const CatchPadInst CPI)
static

◆ isFoldedOrDeadInstruction()

static bool isFoldedOrDeadInstruction ( const Instruction I,
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 1222 of file SelectionDAGISel.cpp.

References I, llvm::Instruction::isEHPad(), llvm::FunctionLoweringInfo::isExportedInst(), llvm::Instruction::isTerminator(), and llvm::Instruction::mayWriteToMemory().

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

References CheckAndImm(), CheckChildInteger(), CheckChildSame(), CheckChildType(), CheckCondCode(), CheckInteger(), llvm::SelectionDAGISel::CheckNodePredicate(), CheckOpcode(), CheckOrImm(), llvm::SelectionDAGISel::CheckPatternPredicate(), CheckSame(), CheckType(), CheckValueType(), llvm::SelectionDAGISel::CurDAG, llvm::SelectionDAG::DAGUpdateListener, E, llvm::SelectionDAG::getDataLayout(), llvm::SDValue::getNode(), llvm::SDValue::getValue(), I, llvm::SDNode::isMachineOpcode(), N, llvm::SelectionDAGISel::OPC_CheckAndImm, llvm::SelectionDAGISel::OPC_CheckChild0Integer, llvm::SelectionDAGISel::OPC_CheckChild0Same, llvm::SelectionDAGISel::OPC_CheckChild0Type, llvm::SelectionDAGISel::OPC_CheckChild1Integer, llvm::SelectionDAGISel::OPC_CheckChild1Same, llvm::SelectionDAGISel::OPC_CheckChild1Type, llvm::SelectionDAGISel::OPC_CheckChild2Integer, llvm::SelectionDAGISel::OPC_CheckChild2Same, llvm::SelectionDAGISel::OPC_CheckChild2Type, llvm::SelectionDAGISel::OPC_CheckChild3Integer, llvm::SelectionDAGISel::OPC_CheckChild3Same, llvm::SelectionDAGISel::OPC_CheckChild3Type, llvm::SelectionDAGISel::OPC_CheckChild4Integer, llvm::SelectionDAGISel::OPC_CheckChild4Type, llvm::SelectionDAGISel::OPC_CheckChild5Type, llvm::SelectionDAGISel::OPC_CheckChild6Type, llvm::SelectionDAGISel::OPC_CheckChild7Type, llvm::SelectionDAGISel::OPC_CheckCondCode, llvm::SelectionDAGISel::OPC_CheckInteger, llvm::SelectionDAGISel::OPC_CheckOpcode, llvm::SelectionDAGISel::OPC_CheckOrImm, llvm::SelectionDAGISel::OPC_CheckPatternPredicate, llvm::SelectionDAGISel::OPC_CheckPredicate, llvm::SelectionDAGISel::OPC_CheckSame, llvm::SelectionDAGISel::OPC_CheckType, llvm::SelectionDAGISel::OPC_CheckTypeRes, llvm::SelectionDAGISel::OPC_CheckValueType, llvm::NVPTX::PTXCvtMode::RN, and llvm::SelectionDAGISel::TLI.

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

◆ mapWasmLandingPadIndex()

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

Definition at line 1136 of file SelectionDAGISel.cpp.

References llvm::MachineFunction::addLandingPad(), llvm::MachineBasicBlock::addLiveIn(), assert(), llvm::BuildMI(), llvm::classifyEHPersonality(), llvm::SelectionDAGISel::CurDAG, llvm::ISD::EH_LABEL, llvm::FunctionLoweringInfo::ExceptionPointerVirtReg, llvm::FunctionLoweringInfo::ExceptionSelectorVirtReg, llvm::FunctionLoweringInfo::Fn, llvm::SelectionDAGISel::FuncInfo, llvm::MCInstrInfo::get(), llvm::FuncletPadInst::getArgOperand(), llvm::MachineBasicBlock::getBasicBlock(), llvm::FunctionLoweringInfo::getCatchPadExceptionPointerVReg(), llvm::SelectionDAGBuilder::getCurDebugLoc(), llvm::SelectionDAG::getDataLayout(), llvm::TargetLoweringBase::getExceptionPointerRegister(), llvm::TargetLoweringBase::getExceptionSelectorRegister(), llvm::BasicBlock::getFirstNonPHI(), llvm::FuncletPadInst::getNumArgOperands(), llvm::MachineBasicBlock::getParent(), llvm::Function::getPersonalityFn(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getRegClassFor(), hasExceptionPointerOrCodeUser(), llvm::FunctionLoweringInfo::InsertPt, llvm::isFuncletEHPersonality(), llvm::RegState::Kill, llvm::SelectionDAGBuilder::LPadToCallSiteMap, llvm::FunctionLoweringInfo::MBB, llvm::SelectionDAGISel::MF, Reg, llvm::SelectionDAGISel::SDB, llvm::MachineFunction::setCallSiteLandingPad(), llvm::MachineFunction::setWasmLandingPadIndex(), llvm::SelectionDAGISel::TII, llvm::SelectionDAGISel::TLI, llvm::Value::users(), llvm::Wasm_CXX, and llvm::Intrinsic::wasm_landingpad_index.

◆ MIIsInTerminatorSequence()

static bool MIIsInTerminatorSequence ( const MachineInstr MI)
static

Given that the input MI is before a partial terminator sequence TSeq, return true if M + TSeq also a partial terminator sequence.

A Terminator sequence is a sequence of MachineInstrs which at this point in lowering copy vregs into physical registers, which are then passed into terminator instructors so we can satisfy ABI constraints. A partial terminator sequence is an improper subset of a terminator sequence (i.e. it may be the whole terminator sequence).

Definition at line 1817 of file SelectionDAGISel.cpp.

References assert(), llvm::MachineOperand::getReg(), llvm::MachineInstr::isCopy(), llvm::MachineInstr::isDebugValue(), llvm::MachineOperand::isDef(), llvm::MachineInstr::isImplicitDef(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MachineOperand::isReg(), llvm::MachineInstr::operands_begin(), and llvm::MachineInstr::operands_end().

◆ preassignSwiftErrorRegs()

static void preassignSwiftErrorRegs ( const TargetLowering TLI,
FunctionLoweringInfo FuncInfo,
BasicBlock::const_iterator  Begin,
BasicBlock::const_iterator  End 
)
static

◆ processDbgDeclares()

static void processDbgDeclares ( FunctionLoweringInfo FuncInfo)
static

◆ propagateSwiftErrorVRegs()

static void propagateSwiftErrorVRegs ( FunctionLoweringInfo FuncInfo)
static

◆ reportFastISelFailure()

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

◆ setupSwiftErrorVals()

static void setupSwiftErrorVals ( const Function Fn,
const TargetLowering TLI,
FunctionLoweringInfo FuncInfo 
)
static

◆ SplitCriticalSideEffectEdges()

static void SplitCriticalSideEffectEdges ( Function Fn,
DominatorTree DT,
LoopInfo LI 
)
static

SplitCriticalSideEffectEdges - Look for critical edges with a PHI value that may trap on it.

In this case we have to split the edge so that the path through the predecessor block that doesn't go to the phi block doesn't execute the possibly trapping instruction. If available, we pass domtree and loop info to be updated when we split critical edges. This is because SelectionDAGISel preserves these analyses. This is required for correctness, so it must be done at -O0.

Definition at line 349 of file SelectionDAGISel.cpp.

References llvm::Constant::canTrap(), llvm::dyn_cast(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getNumSuccessors(), llvm::GetSuccessorNumber(), llvm::BasicBlock::getTerminator(), I, llvm::CriticalEdgeSplittingOptions::setMergeIdenticalEdges(), and llvm::SplitCriticalEdge().

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

◆ STATISTIC() [1/7]

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

◆ STATISTIC() [2/7]

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

◆ STATISTIC() [3/7]

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

◆ STATISTIC() [4/7]

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

◆ STATISTIC() [5/7]

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

◆ STATISTIC() [6/7]

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

◆ STATISTIC() [7/7]

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

Variable Documentation

◆ defaultListDAGScheduler

RegisterScheduler defaultListDAGScheduler("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."))
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."))
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"))
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):"))
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)
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"))
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"))
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"))
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"))
static

◆ ViewLegalizeDAGs

cl::opt<bool> ViewLegalizeDAGs("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"))
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"))
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"))
static