Move the code that adds the DeadMachineInstructionElimPass from
authorDan Gohman <gohman@apple.com>
Sat, 25 Oct 2008 17:46:52 +0000 (17:46 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 25 Oct 2008 17:46:52 +0000 (17:46 +0000)
target-independent code to target-specific code. This prevents it
from running on targets that aren't using fast-isel.

In addition to saving compile time, this addresses the problem
that not all targets are prepared for it. In order to use this
pass, all instructions must declare all their fixed uses and
defs of physical registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58144 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LLVMTargetMachine.cpp
lib/Target/X86/X86TargetMachine.cpp

index fa386b00f7b21f7eff3a509d82c76111c72cbf5f..ee3f604abda74f9400599bda86970a8b9fa49825 100644 (file)
@@ -185,10 +185,6 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, bool Fast) {
   if (PrintMachineCode)
     PM.add(createMachineFunctionPrinterPass(cerr));
 
-  // If we're using Fast-ISel, clean up the mess.
-  if (EnableFastISel)
-    PM.add(createDeadMachineInstructionElimPass());
-
   if (EnableLICM)
     PM.add(createMachineLICMPass());
 
index ef4f897f5d12f101f07c0afa12899a79340aa3fd..2b67971d48001aaea2b06c1c20ea8517238616d0 100644 (file)
@@ -183,6 +183,11 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS,
 bool X86TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) {
   // Install an instruction selector.
   PM.add(createX86ISelDag(*this, Fast));
+
+  // If we're using Fast-ISel, clean up the mess.
+  if (EnableFastISel)
+    PM.add(createDeadMachineInstructionElimPass());
+
   return false;
 }