summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-03-27 01:32:24 +0000
committerNate Begeman <natebegeman@mac.com>2006-03-27 01:32:24 +0000
commited728c12914d4bf953f99f6ab80f4d1a602a9467 (patch)
tree9a7c07447fc8f7fe7cf892d5f1c22301add36075 /llvm/lib/Target/X86/X86TargetMachine.cpp
parent7092888bccaef33f7fa5afef0148b2bea5d07453 (diff)
downloadbcm5719-llvm-ed728c12914d4bf953f99f6ab80f4d1a602a9467.tar.gz
bcm5719-llvm-ed728c12914d4bf953f99f6ab80f4d1a602a9467.zip
SelectionDAGISel can now natively handle Switch instructions, in the same
manner that the LowerSwitch LLVM to LLVM pass does: emitting a binary search tree of basic blocks. The new approach has several advantages: it is faster, it generates significantly smaller code in many cases, and it paves the way for implementing dense switch tables as a jump table by handling switches directly in the instruction selector. This functionality is currently only enabled on x86, but should be safe for every target. In anticipation of making it the default, the cfg is now properly updated in the x86, ppc, and sparc select lowering code. llvm-svn: 27156
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index f6d34ea2df5..44877d9b4d1 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -36,7 +36,8 @@ namespace {
cl::opt<bool> DisableOutput("disable-x86-llc-output", cl::Hidden,
cl::desc("Disable the X86 asm printer, for use "
"when profiling the code generator."));
-
+ cl::opt<bool> DisableLowerSwitch("disable-lower-switch", cl::Hidden,
+ cl::desc("Disable the LowerSwitch pass"));
// Register the target.
RegisterTarget<X86TargetMachine> X("x86", " IA-32 (Pentium and above)");
}
@@ -100,8 +101,9 @@ bool X86TargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out,
PM.add(createLowerInvokePass());
// FIXME: Implement the switch instruction in the instruction selector!
- PM.add(createLowerSwitchPass());
-
+ if (!DisableLowerSwitch)
+ PM.add(createLowerSwitchPass());
+
// Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass());
@@ -168,7 +170,8 @@ void X86JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
PM.add(createLowerInvokePass());
// FIXME: Implement the switch instruction in the instruction selector!
- PM.add(createLowerSwitchPass());
+ if (!DisableLowerSwitch)
+ PM.add(createLowerSwitchPass());
// Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass());
OpenPOWER on IntegriCloud