mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
give MCCodeEmitters access to the current MCContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96038 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3174f6703e
commit
86020e4628
@ -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