LLVM  5.0.0
Classes | Namespaces | Macros | Enumerations | Functions | Variables
SelectionDAGISel.cpp File Reference
#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/OptimizationDiagnosticInfo.h"
#include "llvm/Analysis/TargetLibraryInfo.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/MachineValueType.h"
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/StackProtector.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/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.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
 Compute iterated dominance frontiers using a linear time algorithm.
 

Macros

#define DEBUG_TYPE   "isel"
 

Enumerations

enum  ChainResult { CR_Simple, CR_InducesCycle, CR_LeadsToInteriorNode }
 

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")
 
ScheduleDAGSDNodes * llvm::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 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...
 
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 SDNode * findGlueUse (SDNode *N)
 findGlueUse - Return use of MVT::Glue value produced by the specified SDNode. More...
 
static bool findNonImmUse (SDNode *Use, SDNode *Def, SDNode *ImmedUse, SDNode *Root, SmallPtrSetImpl< SDNode * > &Visited, bool IgnoreChains)
 findNonImmUse - Return true if "Use" is a non-immediate use of "Def". 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 ChainResult WalkChainUsers (const SDNode *ChainedNode, SmallVectorImpl< SDNode * > &ChainedNodesInPattern, DenseMap< const SDNode *, ChainResult > &TokenFactorResult, SmallVectorImpl< SDNode * > &InteriorChainedNodes)
 WalkChainUsers - Walk down the users of the specified chained node that is part of the pattern we're matching, looking at all of the users we find. 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 \"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< 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 > 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 > 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 > 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. More...
 
static RegisterScheduler defaultListDAGScheduler ("default","Best scheduler for the target", createDefaultScheduler)
 

Macro Definition Documentation

#define DEBUG_TYPE   "isel"

Definition at line 103 of file SelectionDAGISel.cpp.

Enumeration Type Documentation

Enumerator
CR_Simple 
CR_InducesCycle 
CR_LeadsToInteriorNode 

Definition at line 2358 of file SelectionDAGISel.cpp.

Function Documentation

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckAndImm ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDValue  N,
const SelectionDAGISel &  SDISel 
)
inlinestatic
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildInteger ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDValue  N,
unsigned  ChildNo 
)
inlinestatic
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

CheckChildSame - Implements OP_CheckChildXSame.

Definition at line 2624 of file SelectionDAGISel.cpp.

References CheckSame(), llvm::SDValue::getNumOperands(), and llvm::SDValue::getOperand().

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

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

Definition at line 2677 of file SelectionDAGISel.cpp.

References N.

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

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckInteger ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDValue  N 
)
inlinestatic
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 2643 of file SelectionDAGISel.cpp.

References llvm::SelectionDAGISel::CheckNodePredicate().

Referenced by IsPredicateKnownToFail().

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOpcode ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDNode *  N 
)
inlinestatic
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOrImm ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDValue  N,
const SelectionDAGISel &  SDISel 
)
inlinestatic
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckPatternPredicate ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
const SelectionDAGISel &  SDISel 
)
inlinestatic

CheckPatternPredicate - Implements OP_CheckPatternPredicate.

Definition at line 2636 of file SelectionDAGISel.cpp.

References llvm::SelectionDAGISel::CheckPatternPredicate().

Referenced by IsPredicateKnownToFail().

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

CheckSame - Implements OP_CheckSame.

Definition at line 2613 of file SelectionDAGISel.cpp.

References assert().

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

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckType ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDValue  N,
const TargetLowering *  TLI,
const DataLayout &  DL 
)
inlinestatic
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckValueType ( const unsigned char *  MatcherTable,
unsigned &  MatcherIndex,
SDValue  N,
const TargetLowering *  TLI,
const DataLayout &  DL 
)
inlinestatic
static void createSwiftErrorEntriesInEntryBlock ( FunctionLoweringInfo *  FuncInfo,
FastISel *  FastIS,
const TargetLowering *  TLI,
const TargetInstrInfo *  TII,
SelectionDAGBuilder *  SDB 
)
static
static SDNode* findGlueUse ( SDNode *  N)
static

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

Definition at line 2107 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().

static bool findNonImmUse ( SDNode *  Use,
SDNode *  Def,
SDNode *  ImmedUse,
SDNode *  Root,
SmallPtrSetImpl< SDNode * > &  Visited,
bool  IgnoreChains 
)
static

