aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-12-05 07:29:55 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-12-05 07:29:55 +0000
commitfd00debde0353b9e567ca4f68d62ad8aae5bf512 (patch)
tree6b49e1237e13fcfd85e59d0d5335380fd6195195 /lib
parent6f40b831e0e653f88cbb17bf00d739bae28b5816 (diff)
downloadexternal_llvm-fd00debde0353b9e567ca4f68d62ad8aae5bf512.zip
external_llvm-fd00debde0353b9e567ca4f68d62ad8aae5bf512.tar.gz
external_llvm-fd00debde0353b9e567ca4f68d62ad8aae5bf512.tar.bz2
JIT large code model support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86CodeEmitter.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index e7e1ed4..fce5075 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -173,6 +173,8 @@ void Emitter::emitConstPoolAddress(unsigned CPI, unsigned Reloc,
unsigned PCAdj /* = 0 */) {
MCE.addRelocation(MachineRelocation::getConstPool(MCE.getCurrentPCOffset(),
Reloc, CPI, PCAdj));
+ if (Reloc == X86::reloc_absolute_dword)
+ MCE.emitWordLE(0);
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 */) {
MCE.addRelocation(MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(),
Reloc, JTI, PCAdj));
+ if (Reloc == X86::reloc_absolute_dword)
+ MCE.emitWordLE(0);
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;
if (NumOps > 1 && Desc->getOperandConstraint(1, TOI::TIED_TO) != -1)
CurOp++;
-
+
unsigned char BaseOpcode = II->getBaseOpcodeFor(Desc);
switch (Desc->TSFlags & X86II::FormMask) {
default: assert(0 && "Unknown FormMask value in X86 MachineCodeEmitter!");
@@ -675,9 +679,8 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
emitConstant(MO1.getImm(), Size);
else {
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_absolute_word;
- // FIXME
if (Opcode == X86::MOV64ri)
- rt = X86::reloc_absolute_dword;
+ rt = X86::reloc_absolute_dword; // FIXME: add X86II flag?
if (MO1.isGlobalAddress())
emitGlobalAddressForPtr(MO1.getGlobal(), rt, MO1.getOffset());
else if (MO1.isExternalSymbol())
@@ -743,10 +746,10 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
if (MO1.isImmediate())
emitConstant(MO1.getImm(), Size);
else {
- unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_absolute_word;
- // FIXME
+ unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
+ : X86::reloc_absolute_word;
if (Opcode == X86::MOV64ri32)
- rt = X86::reloc_absolute_word;
+ rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
if (MO1.isGlobalAddress())
emitGlobalAddressForPtr(MO1.getGlobal(), rt, MO1.getOffset());
else if (MO1.isExternalSymbol())
@@ -777,7 +780,10 @@ void Emitter::emitInstruction(const MachineInstr &MI) {
if (MO.isImmediate())
emitConstant(MO.getImm(), Size);
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())
emitGlobalAddressForPtr(MO.getGlobal(), rt, MO.getOffset());
else if (MO.isExternalSymbol())