aboutsummaryrefslogtreecommitdiff
path: root/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
commitf15485a8d0dff5f720b7ad27346129ac5c3ec503 (patch)
treebd4a5e97dbebfdd53e3eb69083ae1915d132211b /lib/Target/X86/X86TargetMachine.cpp
parentfbcf23c3c12449c264f1448a2eee524be0b799f7 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--lib/Target/X86/X86TargetMachine.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index f6d34ea2df..44877d9b4d 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/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());