stub out a new X86 encoder, which can be tried with

-enable-new-x86-encoder until its stable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95256 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-02-03 21:24:49 +00:00
parent ce79a25980
commit 4576247928
5 changed files with 56 additions and 1 deletions

View File

@ -25,6 +25,7 @@ set(sources
X86InstrInfo.cpp
X86JITInfo.cpp
X86MCAsmInfo.cpp
X86MCCodeEmitter.cpp
X86RegisterInfo.cpp
X86Subtarget.cpp
X86TargetMachine.cpp

View File

@ -50,6 +50,7 @@ FunctionPass *createX86JITCodeEmitterPass(X86TargetMachine &TM,
JITCodeEmitter &JCE);
MCCodeEmitter *createHeinousX86MCCodeEmitter(const Target &, TargetMachine &TM);
MCCodeEmitter *createX86MCCodeEmitter(const Target &, TargetMachine &TM);
/// createX86EmitCodeToMemory - Returns a pass that converts a register
/// allocated function into raw machine code in a dynamically

View File

@ -1099,8 +1099,19 @@ public:
};
}
#include "llvm/Support/CommandLine.h"
static cl::opt<bool> EnableNewEncoder("enable-new-x86-encoder",
cl::ReallyHidden);
// Ok, now you can look.
MCCodeEmitter *llvm::createHeinousX86MCCodeEmitter(const Target &,
MCCodeEmitter *llvm::createHeinousX86MCCodeEmitter(const Target &T,
TargetMachine &TM) {
// FIXME: Remove the heinous one when the new one works.
if (EnableNewEncoder)
return createX86MCCodeEmitter(T, TM);
return new X86MCCodeEmitter(static_cast<X86TargetMachine&>(TM));
}

View File

@ -0,0 +1,41 @@
//===-- X86/X86MCCodeEmitter.cpp - Convert X86 code to machine code -------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the X86MCCodeEmitter class.
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "x86-emitter"
#include "X86.h"
#include "X86TargetMachine.h"
#include "llvm/MC/MCCodeEmitter.h"
using namespace llvm;
namespace {
class X86MCCodeEmitter : public MCCodeEmitter {
X86MCCodeEmitter(const X86MCCodeEmitter &); // DO NOT IMPLEMENT
void operator=(const X86MCCodeEmitter &); // DO NOT IMPLEMENT
X86TargetMachine &TM;
public:
X86MCCodeEmitter(X86TargetMachine &tm) : TM(tm) {
}
~X86MCCodeEmitter() {}
void EncodeInstruction(const MCInst &MI, raw_ostream &OS) const {
}
};
} // end anonymous namespace
MCCodeEmitter *llvm::createX86MCCodeEmitter(const Target &,
TargetMachine &TM) {
return new X86MCCodeEmitter(static_cast<X86TargetMachine&>(TM));
}

View File

@ -48,6 +48,7 @@ extern "C" void LLVMInitializeX86Target() {
RegisterAsmInfoFn B(TheX86_64Target, createMCAsmInfo);
// Register the code emitter.
// FIXME: Remove the heinous one when the new one works.
TargetRegistry::RegisterCodeEmitter(TheX86_32Target,
createHeinousX86MCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(TheX86_64Target,