mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Make x86-64 JIT changes Darwin-specific.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54700 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fe24bd3a89
commit
5f777192a0
@ -525,7 +525,11 @@ DOUT << "isImmediate " << MO.isImmediate() << "\n";
|
||||
emitPCRelativeBlockAddress(MO.getMBB());
|
||||
} else if (MO.isGlobalAddress()) {
|
||||
// Assume undefined functions may be outside the Small codespace.
|
||||
bool NeedStub = Is64BitMode || Opcode == X86::TAILJMPd;
|
||||
bool NeedStub =
|
||||
(Is64BitMode &&
|
||||
(TM.getCodeModel() == CodeModel::Large ||
|
||||
TM.getSubtarget<X86Subtarget>().isTargetDarwin())) ||
|
||||
Opcode == X86::TAILJMPd;
|
||||
emitGlobalAddress(MO.getGlobal(), X86::reloc_pcrel_word,
|
||||
0, 0, NeedStub);
|
||||
} else if (MO.isExternalSymbol()) {
|
||||
@ -549,6 +553,9 @@ DOUT << "isImmediate " << MO.isImmediate() << "\n";
|
||||
else {
|
||||
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
|
||||
: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word);
|
||||
// This should not occur on Darwin for relocatable objects.
|
||||
if (Opcode == X86::MOV64ri)
|
||||
rt = X86::reloc_absolute_dword; // FIXME: add X86II flag?
|
||||
if (MO1.isGlobalAddress()) {
|
||||
bool NeedStub = isa<Function>(MO1.getGlobal());
|
||||
bool isLazy = gvNeedsLazyPtr(MO1.getGlobal());
|
||||
@ -619,6 +626,8 @@ DOUT << "isImmediate " << MO.isImmediate() << "\n";
|
||||
else {
|
||||
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
|
||||
: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word);
|
||||
if (Opcode == X86::MOV64ri32)
|
||||
rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
|
||||
if (MO1.isGlobalAddress()) {
|
||||
bool NeedStub = isa<Function>(MO1.getGlobal());
|
||||
bool isLazy = gvNeedsLazyPtr(MO1.getGlobal());
|
||||
@ -654,6 +663,8 @@ DOUT << "isImmediate " << MO.isImmediate() << "\n";
|
||||
else {
|
||||
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
|
||||
: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word);
|
||||
if (Opcode == X86::MOV64mi32)
|
||||
rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
|
||||
if (MO.isGlobalAddress()) {
|
||||
bool NeedStub = isa<Function>(MO.getGlobal());
|
||||
bool isLazy = gvNeedsLazyPtr(MO.getGlobal());
|
||||
|
@ -194,14 +194,20 @@ bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast,
|
||||
bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast,
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
// FIXME: Move this to TargetJITInfo!
|
||||
// Do not override 64-bit setting made in X86TargetMachine().
|
||||
if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit())
|
||||
// On Darwin, do not override 64-bit setting made in X86TargetMachine().
|
||||
if (DefRelocModel == Reloc::Default &&
|
||||
(!Subtarget.isTargetDarwin() || !Subtarget.is64Bit()))
|
||||
setRelocationModel(Reloc::Static);
|
||||
|
||||
// 64-bit JIT places everything in the same buffer except external functions.
|
||||
// Use small code model but hack the call instruction for externals.
|
||||
if (Subtarget.is64Bit())
|
||||
setCodeModel(CodeModel::Small);
|
||||
// On Darwin, use small code model but hack the call instruction for
|
||||
// externals. Elsewhere, do not assume globals are in the lower 4G.
|
||||
if (Subtarget.is64Bit()) {
|
||||
if (Subtarget.isTargetDarwin())
|
||||
setCodeModel(CodeModel::Small);
|
||||
else
|
||||
setCodeModel(CodeModel::Large);
|
||||
}
|
||||
|
||||
PM.add(createX86CodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
|
Loading…
Reference in New Issue
Block a user