Skip to content

Commit

Permalink
wire up 64-bit MCCodeEmitter.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95438 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Feb 5, 2010
1 parent be1778f commit 00cb3fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/Target/X86/X86.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ FunctionPass *createX86JITCodeEmitterPass(X86TargetMachine &TM,
JITCodeEmitter &JCE);

MCCodeEmitter *createHeinousX86MCCodeEmitter(const Target &, TargetMachine &TM);
MCCodeEmitter *createX86MCCodeEmitter(const Target &, TargetMachine &TM);
MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM);
MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM);

/// createX86EmitCodeToMemory - Returns a pass that converts a register
/// allocated function into raw machine code in a dynamically
Expand Down
7 changes: 5 additions & 2 deletions lib/Target/X86/X86CodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,8 +1117,11 @@ MCCodeEmitter *llvm::createHeinousX86MCCodeEmitter(const Target &T,
TargetMachine &TM) {

// FIXME: Remove the heinous one when the new one works.
if (EnableNewEncoder)
return createX86MCCodeEmitter(T, TM);
if (EnableNewEncoder) {
if (TM.getTargetData()->getPointerSize() == 4)
return createX86_32MCCodeEmitter(T, TM);
return createX86_64MCCodeEmitter(T, TM);
}

return new X86MCCodeEmitter(static_cast<X86TargetMachine&>(TM));
}
16 changes: 10 additions & 6 deletions lib/Target/X86/X86MCCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class X86MCCodeEmitter : public MCCodeEmitter {
const TargetInstrInfo &TII;
bool Is64BitMode;
public:
X86MCCodeEmitter(TargetMachine &tm)
X86MCCodeEmitter(TargetMachine &tm, bool is64Bit)
: TM(tm), TII(*TM.getInstrInfo()) {
// FIXME: Get this from the right place.
Is64BitMode = false;
Is64BitMode = is64Bit;
}

~X86MCCodeEmitter() {}
Expand Down Expand Up @@ -83,9 +82,14 @@ class X86MCCodeEmitter : public MCCodeEmitter {
} // end anonymous namespace


MCCodeEmitter *llvm::createX86MCCodeEmitter(const Target &,
TargetMachine &TM) {
return new X86MCCodeEmitter(TM);
MCCodeEmitter *llvm::createX86_32MCCodeEmitter(const Target &,
TargetMachine &TM) {
return new X86MCCodeEmitter(TM, false);
}

MCCodeEmitter *llvm::createX86_64MCCodeEmitter(const Target &,
TargetMachine &TM) {
return new X86MCCodeEmitter(TM, true);
}


Expand Down

0 comments on commit 00cb3fe

Please sign in to comment.