Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter
after itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22376 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index def4f9c..a0537f5 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/lib/Target/X86/X86TargetMachine.cpp
@@ -162,7 +162,7 @@
// FIXME: We only support emission of ELF files for now, this should check
// the target triple and decide on the format to write (e.g. COFF on
// win32).
- PM.add(createX86ELFObjectWriterPass(Out, *this));
+ addX86ELFObjectWriterPass(PM, Out, *this);
break;
}
@@ -225,3 +225,10 @@
PM.add(createX86CodePrinterPass(std::cerr, TM));
}
+bool X86TargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
+ MachineCodeEmitter &MCE) {
+ PM.add(createX86CodeEmitterPass(MCE));
+ // Delete machine code for this function
+ PM.add(createMachineCodeDeleter());
+ return false;
+}