[llvm-commits] [llvm] r96038 - in /llvm/trunk: include/llvm/Target/TargetRegistry.h lib/CodeGen/LLVMTargetMachine.cpp lib/Target/X86/X86.h lib/Target/X86/X86CodeEmitter.cpp lib/Target/X86/X86MCCodeEmitter.cpp tools/llvm-mc/llvm-mc.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 12 15:12:53 PST 2010
Author: lattner
Date: Fri Feb 12 17:12:47 2010
New Revision: 96038
URL: http://llvm.org/viewvc/llvm-project?rev=96038&view=rev
Log:
give MCCodeEmitters access to the current MCContext.
Modified:
llvm/trunk/include/llvm/Target/TargetRegistry.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/Target/X86/X86.h
llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegistry.h?rev=96038&r1=96037&r2=96038&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegistry.h Fri Feb 12 17:12:47 2010
@@ -72,7 +72,8 @@
const MCAsmInfo &MAI,
raw_ostream &O);
typedef MCCodeEmitter *(*CodeEmitterCtorTy)(const Target &T,
- TargetMachine &TM);
+ TargetMachine &TM,
+ MCContext &Ctx);
private:
/// Next - The next registered target in the linked list, maintained by the
@@ -236,10 +237,10 @@
/// createCodeEmitter - Create a target specific code emitter.
- MCCodeEmitter *createCodeEmitter(TargetMachine &TM) const {
+ MCCodeEmitter *createCodeEmitter(TargetMachine &TM, MCContext &Ctx) const {
if (!CodeEmitterCtorFn)
return 0;
- return CodeEmitterCtorFn(*this, TM);
+ return CodeEmitterCtorFn(*this, TM, Ctx);
}
/// @}
@@ -613,8 +614,9 @@
}
private:
- static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM) {
- return new CodeEmitterImpl(T, TM);
+ static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM,
+ MCContext &Ctx) {
+ return new CodeEmitterImpl(T, TM, Ctx);
}
};
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=96038&r1=96037&r2=96038&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Fri Feb 12 17:12:47 2010
@@ -141,7 +141,7 @@
case CGFT_ObjectFile: {
// Create the code emitter for the target if it exists. If not, .o file
// emission fails.
- MCCodeEmitter *MCE = getTarget().createCodeEmitter(*this);
+ MCCodeEmitter *MCE = getTarget().createCodeEmitter(*this, *Context);
if (MCE == 0)
return true;
Modified: llvm/trunk/lib/Target/X86/X86.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86.h?rev=96038&r1=96037&r2=96038&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86.h (original)
+++ llvm/trunk/lib/Target/X86/X86.h Fri Feb 12 17:12:47 2010
@@ -23,6 +23,7 @@
class FunctionPass;
class MachineCodeEmitter;
class MCCodeEmitter;
+class MCContext;
class JITCodeEmitter;
class Target;
class formatted_raw_ostream;
@@ -49,9 +50,12 @@
FunctionPass *createX86JITCodeEmitterPass(X86TargetMachine &TM,
JITCodeEmitter &JCE);
-MCCodeEmitter *createHeinousX86MCCodeEmitter(const Target &, TargetMachine &TM);
-MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM);
-MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM);
+MCCodeEmitter *createHeinousX86MCCodeEmitter(const Target &, TargetMachine &TM,
+ MCContext &Ctx);
+MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM,
+ MCContext &Ctx);
+MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM,
+ MCContext &Ctx);
/// createX86EmitCodeToMemory - Returns a pass that converts a register
/// allocated function into raw machine code in a dynamically
Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=96038&r1=96037&r2=96038&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Fri Feb 12 17:12:47 2010
@@ -1211,13 +1211,14 @@
// Ok, now you can look.
MCCodeEmitter *llvm::createHeinousX86MCCodeEmitter(const Target &T,
- TargetMachine &TM) {
+ TargetMachine &TM,
+ MCContext &Ctx) {
// FIXME: Remove the heinous one when the new one works.
if (EnableNewEncoder) {
if (TM.getTargetData()->getPointerSize() == 4)
- return createX86_32MCCodeEmitter(T, TM);
- return createX86_64MCCodeEmitter(T, TM);
+ return createX86_32MCCodeEmitter(T, TM, Ctx);
+ return createX86_64MCCodeEmitter(T, TM, Ctx);
}
return new X86MCCodeEmitter(static_cast<X86TargetMachine&>(TM));
Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=96038&r1=96037&r2=96038&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Fri Feb 12 17:12:47 2010
@@ -120,12 +120,14 @@
MCCodeEmitter *llvm::createX86_32MCCodeEmitter(const Target &,
- TargetMachine &TM) {
+ TargetMachine &TM,
+ MCContext &Ctx) {
return new X86MCCodeEmitter(TM, false);
}
MCCodeEmitter *llvm::createX86_64MCCodeEmitter(const Target &,
- TargetMachine &TM) {
+ TargetMachine &TM,
+ MCContext &Ctx) {
return new X86MCCodeEmitter(TM, true);
}
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=96038&r1=96037&r2=96038&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Fri Feb 12 17:12:47 2010
@@ -266,14 +266,14 @@
if (FileType == OFT_AssemblyFile) {
IP.reset(TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out));
if (ShowEncoding)
- CE.reset(TheTarget->createCodeEmitter(*TM));
+ CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
Str.reset(createAsmStreamer(Ctx, *Out, *MAI,
TM->getTargetData()->isLittleEndian(),
/*asmverbose*/true, IP.get(), CE.get(),
ShowInst));
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
- CE.reset(TheTarget->createCodeEmitter(*TM));
+ CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
Str.reset(createMachOStreamer(Ctx, *Out, CE.get()));
}
More information about the llvm-commits
mailing list