diff options
author | Chris Lattner <sabre@nondot.org> | 2002-12-02 21:24:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-12-02 21:24:12 +0000 |
commit | 787a9de68590eab1f35ab140cba2769ac3b39644 (patch) | |
tree | 451392eb1d5af98e6cfc7befd9f71b073cf0fbb7 /llvm/lib | |
parent | cbda9ce676249fa24c64572fd470dd6eecc63574 (diff) | |
download | bcm5719-llvm-787a9de68590eab1f35ab140cba2769ac3b39644.tar.gz bcm5719-llvm-787a9de68590eab1f35ab140cba2769ac3b39644.zip |
Initial support for machine code emission
llvm-svn: 4866
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/MachineCodeEmitter.cpp | 36 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86CodeEmitter.cpp | 36 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86TargetMachine.h | 9 |
3 files changed, 81 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/MachineCodeEmitter.cpp b/llvm/lib/Target/X86/MachineCodeEmitter.cpp new file mode 100644 index 00000000000..ba82503e495 --- /dev/null +++ b/llvm/lib/Target/X86/MachineCodeEmitter.cpp @@ -0,0 +1,36 @@ +//===-- X86/MachineCodeEmitter.cpp - Convert X86 code to machine code -----===// +// +// This file contains the pass that transforms the X86 machine instructions into +// actual executable machine code. +// +//===----------------------------------------------------------------------===// + +#include "X86TargetMachine.h" +#include "llvm/PassManager.h" +#include "llvm/CodeGen/MachineCodeEmitter.h" + +namespace { + struct Emitter : public FunctionPass { + TargetMachine &TM; + MachineCodeEmitter &MCE; + + Emitter(TargetMachine &tm, MachineCodeEmitter &mce) : TM(tm), MCE(mce) {} + ~Emitter() { + } + + bool runOnFunction(Function &F) { return false; } + }; +} + + +/// addPassesToEmitMachineCode - Add passes to the specified pass manager to get +/// machine code emitted. This uses a MAchineCodeEmitter object to handle +/// actually outputting the machine code and resolving things like the address +/// of functions. This method should returns true if machine code emission is +/// not supported. +/// +bool X86TargetMachine::addPassesToEmitMachineCode(PassManager &PM, + MachineCodeEmitter &MCE) { + PM.add(new Emitter(*this, MCE)); + return false; +} diff --git a/llvm/lib/Target/X86/X86CodeEmitter.cpp b/llvm/lib/Target/X86/X86CodeEmitter.cpp new file mode 100644 index 00000000000..ba82503e495 --- /dev/null +++ b/llvm/lib/Target/X86/X86CodeEmitter.cpp @@ -0,0 +1,36 @@ +//===-- X86/MachineCodeEmitter.cpp - Convert X86 code to machine code -----===// +// +// This file contains the pass that transforms the X86 machine instructions into +// actual executable machine code. +// +//===----------------------------------------------------------------------===// + +#include "X86TargetMachine.h" +#include "llvm/PassManager.h" +#include "llvm/CodeGen/MachineCodeEmitter.h" + +namespace { + struct Emitter : public FunctionPass { + TargetMachine &TM; + MachineCodeEmitter &MCE; + + Emitter(TargetMachine &tm, MachineCodeEmitter &mce) : TM(tm), MCE(mce) {} + ~Emitter() { + } + + bool runOnFunction(Function &F) { return false; } + }; +} + + +/// addPassesToEmitMachineCode - Add passes to the specified pass manager to get +/// machine code emitted. This uses a MAchineCodeEmitter object to handle +/// actually outputting the machine code and resolving things like the address +/// of functions. This method should returns true if machine code emission is +/// not supported. +/// +bool X86TargetMachine::addPassesToEmitMachineCode(PassManager &PM, + MachineCodeEmitter &MCE) { + PM.add(new Emitter(*this, MCE)); + return false; +} diff --git a/llvm/lib/Target/X86/X86TargetMachine.h b/llvm/lib/Target/X86/X86TargetMachine.h index 9db8375d8df..065fd368a21 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.h +++ b/llvm/lib/Target/X86/X86TargetMachine.h @@ -30,6 +30,15 @@ public: /// not supported for this target. /// virtual bool addPassesToJITCompile(PassManager &PM); + + /// addPassesToEmitMachineCode - Add passes to the specified pass manager to + /// get machine code emitted. This uses a MAchineCodeEmitter object to handle + /// actually outputting the machine code and resolving things like the address + /// of functions. This method should returns true if machine code emission is + /// not supported. + /// + virtual bool addPassesToEmitMachineCode(PassManager &PM, + MachineCodeEmitter &MCE); }; #endif |