From ec13743da80a80c1817cf6660c28917fc28846bc Mon Sep 17 00:00:00 2001 From: buzbee Date: Tue, 13 Nov 2012 12:13:16 -0800 Subject: Revert "Revert "Refactor codegen resource masks"" This reverts commit 4b39c9f1b77ff32cf5760e6bf77c189678e2c9a6. The problem with the original commit was failure to widen a couple of local variables to hold the newly widenened to 64-bits EncodingMap flag field - thus we lost some high-order resource attributes and broke instruction scheduling for x86. Change-Id: I04d7caf79e2cc802c39369ca04666629218ccaea --- src/compiler/codegen/x86/ArchUtility.cc | 42 +++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'src/compiler/codegen/x86/ArchUtility.cc') diff --git a/src/compiler/codegen/x86/ArchUtility.cc b/src/compiler/codegen/x86/ArchUtility.cc index 4c28b35e03..953ce4a899 100644 --- a/src/compiler/codegen/x86/ArchUtility.cc +++ b/src/compiler/codegen/x86/ArchUtility.cc @@ -22,12 +22,50 @@ namespace art { +/* + * Decode the register id. + */ +u8 getRegMaskCommon(CompilationUnit* cUnit, int reg) +{ + u8 seed; + int shift; + int regId; + + regId = reg & 0xf; + /* Double registers in x86 are just a single FP register */ + seed = 1; + /* FP register starts at bit position 16 */ + shift = FPREG(reg) ? kX86FPReg0 : 0; + /* Expand the double register id into single offset */ + shift += regId; + return (seed << shift); +} + +uint64_t getPCUseDefEncoding() +{ + /* + * FIXME: might make sense to use a virtual resource encoding bit for pc. Might be + * able to clean up some of the x86/Arm_Mips differences + */ + LOG(FATAL) << "Unexpected call to getPCUseDefEncoding for x86"; + return 0ULL; +} + void setupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir) { DCHECK_EQ(cUnit->instructionSet, kX86); // X86-specific resource map setup here. - int flags = EncodingMap[lir->opcode].flags; + uint64_t flags = EncodingMap[lir->opcode].flags; + + if (flags & REG_USE_SP) { + lir->useMask |= ENCODE_X86_REG_SP; + } + + if (flags & REG_DEF_SP) { + lir->defMask |= ENCODE_X86_REG_SP; + } + if (flags & REG_DEFA) { oatSetupRegMask(cUnit, &lir->defMask, rAX); } @@ -147,7 +185,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 < kX86RegEnd; i++) { if (mask & (1ULL << i)) { sprintf(num, "%d ", i); strcat(buf, num); -- cgit v1.2.3-59-g8ed1b