diff options
Diffstat (limited to 'src/compiler/codegen/RallocUtil.cc')
| -rw-r--r-- | src/compiler/codegen/RallocUtil.cc | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc index 9d1878a02b..8fa110a90d 100644 --- a/src/compiler/codegen/RallocUtil.cc +++ b/src/compiler/codegen/RallocUtil.cc @@ -161,6 +161,20 @@ int SRegToPMap(CompilationUnit* cUnit, int sReg) } } +void oatRecordCorePromotion(CompilationUnit* cUnit, int reg, int sReg) +{ + int pMapIdx = SRegToPMap(cUnit, sReg); + int vReg = SRegToVReg(cUnit, sReg); + oatGetRegInfo(cUnit, reg)->inUse = true; + cUnit->coreSpillMask |= (1 << reg); + // Include reg for later sort + cUnit->coreVmapTable.push_back(reg << VREG_NUM_WIDTH | + (vReg & ((1 << VREG_NUM_WIDTH) - 1))); + cUnit->numCoreSpills++; + cUnit->promotionMap[pMapIdx].coreLocation = kLocPhysReg; + cUnit->promotionMap[pMapIdx].coreReg = reg; +} + /* Reserve a callee-save register. Return -1 if none available */ extern int oatAllocPreservedCoreReg(CompilationUnit* cUnit, int sReg) { @@ -168,21 +182,24 @@ extern int oatAllocPreservedCoreReg(CompilationUnit* cUnit, int sReg) RegisterInfo* coreRegs = cUnit->regPool->coreRegs; for (int i = 0; i < cUnit->regPool->numCoreRegs; i++) { if (!coreRegs[i].isTemp && !coreRegs[i].inUse) { - int vReg = SRegToVReg(cUnit, sReg); - int pMapIdx = SRegToPMap(cUnit, sReg); res = coreRegs[i].reg; - coreRegs[i].inUse = true; - cUnit->coreSpillMask |= (1 << res); - cUnit->coreVmapTable.push_back(vReg); - cUnit->numCoreSpills++; - cUnit->promotionMap[pMapIdx].coreLocation = kLocPhysReg; - cUnit->promotionMap[pMapIdx].coreReg = res; + oatRecordCorePromotion(cUnit, res, sReg); break; } } return res; } +void oatRecordFpPromotion(CompilationUnit* cUnit, int reg, int sReg) +{ + int pMapIdx = SRegToPMap(cUnit, sReg); + int vReg = SRegToVReg(cUnit, sReg); + oatGetRegInfo(cUnit, reg)->inUse = true; + oatMarkPreservedSingle(cUnit, vReg, reg); + cUnit->promotionMap[pMapIdx].fpLocation = kLocPhysReg; + cUnit->promotionMap[pMapIdx].fpReg = reg; +} + /* * Reserve a callee-save fp single register. Try to fullfill request for * even/odd allocation, but go ahead and allocate anything if not @@ -195,13 +212,8 @@ int allocPreservedSingle(CompilationUnit* cUnit, int sReg, bool even) for (int i = 0; i < cUnit->regPool->numFPRegs; i++) { if (!FPRegs[i].isTemp && !FPRegs[i].inUse && ((FPRegs[i].reg & 0x1) == 0) == even) { - int vReg = SRegToVReg(cUnit, sReg); - int pMapIdx = SRegToPMap(cUnit, sReg); res = FPRegs[i].reg; - FPRegs[i].inUse = true; - oatMarkPreservedSingle(cUnit, vReg, res); - cUnit->promotionMap[pMapIdx].fpLocation = kLocPhysReg; - cUnit->promotionMap[pMapIdx].fpReg = res; + oatRecordFpPromotion(cUnit, res, sReg); break; } } @@ -1237,6 +1249,9 @@ extern void oatDoPromotion(CompilationUnit* cUnit) } } } + if (cUnit->printMe) { + oatDumpPromotionMap(cUnit); + } } /* Returns sp-relative offset in bytes for a VReg */ |