LLVM API Documentation

Classes | Namespaces | Defines | Enumerations | Functions | Variables
SelectionDAGISel.cpp File Reference
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "ScheduleDAGSDNodes.h"
#include "SelectionDAGBuilder.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/CodeGen/FastISel.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCStrategy.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.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/TargetLibraryInfo.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 dependency graph for SelectionDAGISel.cpp:

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
 

List of target independent CodeGen pass IDs.


Defines

#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")
 STATISTIC (NumFastIselFailRet,"Fast isel fails on Ret")
 STATISTIC (NumFastIselFailBr,"Fast isel fails on Br")
 STATISTIC (NumFastIselFailSwitch,"Fast isel fails on Switch")
 STATISTIC (NumFastIselFailIndirectBr,"Fast isel fails on IndirectBr")
 STATISTIC (NumFastIselFailInvoke,"Fast isel fails on Invoke")
 STATISTIC (NumFastIselFailResume,"Fast isel fails on Resume")
 STATISTIC (NumFastIselFailUnreachable,"Fast isel fails on Unreachable")
 STATISTIC (NumFastIselFailAdd,"Fast isel fails on Add")
 STATISTIC (NumFastIselFailFAdd,"Fast isel fails on FAdd")
 STATISTIC (NumFastIselFailSub,"Fast isel fails on Sub")
 STATISTIC (NumFastIselFailFSub,"Fast isel fails on FSub")
 STATISTIC (NumFastIselFailMul,"Fast isel fails on Mul")
 STATISTIC (NumFastIselFailFMul,"Fast isel fails on FMul")
 STATISTIC (NumFastIselFailUDiv,"Fast isel fails on UDiv")
 STATISTIC (NumFastIselFailSDiv,"Fast isel fails on SDiv")
 STATISTIC (NumFastIselFailFDiv,"Fast isel fails on FDiv")
 STATISTIC (NumFastIselFailURem,"Fast isel fails on URem")
 STATISTIC (NumFastIselFailSRem,"Fast isel fails on SRem")
 STATISTIC (NumFastIselFailFRem,"Fast isel fails on FRem")
 STATISTIC (NumFastIselFailAnd,"Fast isel fails on And")
 STATISTIC (NumFastIselFailOr,"Fast isel fails on Or")
 STATISTIC (NumFastIselFailXor,"Fast isel fails on Xor")
 STATISTIC (NumFastIselFailAlloca,"Fast isel fails on Alloca")
 STATISTIC (NumFastIselFailLoad,"Fast isel fails on Load")
 STATISTIC (NumFastIselFailStore,"Fast isel fails on Store")
 STATISTIC (NumFastIselFailAtomicCmpXchg,"Fast isel fails on AtomicCmpXchg")
 STATISTIC (NumFastIselFailAtomicRMW,"Fast isel fails on AtomicRWM")
 STATISTIC (NumFastIselFailFence,"Fast isel fails on Frence")
 STATISTIC (NumFastIselFailGetElementPtr,"Fast isel fails on GetElementPtr")
 STATISTIC (NumFastIselFailTrunc,"Fast isel fails on Trunc")
 STATISTIC (NumFastIselFailZExt,"Fast isel fails on ZExt")
 STATISTIC (NumFastIselFailSExt,"Fast isel fails on SExt")
 STATISTIC (NumFastIselFailFPTrunc,"Fast isel fails on FPTrunc")
 STATISTIC (NumFastIselFailFPExt,"Fast isel fails on FPExt")
 STATISTIC (NumFastIselFailFPToUI,"Fast isel fails on FPToUI")
 STATISTIC (NumFastIselFailFPToSI,"Fast isel fails on FPToSI")
 STATISTIC (NumFastIselFailUIToFP,"Fast isel fails on UIToFP")
 STATISTIC (NumFastIselFailSIToFP,"Fast isel fails on SIToFP")
 STATISTIC (NumFastIselFailIntToPtr,"Fast isel fails on IntToPtr")
 STATISTIC (NumFastIselFailPtrToInt,"Fast isel fails on PtrToInt")
 STATISTIC (NumFastIselFailBitCast,"Fast isel fails on BitCast")
 STATISTIC (NumFastIselFailICmp,"Fast isel fails on ICmp")
 STATISTIC (NumFastIselFailFCmp,"Fast isel fails on FCmp")
 STATISTIC (NumFastIselFailPHI,"Fast isel fails on PHI")
 STATISTIC (NumFastIselFailSelect,"Fast isel fails on Select")
 STATISTIC (NumFastIselFailCall,"Fast isel fails on Call")
 STATISTIC (NumFastIselFailShl,"Fast isel fails on Shl")
 STATISTIC (NumFastIselFailLShr,"Fast isel fails on LShr")
 STATISTIC (NumFastIselFailAShr,"Fast isel fails on AShr")
 STATISTIC (NumFastIselFailVAArg,"Fast isel fails on VAArg")
 STATISTIC (NumFastIselFailExtractElement,"Fast isel fails on ExtractElement")
 STATISTIC (NumFastIselFailInsertElement,"Fast isel fails on InsertElement")
 STATISTIC (NumFastIselFailShuffleVector,"Fast isel fails on ShuffleVector")
 STATISTIC (NumFastIselFailExtractValue,"Fast isel fails on ExtractValue")
 STATISTIC (NumFastIselFailInsertValue,"Fast isel fails on InsertValue")
 STATISTIC (NumFastIselFailLandingPad,"Fast isel fails on LandingPad")
 STATISTIC (NumFastIselFailIntrinsicCall,"Fast isel fails on Intrinsic call")
 STATISTIC (NumFastIselFailSAddWithOverflow,"Fast isel fails on sadd.with.overflow")
 STATISTIC (NumFastIselFailUAddWithOverflow,"Fast isel fails on uadd.with.overflow")
 STATISTIC (NumFastIselFailSSubWithOverflow,"Fast isel fails on ssub.with.overflow")
 STATISTIC (NumFastIselFailUSubWithOverflow,"Fast isel fails on usub.with.overflow")
 STATISTIC (NumFastIselFailSMulWithOverflow,"Fast isel fails on smul.with.overflow")
 STATISTIC (NumFastIselFailUMulWithOverflow,"Fast isel fails on umul.with.overflow")
 STATISTIC (NumFastIselFailFrameaddress,"Fast isel fails on Frameaddress")
 STATISTIC (NumFastIselFailSqrt,"Fast isel fails on sqrt call")
 STATISTIC (NumFastIselFailStackMap,"Fast isel fails on StackMap call")
 STATISTIC (NumFastIselFailPatchPoint,"Fast isel fails on PatchPoint call")
