mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 15:48:38 +00:00
give MCCodeEmitters access to the current MCContext.
llvm-svn: 96038
This commit is contained in:
parent
72e77cf286
commit
946403d05f
@ -72,7 +72,8 @@ namespace llvm {
|
||||
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 @@ namespace llvm {
|
||||
|
||||
|
||||
/// 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 @@ namespace llvm {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -141,7 +141,7 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
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;
|
||||
|
||||
|
@ -23,6 +23,7 @@ class X86TargetMachine;
|
||||
class FunctionPass;
|
||||
class MachineCodeEmitter;
|
||||
class MCCodeEmitter;
|
||||
class MCContext;
|
||||
class JITCodeEmitter;
|
||||
class Target;
|
||||
class formatted_raw_ostream;
|
||||
@ -49,9 +50,12 @@ FunctionPass *createX87FPRegKillInserterPass();
|
||||
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
|
||||
|
@ -1211,13 +1211,14 @@ static cl::opt<bool> EnableNewEncoder("enable-new-x86-encoder",
|
||||
|
||||
// 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));
|
||||
|
@ -120,12 +120,14 @@ public:
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -266,14 +266,14 @@ static int AssembleInput(const char *ProgName) {
|
||||
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()));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user