summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/arm/ArmRallocUtil.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2011-09-23 12:46:19 -0700
committer buzbee <buzbee@google.com> 2011-09-23 13:53:25 -0700
commitc41e5b5ae1befe2c602d55de1dbc04d1914f4a6c (patch)
treefa122d75b64193d7c2dee7a1be871a5ae8511493 /src/compiler/codegen/arm/ArmRallocUtil.cc
parentf4afb7aec4e51c2e682cf3af4d6511add74d2f38 (diff)
Add tables to map between callee saves and vregs
Also added function to return sp-relative offset for Dalvik virtual registers using Method* [Note: must be matched with corresponding libcore change to reflect new field in Method] Change-Id: Id739908c6232ce60763d8199bc05111e960da46e
Diffstat (limited to 'src/compiler/codegen/arm/ArmRallocUtil.cc')
-rw-r--r--src/compiler/codegen/arm/ArmRallocUtil.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/codegen/arm/ArmRallocUtil.cc b/src/compiler/codegen/arm/ArmRallocUtil.cc
index 030131f41c..0908c6d429 100644
--- a/src/compiler/codegen/arm/ArmRallocUtil.cc
+++ b/src/compiler/codegen/arm/ArmRallocUtil.cc
@@ -260,6 +260,21 @@ extern int oatVRegOffset(CompilationUnit* cUnit, int reg)
cUnit->insOffset + ((reg - cUnit->numRegs) << 2);
}
+/* Return sp-relative offset in bytes using Method* */
+extern int oatVRegOffsetFromMethod(Method* method, int reg)
+{
+ int numIns = method->NumIns();
+ int numRegs = method->NumRegisters() - numIns;
+ int numOuts = method->NumOuts();
+ int numSpills = __builtin_popcount(method->GetCoreSpillMask()) +
+ __builtin_popcount(method->GetFpSpillMask());
+ int numPadding = (STACK_ALIGN_WORDS -
+ (numSpills + numRegs + numOuts + 2)) & (STACK_ALIGN_WORDS-1);
+ int regsOffset = (numOuts + numPadding + 1) * 4;
+ int insOffset = method->GetFrameSizeInBytes() + 4;
+ return (reg < numRegs) ? regsOffset + (reg << 2) :
+ insOffset + ((reg - numRegs) << 2);
+}
/* Clobber all regs that might be used by an external C call */
extern void oatClobberCallRegs(CompilationUnit *cUnit)