ScheduleDAGSDNodesllvm::createDefaultScheduler (SelectionDAGISel *IS, CodeGenOpt::Level OptLevel)
static void SplitCriticalSideEffectEdges (Function &Fn, Pass *SDISel)
static bool isFoldedOrDeadInstruction (const Instruction *I, FunctionLoweringInfo *FuncInfo)
static void collectFailStats (const Instruction *I)
static bool MIIsInTerminatorSequence (const MachineInstr *MI)
static MachineBasicBlock::iterator FindSplitPointForStackProtector (MachineBasicBlock *BB, DebugLoc DL)
static SDNodefindGlueUse (SDNode *N)
static bool findNonImmUse (SDNode *Use, SDNode *Def, SDNode *ImmedUse, SDNode *Root, SmallPtrSetImpl< SDNode * > &Visited, bool IgnoreChains)
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 ChainResult WalkChainUsers (const SDNode *ChainedNode, SmallVectorImpl< SDNode * > &ChainedNodesInPattern, SmallVectorImpl< SDNode * > &InteriorChainedNodes)
static SDValue HandleMergeInputChains (SmallVectorImpl< SDNode * > &ChainNodesMatched, SelectionDAG *CurDAG)
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 (const unsigned char *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel)
 CheckPatternPredicate - Implements OP_CheckPatternPredicate.
static
LLVM_ATTRIBUTE_ALWAYS_INLINE
bool 
CheckNodePredicate (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 (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI)
static
LLVM_ATTRIBUTE_ALWAYS_INLINE
bool 
CheckChildType (const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, 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)
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)

