summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-08-20 00:47:54 +0000
committerDan Gohman <gohman@apple.com>2008-08-20 00:47:54 +0000
commit3e697cfa979538c77459a3e4237e9bc1ac638761 (patch)
treeac2e88bdfefe7961c099b9fa890a7f9ee39759db /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
parenta7f2dff98e68ed8b2ac32f953768c04f26b52bea (diff)
downloadllvm-3e697cfa979538c77459a3e4237e9bc1ac638761.tar.gz
llvm-3e697cfa979538c77459a3e4237e9bc1ac638761.tar.bz2
llvm-3e697cfa979538c77459a3e4237e9bc1ac638761.tar.xz
Add support for running SelectionDAG if FastISel fails. This is under
a command-line option, so that the default behavior is an abort, which is useful for exposing code that isn't supported yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 188d938819..6a626b90e3 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -59,7 +59,10 @@ EnableLegalizeTypes("enable-legalize-types", cl::Hidden);
static cl::opt<bool>
EnableFastISel("fast-isel", cl::Hidden,
cl::desc("Enable the experimental \"fast\" instruction selector"));
-
+static cl::opt<bool>
+DisableFastISelAbort("fast-isel-no-abort", cl::Hidden,
+ cl::desc("Use the SelectionDAGISel when \"fast\" instruction "
+ "selection fails"));
#ifndef NDEBUG
static cl::opt<bool>
@@ -5103,6 +5106,7 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
// landing pads, which also require special handling.
// For now, also exclude blocks with terminators that aren't
// unconditional branches.
+ BasicBlock::iterator Begin = LLVMBB->begin();
if (EnableFastISel &&
LLVMBB != &LLVMBB->getParent()->getEntryBlock() &&
!BB->isLandingPad() &&
@@ -5110,17 +5114,18 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
cast<BranchInst>(LLVMBB->getTerminator())->isUnconditional()) {
if (FastISel *F = TLI.createFastISel(BB, &FuncInfo.MF,
TLI.getTargetMachine().getInstrInfo())) {
- BasicBlock::iterator I =
- F->SelectInstructions(LLVMBB->begin(), LLVMBB->end(), FuncInfo.ValueMap);
- if (I == LLVMBB->end())
+ Begin = F->SelectInstructions(Begin, LLVMBB->end(), FuncInfo.ValueMap);
+ if (Begin == LLVMBB->end())
// The "fast" selector selected the entire block, so we're done.
return;
- // The "fast" selector couldn't handle something and bailed.
- // For the temporary purpose of debugging, just abort.
- I->dump();
- assert(0 && "FastISel didn't select the entire block");
- abort();
+ if (!DisableFastISelAbort) {
+ // The "fast" selector couldn't handle something and bailed.
+ // For the purpose of debugging, just abort.
+ DEBUG(Begin->dump());
+ assert(0 && "FastISel didn't select the entire block");
+ abort();
+ }
}
}
@@ -5172,13 +5177,13 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
}
// Lower all of the non-terminator instructions.
- for (BasicBlock::iterator I = LLVMBB->begin(), E = --LLVMBB->end();
+ for (BasicBlock::iterator I = Begin, E = --LLVMBB->end();
I != E; ++I)
SDL.visit(*I);
// Ensure that all instructions which are used outside of their defining
// blocks are available as virtual registers. Invoke is handled elsewhere.
- for (BasicBlock::iterator I = LLVMBB->begin(), E = LLVMBB->end(); I != E;++I)
+ for (BasicBlock::iterator I = Begin, E = LLVMBB->end(); I != E;++I)
if (!I->use_empty() && !isa<PHINode>(I) && !isa<InvokeInst>(I)) {
DenseMap<const Value*, unsigned>::iterator VMI =FuncInfo.ValueMap.find(I);
if (VMI != FuncInfo.ValueMap.end())