summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/CodegenUtil.cc
diff options
context:
space:
mode:
author Bill Buzbee <buzbee@google.com> 2012-11-08 13:37:13 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2012-11-08 13:37:13 -0800
commitd21df09a54b08fbf90f9eb64801f0b03a100b8ec (patch)
tree7bad64cf4afe2825a95e09442ab2f029105fbcc7 /src/compiler/codegen/CodegenUtil.cc
parent9572fa7e2742e5b3c706699a4a9f262cf93fb6e7 (diff)
parent4b39c9f1b77ff32cf5760e6bf77c189678e2c9a6 (diff)
Merge "Revert "Refactor codegen resource masks"" into dalvik-dev
Diffstat (limited to 'src/compiler/codegen/CodegenUtil.cc')
-rw-r--r--src/compiler/codegen/CodegenUtil.cc39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/compiler/codegen/CodegenUtil.cc b/src/compiler/codegen/CodegenUtil.cc
index 3041d0b427..7ad2647f18 100644
--- a/src/compiler/codegen/CodegenUtil.cc
+++ b/src/compiler/codegen/CodegenUtil.cc
@@ -65,7 +65,36 @@ void annotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit)
* Store the Dalvik register id in aliasInfo. Mark the MSB if it is a 64-bit
* access.
*/
- lir->aliasInfo = ENCODE_ALIAS_INFO(regId, is64bit);
+ lir->aliasInfo = regId;
+ if (is64bit) {
+ lir->aliasInfo |= 0x80000000;
+ }
+}
+
+/*
+ * Decode the register id.
+ */
+inline u8 getRegMaskCommon(CompilationUnit* cUnit, int reg)
+{
+ u8 seed;
+ int shift;
+ int regId;
+
+
+ if (cUnit->instructionSet == kX86) {
+ regId = reg & 0xf;
+ /* Double registers in x86 are just a single FP register */
+ seed = 1;
+ } else {
+ regId = reg & 0x1f;
+ /* Each double register is equal to a pair of single-precision FP registers */
+ seed = DOUBLEREG(reg) ? 3 : 1;
+ }
+ /* FP register starts at bit position 16 */
+ shift = FPREG(reg) ? kFPReg0 : 0;
+ /* Expand the double register id into single offset */
+ shift += regId;
+ return (seed << shift);
}
u8 oatGetRegMaskCommon(CompilationUnit* cUnit, int reg)
@@ -132,6 +161,10 @@ void setupResourceMasks(CompilationUnit* cUnit, LIR* lir)
setupRegMask(cUnit, &lir->defMask, lir->operands[1]);
}
+ if (flags & REG_DEF_SP) {
+ lir->defMask |= ENCODE_REG_SP;
+ }
+
if (flags & SETS_CCODES) {
lir->defMask |= ENCODE_CCODE;
@@ -147,6 +180,10 @@ void setupResourceMasks(CompilationUnit* cUnit, LIR* lir)
}
}
+ if (flags & REG_USE_SP) {
+ lir->useMask |= ENCODE_REG_SP;
+ }
+
if (flags & USES_CCODES) {
lir->useMask |= ENCODE_CCODE;
}