aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-06-27 06:30:12 +0000
committerChris Lattner <sabre@nondot.org>2005-06-27 06:30:12 +0000
commit07a9144efea7e870c53552d73dc078de8a3d0731 (patch)
treed3a9fa9c0b31322a7f6106f8504feb5c83ad1488 /lib/Target/X86/X86TargetMachine.cpp
parent35f0a4f24e1d7ded182bd557503a9035fb540a58 (diff)
downloadexternal_llvm-07a9144efea7e870c53552d73dc078de8a3d0731.zip
external_llvm-07a9144efea7e870c53552d73dc078de8a3d0731.tar.gz
external_llvm-07a9144efea7e870c53552d73dc078de8a3d0731.tar.bz2
Add support to the X86 backend for emitting ELF files. To use this, we
currently use: llc t.bc --filetype=obj This will produce a t.o file which is dumpable with readelf. Currently the file produced is empty, but the scaffolding to do more is now in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22292 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--lib/Target/X86/X86TargetMachine.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index dcf27ac..2330182 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/lib/Target/X86/X86TargetMachine.cpp
@@ -98,7 +98,8 @@ X86TargetMachine::X86TargetMachine(const Module &M, IntrinsicLowering *IL)
// does to emit statically compiled machine code.
bool X86TargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out,
CodeGenFileType FileType) {
- if (FileType != TargetMachine::AssemblyFile) return true;
+ if (FileType != TargetMachine::AssemblyFile &&
+ FileType != TargetMachine::ObjectFile) return true;
// FIXME: Implement efficient support for garbage collection intrinsics.
PM.add(createLowerGCPass());
@@ -146,7 +147,19 @@ bool X86TargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out,
PM.add(createX86CodePrinterPass(std::cerr, *this));
if (!DisableOutput)
- PM.add(createX86CodePrinterPass(Out, *this));
+ switch (FileType) {
+ default:
+ assert(0 && "Unexpected filetype here!");
+ case TargetMachine::AssemblyFile:
+ PM.add(createX86CodePrinterPass(Out, *this));
+ break;
+ case TargetMachine::ObjectFile:
+ // 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));
+ break;
+ }
// Delete machine code for this function
PM.add(createMachineCodeDeleter());