mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
JIT large code model support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32220 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6f40b831e0
commit
fd00debde0
@ -173,6 +173,8 @@ void Emitter::emitConstPoolAddress(unsigned CPI, unsigned Reloc,
|
|||||||
unsigned PCAdj /* = 0 */) {
|
unsigned PCAdj /* = 0 */) {
|
||||||
MCE.addRelocation(MachineRelocation::getConstPool(MCE.getCurrentPCOffset(),
|
MCE.addRelocation(MachineRelocation::getConstPool(MCE.getCurrentPCOffset(),
|
||||||
Reloc, CPI, PCAdj));
|
Reloc, CPI, PCAdj));
|
||||||
|
if (Reloc == X86::reloc_absolute_dword)
|
||||||
|
MCE.emitWordLE(0);
|
||||||
MCE.emitWordLE(Disp); // The relocated value will be added to the displacement
|
MCE.emitWordLE(Disp); // The relocated value will be added to the displacement
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +185,8 @@ void Emitter::emitJumpTableAddress(unsigned JTI, unsigned Reloc,
|
|||||||
unsigned PCAdj /* = 0 */) {
|
unsigned PCAdj /* = 0 */) {
|
||||||
MCE.addRelocation(MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(),
|
MCE.addRelocation(MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(),
|
||||||
Reloc, JTI, PCAdj));
|
Reloc, JTI, PCAdj));
|
||||||
|
if (Reloc == X86::reloc_absolute_dword)
|
||||||
|
MCE.emitWordLE(0);
|
||||||
MCE.emitWordLE(0); // The relocated value will be added to the displacement
|
MCE.emitWordLE(0); // The relocated value will be added to the displacement
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +621,7 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
|
|||||||
unsigned CurOp = 0;
|
unsigned CurOp = 0;
|
||||||
if (NumOps > 1 && Desc->getOperandConstraint(1, TOI::TIED_TO) != -1)
|
if (NumOps > 1 && Desc->getOperandConstraint(1, TOI::TIED_TO) != -1)
|
||||||
CurOp++;
|
CurOp++;
|
||||||
|
|
||||||
unsigned char BaseOpcode = II->getBaseOpcodeFor(Desc);
|
unsigned char BaseOpcode = II->getBaseOpcodeFor(Desc);
|
||||||
switch (Desc->TSFlags & X86II::FormMask) {
|
switch (Desc->TSFlags & X86II::FormMask) {
|
||||||
default: assert(0 && "Unknown FormMask value in X86 MachineCodeEmitter!");
|
default: assert(0 && "Unknown FormMask value in X86 MachineCodeEmitter!");
|
||||||
@ -675,9 +679,8 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
|
|||||||
emitConstant(MO1.getImm(), Size);
|
emitConstant(MO1.getImm(), Size);
|
||||||
else {
|
else {
|
||||||
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_absolute_word;
|
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_absolute_word;
|
||||||
// FIXME
|
|
||||||
if (Opcode == X86::MOV64ri)
|
if (Opcode == X86::MOV64ri)
|
||||||
rt = X86::reloc_absolute_dword;
|
rt = X86::reloc_absolute_dword; // FIXME: add X86II flag?
|
||||||
if (MO1.isGlobalAddress())
|
if (MO1.isGlobalAddress())
|
||||||
emitGlobalAddressForPtr(MO1.getGlobal(), rt, MO1.getOffset());
|
emitGlobalAddressForPtr(MO1.getGlobal(), rt, MO1.getOffset());
|
||||||
else if (MO1.isExternalSymbol())
|
else if (MO1.isExternalSymbol())
|
||||||
@ -743,10 +746,10 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
|
|||||||
if (MO1.isImmediate())
|
if (MO1.isImmediate())
|
||||||
emitConstant(MO1.getImm(), Size);
|
emitConstant(MO1.getImm(), Size);
|
||||||
else {
|
else {
|
||||||
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_absolute_word;
|
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
|
||||||
// FIXME
|
: X86::reloc_absolute_word;
|
||||||
if (Opcode == X86::MOV64ri32)
|
if (Opcode == X86::MOV64ri32)
|
||||||
rt = X86::reloc_absolute_word;
|
rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
|
||||||
if (MO1.isGlobalAddress())
|
if (MO1.isGlobalAddress())
|
||||||
emitGlobalAddressForPtr(MO1.getGlobal(), rt, MO1.getOffset());
|
emitGlobalAddressForPtr(MO1.getGlobal(), rt, MO1.getOffset());
|
||||||
else if (MO1.isExternalSymbol())
|
else if (MO1.isExternalSymbol())
|
||||||
@ -777,7 +780,10 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
|
|||||||
if (MO.isImmediate())
|
if (MO.isImmediate())
|
||||||
emitConstant(MO.getImm(), Size);
|
emitConstant(MO.getImm(), Size);
|
||||||
else {
|
else {
|
||||||
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_absolute_word;
|
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
|
||||||
|
: X86::reloc_absolute_word;
|
||||||
|
if (Opcode == X86::MOV64mi32)
|
||||||
|
rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
|
||||||
if (MO.isGlobalAddress())
|
if (MO.isGlobalAddress())
|
||||||
emitGlobalAddressForPtr(MO.getGlobal(), rt, MO.getOffset());
|
emitGlobalAddressForPtr(MO.getGlobal(), rt, MO.getOffset());
|
||||||
else if (MO.isExternalSymbol())
|
else if (MO.isExternalSymbol())
|
||||||
|
Loading…
Reference in New Issue
Block a user