LLVM API Documentation

SelectionDAGISel.cpp File Reference

#include "ScheduleDAGSDNodes.h"
#include "SelectionDAGBuild.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Constants.h"
#include "llvm/CallingConv.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/CodeGen/FastISel.h"
#include "llvm/CodeGen/GCStrategy.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.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/CodeGen/DwarfWriter.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>

Include dependency graph for SelectionDAGISel.cpp:

Go to the source code of this file.

Namespaces

namespace  llvm

Defines

#define DEBUG_TYPE   "isel"

Functions

ScheduleDAGSDNodes * llvm::createDefaultScheduler (SelectionDAGISel *IS, CodeGenOpt::Level OptLevel)
static void EmitLiveInCopy (MachineBasicBlock *MBB, MachineBasicBlock::iterator &InsertPos, unsigned VirtReg, unsigned PhysReg, const TargetRegisterClass *RC, DenseMap< MachineInstr *, unsigned > &CopyRegMap, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const TargetInstrInfo &TII)
static void EmitLiveInCopies (MachineBasicBlock *EntryMBB, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const TargetInstrInfo &TII)
static void copyCatchInfo (BasicBlock *SrcBB, BasicBlock *DestBB, MachineModuleInfo *MMI, FunctionLoweringInfo &FLI)
static SDNode * findFlagUse (SDNode *N)
static bool findNonImmUse (SDNode *Use, SDNode *Def, SDNode *ImmedUse, SDNode *Root, SmallPtrSet< SDNode *, 16 > &Visited)
static bool isNonImmUse (SDNode *Root, SDNode *Def, SDNode *ImmedUse)

Variables

static cl::opt< bool > DisableLegalizeTypes ("disable-legalize-types", cl::Hidden)
static cl::opt< bool > EnableFastISelVerbose ("fast-isel-verbose", cl::Hidden, cl::desc("Enable verbose messages in the \"fast\" ""instruction selector"))
static cl::opt< bool > EnableFastISelAbort ("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction fails"))
static cl::opt< bool > SchedLiveInCopies ("schedule-livein-copies", cl::desc("Schedule copies of livein registers"), cl::init(false))
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::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 14 of file SelectionDAGISel.cpp.


Function Documentation

static void copyCatchInfo ( BasicBlock *  SrcBB,
BasicBlock *  DestBB,
MachineModuleInfo *  MMI,
FunctionLoweringInfo &  FLI 
) [static]

static void EmitLiveInCopies ( MachineBasicBlock *  EntryMBB,
const MachineRegisterInfo &  MRI,
const TargetRegisterInfo &  TRI,
const TargetInstrInfo &  TII 
) [static]

EmitLiveInCopies - If this is the first basic block in the function, and if it has live ins that need to be copied into vregs, emit the copies into the block.

Definition at line 237 of file SelectionDAGISel.cpp.

References llvm::MachineBasicBlock::begin(), llvm::TargetInstrInfo::copyRegToReg(), E, EmitLiveInCopy(), llvm::MachineRegisterInfo::getRegClass(), InsertPos, LI, llvm::MachineRegisterInfo::livein_begin(), llvm::MachineRegisterInfo::livein_end(), and SchedLiveInCopies.

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

static void EmitLiveInCopy ( MachineBasicBlock *  MBB,
MachineBasicBlock::iterator &  InsertPos,
unsigned  VirtReg,
unsigned  PhysReg,
const TargetRegisterClass *  RC,
DenseMap< MachineInstr *, unsigned > &  CopyRegMap,
const MachineRegisterInfo &  MRI,
const TargetRegisterInfo &  TRI,
const TargetInstrInfo &  TII 
) [static]

static SDNode* findFlagUse ( SDNode *  N  )  [static]

findFlagUse - Return use of EVT::Flag value produced by the specified SDNode.

Definition at line 1138 of file SelectionDAGISel.cpp.

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

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

static bool findNonImmUse ( SDNode *  Use,
SDNode *  Def,
SDNode *  ImmedUse,
SDNode *  Root,
SmallPtrSet< SDNode *, 16 > &  Visited 
) [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 1151 of file SelectionDAGISel.cpp.

References llvm::SDValue::getNode(), llvm::SDNode::getNodeId(), llvm::SDNode::getNumOperands(), llvm::SDNode::getOperand(), and llvm::SmallPtrSet< PtrType, SmallSize >::insert().

Referenced by isNonImmUse().

static bool isNonImmUse ( SDNode *  Root,
SDNode *  Def,
SDNode *  ImmedUse 
) [inline, static]

isNonImmUse - Start searching from Root up the DAG to check is Def can be reached. Return true if that's the case. However, ignore direct uses by ImmedUse (which would be U in the example illustrated in IsLegalAndProfitableToFold) and by Root (which can happen in the store case). FIXME: to be really generic, we should allow direct use by any node that is being folded. But realisticly since we only fold loads which have one non-chain use, we only need to watch out for load/op/store and load/op/cmp case where the root (store / cmp) may reach the load via its chain operand.

Definition at line 1184 of file SelectionDAGISel.cpp.

References findNonImmUse(), and Visited.

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


Variable Documentation

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

cl::opt<bool> DisableLegalizeTypes("disable-legalize-types", cl::Hidden) [static]

cl::opt<bool> EnableFastISelAbort("fast-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"fast\" instruction fails")) [static]

cl::opt<bool> EnableFastISelVerbose("fast-isel-verbose", cl::Hidden, cl::desc("Enable verbose messages in the \"fast\" ""instruction selector")) [static]

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

ISHeuristic command line option for instruction schedulers.

cl::opt<bool> SchedLiveInCopies("schedule-livein-copies", cl::desc("Schedule copies of livein registers"), cl::init(false)) [static]

Referenced by EmitLiveInCopies().

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]