diff options
| author | 2012-11-07 16:13:14 -0800 | |
|---|---|---|
| committer | 2012-11-08 05:44:02 -0800 | |
| commit | 07131ca93c301e5cbd6a8702d6af777e1662fe65 (patch) | |
| tree | ae60544b0065f8fc935bc254cc5893c3a3f89350 /src/compiler/codegen/mips/ArchUtility.cc | |
| parent | ebf6aa8185d59eeaa428b51a7e32ccc2b9ab1daf (diff) | |
Refactor codegen resource masks
Another step towards a single compiler: unified the bulk of the
target-specific instruction resource use/def maps. This will
allow more shared code usage, and eliminates target-specific
defines used by otherwise common code.
Change-Id: I4132cb4d31647517a654ffdf6c87843b84af132b
Diffstat (limited to 'src/compiler/codegen/mips/ArchUtility.cc')
| -rw-r--r-- | src/compiler/codegen/mips/ArchUtility.cc | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/compiler/codegen/mips/ArchUtility.cc b/src/compiler/codegen/mips/ArchUtility.cc index f837c399ae..9a2b923baf 100644 --- a/src/compiler/codegen/mips/ArchUtility.cc +++ b/src/compiler/codegen/mips/ArchUtility.cc @@ -22,14 +22,49 @@ namespace art { +/* + * Decode the register id. + */ +u8 getRegMaskCommon(CompilationUnit* cUnit, int reg) +{ + u8 seed; + int shift; + int regId; + + + 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) ? kMipsFPReg0 : 0; + /* Expand the double register id into single offset */ + shift += regId; + return (seed << shift); +} + +uint64_t getPCUseDefEncoding() +{ + return ENCODE_MIPS_REG_PC; +} + + void setupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir) { DCHECK_EQ(cUnit->instructionSet, kMips); // Mips-specific resource map setup here. - int flags = EncodingMap[lir->opcode].flags; + uint64_t flags = EncodingMap[lir->opcode].flags; + + if (flags & REG_DEF_SP) { + lir->defMask |= ENCODE_MIPS_REG_SP; + } + + if (flags & REG_USE_SP) { + lir->useMask |= ENCODE_MIPS_REG_SP; + } + if (flags & REG_DEF_LR) { - lir->defMask |= ENCODE_REG_LR; + lir->defMask |= ENCODE_MIPS_REG_LR; } } @@ -151,7 +186,7 @@ void oatDumpResourceMask(LIR *lir, u8 mask, const char *prefix) char num[8]; int i; - for (i = 0; i < kRegEnd; i++) { + for (i = 0; i < kMipsRegEnd; i++) { if (mask & (1ULL << i)) { sprintf(num, "%d ", i); strcat(buf, num); |