Variables

static cl::opt< boolEnableFastISelVerbose2 ("fast-isel-verbose2", cl::Hidden, cl::desc("Enable extra verbose messages in the \"fast\" ""instruction selector"))
static cl::opt< boolEnableFastISelVerbose ("fast-isel-verbose", cl::Hidden, cl::desc("Enable verbose messages in the \"fast\" ""instruction selector"))
static cl::opt< boolEnableFastISelAbort ("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection ""fails to lower an instruction"))
static cl::opt< boolEnableFastISelAbortArgs ("fast-isel-abort-args", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection ""fails to lower a formal argument"))
static cl::opt< boolUseMBPI ("use-mbpi", cl::desc("use Machine Branch Probability Info"), cl::init(true), cl::Hidden)
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):"))
static RegisterScheduler defaultListDAGScheduler ("default","Best scheduler for the target", createDefaultScheduler)

Define Documentation

#define DEBUG_TYPE   "isel"

Definition at line 60 of file SelectionDAGISel.cpp.


Enumeration Type Documentation

Enumerator:
CR_Simple 
CR_InducesCycle 
CR_LeadsToInteriorNode 

Definition at line 1979 of file SelectionDAGISel.cpp.


Function Documentation

static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckAndImm ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const SelectionDAGISel SDISel 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckChildInteger ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
SDValue  N,
unsigned  ChildNo 
) [static]
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 2229 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,
unsigned  ChildNo 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckCondCode ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
SDValue  N 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckInteger ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
SDValue  N 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckNodePredicate ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
const SelectionDAGISel SDISel,
SDNode N 
) [static]

CheckNodePredicate - Implements OP_CheckNodePredicate.

Definition at line 2248 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 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckOrImm ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const SelectionDAGISel SDISel 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckPatternPredicate ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
const SelectionDAGISel SDISel 
) [static]

CheckPatternPredicate - Implements OP_CheckPatternPredicate.

Definition at line 2241 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 
) [static]

CheckSame - Implements OP_CheckSame.

Definition at line 2218 of file SelectionDAGISel.cpp.

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 
) [static]
static LLVM_ATTRIBUTE_ALWAYS_INLINE bool CheckValueType ( const unsigned char *  MatcherTable,
unsigned MatcherIndex,
SDValue  N,
const TargetLowering TLI 
) [static]
static void collectFailStats ( const Instruction I) [static]
static SDNode* findGlueUse ( SDNode N) [static]

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

Definition at line 1717 of file SelectionDAGISel.cpp.

References 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 recursively traverses up the operand chain, ignoring certain nodes.

Definition at line 1730 of file SelectionDAGISel.cpp.

References llvm::SDValue::getNode(), llvm::SDNode::getNodeId(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), llvm::SDValue::getValueType(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::MVT::Other.

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

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 1314 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 
) [static]

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

Definition at line 1892 of file SelectionDAGISel.cpp.

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

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

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

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

References I, 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 2348 of file SelectionDAGISel.cpp.

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

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

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

