summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-08-11 23:46:25 +0000
committerDale Johannesen <dalej@apple.com>2008-08-11 23:46:25 +0000
commitdafdbf77b315961fedc959e9ea732fa3f5cbee67 (patch)
tree15ab3561938181add7ce138708c3339bf9a317bf /llvm/lib/Target/X86/X86TargetMachine.cpp
parentb56e07e73689ee9edd918d01918640539382dab8 (diff)
downloadbcm5719-llvm-dafdbf77b315961fedc959e9ea732fa3f5cbee67.tar.gz
bcm5719-llvm-dafdbf77b315961fedc959e9ea732fa3f5cbee67.zip
Some fixes for x86-64 JIT. Make it use small code
model, except for external calls; this makes addressing modes PC-relative. Incomplete. The assertion at the top of Emitter::runOnMachineFunction was obviously bogus (always true) so I removed it. If someone knows what the correct test should be to cover all the various targets, please fix. llvm-svn: 54656
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index e163956f3e4..8e10ee9b225 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -194,12 +194,14 @@ bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast,
bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast,
bool DumpAsm, MachineCodeEmitter &MCE) {
// FIXME: Move this to TargetJITInfo!
- if (DefRelocModel == Reloc::Default)
+ // Do not override 64-bit setting made in X86TargetMachine().
+ if (DefRelocModel == Reloc::Default && !Subtarget.is64Bit())
setRelocationModel(Reloc::Static);
- // JIT cannot ensure globals are placed in the lower 4G of address.
+ // 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::Large);
+ setCodeModel(CodeModel::Small);
PM.add(createX86CodeEmitterPass(*this, MCE));
if (DumpAsm)
OpenPOWER on IntegriCloud