findNonImmUse - Return true if "Use" is a non-immediate use of "Def".

This function iteratively traverses up the operand chain, ignoring certain nodes.

Definition at line 2120 of file SelectionDAGISel.cpp.

References assert(), llvm::SDNode::getNodeId(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SDNode::op_values(), and llvm::MVT::Other.

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

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

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

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

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

Definition at line 2290 of file SelectionDAGISel.cpp.

References assert().

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

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

References assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::count(), CR_InducesCycle, llvm::SmallVectorTemplateCommon< T >::end(), llvm::SelectionDAG::getNode(), llvm::SDNode::getOpcode(), llvm::SDValue::getValueType(), N, llvm::SDNode::op_values(), llvm::MVT::Other, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::ISD::TokenFactor, and WalkChainUsers().

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

static bool hasExceptionPointerOrCodeUser ( const CatchPadInst *  CPI)
static

Definition at line 976 of file SelectionDAGISel.cpp.

References llvm::Value::users().

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

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

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

References CheckAndImm(), CheckChildInteger(), CheckChildSame(), CheckChildType(), CheckCondCode(), CheckInteger(), CheckNodePredicate(), CheckOpcode(), CheckOrImm(), CheckPatternPredicate(), CheckSame(), CheckType(), CheckValueType(), llvm::SelectionDAGISel::CurDAG, llvm::SelectionDAG::getDataLayout(), llvm::SDValue::getNode(), 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_CheckValueType, and llvm::SelectionDAGISel::TLI.

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

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 1633 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().

Referenced by FindSplitPointForStackProtector().

void preassignSwiftErrorRegs ( const TargetLowering *  TLI,
FunctionLoweringInfo *  FuncInfo,
BasicBlock::const_iterator  Begin,
BasicBlock::const_iterator  End 
)
static void processDbgDeclares ( FunctionLoweringInfo *  FuncInfo)
static
static void propagateSwiftErrorVRegs ( FunctionLoweringInfo *  FuncInfo)
static
static void reportFastISelFailure ( MachineFunction &  MF,
OptimizationRemarkEmitter &  ORE,
OptimizationRemarkMissed &  R,
bool  ShouldAbort 
)
static
static void setupSwiftErrorVals ( const Function &  Fn,
const TargetLowering *  TLI,
FunctionLoweringInfo *  FuncInfo 
)
static
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 345 of file SelectionDAGISel.cpp.

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

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

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 ChainResult WalkChainUsers ( const SDNode *  ChainedNode,
SmallVectorImpl< SDNode * > &  ChainedNodesInPattern,
DenseMap< const SDNode *, ChainResult > &  TokenFactorResult,
SmallVectorImpl< SDNode * > &  InteriorChainedNodes 
)
static

WalkChainUsers - Walk down the users of the specified chained node that is part of the pattern we're matching, looking at all of the users we find.

This determines whether something is an interior node, whether we have a non-pattern node in between two pattern nodes (which prevent folding because it would induce a cycle) and whether we have a TokenFactor node sandwiched between pattern nodes (in which case the TF becomes part of the pattern).

The walk we do here is guaranteed to be small because we quickly get down to already selected nodes "below" us.

Definition at line 2374 of file SelectionDAGISel.cpp.

References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::ISD::CopyFromReg, llvm::ISD::CopyToReg, llvm::count(), CR_InducesCycle, CR_LeadsToInteriorNode, CR_Simple, E, llvm::ISD::EH_LABEL, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::SDNode::getNodeId(), llvm::SDNode::getOpcode(), llvm::ISD::HANDLENODE, llvm::ISD::INLINEASM, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::insert(), llvm::SDNode::isMachineOpcode(), llvm::ISD::LIFETIME_END, llvm::ISD::LIFETIME_START, llvm::MVT::Other, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::ISD::TokenFactor, llvm::SDNode::use_begin(), and llvm::SDNode::use_end().

Referenced by HandleMergeInputChains().

Variable Documentation

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

cl::opt<bool> UseMBPI("use-mbpi", cl::desc("use Machine Branch Probability Info"), cl::init(true), cl::Hidden)
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> 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> 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> ViewISelDAGs("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected"))
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> ViewLegalizeTypesDAGs("view-legalize-types-dags", cl::Hidden, cl::desc("Pop up a window to show dags before legalize types"))
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