static void SplitCriticalSideEffectEdges ( Function Fn,
Pass SDISel 
) [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.

This is required for correctness, so it must be done at -O0.

Definition at line 375 of file SelectionDAGISel.cpp.

References llvm::Function::begin(), llvm::Constant::canTrap(), llvm::WinEH::CE, llvm::dyn_cast(), llvm::Function::end(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::TerminatorInst::getNumSuccessors(), llvm::GetSuccessorNumber(), llvm::BasicBlock::getTerminator(), I, 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"   
)
STATISTIC ( NumFastIselFailRet  ,
"Fast isel fails on Ret"   
)
STATISTIC ( NumFastIselFailBr  ,
"Fast isel fails on Br"   
)
STATISTIC ( NumFastIselFailSwitch  ,
"Fast isel fails on Switch"   
)
STATISTIC ( NumFastIselFailIndirectBr  ,
"Fast isel fails on IndirectBr"   
)
STATISTIC ( NumFastIselFailInvoke  ,
"Fast isel fails on Invoke"   
)
STATISTIC ( NumFastIselFailResume  ,
"Fast isel fails on Resume"   
)
STATISTIC ( NumFastIselFailUnreachable  ,
"Fast isel fails on Unreachable"   
)
STATISTIC ( NumFastIselFailAdd  ,
"Fast isel fails on Add"   
)
STATISTIC ( NumFastIselFailFAdd  ,
"Fast isel fails on FAdd"   
)
STATISTIC ( NumFastIselFailSub  ,
"Fast isel fails on Sub"   
)
STATISTIC ( NumFastIselFailFSub  ,
"Fast isel fails on FSub"   
)
STATISTIC ( NumFastIselFailMul  ,
"Fast isel fails on Mul"   
)
STATISTIC ( NumFastIselFailFMul  ,
"Fast isel fails on FMul"   
)
STATISTIC ( NumFastIselFailUDiv  ,
"Fast isel fails on UDiv"   
)
STATISTIC ( NumFastIselFailSDiv  ,
"Fast isel fails on SDiv"   
)
STATISTIC ( NumFastIselFailFDiv  ,
"Fast isel fails on FDiv"   
)
STATISTIC ( NumFastIselFailURem  ,
"Fast isel fails on URem"   
)
STATISTIC ( NumFastIselFailSRem  ,
"Fast isel fails on SRem"   
)
STATISTIC ( NumFastIselFailFRem  ,
"Fast isel fails on FRem"   
)
STATISTIC ( NumFastIselFailAnd  ,
"Fast isel fails on And"   
)
STATISTIC ( NumFastIselFailOr  ,
"Fast isel fails on Or"   
)
STATISTIC ( NumFastIselFailXor  ,
"Fast isel fails on Xor"   
)
STATISTIC ( NumFastIselFailAlloca  ,
"Fast isel fails on Alloca"   
)
STATISTIC ( NumFastIselFailLoad  ,
"Fast isel fails on Load"   
)
STATISTIC ( NumFastIselFailStore  ,
"Fast isel fails on Store"   
)
STATISTIC ( NumFastIselFailAtomicCmpXchg  ,
"Fast isel fails on AtomicCmpXchg"   
)
STATISTIC ( NumFastIselFailAtomicRMW  ,
"Fast isel fails on AtomicRWM"   
)
STATISTIC ( NumFastIselFailFence  ,
"Fast isel fails on Frence"   
)
STATISTIC ( NumFastIselFailGetElementPtr  ,
"Fast isel fails on GetElementPtr"   
)
STATISTIC ( NumFastIselFailTrunc  ,
"Fast isel fails on Trunc"   
)
STATISTIC ( NumFastIselFailZExt  ,
"Fast isel fails on ZExt"   
)
STATISTIC ( NumFastIselFailSExt  ,
"Fast isel fails on SExt"   
)
STATISTIC ( NumFastIselFailFPTrunc  ,
"Fast isel fails on FPTrunc"   
)
STATISTIC ( NumFastIselFailFPExt  ,
"Fast isel fails on FPExt"   
)
STATISTIC ( NumFastIselFailFPToUI  ,
"Fast isel fails on FPToUI"   
)
STATISTIC ( NumFastIselFailFPToSI  ,
"Fast isel fails on FPToSI"   
)
STATISTIC ( NumFastIselFailUIToFP  ,
"Fast isel fails on UIToFP"   
)
STATISTIC ( NumFastIselFailSIToFP  ,
"Fast isel fails on SIToFP"   
)
STATISTIC ( NumFastIselFailIntToPtr  ,
"Fast isel fails on IntToPtr"   
)
STATISTIC ( NumFastIselFailPtrToInt  ,
"Fast isel fails on PtrToInt"   
)
STATISTIC ( NumFastIselFailBitCast  ,
"Fast isel fails on BitCast"   
)
STATISTIC ( NumFastIselFailICmp  ,
"Fast isel fails on ICmp"   
)
STATISTIC ( NumFastIselFailFCmp  ,
"Fast isel fails on FCmp"   
)
STATISTIC ( NumFastIselFailPHI  ,
"Fast isel fails on PHI"   
)
STATISTIC ( NumFastIselFailSelect  ,
"Fast isel fails on Select"   
)
STATISTIC ( NumFastIselFailCall  ,
"Fast isel fails on Call"   
)
STATISTIC ( NumFastIselFailShl  ,
"Fast isel fails on Shl"   
)
STATISTIC ( NumFastIselFailLShr  ,
"Fast isel fails on LShr"   
)
STATISTIC ( NumFastIselFailAShr  ,
"Fast isel fails on AShr"   
)
STATISTIC ( NumFastIselFailVAArg  ,
"Fast isel fails on VAArg"   
)
STATISTIC ( NumFastIselFailExtractElement  ,
"Fast isel fails on ExtractElement  
)
STATISTIC ( NumFastIselFailInsertElement  ,
"Fast isel fails on InsertElement"   
)
STATISTIC ( NumFastIselFailShuffleVector  ,
"Fast isel fails on ShuffleVector"   
)
STATISTIC ( NumFastIselFailExtractValue  ,
"Fast isel fails on ExtractValue"   
)
STATISTIC ( NumFastIselFailInsertValue  ,
"Fast isel fails on InsertValue"   
)
STATISTIC ( NumFastIselFailLandingPad  ,
"Fast isel fails on LandingPad"   
)
STATISTIC ( NumFastIselFailIntrinsicCall  ,
"Fast isel fails on Intrinsic call"   
)
STATISTIC ( NumFastIselFailSAddWithOverflow  ,
"Fast isel fails on sadd.with.overflow"   
)
STATISTIC ( NumFastIselFailUAddWithOverflow  ,
"Fast isel fails on uadd.with.overflow"   
)
STATISTIC ( NumFastIselFailSSubWithOverflow  ,
"Fast isel fails on ssub.with.overflow"   
)
STATISTIC ( NumFastIselFailUSubWithOverflow  ,
"Fast isel fails on usub.with.overflow"   
)
STATISTIC ( NumFastIselFailSMulWithOverflow  ,
"Fast isel fails on smul.with.overflow"   
)
STATISTIC ( NumFastIselFailUMulWithOverflow  ,
"Fast isel fails on umul.with.overflow"   
)
STATISTIC ( NumFastIselFailFrameaddress  ,
"Fast isel fails on Frameaddress"   
)
STATISTIC ( NumFastIselFailSqrt  ,
"Fast isel fails on sqrt call"   
)
STATISTIC ( NumFastIselFailStackMap  ,
"Fast isel fails on StackMap call"   
)
STATISTIC ( NumFastIselFailPatchPoint  ,
"Fast isel fails on PatchPoint call"   
)
static ChainResult WalkChainUsers ( const SDNode ChainedNode,
SmallVectorImpl< SDNode * > &  ChainedNodesInPattern,
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 1995 of file SelectionDAGISel.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::ISD::CopyFromReg, llvm::ISD::CopyToReg, CR_InducesCycle, CR_LeadsToInteriorNode, CR_Simple, llvm::ISD::EH_LABEL, llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SDNode::getNodeId(), llvm::SDNode::getOpcode(), llvm::ISD::HANDLENODE, llvm::ISD::INLINEASM, llvm::SDNode::isMachineOpcode(), llvm::ISD::LIFETIME_END, llvm::ISD::LIFETIME_START, llvm::MVT::Other, llvm::SmallVectorTemplateBase< T, isPodLike >::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<bool> EnableFastISelAbort("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection ""fails to lower an instruction")) [static]
cl::opt<bool> EnableFastISelAbortArgs("fast-isel-abort-args", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction selection ""fails to lower a formal argument")) [static]
cl::opt<bool> EnableFastISelVerbose("fast-isel-verbose", cl::Hidden, cl::desc("Enable verbose messages in the \"fast\" ""instruction selector")) [static]
cl::opt<bool> EnableFastISelVerbose2("fast-isel-verbose2", cl::Hidden, cl::desc("Enable extra verbose messages in the \"fast\" ""instruction selector")) [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]