X86_64 QBE: use RIP addressing
Take advantage of RIP addressing in 64 bit mode to improve the code
generation for accesses to the constant area as well as packed switches.
Avoid computing the address of the start of the method, which is needed
in 32 bit mode.
To do this, we add a new 'pseudo-register' kRIPReg to minimize the
changes needed to get the new addressing mode to be generated.
Change-Id: Ia28c93f98b09939806d91ff0bd7392e58996d108
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
diff --git a/compiler/dex/quick/x86/int_x86.cc b/compiler/dex/quick/x86/int_x86.cc
index 80cdc83..85ab92b 100755
--- a/compiler/dex/quick/x86/int_x86.cc
+++ b/compiler/dex/quick/x86/int_x86.cc
@@ -1289,6 +1289,18 @@
}
LIR* X86Mir2Lir::OpPcRelLoad(RegStorage reg, LIR* target) {
+ if (cu_->target64) {
+ // We can do this directly using RIP addressing.
+ // We don't know the proper offset for the value, so pick one that will force
+ // 4 byte offset. We will fix this up in the assembler later to have the right
+ // value.
+ ScopedMemRefType mem_ref_type(this, ResourceMask::kLiteral);
+ LIR* res = NewLIR3(kX86Mov32RM, reg.GetReg(), kRIPReg, 256);
+ res->target = target;
+ res->flags.fixup = kFixupLoad;
+ return res;
+ }
+
CHECK(base_of_code_ != nullptr);
// Address the start of the method
@@ -1309,7 +1321,6 @@
0, 0, target);
res->target = target;
res->flags.fixup = kFixupLoad;
- store_method_addr_used_ = true;
return res;
}