Quick Compiler function renaming
Move the Quick compiler's function naming to Art coding conventions. Will
be done is pieces: names first, then arguments and locals. Also removed
some dead code and marked statics for the top level source files
No logic changes aside from eliminating a few useless exported "oat"
routines.
Change-Id: Iadaddc560942a0fc1199ba5b1c261cd6ac5cfd9a
diff --git a/src/compiler/codegen/arm/assemble_arm.cc b/src/compiler/codegen/arm/assemble_arm.cc
index d7fa05d..8e7a07b 100644
--- a/src/compiler/codegen/arm/assemble_arm.cc
+++ b/src/compiler/codegen/arm/assemble_arm.cc
@@ -987,7 +987,7 @@
* discover that pc-relative displacements may not fit the selected
* instruction.
*/
-AssemblerStatus oatAssembleInstructions(CompilationUnit* cUnit,
+AssemblerStatus AssembleInstructions(CompilationUnit* cUnit,
uintptr_t startAddr)
{
LIR* lir;
@@ -1057,9 +1057,9 @@
lir->operands[0] : rARM_LR;
// Add new Adr to generate the address
- LIR* newAdr = rawLIR(cUnit, lir->dalvikOffset, kThumb2Adr,
+ LIR* newAdr = RawLIR(cUnit, lir->dalvikOffset, kThumb2Adr,
baseReg, 0, 0, 0, 0, lir->target);
- oatInsertLIRBefore(lir, newAdr);
+ InsertLIRBefore(lir, newAdr);
// Convert to normal load
if (lir->opcode == kThumb2LdrPcRel12) {
@@ -1068,7 +1068,7 @@
// Change the load to be relative to the new Adr base
lir->operands[1] = baseReg;
lir->operands[2] = 0;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
} else {
if ((lir->opcode == kThumb2Vldrs) ||
@@ -1090,16 +1090,16 @@
* Make new branch instruction and insert after
*/
LIR* newInst =
- rawLIR(cUnit, lir->dalvikOffset, kThumbBCond, 0,
+ RawLIR(cUnit, lir->dalvikOffset, kThumbBCond, 0,
(lir->opcode == kThumb2Cbz) ? kArmCondEq : kArmCondNe,
0, 0, 0, lir->target);
- oatInsertLIRAfter(lir, newInst);
+ InsertLIRAfter(lir, newInst);
/* Convert the cb[n]z to a cmp rx, #0 ] */
lir->opcode = kThumbCmpRI8;
/* operand[0] is src1 in both cb[n]z & CmpRI8 */
lir->operands[1] = 0;
lir->target = 0;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
} else {
lir->operands[1] = delta >> 1;
@@ -1124,7 +1124,7 @@
}
}
lir->operands[0] = reg;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
}
} else if (lir->opcode == kThumbBCond || lir->opcode == kThumb2BCond) {
@@ -1136,7 +1136,7 @@
delta = target - pc;
if ((lir->opcode == kThumbBCond) && (delta > 254 || delta < -256)) {
lir->opcode = kThumb2BCond;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
}
lir->operands[0] = delta >> 1;
@@ -1160,7 +1160,7 @@
// Convert to Thumb2BCond w/ kArmCondAl
lir->opcode = kThumb2BUncond;
lir->operands[0] = 0;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
} else {
lir->operands[0] = delta >> 1;
@@ -1207,19 +1207,19 @@
} else {
// convert to ldimm16l, ldimm16h, add tgt, pc, operands[0]
LIR *newMov16L =
- rawLIR(cUnit, lir->dalvikOffset, kThumb2MovImm16LST,
+ RawLIR(cUnit, lir->dalvikOffset, kThumb2MovImm16LST,
lir->operands[0], 0, reinterpret_cast<uintptr_t>(lir),
reinterpret_cast<uintptr_t>(tabRec), 0, lir->target);
- oatInsertLIRBefore(lir, newMov16L);
+ InsertLIRBefore(lir, newMov16L);
LIR *newMov16H =
- rawLIR(cUnit, lir->dalvikOffset, kThumb2MovImm16HST,
+ RawLIR(cUnit, lir->dalvikOffset, kThumb2MovImm16HST,
lir->operands[0], 0, reinterpret_cast<uintptr_t>(lir),
reinterpret_cast<uintptr_t>(tabRec), 0, lir->target);
- oatInsertLIRBefore(lir, newMov16H);
+ InsertLIRBefore(lir, newMov16H);
lir->opcode = kThumb2AddRRR;
lir->operands[1] = rARM_PC;
lir->operands[2] = lir->operands[0];
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
}
} else if (lir->opcode == kThumb2MovImm16LST) {
@@ -1361,7 +1361,7 @@
return res;
}
-int oatGetInsnSize(LIR* lir)
+int GetInsnSize(LIR* lir)
{
return EncodingMap[lir->opcode].size;
}
@@ -1369,7 +1369,7 @@
/*
* Target-dependent offset assignment.
*/
-int oatAssignInsnOffsets(CompilationUnit* cUnit)
+int AssignInsnOffsets(CompilationUnit* cUnit)
{
LIR* armLIR;
int offset = 0;
diff --git a/src/compiler/codegen/arm/call_arm.cc b/src/compiler/codegen/arm/call_arm.cc
index 0964226..3250448 100644
--- a/src/compiler/codegen/arm/call_arm.cc
+++ b/src/compiler/codegen/arm/call_arm.cc
@@ -26,7 +26,7 @@
/* Return the position of an ssa name within the argument list */
-int inPosition(CompilationUnit* cUnit, int sReg)
+int InPosition(CompilationUnit* cUnit, int sReg)
{
int vReg = SRegToVReg(cUnit, sReg);
return vReg - cUnit->numRegs;
@@ -37,9 +37,9 @@
* there. NOTE: all live arg registers must be locked prior to this call
* to avoid having them allocated as a temp by downstream utilities.
*/
-RegLocation argLoc(CompilationUnit* cUnit, RegLocation loc)
+RegLocation ArgLoc(CompilationUnit* cUnit, RegLocation loc)
{
- int argNum = inPosition(cUnit, loc.sRegLow);
+ int argNum = InPosition(cUnit, loc.sRegLow);
if (loc.wide) {
if (argNum == 2) {
// Bad case - half in register, half in frame. Just punt
@@ -64,18 +64,18 @@
/*
* Load an argument. If already in a register, just return. If in
- * the frame, we can't use the normal loadValue() because it assumed
+ * the frame, we can't use the normal LoadValue() because it assumed
* a proper frame - and we're frameless.
*/
-RegLocation loadArg(CompilationUnit* cUnit, RegLocation loc)
+RegLocation LoadArg(CompilationUnit* cUnit, RegLocation loc)
{
if (loc.location == kLocDalvikFrame) {
- int start = (inPosition(cUnit, loc.sRegLow) + 1) * sizeof(uint32_t);
- loc.lowReg = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rARM_SP, start, loc.lowReg);
+ int start = (InPosition(cUnit, loc.sRegLow) + 1) * sizeof(uint32_t);
+ loc.lowReg = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rARM_SP, start, loc.lowReg);
if (loc.wide) {
- loc.highReg = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rARM_SP, start + sizeof(uint32_t), loc.highReg);
+ loc.highReg = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rARM_SP, start + sizeof(uint32_t), loc.highReg);
}
loc.location = kLocPhysReg;
}
@@ -83,21 +83,21 @@
}
/* Lock any referenced arguments that arrive in registers */
-void lockLiveArgs(CompilationUnit* cUnit, MIR* mir)
+void LockLiveArgs(CompilationUnit* cUnit, MIR* mir)
{
int firstIn = cUnit->numRegs;
const int numArgRegs = 3; // TODO: generalize & move to RegUtil.cc
for (int i = 0; i < mir->ssaRep->numUses; i++) {
int vReg = SRegToVReg(cUnit, mir->ssaRep->uses[i]);
- int inPosition = vReg - firstIn;
- if (inPosition < numArgRegs) {
- oatLockTemp(cUnit, rARM_ARG1 + inPosition);
+ int InPosition = vReg - firstIn;
+ if (InPosition < numArgRegs) {
+ LockTemp(cUnit, rARM_ARG1 + InPosition);
}
}
}
/* Find the next MIR, which may be in a following basic block */
-MIR* getNextMir(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir)
+MIR* GetNextMir(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir)
{
BasicBlock* bb = *pBb;
MIR* origMir = mir;
@@ -122,107 +122,107 @@
}
/* Used for the "printMe" listing */
-void genPrintLabel(CompilationUnit *cUnit, MIR* mir)
+void GenPrintLabel(CompilationUnit *cUnit, MIR* mir)
{
/* Mark the beginning of a Dalvik instruction for line tracking */
char* instStr = cUnit->printMe ?
- oatGetDalvikDisassembly(cUnit, mir->dalvikInsn, "") : NULL;
- markBoundary(cUnit, mir->offset, instStr);
+ GetDalvikDisassembly(cUnit, mir->dalvikInsn, "") : NULL;
+ MarkBoundary(cUnit, mir->offset, instStr);
/* Don't generate the SSA annotation unless verbose mode is on */
if (cUnit->printMe && mir->ssaRep) {
- char* ssaString = oatGetSSAString(cUnit, mir->ssaRep);
- newLIR1(cUnit, kPseudoSSARep, reinterpret_cast<uintptr_t>(ssaString));
+ char* ssaString = GetSSAString(cUnit, mir->ssaRep);
+ NewLIR1(cUnit, kPseudoSSARep, reinterpret_cast<uintptr_t>(ssaString));
}
}
-MIR* specialIGet(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
+MIR* SpecialIGet(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
OpSize size, bool longOrDouble, bool isObject)
{
int fieldOffset;
bool isVolatile;
uint32_t fieldIdx = mir->dalvikInsn.vC;
- bool fastPath = fastInstance(cUnit, fieldIdx, fieldOffset, isVolatile, false);
+ bool fastPath = FastInstance(cUnit, fieldIdx, fieldOffset, isVolatile, false);
if (!fastPath || !(mir->optimizationFlags & MIR_IGNORE_NULL_CHECK)) {
return NULL;
}
- RegLocation rlObj = oatGetSrc(cUnit, mir, 0);
- lockLiveArgs(cUnit, mir);
- rlObj = argLoc(cUnit, rlObj);
+ RegLocation rlObj = GetSrc(cUnit, mir, 0);
+ LockLiveArgs(cUnit, mir);
+ rlObj = ArgLoc(cUnit, rlObj);
RegLocation rlDest;
if (longOrDouble) {
- rlDest = oatGetReturnWide(cUnit, false);
+ rlDest = GetReturnWide(cUnit, false);
} else {
- rlDest = oatGetReturn(cUnit, false);
+ rlDest = GetReturn(cUnit, false);
}
// Point of no return - no aborts after this
- genPrintLabel(cUnit, mir);
- rlObj = loadArg(cUnit, rlObj);
- genIGet(cUnit, fieldIdx, mir->optimizationFlags, size, rlDest, rlObj,
+ GenPrintLabel(cUnit, mir);
+ rlObj = LoadArg(cUnit, rlObj);
+ GenIGet(cUnit, fieldIdx, mir->optimizationFlags, size, rlDest, rlObj,
longOrDouble, isObject);
- return getNextMir(cUnit, bb, mir);
+ return GetNextMir(cUnit, bb, mir);
}
-MIR* specialIPut(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
+MIR* SpecialIPut(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
OpSize size, bool longOrDouble, bool isObject)
{
int fieldOffset;
bool isVolatile;
uint32_t fieldIdx = mir->dalvikInsn.vC;
- bool fastPath = fastInstance(cUnit, fieldIdx, fieldOffset, isVolatile, false);
+ bool fastPath = FastInstance(cUnit, fieldIdx, fieldOffset, isVolatile, false);
if (!fastPath || !(mir->optimizationFlags & MIR_IGNORE_NULL_CHECK)) {
return NULL;
}
RegLocation rlSrc;
RegLocation rlObj;
- lockLiveArgs(cUnit, mir);
+ LockLiveArgs(cUnit, mir);
if (longOrDouble) {
- rlSrc = oatGetSrcWide(cUnit, mir, 0);
- rlObj = oatGetSrc(cUnit, mir, 2);
+ rlSrc = GetSrcWide(cUnit, mir, 0);
+ rlObj = GetSrc(cUnit, mir, 2);
} else {
- rlSrc = oatGetSrc(cUnit, mir, 0);
- rlObj = oatGetSrc(cUnit, mir, 1);
+ rlSrc = GetSrc(cUnit, mir, 0);
+ rlObj = GetSrc(cUnit, mir, 1);
}
- rlSrc = argLoc(cUnit, rlSrc);
- rlObj = argLoc(cUnit, rlObj);
+ rlSrc = ArgLoc(cUnit, rlSrc);
+ rlObj = ArgLoc(cUnit, rlObj);
// Reject if source is split across registers & frame
if (rlObj.location == kLocInvalid) {
- oatResetRegPool(cUnit);
+ ResetRegPool(cUnit);
return NULL;
}
// Point of no return - no aborts after this
- genPrintLabel(cUnit, mir);
- rlObj = loadArg(cUnit, rlObj);
- rlSrc = loadArg(cUnit, rlSrc);
- genIPut(cUnit, fieldIdx, mir->optimizationFlags, size, rlSrc, rlObj,
+ GenPrintLabel(cUnit, mir);
+ rlObj = LoadArg(cUnit, rlObj);
+ rlSrc = LoadArg(cUnit, rlSrc);
+ GenIPut(cUnit, fieldIdx, mir->optimizationFlags, size, rlSrc, rlObj,
longOrDouble, isObject);
- return getNextMir(cUnit, bb, mir);
+ return GetNextMir(cUnit, bb, mir);
}
-MIR* specialIdentity(CompilationUnit* cUnit, MIR* mir)
+MIR* SpecialIdentity(CompilationUnit* cUnit, MIR* mir)
{
RegLocation rlSrc;
RegLocation rlDest;
bool wide = (mir->ssaRep->numUses == 2);
if (wide) {
- rlSrc = oatGetSrcWide(cUnit, mir, 0);
- rlDest = oatGetReturnWide(cUnit, false);
+ rlSrc = GetSrcWide(cUnit, mir, 0);
+ rlDest = GetReturnWide(cUnit, false);
} else {
- rlSrc = oatGetSrc(cUnit, mir, 0);
- rlDest = oatGetReturn(cUnit, false);
+ rlSrc = GetSrc(cUnit, mir, 0);
+ rlDest = GetReturn(cUnit, false);
}
- lockLiveArgs(cUnit, mir);
- rlSrc = argLoc(cUnit, rlSrc);
+ LockLiveArgs(cUnit, mir);
+ rlSrc = ArgLoc(cUnit, rlSrc);
if (rlSrc.location == kLocInvalid) {
- oatResetRegPool(cUnit);
+ ResetRegPool(cUnit);
return NULL;
}
// Point of no return - no aborts after this
- genPrintLabel(cUnit, mir);
- rlSrc = loadArg(cUnit, rlSrc);
+ GenPrintLabel(cUnit, mir);
+ rlSrc = LoadArg(cUnit, rlSrc);
if (wide) {
- storeValueWide(cUnit, rlDest, rlSrc);
+ StoreValueWide(cUnit, rlDest, rlSrc);
} else {
- storeValue(cUnit, rlDest, rlSrc);
+ StoreValue(cUnit, rlDest, rlSrc);
}
return mir;
}
@@ -230,7 +230,7 @@
/*
* Special-case code genration for simple non-throwing leaf methods.
*/
-void genSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
SpecialCaseHandler specialCase)
{
cUnit->currentDalvikOffset = mir->offset;
@@ -241,50 +241,50 @@
nextMir = mir;
break;
case kConstFunction:
- genPrintLabel(cUnit, mir);
- loadConstant(cUnit, rARM_RET0, mir->dalvikInsn.vB);
- nextMir = getNextMir(cUnit, &bb, mir);
+ GenPrintLabel(cUnit, mir);
+ LoadConstant(cUnit, rARM_RET0, mir->dalvikInsn.vB);
+ nextMir = GetNextMir(cUnit, &bb, mir);
break;
case kIGet:
- nextMir = specialIGet(cUnit, &bb, mir, kWord, false, false);
+ nextMir = SpecialIGet(cUnit, &bb, mir, kWord, false, false);
break;
case kIGetBoolean:
case kIGetByte:
- nextMir = specialIGet(cUnit, &bb, mir, kUnsignedByte, false, false);
+ nextMir = SpecialIGet(cUnit, &bb, mir, kUnsignedByte, false, false);
break;
case kIGetObject:
- nextMir = specialIGet(cUnit, &bb, mir, kWord, false, true);
+ nextMir = SpecialIGet(cUnit, &bb, mir, kWord, false, true);
break;
case kIGetChar:
- nextMir = specialIGet(cUnit, &bb, mir, kUnsignedHalf, false, false);
+ nextMir = SpecialIGet(cUnit, &bb, mir, kUnsignedHalf, false, false);
break;
case kIGetShort:
- nextMir = specialIGet(cUnit, &bb, mir, kSignedHalf, false, false);
+ nextMir = SpecialIGet(cUnit, &bb, mir, kSignedHalf, false, false);
break;
case kIGetWide:
- nextMir = specialIGet(cUnit, &bb, mir, kLong, true, false);
+ nextMir = SpecialIGet(cUnit, &bb, mir, kLong, true, false);
break;
case kIPut:
- nextMir = specialIPut(cUnit, &bb, mir, kWord, false, false);
+ nextMir = SpecialIPut(cUnit, &bb, mir, kWord, false, false);
break;
case kIPutBoolean:
case kIPutByte:
- nextMir = specialIPut(cUnit, &bb, mir, kUnsignedByte, false, false);
+ nextMir = SpecialIPut(cUnit, &bb, mir, kUnsignedByte, false, false);
break;
case kIPutObject:
- nextMir = specialIPut(cUnit, &bb, mir, kWord, false, true);
+ nextMir = SpecialIPut(cUnit, &bb, mir, kWord, false, true);
break;
case kIPutChar:
- nextMir = specialIPut(cUnit, &bb, mir, kUnsignedHalf, false, false);
+ nextMir = SpecialIPut(cUnit, &bb, mir, kUnsignedHalf, false, false);
break;
case kIPutShort:
- nextMir = specialIPut(cUnit, &bb, mir, kSignedHalf, false, false);
+ nextMir = SpecialIPut(cUnit, &bb, mir, kSignedHalf, false, false);
break;
case kIPutWide:
- nextMir = specialIPut(cUnit, &bb, mir, kLong, true, false);
+ nextMir = SpecialIPut(cUnit, &bb, mir, kLong, true, false);
break;
case kIdentity:
- nextMir = specialIdentity(cUnit, mir);
+ nextMir = SpecialIdentity(cUnit, mir);
break;
default:
return;
@@ -292,9 +292,9 @@
if (nextMir != NULL) {
cUnit->currentDalvikOffset = nextMir->offset;
if (specialCase != kIdentity) {
- genPrintLabel(cUnit, nextMir);
+ GenPrintLabel(cUnit, nextMir);
}
- newLIR1(cUnit, kThumbBx, rARM_LR);
+ NewLIR1(cUnit, kThumbBx, rARM_LR);
cUnit->coreSpillMask = 0;
cUnit->numCoreSpills = 0;
cUnit->fpSpillMask = 0;
@@ -324,28 +324,28 @@
* add rARM_PC, rDisp ; This is the branch from which we compute displacement
* cbnz rIdx, lp
*/
-void genSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpSparseSwitchTable(table);
+ DumpSparseSwitchTable(table);
}
// Add the table to the list - we'll process it later
SwitchTable *tabRec =
- static_cast<SwitchTable*>(oatNew(cUnit, sizeof(SwitchTable), true, kAllocData));
+ static_cast<SwitchTable*>(NewMem(cUnit, sizeof(SwitchTable), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
int size = table[1];
- tabRec->targets = static_cast<LIR**>(oatNew(cUnit, size * sizeof(LIR*), true, kAllocLIR));
- oatInsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
+ tabRec->targets = static_cast<LIR**>(NewMem(cUnit, size * sizeof(LIR*), true, kAllocLIR));
+ InsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
// Get the switch value
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- int rBase = oatAllocTemp(cUnit);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ int rBase = AllocTemp(cUnit);
/* Allocate key and disp temps */
- int rKey = oatAllocTemp(cUnit);
- int rDisp = oatAllocTemp(cUnit);
+ int rKey = AllocTemp(cUnit);
+ int rDisp = AllocTemp(cUnit);
// Make sure rKey's register number is less than rDisp's number for ldmia
if (rKey > rDisp) {
int tmp = rDisp;
@@ -353,69 +353,69 @@
rKey = tmp;
}
// Materialize a pointer to the switch table
- newLIR3(cUnit, kThumb2Adr, rBase, 0, reinterpret_cast<uintptr_t>(tabRec));
+ NewLIR3(cUnit, kThumb2Adr, rBase, 0, reinterpret_cast<uintptr_t>(tabRec));
// Set up rIdx
- int rIdx = oatAllocTemp(cUnit);
- loadConstant(cUnit, rIdx, size);
+ int rIdx = AllocTemp(cUnit);
+ LoadConstant(cUnit, rIdx, size);
// Establish loop branch target
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
// Load next key/disp
- newLIR2(cUnit, kThumb2LdmiaWB, rBase, (1 << rKey) | (1 << rDisp));
- opRegReg(cUnit, kOpCmp, rKey, rlSrc.lowReg);
+ NewLIR2(cUnit, kThumb2LdmiaWB, rBase, (1 << rKey) | (1 << rDisp));
+ OpRegReg(cUnit, kOpCmp, rKey, rlSrc.lowReg);
// Go if match. NOTE: No instruction set switch here - must stay Thumb2
- opIT(cUnit, kArmCondEq, "");
- LIR* switchBranch = newLIR1(cUnit, kThumb2AddPCR, rDisp);
+ OpIT(cUnit, kArmCondEq, "");
+ LIR* switchBranch = NewLIR1(cUnit, kThumb2AddPCR, rDisp);
tabRec->anchor = switchBranch;
// Needs to use setflags encoding here
- newLIR3(cUnit, kThumb2SubsRRI12, rIdx, rIdx, 1);
- opCondBranch(cUnit, kCondNe, target);
+ NewLIR3(cUnit, kThumb2SubsRRI12, rIdx, rIdx, 1);
+ OpCondBranch(cUnit, kCondNe, target);
}
-void genPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpPackedSwitchTable(table);
+ DumpPackedSwitchTable(table);
}
// Add the table to the list - we'll process it later
SwitchTable *tabRec =
- static_cast<SwitchTable*>(oatNew(cUnit, sizeof(SwitchTable), true, kAllocData));
+ static_cast<SwitchTable*>(NewMem(cUnit, sizeof(SwitchTable), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
int size = table[1];
- tabRec->targets = static_cast<LIR**>(oatNew(cUnit, size * sizeof(LIR*), true, kAllocLIR));
- oatInsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
+ tabRec->targets = static_cast<LIR**>(NewMem(cUnit, size * sizeof(LIR*), true, kAllocLIR));
+ InsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
// Get the switch value
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- int tableBase = oatAllocTemp(cUnit);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ int tableBase = AllocTemp(cUnit);
// Materialize a pointer to the switch table
- newLIR3(cUnit, kThumb2Adr, tableBase, 0, reinterpret_cast<uintptr_t>(tabRec));
+ NewLIR3(cUnit, kThumb2Adr, tableBase, 0, reinterpret_cast<uintptr_t>(tabRec));
int lowKey = s4FromSwitchData(&table[2]);
int keyReg;
// Remove the bias, if necessary
if (lowKey == 0) {
keyReg = rlSrc.lowReg;
} else {
- keyReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpSub, keyReg, rlSrc.lowReg, lowKey);
+ keyReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpSub, keyReg, rlSrc.lowReg, lowKey);
}
// Bounds check - if < 0 or >= size continue following switch
- opRegImm(cUnit, kOpCmp, keyReg, size-1);
- LIR* branchOver = opCondBranch(cUnit, kCondHi, NULL);
+ OpRegImm(cUnit, kOpCmp, keyReg, size-1);
+ LIR* branchOver = OpCondBranch(cUnit, kCondHi, NULL);
// Load the displacement from the switch table
- int dispReg = oatAllocTemp(cUnit);
- loadBaseIndexed(cUnit, tableBase, keyReg, dispReg, 2, kWord);
+ int dispReg = AllocTemp(cUnit);
+ LoadBaseIndexed(cUnit, tableBase, keyReg, dispReg, 2, kWord);
// ..and go! NOTE: No instruction set switch here - must stay Thumb2
- LIR* switchBranch = newLIR1(cUnit, kThumb2AddPCR, dispReg);
+ LIR* switchBranch = NewLIR1(cUnit, kThumb2AddPCR, dispReg);
tabRec->anchor = switchBranch;
/* branchOver target here */
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
}
@@ -429,30 +429,30 @@
*
* Total size is 4+(width * size + 1)/2 16-bit code units.
*/
-void genFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc)
+void GenFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
// Add the table to the list - we'll process it later
FillArrayData *tabRec =
- static_cast<FillArrayData*>(oatNew(cUnit, sizeof(FillArrayData), true, kAllocData));
+ static_cast<FillArrayData*>(NewMem(cUnit, sizeof(FillArrayData), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
uint16_t width = tabRec->table[1];
uint32_t size = tabRec->table[2] | ((static_cast<uint32_t>(tabRec->table[3])) << 16);
tabRec->size = (size * width) + 8;
- oatInsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
+ InsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
// Making a call - use explicit registers
- oatFlushAllRegs(cUnit); /* Everything to home location */
- loadValueDirectFixed(cUnit, rlSrc, r0);
- loadWordDisp(cUnit, rARM_SELF, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode),
+ FlushAllRegs(cUnit); /* Everything to home location */
+ LoadValueDirectFixed(cUnit, rlSrc, r0);
+ LoadWordDisp(cUnit, rARM_SELF, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode),
rARM_LR);
// Materialize a pointer to the fill data image
- newLIR3(cUnit, kThumb2Adr, r1, 0, reinterpret_cast<uintptr_t>(tabRec));
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rARM_LR);
- markSafepointPC(cUnit, callInst);
+ NewLIR3(cUnit, kThumb2Adr, r1, 0, reinterpret_cast<uintptr_t>(tabRec));
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rARM_LR);
+ MarkSafepointPC(cUnit, callInst);
}
/*
@@ -481,33 +481,33 @@
* preserved.
*
*/
-void genMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
+ FlushAllRegs(cUnit);
DCHECK_EQ(LW_SHAPE_THIN, 0);
- loadValueDirectFixed(cUnit, rlSrc, r0); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, r0, optFlags);
- loadWordDisp(cUnit, rARM_SELF, Thread::ThinLockIdOffset().Int32Value(), r2);
- newLIR3(cUnit, kThumb2Ldrex, r1, r0,
+ LoadValueDirectFixed(cUnit, rlSrc, r0); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, r0, optFlags);
+ LoadWordDisp(cUnit, rARM_SELF, Thread::ThinLockIdOffset().Int32Value(), r2);
+ NewLIR3(cUnit, kThumb2Ldrex, r1, r0,
Object::MonitorOffset().Int32Value() >> 2); // Get object->lock
// Align owner
- opRegImm(cUnit, kOpLsl, r2, LW_LOCK_OWNER_SHIFT);
+ OpRegImm(cUnit, kOpLsl, r2, LW_LOCK_OWNER_SHIFT);
// Is lock unheld on lock or held by us (==threadId) on unlock?
- newLIR4(cUnit, kThumb2Bfi, r2, r1, 0, LW_LOCK_OWNER_SHIFT - 1);
- newLIR3(cUnit, kThumb2Bfc, r1, LW_HASH_STATE_SHIFT, LW_LOCK_OWNER_SHIFT - 1);
- opRegImm(cUnit, kOpCmp, r1, 0);
- opIT(cUnit, kArmCondEq, "");
- newLIR4(cUnit, kThumb2Strex, r1, r2, r0,
+ NewLIR4(cUnit, kThumb2Bfi, r2, r1, 0, LW_LOCK_OWNER_SHIFT - 1);
+ NewLIR3(cUnit, kThumb2Bfc, r1, LW_HASH_STATE_SHIFT, LW_LOCK_OWNER_SHIFT - 1);
+ OpRegImm(cUnit, kOpCmp, r1, 0);
+ OpIT(cUnit, kArmCondEq, "");
+ NewLIR4(cUnit, kThumb2Strex, r1, r2, r0,
Object::MonitorOffset().Int32Value() >> 2);
- opRegImm(cUnit, kOpCmp, r1, 0);
- opIT(cUnit, kArmCondNe, "T");
+ OpRegImm(cUnit, kOpCmp, r1, 0);
+ OpIT(cUnit, kArmCondNe, "T");
// Go expensive route - artLockObjectFromCode(self, obj);
- loadWordDisp(cUnit, rARM_SELF, ENTRYPOINT_OFFSET(pLockObjectFromCode), rARM_LR);
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rARM_LR);
- markSafepointPC(cUnit, callInst);
- oatGenMemBarrier(cUnit, kLoadLoad);
+ LoadWordDisp(cUnit, rARM_SELF, ENTRYPOINT_OFFSET(pLockObjectFromCode), rARM_LR);
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rARM_LR);
+ MarkSafepointPC(cUnit, callInst);
+ GenMemBarrier(cUnit, kLoadLoad);
}
/*
@@ -516,51 +516,51 @@
* a zero recursion count, it's safe to punch it back to the
* initial, unlock thin state with a store word.
*/
-void genMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
DCHECK_EQ(LW_SHAPE_THIN, 0);
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, r0); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, r0, optFlags);
- loadWordDisp(cUnit, r0, Object::MonitorOffset().Int32Value(), r1); // Get lock
- loadWordDisp(cUnit, rARM_SELF, Thread::ThinLockIdOffset().Int32Value(), r2);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, r0); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, r0, optFlags);
+ LoadWordDisp(cUnit, r0, Object::MonitorOffset().Int32Value(), r1); // Get lock
+ LoadWordDisp(cUnit, rARM_SELF, Thread::ThinLockIdOffset().Int32Value(), r2);
// Is lock unheld on lock or held by us (==threadId) on unlock?
- opRegRegImm(cUnit, kOpAnd, r3, r1,
+ OpRegRegImm(cUnit, kOpAnd, r3, r1,
(LW_HASH_STATE_MASK << LW_HASH_STATE_SHIFT));
// Align owner
- opRegImm(cUnit, kOpLsl, r2, LW_LOCK_OWNER_SHIFT);
- newLIR3(cUnit, kThumb2Bfc, r1, LW_HASH_STATE_SHIFT, LW_LOCK_OWNER_SHIFT - 1);
- opRegReg(cUnit, kOpSub, r1, r2);
- opIT(cUnit, kArmCondEq, "EE");
- storeWordDisp(cUnit, r0, Object::MonitorOffset().Int32Value(), r3);
+ OpRegImm(cUnit, kOpLsl, r2, LW_LOCK_OWNER_SHIFT);
+ NewLIR3(cUnit, kThumb2Bfc, r1, LW_HASH_STATE_SHIFT, LW_LOCK_OWNER_SHIFT - 1);
+ OpRegReg(cUnit, kOpSub, r1, r2);
+ OpIT(cUnit, kArmCondEq, "EE");
+ StoreWordDisp(cUnit, r0, Object::MonitorOffset().Int32Value(), r3);
// Go expensive route - UnlockObjectFromCode(obj);
- loadWordDisp(cUnit, rARM_SELF, ENTRYPOINT_OFFSET(pUnlockObjectFromCode), rARM_LR);
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rARM_LR);
- markSafepointPC(cUnit, callInst);
- oatGenMemBarrier(cUnit, kStoreLoad);
+ LoadWordDisp(cUnit, rARM_SELF, ENTRYPOINT_OFFSET(pUnlockObjectFromCode), rARM_LR);
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rARM_LR);
+ MarkSafepointPC(cUnit, callInst);
+ GenMemBarrier(cUnit, kStoreLoad);
}
/*
* Mark garbage collection card. Skip if the value we're storing is null.
*/
-void markGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
+void MarkGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
{
- int regCardBase = oatAllocTemp(cUnit);
- int regCardNo = oatAllocTemp(cUnit);
- LIR* branchOver = opCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
- loadWordDisp(cUnit, rARM_SELF, Thread::CardTableOffset().Int32Value(), regCardBase);
- opRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
- storeBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
+ int regCardBase = AllocTemp(cUnit);
+ int regCardNo = AllocTemp(cUnit);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
+ LoadWordDisp(cUnit, rARM_SELF, Thread::CardTableOffset().Int32Value(), regCardBase);
+ OpRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
+ StoreBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
kUnsignedByte);
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
- oatFreeTemp(cUnit, regCardBase);
- oatFreeTemp(cUnit, regCardNo);
+ FreeTemp(cUnit, regCardBase);
+ FreeTemp(cUnit, regCardNo);
}
-void genEntrySequence(CompilationUnit* cUnit, RegLocation* argLocs,
+void GenEntrySequence(CompilationUnit* cUnit, RegLocation* ArgLocs,
RegLocation rlMethod)
{
int spillCount = cUnit->numCoreSpills + cUnit->numFPSpills;
@@ -570,10 +570,10 @@
* expanding the frame or flushing. This leaves the utility
* code with a single temp: r12. This should be enough.
*/
- oatLockTemp(cUnit, r0);
- oatLockTemp(cUnit, r1);
- oatLockTemp(cUnit, r2);
- oatLockTemp(cUnit, r3);
+ LockTemp(cUnit, r0);
+ LockTemp(cUnit, r1);
+ LockTemp(cUnit, r2);
+ LockTemp(cUnit, r3);
/*
* We can safely skip the stack overflow check if we're
@@ -582,13 +582,13 @@
bool skipOverflowCheck = ((cUnit->attrs & METHOD_IS_LEAF) &&
(static_cast<size_t>(cUnit->frameSize) <
Thread::kStackOverflowReservedBytes));
- newLIR0(cUnit, kPseudoMethodEntry);
+ NewLIR0(cUnit, kPseudoMethodEntry);
if (!skipOverflowCheck) {
/* Load stack limit */
- loadWordDisp(cUnit, rARM_SELF, Thread::StackEndOffset().Int32Value(), r12);
+ LoadWordDisp(cUnit, rARM_SELF, Thread::StackEndOffset().Int32Value(), r12);
}
/* Spill core callee saves */
- newLIR1(cUnit, kThumb2Push, cUnit->coreSpillMask);
+ NewLIR1(cUnit, kThumb2Push, cUnit->coreSpillMask);
/* Need to spill any FP regs? */
if (cUnit->numFPSpills) {
/*
@@ -596,49 +596,49 @@
* they are pushed as a contiguous block. When promoting from
* the fp set, we must allocate all singles from s16..highest-promoted
*/
- newLIR1(cUnit, kThumb2VPushCS, cUnit->numFPSpills);
+ NewLIR1(cUnit, kThumb2VPushCS, cUnit->numFPSpills);
}
if (!skipOverflowCheck) {
- opRegRegImm(cUnit, kOpSub, rARM_LR, rARM_SP, cUnit->frameSize - (spillCount * 4));
- genRegRegCheck(cUnit, kCondCc, rARM_LR, r12, kThrowStackOverflow);
- opRegCopy(cUnit, rARM_SP, rARM_LR); // Establish stack
+ OpRegRegImm(cUnit, kOpSub, rARM_LR, rARM_SP, cUnit->frameSize - (spillCount * 4));
+ GenRegRegCheck(cUnit, kCondCc, rARM_LR, r12, kThrowStackOverflow);
+ OpRegCopy(cUnit, rARM_SP, rARM_LR); // Establish stack
} else {
- opRegImm(cUnit, kOpSub, rARM_SP, cUnit->frameSize - (spillCount * 4));
+ OpRegImm(cUnit, kOpSub, rARM_SP, cUnit->frameSize - (spillCount * 4));
}
- flushIns(cUnit, argLocs, rlMethod);
+ FlushIns(cUnit, ArgLocs, rlMethod);
- oatFreeTemp(cUnit, r0);
- oatFreeTemp(cUnit, r1);
- oatFreeTemp(cUnit, r2);
- oatFreeTemp(cUnit, r3);
+ FreeTemp(cUnit, r0);
+ FreeTemp(cUnit, r1);
+ FreeTemp(cUnit, r2);
+ FreeTemp(cUnit, r3);
}
-void genExitSequence(CompilationUnit* cUnit)
+void GenExitSequence(CompilationUnit* cUnit)
{
int spillCount = cUnit->numCoreSpills + cUnit->numFPSpills;
/*
* In the exit path, r0/r1 are live - make sure they aren't
* allocated by the register utilities as temps.
*/
- oatLockTemp(cUnit, r0);
- oatLockTemp(cUnit, r1);
+ LockTemp(cUnit, r0);
+ LockTemp(cUnit, r1);
- newLIR0(cUnit, kPseudoMethodExit);
- opRegImm(cUnit, kOpAdd, rARM_SP, cUnit->frameSize - (spillCount * 4));
+ NewLIR0(cUnit, kPseudoMethodExit);
+ OpRegImm(cUnit, kOpAdd, rARM_SP, cUnit->frameSize - (spillCount * 4));
/* Need to restore any FP callee saves? */
if (cUnit->numFPSpills) {
- newLIR1(cUnit, kThumb2VPopCS, cUnit->numFPSpills);
+ NewLIR1(cUnit, kThumb2VPopCS, cUnit->numFPSpills);
}
if (cUnit->coreSpillMask & (1 << rARM_LR)) {
/* Unspill rARM_LR to rARM_PC */
cUnit->coreSpillMask &= ~(1 << rARM_LR);
cUnit->coreSpillMask |= (1 << rARM_PC);
}
- newLIR1(cUnit, kThumb2Pop, cUnit->coreSpillMask);
+ NewLIR1(cUnit, kThumb2Pop, cUnit->coreSpillMask);
if (!(cUnit->coreSpillMask & (1 << rARM_PC))) {
/* We didn't pop to rARM_PC, so must do a bv rARM_LR */
- newLIR1(cUnit, kThumbBx, rARM_LR);
+ NewLIR1(cUnit, kThumbBx, rARM_LR);
}
}
diff --git a/src/compiler/codegen/arm/fp_arm.cc b/src/compiler/codegen/arm/fp_arm.cc
index 3b0d540..3584971 100644
--- a/src/compiler/codegen/arm/fp_arm.cc
+++ b/src/compiler/codegen/arm/fp_arm.cc
@@ -20,7 +20,7 @@
namespace art {
-bool genArithOpFloat(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenArithOpFloat(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
int op = kThumbBkpt;
@@ -50,20 +50,20 @@
case Instruction::REM_FLOAT_2ADDR:
case Instruction::REM_FLOAT:
case Instruction::NEG_FLOAT: {
- return genArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
}
default:
return true;
}
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR3(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR3(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-bool genArithOpDouble(CompilationUnit* cUnit, Instruction::Code opcode,
+bool GenArithOpDouble(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2)
{
int op = kThumbBkpt;
@@ -89,26 +89,26 @@
case Instruction::REM_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE:
case Instruction::NEG_DOUBLE: {
- return genArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
}
default:
return true;
}
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
DCHECK(rlSrc1.wide);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
DCHECK(rlSrc2.wide);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
DCHECK(rlDest.wide);
DCHECK(rlResult.wide);
- newLIR3(cUnit, op, s2d(rlResult.lowReg, rlResult.highReg), s2d(rlSrc1.lowReg, rlSrc1.highReg),
- s2d(rlSrc2.lowReg, rlSrc2.highReg));
- storeValueWide(cUnit, rlDest, rlResult);
+ NewLIR3(cUnit, op, S2d(rlResult.lowReg, rlResult.highReg), S2d(rlSrc1.lowReg, rlSrc1.highReg),
+ S2d(rlSrc2.lowReg, rlSrc2.highReg));
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genConversion(CompilationUnit* cUnit, Instruction::Code opcode,
+bool GenConversion(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc)
{
int op = kThumbBkpt;
@@ -138,30 +138,30 @@
case Instruction::FLOAT_TO_LONG:
case Instruction::LONG_TO_FLOAT:
case Instruction::DOUBLE_TO_LONG:
- return genConversionPortable(cUnit, opcode, rlDest, rlSrc);
+ return GenConversionPortable(cUnit, opcode, rlDest, rlSrc);
default:
return true;
}
if (rlSrc.wide) {
- rlSrc = loadValueWide(cUnit, rlSrc, kFPReg);
- srcReg = s2d(rlSrc.lowReg, rlSrc.highReg);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kFPReg);
+ srcReg = S2d(rlSrc.lowReg, rlSrc.highReg);
} else {
- rlSrc = loadValue(cUnit, rlSrc, kFPReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kFPReg);
srcReg = rlSrc.lowReg;
}
if (rlDest.wide) {
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, op, s2d(rlResult.lowReg, rlResult.highReg), srcReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, op, S2d(rlResult.lowReg, rlResult.highReg), srcReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, op, rlResult.lowReg, srcReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, op, rlResult.lowReg, srcReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
return false;
}
-void genFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
bool gtBias, bool isDouble)
{
LIR* labelList = cUnit->blockLabelList;
@@ -169,20 +169,20 @@
RegLocation rlSrc1;
RegLocation rlSrc2;
if (isDouble) {
- rlSrc1 = oatGetSrcWide(cUnit, mir, 0);
- rlSrc2 = oatGetSrcWide(cUnit, mir, 2);
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
- newLIR2(cUnit, kThumb2Vcmpd, s2d(rlSrc1.lowReg, rlSrc2.highReg),
- s2d(rlSrc2.lowReg, rlSrc2.highReg));
+ rlSrc1 = GetSrcWide(cUnit, mir, 0);
+ rlSrc2 = GetSrcWide(cUnit, mir, 2);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
+ NewLIR2(cUnit, kThumb2Vcmpd, S2d(rlSrc1.lowReg, rlSrc2.highReg),
+ S2d(rlSrc2.lowReg, rlSrc2.highReg));
} else {
- rlSrc1 = oatGetSrc(cUnit, mir, 0);
- rlSrc2 = oatGetSrc(cUnit, mir, 1);
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
- newLIR2(cUnit, kThumb2Vcmps, rlSrc1.lowReg, rlSrc2.lowReg);
+ rlSrc1 = GetSrc(cUnit, mir, 0);
+ rlSrc2 = GetSrc(cUnit, mir, 1);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
+ NewLIR2(cUnit, kThumb2Vcmps, rlSrc1.lowReg, rlSrc2.lowReg);
}
- newLIR0(cUnit, kThumb2Fmstat);
+ NewLIR0(cUnit, kThumb2Fmstat);
ConditionCode ccode = static_cast<ConditionCode>(mir->dalvikInsn.arg[0]);
switch(ccode) {
case kCondEq:
@@ -211,11 +211,11 @@
default:
LOG(FATAL) << "Unexpected ccode: " << ccode;
}
- opCondBranch(cUnit, ccode, target);
+ OpCondBranch(cUnit, ccode, target);
}
-bool genCmpFP(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenCmpFP(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
bool isDouble;
@@ -243,77 +243,77 @@
return true;
}
if (isDouble) {
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
- oatClobberSReg(cUnit, rlDest.sRegLow);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- loadConstant(cUnit, rlResult.lowReg, defaultResult);
- newLIR2(cUnit, kThumb2Vcmpd, s2d(rlSrc1.lowReg, rlSrc2.highReg),
- s2d(rlSrc2.lowReg, rlSrc2.highReg));
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
+ ClobberSReg(cUnit, rlDest.sRegLow);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ LoadConstant(cUnit, rlResult.lowReg, defaultResult);
+ NewLIR2(cUnit, kThumb2Vcmpd, S2d(rlSrc1.lowReg, rlSrc2.highReg),
+ S2d(rlSrc2.lowReg, rlSrc2.highReg));
} else {
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
- oatClobberSReg(cUnit, rlDest.sRegLow);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- loadConstant(cUnit, rlResult.lowReg, defaultResult);
- newLIR2(cUnit, kThumb2Vcmps, rlSrc1.lowReg, rlSrc2.lowReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
+ ClobberSReg(cUnit, rlDest.sRegLow);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ LoadConstant(cUnit, rlResult.lowReg, defaultResult);
+ NewLIR2(cUnit, kThumb2Vcmps, rlSrc1.lowReg, rlSrc2.lowReg);
}
DCHECK(!ARM_FPREG(rlResult.lowReg));
- newLIR0(cUnit, kThumb2Fmstat);
+ NewLIR0(cUnit, kThumb2Fmstat);
- opIT(cUnit, (defaultResult == -1) ? kArmCondGt : kArmCondMi, "");
- newLIR2(cUnit, kThumb2MovImmShift, rlResult.lowReg,
- modifiedImmediate(-defaultResult)); // Must not alter ccodes
- genBarrier(cUnit);
+ OpIT(cUnit, (defaultResult == -1) ? kArmCondGt : kArmCondMi, "");
+ NewLIR2(cUnit, kThumb2MovImmShift, rlResult.lowReg,
+ ModifiedImmediate(-defaultResult)); // Must not alter ccodes
+ GenBarrier(cUnit);
- opIT(cUnit, kArmCondEq, "");
- loadConstant(cUnit, rlResult.lowReg, 0);
- genBarrier(cUnit);
+ OpIT(cUnit, kArmCondEq, "");
+ LoadConstant(cUnit, rlResult.lowReg, 0);
+ GenBarrier(cUnit);
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-void genNegFloat(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
+void GenNegFloat(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
RegLocation rlResult;
- rlSrc = loadValue(cUnit, rlSrc, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, kThumb2Vnegs, rlResult.lowReg, rlSrc.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc = LoadValue(cUnit, rlSrc, kFPReg);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, kThumb2Vnegs, rlResult.lowReg, rlSrc.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
-void genNegDouble(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
+void GenNegDouble(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
RegLocation rlResult;
- rlSrc = loadValueWide(cUnit, rlSrc, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, kThumb2Vnegd, s2d(rlResult.lowReg, rlResult.highReg),
- s2d(rlSrc.lowReg, rlSrc.highReg));
- storeValueWide(cUnit, rlDest, rlResult);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kFPReg);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, kThumb2Vnegd, S2d(rlResult.lowReg, rlResult.highReg),
+ S2d(rlSrc.lowReg, rlSrc.highReg));
+ StoreValueWide(cUnit, rlDest, rlResult);
}
-bool genInlinedSqrt(CompilationUnit* cUnit, CallInfo* info) {
+bool GenInlinedSqrt(CompilationUnit* cUnit, CallInfo* info) {
DCHECK_EQ(cUnit->instructionSet, kThumb2);
LIR *branch;
RegLocation rlSrc = info->args[0];
- RegLocation rlDest = inlineTargetWide(cUnit, info); // double place for result
- rlSrc = loadValueWide(cUnit, rlSrc, kFPReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, kThumb2Vsqrtd, s2d(rlResult.lowReg, rlResult.highReg),
- s2d(rlSrc.lowReg, rlSrc.highReg));
- newLIR2(cUnit, kThumb2Vcmpd, s2d(rlResult.lowReg, rlResult.highReg),
- s2d(rlResult.lowReg, rlResult.highReg));
- newLIR0(cUnit, kThumb2Fmstat);
- branch = newLIR2(cUnit, kThumbBCond, 0, kArmCondEq);
- oatClobberCalleeSave(cUnit);
- oatLockCallTemps(cUnit); // Using fixed registers
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pSqrt));
- newLIR3(cUnit, kThumb2Fmrrd, r0, r1, s2d(rlSrc.lowReg, rlSrc.highReg));
- newLIR1(cUnit, kThumbBlxR, rTgt);
- newLIR3(cUnit, kThumb2Fmdrr, s2d(rlResult.lowReg, rlResult.highReg), r0, r1);
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
- storeValueWide(cUnit, rlDest, rlResult);
+ RegLocation rlDest = InlineTargetWide(cUnit, info); // double place for result
+ rlSrc = LoadValueWide(cUnit, rlSrc, kFPReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, kThumb2Vsqrtd, S2d(rlResult.lowReg, rlResult.highReg),
+ S2d(rlSrc.lowReg, rlSrc.highReg));
+ NewLIR2(cUnit, kThumb2Vcmpd, S2d(rlResult.lowReg, rlResult.highReg),
+ S2d(rlResult.lowReg, rlResult.highReg));
+ NewLIR0(cUnit, kThumb2Fmstat);
+ branch = NewLIR2(cUnit, kThumbBCond, 0, kArmCondEq);
+ ClobberCalleeSave(cUnit);
+ LockCallTemps(cUnit); // Using fixed registers
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pSqrt));
+ NewLIR3(cUnit, kThumb2Fmrrd, r0, r1, S2d(rlSrc.lowReg, rlSrc.highReg));
+ NewLIR1(cUnit, kThumbBlxR, rTgt);
+ NewLIR3(cUnit, kThumb2Fmdrr, S2d(rlResult.lowReg, rlResult.highReg), r0, r1);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ StoreValueWide(cUnit, rlDest, rlResult);
return true;
}
diff --git a/src/compiler/codegen/arm/int_arm.cc b/src/compiler/codegen/arm/int_arm.cc
index f54c58c..bdb3bea 100644
--- a/src/compiler/codegen/arm/int_arm.cc
+++ b/src/compiler/codegen/arm/int_arm.cc
@@ -24,11 +24,11 @@
namespace art {
-LIR* opCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1,
+LIR* OpCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1,
int src2, LIR* target)
{
- opRegReg(cUnit, kOpCmp, src1, src2);
- return opCondBranch(cUnit, cond, target);
+ OpRegReg(cUnit, kOpCmp, src1, src2);
+ return OpCondBranch(cUnit, cond, target);
}
/*
@@ -41,7 +41,7 @@
* met, and an "E" means the instruction is executed if the condition
* is not met.
*/
-LIR* opIT(CompilationUnit* cUnit, ArmConditionCode code, const char* guide)
+LIR* OpIT(CompilationUnit* cUnit, ArmConditionCode code, const char* guide)
{
int mask;
int condBit = code & 1;
@@ -62,11 +62,11 @@
case 0:
break;
default:
- LOG(FATAL) << "OAT: bad case in opIT";
+ LOG(FATAL) << "OAT: bad case in OpIT";
}
mask = (mask3 << 3) | (mask2 << 2) | (mask1 << 1) |
(1 << (3 - strlen(guide)));
- return newLIR2(cUnit, kThumb2It, code, mask);
+ return NewLIR2(cUnit, kThumb2It, code, mask);
}
/*
@@ -84,122 +84,122 @@
* neg rX
* done:
*/
-void genCmpLong(CompilationUnit* cUnit, RegLocation rlDest,
+void GenCmpLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
LIR* target1;
LIR* target2;
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
- int tReg = oatAllocTemp(cUnit);
- loadConstant(cUnit, tReg, -1);
- opRegReg(cUnit, kOpCmp, rlSrc1.highReg, rlSrc2.highReg);
- LIR* branch1 = opCondBranch(cUnit, kCondLt, NULL);
- LIR* branch2 = opCondBranch(cUnit, kCondGt, NULL);
- opRegRegReg(cUnit, kOpSub, tReg, rlSrc1.lowReg, rlSrc2.lowReg);
- LIR* branch3 = opCondBranch(cUnit, kCondEq, NULL);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
+ int tReg = AllocTemp(cUnit);
+ LoadConstant(cUnit, tReg, -1);
+ OpRegReg(cUnit, kOpCmp, rlSrc1.highReg, rlSrc2.highReg);
+ LIR* branch1 = OpCondBranch(cUnit, kCondLt, NULL);
+ LIR* branch2 = OpCondBranch(cUnit, kCondGt, NULL);
+ OpRegRegReg(cUnit, kOpSub, tReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ LIR* branch3 = OpCondBranch(cUnit, kCondEq, NULL);
- opIT(cUnit, kArmCondHi, "E");
- newLIR2(cUnit, kThumb2MovImmShift, tReg, modifiedImmediate(-1));
- loadConstant(cUnit, tReg, 1);
- genBarrier(cUnit);
+ OpIT(cUnit, kArmCondHi, "E");
+ NewLIR2(cUnit, kThumb2MovImmShift, tReg, ModifiedImmediate(-1));
+ LoadConstant(cUnit, tReg, 1);
+ GenBarrier(cUnit);
- target2 = newLIR0(cUnit, kPseudoTargetLabel);
- opRegReg(cUnit, kOpNeg, tReg, tReg);
+ target2 = NewLIR0(cUnit, kPseudoTargetLabel);
+ OpRegReg(cUnit, kOpNeg, tReg, tReg);
- target1 = newLIR0(cUnit, kPseudoTargetLabel);
+ target1 = NewLIR0(cUnit, kPseudoTargetLabel);
- RegLocation rlTemp = locCReturn(); // Just using as template, will change
+ RegLocation rlTemp = LocCReturn(); // Just using as template, will change
rlTemp.lowReg = tReg;
- storeValue(cUnit, rlDest, rlTemp);
- oatFreeTemp(cUnit, tReg);
+ StoreValue(cUnit, rlDest, rlTemp);
+ FreeTemp(cUnit, tReg);
branch1->target = target1;
branch2->target = target2;
branch3->target = branch1->target;
}
-void genFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
+void GenFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
{
LIR* labelList = cUnit->blockLabelList;
LIR* taken = &labelList[bb->taken->id];
LIR* notTaken = &labelList[bb->fallThrough->id];
- RegLocation rlSrc1 = oatGetSrcWide(cUnit, mir, 0);
- RegLocation rlSrc2 = oatGetSrcWide(cUnit, mir, 2);
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
+ RegLocation rlSrc1 = GetSrcWide(cUnit, mir, 0);
+ RegLocation rlSrc2 = GetSrcWide(cUnit, mir, 2);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
ConditionCode ccode = static_cast<ConditionCode>(mir->dalvikInsn.arg[0]);
- opRegReg(cUnit, kOpCmp, rlSrc1.highReg, rlSrc2.highReg);
+ OpRegReg(cUnit, kOpCmp, rlSrc1.highReg, rlSrc2.highReg);
switch(ccode) {
case kCondEq:
- opCondBranch(cUnit, kCondNe, notTaken);
+ OpCondBranch(cUnit, kCondNe, notTaken);
break;
case kCondNe:
- opCondBranch(cUnit, kCondNe, taken);
+ OpCondBranch(cUnit, kCondNe, taken);
break;
case kCondLt:
- opCondBranch(cUnit, kCondLt, taken);
- opCondBranch(cUnit, kCondGt, notTaken);
+ OpCondBranch(cUnit, kCondLt, taken);
+ OpCondBranch(cUnit, kCondGt, notTaken);
ccode = kCondCc;
break;
case kCondLe:
- opCondBranch(cUnit, kCondLt, taken);
- opCondBranch(cUnit, kCondGt, notTaken);
+ OpCondBranch(cUnit, kCondLt, taken);
+ OpCondBranch(cUnit, kCondGt, notTaken);
ccode = kCondLs;
break;
case kCondGt:
- opCondBranch(cUnit, kCondGt, taken);
- opCondBranch(cUnit, kCondLt, notTaken);
+ OpCondBranch(cUnit, kCondGt, taken);
+ OpCondBranch(cUnit, kCondLt, notTaken);
ccode = kCondHi;
break;
case kCondGe:
- opCondBranch(cUnit, kCondGt, taken);
- opCondBranch(cUnit, kCondLt, notTaken);
+ OpCondBranch(cUnit, kCondGt, taken);
+ OpCondBranch(cUnit, kCondLt, notTaken);
ccode = kCondCs;
break;
default:
LOG(FATAL) << "Unexpected ccode: " << ccode;
}
- opRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
- opCondBranch(cUnit, ccode, taken);
+ OpRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
+ OpCondBranch(cUnit, ccode, taken);
}
/*
* Generate a register comparison to an immediate and branch. Caller
* is responsible for setting branch target field.
*/
-LIR* opCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg,
+LIR* OpCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg,
int checkValue, LIR* target)
{
LIR* branch;
int modImm;
- ArmConditionCode armCond = oatArmConditionEncoding(cond);
+ ArmConditionCode armCond = ArmConditionEncoding(cond);
if ((ARM_LOWREG(reg)) && (checkValue == 0) &&
((armCond == kArmCondEq) || (armCond == kArmCondNe))) {
- branch = newLIR2(cUnit, (armCond == kArmCondEq) ? kThumb2Cbz : kThumb2Cbnz,
+ branch = NewLIR2(cUnit, (armCond == kArmCondEq) ? kThumb2Cbz : kThumb2Cbnz,
reg, 0);
} else {
- modImm = modifiedImmediate(checkValue);
+ modImm = ModifiedImmediate(checkValue);
if (ARM_LOWREG(reg) && ((checkValue & 0xff) == checkValue)) {
- newLIR2(cUnit, kThumbCmpRI8, reg, checkValue);
+ NewLIR2(cUnit, kThumbCmpRI8, reg, checkValue);
} else if (modImm >= 0) {
- newLIR2(cUnit, kThumb2CmpRI8, reg, modImm);
+ NewLIR2(cUnit, kThumb2CmpRI8, reg, modImm);
} else {
- int tReg = oatAllocTemp(cUnit);
- loadConstant(cUnit, tReg, checkValue);
- opRegReg(cUnit, kOpCmp, reg, tReg);
+ int tReg = AllocTemp(cUnit);
+ LoadConstant(cUnit, tReg, checkValue);
+ OpRegReg(cUnit, kOpCmp, reg, tReg);
}
- branch = newLIR2(cUnit, kThumbBCond, 0, armCond);
+ branch = NewLIR2(cUnit, kThumbBCond, 0, armCond);
}
branch->target = target;
return branch;
}
-LIR* opRegCopyNoInsert(CompilationUnit* cUnit, int rDest, int rSrc)
+LIR* OpRegCopyNoInsert(CompilationUnit* cUnit, int rDest, int rSrc)
{
LIR* res;
int opcode;
if (ARM_FPREG(rDest) || ARM_FPREG(rSrc))
- return fpRegCopy(cUnit, rDest, rSrc);
+ return FpRegCopy(cUnit, rDest, rSrc);
if (ARM_LOWREG(rDest) && ARM_LOWREG(rSrc))
opcode = kThumbMovRR;
else if (!ARM_LOWREG(rDest) && !ARM_LOWREG(rSrc))
@@ -208,21 +208,21 @@
opcode = kThumbMovRR_H2L;
else
opcode = kThumbMovRR_L2H;
- res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
+ res = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) && rDest == rSrc) {
res->flags.isNop = true;
}
return res;
}
-LIR* opRegCopy(CompilationUnit* cUnit, int rDest, int rSrc)
+LIR* OpRegCopy(CompilationUnit* cUnit, int rDest, int rSrc)
{
- LIR* res = opRegCopyNoInsert(cUnit, rDest, rSrc);
- oatAppendLIR(cUnit, res);
+ LIR* res = OpRegCopyNoInsert(cUnit, rDest, rSrc);
+ AppendLIR(cUnit, res);
return res;
}
-void opRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi,
+void OpRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi,
int srcLo, int srcHi)
{
bool destFP = ARM_FPREG(destLo) && ARM_FPREG(destHi);
@@ -231,21 +231,21 @@
DCHECK_EQ(ARM_FPREG(destLo), ARM_FPREG(destHi));
if (destFP) {
if (srcFP) {
- opRegCopy(cUnit, s2d(destLo, destHi), s2d(srcLo, srcHi));
+ OpRegCopy(cUnit, S2d(destLo, destHi), S2d(srcLo, srcHi));
} else {
- newLIR3(cUnit, kThumb2Fmdrr, s2d(destLo, destHi), srcLo, srcHi);
+ NewLIR3(cUnit, kThumb2Fmdrr, S2d(destLo, destHi), srcLo, srcHi);
}
} else {
if (srcFP) {
- newLIR3(cUnit, kThumb2Fmrrd, destLo, destHi, s2d(srcLo, srcHi));
+ NewLIR3(cUnit, kThumb2Fmrrd, destLo, destHi, S2d(srcLo, srcHi));
} else {
// Handle overlap
if (srcHi == destLo) {
- opRegCopy(cUnit, destHi, srcHi);
- opRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
} else {
- opRegCopy(cUnit, destLo, srcLo);
- opRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
}
}
}
@@ -278,7 +278,7 @@
};
// Integer division by constant via reciprocal multiply (Hacker's Delight, 10-4)
-bool smallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
+bool SmallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
RegLocation rlSrc, RegLocation rlDest, int lit)
{
if ((lit < 0) || (lit >= static_cast<int>(sizeof(magicTable)/sizeof(magicTable[0])))) {
@@ -293,84 +293,84 @@
return false;
}
- int rMagic = oatAllocTemp(cUnit);
- loadConstant(cUnit, rMagic, magicTable[lit].magic);
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- int rHi = oatAllocTemp(cUnit);
- int rLo = oatAllocTemp(cUnit);
- newLIR4(cUnit, kThumb2Smull, rLo, rHi, rMagic, rlSrc.lowReg);
+ int rMagic = AllocTemp(cUnit);
+ LoadConstant(cUnit, rMagic, magicTable[lit].magic);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ int rHi = AllocTemp(cUnit);
+ int rLo = AllocTemp(cUnit);
+ NewLIR4(cUnit, kThumb2Smull, rLo, rHi, rMagic, rlSrc.lowReg);
switch(pattern) {
case Divide3:
- opRegRegRegShift(cUnit, kOpSub, rlResult.lowReg, rHi,
- rlSrc.lowReg, encodeShift(kArmAsr, 31));
+ OpRegRegRegShift(cUnit, kOpSub, rlResult.lowReg, rHi,
+ rlSrc.lowReg, EncodeShift(kArmAsr, 31));
break;
case Divide5:
- opRegRegImm(cUnit, kOpAsr, rLo, rlSrc.lowReg, 31);
- opRegRegRegShift(cUnit, kOpRsub, rlResult.lowReg, rLo, rHi,
- encodeShift(kArmAsr, magicTable[lit].shift));
+ OpRegRegImm(cUnit, kOpAsr, rLo, rlSrc.lowReg, 31);
+ OpRegRegRegShift(cUnit, kOpRsub, rlResult.lowReg, rLo, rHi,
+ EncodeShift(kArmAsr, magicTable[lit].shift));
break;
case Divide7:
- opRegReg(cUnit, kOpAdd, rHi, rlSrc.lowReg);
- opRegRegImm(cUnit, kOpAsr, rLo, rlSrc.lowReg, 31);
- opRegRegRegShift(cUnit, kOpRsub, rlResult.lowReg, rLo, rHi,
- encodeShift(kArmAsr, magicTable[lit].shift));
+ OpRegReg(cUnit, kOpAdd, rHi, rlSrc.lowReg);
+ OpRegRegImm(cUnit, kOpAsr, rLo, rlSrc.lowReg, 31);
+ OpRegRegRegShift(cUnit, kOpRsub, rlResult.lowReg, rLo, rHi,
+ EncodeShift(kArmAsr, magicTable[lit].shift));
break;
default:
LOG(FATAL) << "Unexpected pattern: " << pattern;
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-LIR* genRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode,
+LIR* GenRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode,
int reg1, int base, int offset, ThrowKind kind)
{
- LOG(FATAL) << "Unexpected use of genRegMemCheck for Arm";
+ LOG(FATAL) << "Unexpected use of GenRegMemCheck for Arm";
return NULL;
}
-RegLocation genDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int lit, bool isDiv)
+RegLocation GenDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int lit, bool isDiv)
{
- LOG(FATAL) << "Unexpected use of genDivRemLit for Arm";
+ LOG(FATAL) << "Unexpected use of GenDivRemLit for Arm";
return rlDest;
}
-RegLocation genDivRem(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int reg2, bool isDiv)
+RegLocation GenDivRem(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int reg2, bool isDiv)
{
- LOG(FATAL) << "Unexpected use of genDivRem for Arm";
+ LOG(FATAL) << "Unexpected use of GenDivRem for Arm";
return rlDest;
}
-bool genInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin)
+bool GenInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin)
{
DCHECK_EQ(cUnit->instructionSet, kThumb2);
RegLocation rlSrc1 = info->args[0];
RegLocation rlSrc2 = info->args[1];
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
- RegLocation rlDest = inlineTarget(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
- opIT(cUnit, (isMin) ? kArmCondGt : kArmCondLt, "E");
- opRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc2.lowReg);
- opRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc1.lowReg);
- genBarrier(cUnit);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
+ OpIT(cUnit, (isMin) ? kArmCondGt : kArmCondLt, "E");
+ OpRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc2.lowReg);
+ OpRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc1.lowReg);
+ GenBarrier(cUnit);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-void opLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset)
+void OpLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset)
{
- LOG(FATAL) << "Unexpected use of opLea for Arm";
+ LOG(FATAL) << "Unexpected use of OpLea for Arm";
}
-void opTlsCmp(CompilationUnit* cUnit, int offset, int val)
+void OpTlsCmp(CompilationUnit* cUnit, int offset, int val)
{
- LOG(FATAL) << "Unexpected use of opTlsCmp for Arm";
+ LOG(FATAL) << "Unexpected use of OpTlsCmp for Arm";
}
-bool genInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier) {
+bool GenInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier) {
DCHECK_EQ(cUnit->instructionSet, kThumb2);
// Unused - RegLocation rlSrcUnsafe = info->args[0];
RegLocation rlSrcObj= info->args[1]; // Object - known non-null
@@ -378,35 +378,35 @@
rlSrcOffset.wide = 0; // ignore high half in info->args[3]
RegLocation rlSrcExpected= info->args[4]; // int or Object
RegLocation rlSrcNewValue= info->args[5]; // int or Object
- RegLocation rlDest = inlineTarget(cUnit, info); // boolean place for result
+ RegLocation rlDest = InlineTarget(cUnit, info); // boolean place for result
// Release store semantics, get the barrier out of the way. TODO: revisit
- oatGenMemBarrier(cUnit, kStoreLoad);
+ GenMemBarrier(cUnit, kStoreLoad);
- RegLocation rlObject = loadValue(cUnit, rlSrcObj, kCoreReg);
- RegLocation rlNewValue = loadValue(cUnit, rlSrcNewValue, kCoreReg);
+ RegLocation rlObject = LoadValue(cUnit, rlSrcObj, kCoreReg);
+ RegLocation rlNewValue = LoadValue(cUnit, rlSrcNewValue, kCoreReg);
if (need_write_barrier) {
// Mark card for object assuming new value is stored.
- markGCCard(cUnit, rlNewValue.lowReg, rlObject.lowReg);
+ MarkGCCard(cUnit, rlNewValue.lowReg, rlObject.lowReg);
}
- RegLocation rlOffset = loadValue(cUnit, rlSrcOffset, kCoreReg);
+ RegLocation rlOffset = LoadValue(cUnit, rlSrcOffset, kCoreReg);
- int rPtr = oatAllocTemp(cUnit);
- opRegRegReg(cUnit, kOpAdd, rPtr, rlObject.lowReg, rlOffset.lowReg);
+ int rPtr = AllocTemp(cUnit);
+ OpRegRegReg(cUnit, kOpAdd, rPtr, rlObject.lowReg, rlOffset.lowReg);
// Free now unneeded rlObject and rlOffset to give more temps.
- oatClobberSReg(cUnit, rlObject.sRegLow);
- oatFreeTemp(cUnit, rlObject.lowReg);
- oatClobberSReg(cUnit, rlOffset.sRegLow);
- oatFreeTemp(cUnit, rlOffset.lowReg);
+ ClobberSReg(cUnit, rlObject.sRegLow);
+ FreeTemp(cUnit, rlObject.lowReg);
+ ClobberSReg(cUnit, rlOffset.sRegLow);
+ FreeTemp(cUnit, rlOffset.lowReg);
- int rOldValue = oatAllocTemp(cUnit);
- newLIR3(cUnit, kThumb2Ldrex, rOldValue, rPtr, 0); // rOldValue := [rPtr]
+ int rOldValue = AllocTemp(cUnit);
+ NewLIR3(cUnit, kThumb2Ldrex, rOldValue, rPtr, 0); // rOldValue := [rPtr]
- RegLocation rlExpected = loadValue(cUnit, rlSrcExpected, kCoreReg);
+ RegLocation rlExpected = LoadValue(cUnit, rlSrcExpected, kCoreReg);
// if (rOldValue == rExpected) {
// [rPtr] <- rNewValue && rResult := success ? 0 : 1
@@ -414,70 +414,70 @@
// } else {
// rResult := 0
// }
- opRegReg(cUnit, kOpCmp, rOldValue, rlExpected.lowReg);
- oatFreeTemp(cUnit, rOldValue); // Now unneeded.
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opIT(cUnit, kArmCondEq, "TE");
- newLIR4(cUnit, kThumb2Strex, rlResult.lowReg, rlNewValue.lowReg, rPtr, 0);
- oatFreeTemp(cUnit, rPtr); // Now unneeded.
- opRegImm(cUnit, kOpXor, rlResult.lowReg, 1);
- opRegReg(cUnit, kOpXor, rlResult.lowReg, rlResult.lowReg);
+ OpRegReg(cUnit, kOpCmp, rOldValue, rlExpected.lowReg);
+ FreeTemp(cUnit, rOldValue); // Now unneeded.
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpIT(cUnit, kArmCondEq, "TE");
+ NewLIR4(cUnit, kThumb2Strex, rlResult.lowReg, rlNewValue.lowReg, rPtr, 0);
+ FreeTemp(cUnit, rPtr); // Now unneeded.
+ OpRegImm(cUnit, kOpXor, rlResult.lowReg, 1);
+ OpRegReg(cUnit, kOpXor, rlResult.lowReg, rlResult.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-LIR* opPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target)
+LIR* OpPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target)
{
- return rawLIR(cUnit, cUnit->currentDalvikOffset, kThumb2LdrPcRel12, reg, 0, 0, 0, 0, target);
+ return RawLIR(cUnit, cUnit->currentDalvikOffset, kThumb2LdrPcRel12, reg, 0, 0, 0, 0, target);
}
-LIR* opVldm(CompilationUnit* cUnit, int rBase, int count)
+LIR* OpVldm(CompilationUnit* cUnit, int rBase, int count)
{
- return newLIR3(cUnit, kThumb2Vldms, rBase, fr0, count);
+ return NewLIR3(cUnit, kThumb2Vldms, rBase, fr0, count);
}
-LIR* opVstm(CompilationUnit* cUnit, int rBase, int count)
+LIR* OpVstm(CompilationUnit* cUnit, int rBase, int count)
{
- return newLIR3(cUnit, kThumb2Vstms, rBase, fr0, count);
+ return NewLIR3(cUnit, kThumb2Vstms, rBase, fr0, count);
}
-void genMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc,
+void GenMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc,
RegLocation rlResult, int lit,
int firstBit, int secondBit)
{
- opRegRegRegShift(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, rlSrc.lowReg,
- encodeShift(kArmLsl, secondBit - firstBit));
+ OpRegRegRegShift(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, rlSrc.lowReg,
+ EncodeShift(kArmLsl, secondBit - firstBit));
if (firstBit != 0) {
- opRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlResult.lowReg, firstBit);
+ OpRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlResult.lowReg, firstBit);
}
}
-void genDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi)
+void GenDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi)
{
- int tReg = oatAllocTemp(cUnit);
- newLIR4(cUnit, kThumb2OrrRRRs, tReg, regLo, regHi, 0);
- oatFreeTemp(cUnit, tReg);
- genCheck(cUnit, kCondEq, kThrowDivZero);
+ int tReg = AllocTemp(cUnit);
+ NewLIR4(cUnit, kThumb2OrrRRRs, tReg, regLo, regHi, 0);
+ FreeTemp(cUnit, tReg);
+ GenCheck(cUnit, kCondEq, kThrowDivZero);
}
// Test suspend flag, return target of taken suspend branch
-LIR* opTestSuspend(CompilationUnit* cUnit, LIR* target)
+LIR* OpTestSuspend(CompilationUnit* cUnit, LIR* target)
{
- newLIR2(cUnit, kThumbSubRI8, rARM_SUSPEND, 1);
- return opCondBranch(cUnit, (target == NULL) ? kCondEq : kCondNe, target);
+ NewLIR2(cUnit, kThumbSubRI8, rARM_SUSPEND, 1);
+ return OpCondBranch(cUnit, (target == NULL) ? kCondEq : kCondNe, target);
}
// Decrement register and branch on condition
-LIR* opDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target)
+LIR* OpDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target)
{
// Combine sub & test using sub setflags encoding here
- newLIR3(cUnit, kThumb2SubsRRI12, reg, reg, 1);
- return opCondBranch(cUnit, cCode, target);
+ NewLIR3(cUnit, kThumb2SubsRRI12, reg, reg, 1);
+ return OpCondBranch(cUnit, cCode, target);
}
-void oatGenMemBarrier(CompilationUnit* cUnit, MemBarrierKind barrierKind)
+void GenMemBarrier(CompilationUnit* cUnit, MemBarrierKind barrierKind)
{
#if ANDROID_SMP != 0
int dmbFlavor;
@@ -492,62 +492,62 @@
dmbFlavor = kSY; // quiet gcc.
break;
}
- LIR* dmb = newLIR1(cUnit, kThumb2Dmb, dmbFlavor);
+ LIR* dmb = NewLIR1(cUnit, kThumb2Dmb, dmbFlavor);
dmb->defMask = ENCODE_ALL;
#endif
}
-bool genNegLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenNegLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- int zReg = oatAllocTemp(cUnit);
- loadConstantNoClobber(cUnit, zReg, 0);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ int zReg = AllocTemp(cUnit);
+ LoadConstantNoClobber(cUnit, zReg, 0);
// Check for destructive overlap
if (rlResult.lowReg == rlSrc.highReg) {
- int tReg = oatAllocTemp(cUnit);
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, zReg, rlSrc.lowReg);
- opRegRegReg(cUnit, kOpSbc, rlResult.highReg, zReg, tReg);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, zReg, rlSrc.lowReg);
+ OpRegRegReg(cUnit, kOpSbc, rlResult.highReg, zReg, tReg);
+ FreeTemp(cUnit, tReg);
} else {
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, zReg, rlSrc.lowReg);
- opRegRegReg(cUnit, kOpSbc, rlResult.highReg, zReg, rlSrc.highReg);
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, zReg, rlSrc.lowReg);
+ OpRegRegReg(cUnit, kOpSbc, rlResult.highReg, zReg, rlSrc.highReg);
}
- oatFreeTemp(cUnit, zReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ FreeTemp(cUnit, zReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genAddLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenAddLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genAddLong for Arm";
+ LOG(FATAL) << "Unexpected use of GenAddLong for Arm";
return false;
}
-bool genSubLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenSubLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genSubLong for Arm";
+ LOG(FATAL) << "Unexpected use of GenSubLong for Arm";
return false;
}
-bool genAndLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenAndLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genAndLong for Arm";
+ LOG(FATAL) << "Unexpected use of GenAndLong for Arm";
return false;
}
-bool genOrLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenOrLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genOrLong for Arm";
+ LOG(FATAL) << "Unexpected use of GenOrLong for Arm";
return false;
}
-bool genXorLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenXorLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
LOG(FATAL) << "Unexpected use of genXoLong for Arm";
diff --git a/src/compiler/codegen/arm/target_arm.cc b/src/compiler/codegen/arm/target_arm.cc
index aa67be1..744800d 100644
--- a/src/compiler/codegen/arm/target_arm.cc
+++ b/src/compiler/codegen/arm/target_arm.cc
@@ -25,8 +25,8 @@
static int coreRegs[] = {r0, r1, r2, r3, rARM_SUSPEND, r5, r6, r7, r8, rARM_SELF, r10,
r11, r12, rARM_SP, rARM_LR, rARM_PC};
-static int reservedRegs[] = {rARM_SUSPEND, rARM_SELF, rARM_SP, rARM_LR, rARM_PC};
-static int fpRegs[] = {fr0, fr1, fr2, fr3, fr4, fr5, fr6, fr7,
+static int ReservedRegs[] = {rARM_SUSPEND, rARM_SELF, rARM_SP, rARM_LR, rARM_PC};
+static int FpRegs[] = {fr0, fr1, fr2, fr3, fr4, fr5, fr6, fr7,
fr8, fr9, fr10, fr11, fr12, fr13, fr14, fr15,
fr16, fr17, fr18, fr19, fr20, fr21, fr22, fr23,
fr24, fr25, fr26, fr27, fr28, fr29, fr30, fr31};
@@ -34,32 +34,32 @@
static int fpTemps[] = {fr0, fr1, fr2, fr3, fr4, fr5, fr6, fr7,
fr8, fr9, fr10, fr11, fr12, fr13, fr14, fr15};
-RegLocation locCReturn()
+RegLocation LocCReturn()
{
RegLocation res = ARM_LOC_C_RETURN;
return res;
}
-RegLocation locCReturnWide()
+RegLocation LocCReturnWide()
{
RegLocation res = ARM_LOC_C_RETURN_WIDE;
return res;
}
-RegLocation locCReturnFloat()
+RegLocation LocCReturnFloat()
{
RegLocation res = ARM_LOC_C_RETURN_FLOAT;
return res;
}
-RegLocation locCReturnDouble()
+RegLocation LocCReturnDouble()
{
RegLocation res = ARM_LOC_C_RETURN_DOUBLE;
return res;
}
// Return a target-dependent special register.
-int targetReg(SpecialTargetRegister reg) {
+int TargetReg(SpecialTargetRegister reg) {
int res = INVALID_REG;
switch (reg) {
case kSelf: res = rARM_SELF; break;
@@ -85,37 +85,37 @@
// Create a double from a pair of singles.
-int s2d(int lowReg, int highReg)
+int S2d(int lowReg, int highReg)
{
return ARM_S2D(lowReg, highReg);
}
// Is reg a single or double?
-bool fpReg(int reg)
+bool FpReg(int reg)
{
return ARM_FPREG(reg);
}
// Is reg a single?
-bool singleReg(int reg)
+bool SingleReg(int reg)
{
return ARM_SINGLEREG(reg);
}
// Is reg a double?
-bool doubleReg(int reg)
+bool DoubleReg(int reg)
{
return ARM_DOUBLEREG(reg);
}
// Return mask to strip off fp reg flags and bias.
-uint32_t fpRegMask()
+uint32_t FpRegMask()
{
return ARM_FP_REG_MASK;
}
// True if both regs single, both core or both double.
-bool sameRegType(int reg1, int reg2)
+bool SameRegType(int reg1, int reg2)
{
return (ARM_REGTYPE(reg1) == ARM_REGTYPE(reg2));
}
@@ -123,7 +123,7 @@
/*
* Decode the register id.
*/
-uint64_t getRegMaskCommon(CompilationUnit* cUnit, int reg)
+uint64_t GetRegMaskCommon(CompilationUnit* cUnit, int reg)
{
uint64_t seed;
int shift;
@@ -140,12 +140,12 @@
return (seed << shift);
}
-uint64_t getPCUseDefEncoding()
+uint64_t GetPCUseDefEncoding()
{
return ENCODE_ARM_REG_PC;
}
-void setupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir)
+void SetupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir)
{
DCHECK_EQ(cUnit->instructionSet, kThumb2);
@@ -175,7 +175,7 @@
if (flags & REG_DEF_FPCS_LIST2) {
for (int i = 0; i < lir->operands[2]; i++) {
- oatSetupRegMask(cUnit, &lir->defMask, lir->operands[1] + i);
+ SetupRegMask(cUnit, &lir->defMask, lir->operands[1] + i);
}
}
@@ -202,12 +202,12 @@
if (flags & REG_USE_FPCS_LIST2) {
for (int i = 0; i < lir->operands[2]; i++) {
- oatSetupRegMask(cUnit, &lir->useMask, lir->operands[1] + i);
+ SetupRegMask(cUnit, &lir->useMask, lir->operands[1] + i);
}
}
/* Fixup for kThumbPush/lr and kThumbPop/pc */
if (opcode == kThumbPush || opcode == kThumbPop) {
- uint64_t r8Mask = oatGetRegMaskCommon(cUnit, r8);
+ uint64_t r8Mask = GetRegMaskCommon(cUnit, r8);
if ((opcode == kThumbPush) && (lir->useMask & r8Mask)) {
lir->useMask &= ~r8Mask;
lir->useMask |= ENCODE_ARM_REG_LR;
@@ -221,7 +221,7 @@
}
}
-ArmConditionCode oatArmConditionEncoding(ConditionCode ccode)
+ArmConditionCode ArmConditionEncoding(ConditionCode ccode)
{
ArmConditionCode res;
switch (ccode) {
@@ -275,7 +275,7 @@
"ror"};
/* Decode and print a ARM register name */
-char* decodeRegList(int opcode, int vector, char* buf)
+char* DecodeRegList(int opcode, int vector, char* buf)
{
int i;
bool printed = false;
@@ -299,7 +299,7 @@
return buf;
}
-char* decodeFPCSRegList(int count, int base, char* buf)
+char* DecodeFPCSRegList(int count, int base, char* buf)
{
sprintf(buf, "s%d", base);
for (int i = 1; i < count; i++) {
@@ -308,7 +308,7 @@
return buf;
}
-int expandImmediate(int value)
+int ExpandImmediate(int value)
{
int mode = (value & 0xf00) >> 8;
uint32_t bits = value & 0xff;
@@ -334,7 +334,7 @@
* Interpret a format string and build a string no longer than size
* See format key in Assemble.c.
*/
-std::string buildInsnString(const char* fmt, LIR* lir, unsigned char* baseAddr)
+std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* baseAddr)
{
std::string buf;
int i;
@@ -396,11 +396,11 @@
}
break;
case 'n':
- operand = ~expandImmediate(operand);
+ operand = ~ExpandImmediate(operand);
sprintf(tbuf,"%d [%#x]", operand, operand);
break;
case 'm':
- operand = expandImmediate(operand);
+ operand = ExpandImmediate(operand);
sprintf(tbuf,"%d [%#x]", operand, operand);
break;
case 's':
@@ -452,13 +452,13 @@
strcpy(tbuf, "see above");
break;
case 'R':
- decodeRegList(lir->opcode, operand, tbuf);
+ DecodeRegList(lir->opcode, operand, tbuf);
break;
case 'P':
- decodeFPCSRegList(operand, 16, tbuf);
+ DecodeFPCSRegList(operand, 16, tbuf);
break;
case 'Q':
- decodeFPCSRegList(operand, 0, tbuf);
+ DecodeFPCSRegList(operand, 0, tbuf);
break;
default:
strcpy(tbuf,"DecodeError1");
@@ -473,7 +473,7 @@
return buf;
}
-void oatDumpResourceMask(LIR* armLIR, uint64_t mask, const char* prefix)
+void DumpResourceMask(LIR* armLIR, uint64_t mask, const char* prefix)
{
char buf[256];
buf[0] = 0;
@@ -519,13 +519,13 @@
}
}
-bool branchUnconditional(LIR* lir)
+bool BranchUnconditional(LIR* lir)
{
return ((lir->opcode == kThumbBUncond) || (lir->opcode == kThumb2BUncond));
}
/* Common initialization routine for an architecture family */
-bool oatArchInit()
+bool ArchInit()
{
int i;
@@ -537,19 +537,11 @@
}
}
- return oatArchVariantInit();
-}
-/*
- * Determine the initial instruction set to be used for this trace.
- * Later components may decide to change this.
- */
-InstructionSet oatInstructionSet()
-{
- return kThumb2;
+ return ArchVariantInit();
}
/* Architecture-specific initializations and checks go here */
-bool oatArchVariantInit(void)
+bool ArchVariantInit(void)
{
return true;
}
@@ -558,62 +550,62 @@
* Alloc a pair of core registers, or a double. Low reg in low byte,
* high reg in next byte.
*/
-int oatAllocTypedTempPair(CompilationUnit* cUnit, bool fpHint, int regClass)
+int AllocTypedTempPair(CompilationUnit* cUnit, bool fpHint, int regClass)
{
int highReg;
int lowReg;
int res = 0;
if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg)) {
- lowReg = oatAllocTempDouble(cUnit);
+ lowReg = AllocTempDouble(cUnit);
highReg = lowReg + 1;
} else {
- lowReg = oatAllocTemp(cUnit);
- highReg = oatAllocTemp(cUnit);
+ lowReg = AllocTemp(cUnit);
+ highReg = AllocTemp(cUnit);
}
res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
return res;
}
-int oatAllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass)
+int AllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass)
{
if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg))
- return oatAllocTempFloat(cUnit);
- return oatAllocTemp(cUnit);
+ return AllocTempFloat(cUnit);
+ return AllocTemp(cUnit);
}
-void oatInitializeRegAlloc(CompilationUnit* cUnit)
+void CompilerInitializeRegAlloc(CompilationUnit* cUnit)
{
int numRegs = sizeof(coreRegs)/sizeof(*coreRegs);
- int numReserved = sizeof(reservedRegs)/sizeof(*reservedRegs);
+ int numReserved = sizeof(ReservedRegs)/sizeof(*ReservedRegs);
int numTemps = sizeof(coreTemps)/sizeof(*coreTemps);
- int numFPRegs = sizeof(fpRegs)/sizeof(*fpRegs);
+ int numFPRegs = sizeof(FpRegs)/sizeof(*FpRegs);
int numFPTemps = sizeof(fpTemps)/sizeof(*fpTemps);
RegisterPool *pool =
- static_cast<RegisterPool*>(oatNew(cUnit, sizeof(*pool), true, kAllocRegAlloc));
+ static_cast<RegisterPool*>(NewMem(cUnit, sizeof(*pool), true, kAllocRegAlloc));
cUnit->regPool = pool;
pool->numCoreRegs = numRegs;
pool->coreRegs = reinterpret_cast<RegisterInfo*>
- (oatNew(cUnit, numRegs * sizeof(*cUnit->regPool->coreRegs), true, kAllocRegAlloc));
+ (NewMem(cUnit, numRegs * sizeof(*cUnit->regPool->coreRegs), true, kAllocRegAlloc));
pool->numFPRegs = numFPRegs;
pool->FPRegs = static_cast<RegisterInfo*>
- (oatNew(cUnit, numFPRegs * sizeof(*cUnit->regPool->FPRegs), true, kAllocRegAlloc));
- oatInitPool(pool->coreRegs, coreRegs, pool->numCoreRegs);
- oatInitPool(pool->FPRegs, fpRegs, pool->numFPRegs);
+ (NewMem(cUnit, numFPRegs * sizeof(*cUnit->regPool->FPRegs), true, kAllocRegAlloc));
+ CompilerInitPool(pool->coreRegs, coreRegs, pool->numCoreRegs);
+ CompilerInitPool(pool->FPRegs, FpRegs, pool->numFPRegs);
// Keep special registers from being allocated
for (int i = 0; i < numReserved; i++) {
- if (NO_SUSPEND && (reservedRegs[i] == rARM_SUSPEND)) {
+ if (NO_SUSPEND && (ReservedRegs[i] == rARM_SUSPEND)) {
//To measure cost of suspend check
continue;
}
- oatMarkInUse(cUnit, reservedRegs[i]);
+ MarkInUse(cUnit, ReservedRegs[i]);
}
// Mark temp regs - all others not in use can be used for promotion
for (int i = 0; i < numTemps; i++) {
- oatMarkTemp(cUnit, coreTemps[i]);
+ MarkTemp(cUnit, coreTemps[i]);
}
for (int i = 0; i < numFPTemps; i++) {
- oatMarkTemp(cUnit, fpTemps[i]);
+ MarkTemp(cUnit, fpTemps[i]);
}
// Start allocation at r2 in an attempt to avoid clobbering return values
@@ -621,7 +613,7 @@
// Construct the alias map.
cUnit->phiAliasMap = static_cast<int*>
- (oatNew(cUnit, cUnit->numSSARegs * sizeof(cUnit->phiAliasMap[0]), false, kAllocDFInfo));
+ (NewMem(cUnit, cUnit->numSSARegs * sizeof(cUnit->phiAliasMap[0]), false, kAllocDFInfo));
for (int i = 0; i < cUnit->numSSARegs; i++) {
cUnit->phiAliasMap[i] = i;
}
@@ -637,14 +629,14 @@
}
}
-void freeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep,
+void FreeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep,
RegLocation rlFree)
{
if ((rlFree.lowReg != rlKeep.lowReg) && (rlFree.lowReg != rlKeep.highReg) &&
(rlFree.highReg != rlKeep.lowReg) && (rlFree.highReg != rlKeep.highReg)) {
// No overlap, free both
- oatFreeTemp(cUnit, rlFree.lowReg);
- oatFreeTemp(cUnit, rlFree.highReg);
+ FreeTemp(cUnit, rlFree.lowReg);
+ FreeTemp(cUnit, rlFree.highReg);
}
}
/*
@@ -653,7 +645,7 @@
* machinery is in place, always spill lr.
*/
-void oatAdjustSpillMask(CompilationUnit* cUnit)
+void AdjustSpillMask(CompilationUnit* cUnit)
{
cUnit->coreSpillMask |= (1 << rARM_LR);
cUnit->numCoreSpills++;
@@ -665,7 +657,7 @@
* include any holes in the mask. Associate holes with
* Dalvik register INVALID_VREG (0xFFFFU).
*/
-void oatMarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg)
+void MarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg)
{
DCHECK_GE(reg, ARM_FP_REG_MASK + ARM_FP_CALLEE_SAVE_BASE);
reg = (reg & ARM_FP_REG_MASK) - ARM_FP_CALLEE_SAVE_BASE;
@@ -681,10 +673,10 @@
cUnit->fpSpillMask = ((1 << cUnit->numFPSpills) - 1) << ARM_FP_CALLEE_SAVE_BASE;
}
-void oatFlushRegWide(CompilationUnit* cUnit, int reg1, int reg2)
+void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2)
{
- RegisterInfo* info1 = oatGetRegInfo(cUnit, reg1);
- RegisterInfo* info2 = oatGetRegInfo(cUnit, reg2);
+ RegisterInfo* info1 = GetRegInfo(cUnit, reg1);
+ RegisterInfo* info2 = GetRegInfo(cUnit, reg2);
DCHECK(info1 && info2 && info1->pair && info2->pair &&
(info1->partner == info2->reg) &&
(info2->partner == info1->reg));
@@ -700,119 +692,115 @@
SRegToVReg(cUnit, info1->sReg))
info1 = info2;
int vReg = SRegToVReg(cUnit, info1->sReg);
- storeBaseDispWide(cUnit, rARM_SP, oatVRegOffset(cUnit, vReg), info1->reg, info1->partner);
+ StoreBaseDispWide(cUnit, rARM_SP, VRegOffset(cUnit, vReg), info1->reg, info1->partner);
}
}
-void oatFlushReg(CompilationUnit* cUnit, int reg)
+void FlushReg(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
if (info->live && info->dirty) {
info->dirty = false;
int vReg = SRegToVReg(cUnit, info->sReg);
- storeBaseDisp(cUnit, rARM_SP, oatVRegOffset(cUnit, vReg), reg, kWord);
+ StoreBaseDisp(cUnit, rARM_SP, VRegOffset(cUnit, vReg), reg, kWord);
}
}
/* Give access to the target-dependent FP register encoding to common code */
-bool oatIsFpReg(int reg) {
+bool IsFpReg(int reg) {
return ARM_FPREG(reg);
}
-uint32_t oatFpRegMask() {
- return ARM_FP_REG_MASK;
-}
-
/* Clobber all regs that might be used by an external C call */
-void oatClobberCalleeSave(CompilationUnit *cUnit)
+void ClobberCalleeSave(CompilationUnit *cUnit)
{
- oatClobber(cUnit, r0);
- oatClobber(cUnit, r1);
- oatClobber(cUnit, r2);
- oatClobber(cUnit, r3);
- oatClobber(cUnit, r12);
- oatClobber(cUnit, r14lr);
- oatClobber(cUnit, fr0);
- oatClobber(cUnit, fr1);
- oatClobber(cUnit, fr2);
- oatClobber(cUnit, fr3);
- oatClobber(cUnit, fr4);
- oatClobber(cUnit, fr5);
- oatClobber(cUnit, fr6);
- oatClobber(cUnit, fr7);
- oatClobber(cUnit, fr8);
- oatClobber(cUnit, fr9);
- oatClobber(cUnit, fr10);
- oatClobber(cUnit, fr11);
- oatClobber(cUnit, fr12);
- oatClobber(cUnit, fr13);
- oatClobber(cUnit, fr14);
- oatClobber(cUnit, fr15);
+ Clobber(cUnit, r0);
+ Clobber(cUnit, r1);
+ Clobber(cUnit, r2);
+ Clobber(cUnit, r3);
+ Clobber(cUnit, r12);
+ Clobber(cUnit, r14lr);
+ Clobber(cUnit, fr0);
+ Clobber(cUnit, fr1);
+ Clobber(cUnit, fr2);
+ Clobber(cUnit, fr3);
+ Clobber(cUnit, fr4);
+ Clobber(cUnit, fr5);
+ Clobber(cUnit, fr6);
+ Clobber(cUnit, fr7);
+ Clobber(cUnit, fr8);
+ Clobber(cUnit, fr9);
+ Clobber(cUnit, fr10);
+ Clobber(cUnit, fr11);
+ Clobber(cUnit, fr12);
+ Clobber(cUnit, fr13);
+ Clobber(cUnit, fr14);
+ Clobber(cUnit, fr15);
}
-extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit)
+extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit)
{
- RegLocation res = locCReturnWide();
+ RegLocation res = LocCReturnWide();
res.lowReg = r2;
res.highReg = r3;
- oatClobber(cUnit, r2);
- oatClobber(cUnit, r3);
- oatMarkInUse(cUnit, r2);
- oatMarkInUse(cUnit, r3);
- oatMarkPair(cUnit, res.lowReg, res.highReg);
+ Clobber(cUnit, r2);
+ Clobber(cUnit, r3);
+ MarkInUse(cUnit, r2);
+ MarkInUse(cUnit, r3);
+ MarkPair(cUnit, res.lowReg, res.highReg);
return res;
}
-extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit)
+extern RegLocation GetReturnAlt(CompilationUnit* cUnit)
{
- RegLocation res = locCReturn();
+ RegLocation res = LocCReturn();
res.lowReg = r1;
- oatClobber(cUnit, r1);
- oatMarkInUse(cUnit, r1);
+ Clobber(cUnit, r1);
+ MarkInUse(cUnit, r1);
return res;
}
-extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg)
+extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg)
{
return ARM_FPREG(reg) ? &cUnit->regPool->FPRegs[reg & ARM_FP_REG_MASK]
: &cUnit->regPool->coreRegs[reg];
}
/* To be used when explicitly managing register use */
-extern void oatLockCallTemps(CompilationUnit* cUnit)
+extern void LockCallTemps(CompilationUnit* cUnit)
{
- oatLockTemp(cUnit, r0);
- oatLockTemp(cUnit, r1);
- oatLockTemp(cUnit, r2);
- oatLockTemp(cUnit, r3);
+ LockTemp(cUnit, r0);
+ LockTemp(cUnit, r1);
+ LockTemp(cUnit, r2);
+ LockTemp(cUnit, r3);
}
/* To be used when explicitly managing register use */
-extern void oatFreeCallTemps(CompilationUnit* cUnit)
+extern void FreeCallTemps(CompilationUnit* cUnit)
{
- oatFreeTemp(cUnit, r0);
- oatFreeTemp(cUnit, r1);
- oatFreeTemp(cUnit, r2);
- oatFreeTemp(cUnit, r3);
+ FreeTemp(cUnit, r0);
+ FreeTemp(cUnit, r1);
+ FreeTemp(cUnit, r2);
+ FreeTemp(cUnit, r3);
}
-int loadHelper(CompilationUnit* cUnit, int offset)
+int LoadHelper(CompilationUnit* cUnit, int offset)
{
- loadWordDisp(cUnit, rARM_SELF, offset, rARM_LR);
+ LoadWordDisp(cUnit, rARM_SELF, offset, rARM_LR);
return rARM_LR;
}
-uint64_t getTargetInstFlags(int opcode)
+uint64_t GetTargetInstFlags(int opcode)
{
return EncodingMap[opcode].flags;
}
-const char* getTargetInstName(int opcode)
+const char* GetTargetInstName(int opcode)
{
return EncodingMap[opcode].name;
}
-const char* getTargetInstFmt(int opcode)
+const char* GetTargetInstFmt(int opcode)
{
return EncodingMap[opcode].fmt;
}
diff --git a/src/compiler/codegen/arm/utility_arm.cc b/src/compiler/codegen/arm/utility_arm.cc
index 35f4a2d..1c8ea89 100644
--- a/src/compiler/codegen/arm/utility_arm.cc
+++ b/src/compiler/codegen/arm/utility_arm.cc
@@ -22,7 +22,7 @@
/* This file contains codegen for the Thumb ISA. */
-int encodeImmSingle(int value)
+int EncodeImmSingle(int value)
{
int res;
int bitA = (value & 0x80000000) >> 31;
@@ -44,26 +44,26 @@
return res;
}
-LIR* loadFPConstantValue(CompilationUnit* cUnit, int rDest, int value)
+LIR* LoadFPConstantValue(CompilationUnit* cUnit, int rDest, int value)
{
- int encodedImm = encodeImmSingle(value);
+ int encodedImm = EncodeImmSingle(value);
DCHECK(ARM_SINGLEREG(rDest));
if (encodedImm >= 0) {
- return newLIR2(cUnit, kThumb2Vmovs_IMM8, rDest, encodedImm);
+ return NewLIR2(cUnit, kThumb2Vmovs_IMM8, rDest, encodedImm);
}
- LIR* dataTarget = scanLiteralPool(cUnit->literalList, value, 0);
+ LIR* dataTarget = ScanLiteralPool(cUnit->literalList, value, 0);
if (dataTarget == NULL) {
- dataTarget = addWordData(cUnit, &cUnit->literalList, value);
+ dataTarget = AddWordData(cUnit, &cUnit->literalList, value);
}
- LIR* loadPcRel = rawLIR(cUnit, cUnit->currentDalvikOffset, kThumb2Vldrs,
+ LIR* loadPcRel = RawLIR(cUnit, cUnit->currentDalvikOffset, kThumb2Vldrs,
rDest, r15pc, 0, 0, 0, dataTarget);
- setMemRefType(loadPcRel, true, kLiteral);
+ SetMemRefType(loadPcRel, true, kLiteral);
loadPcRel->aliasInfo = reinterpret_cast<uintptr_t>(dataTarget);
- oatAppendLIR(cUnit, loadPcRel);
+ AppendLIR(cUnit, loadPcRel);
return loadPcRel;
}
-int leadingZeros(uint32_t val)
+int LeadingZeros(uint32_t val)
{
uint32_t alt;
int n;
@@ -86,7 +86,7 @@
* Determine whether value can be encoded as a Thumb2 modified
* immediate. If not, return -1. If so, return i:imm3:a:bcdefgh form.
*/
-int modifiedImmediate(uint32_t value)
+int ModifiedImmediate(uint32_t value)
{
int zLeading;
int zTrailing;
@@ -103,8 +103,8 @@
if (value == ((b0 << 24) | (b0 << 8)))
return (0x2 << 8) | b0; /* 0:010:a:bcdefgh */
/* Can we do it with rotation? */
- zLeading = leadingZeros(value);
- zTrailing = 32 - leadingZeros(~value & (value - 1));
+ zLeading = LeadingZeros(value);
+ zTrailing = 32 - LeadingZeros(~value & (value - 1));
/* A run of eight or fewer active bits? */
if ((zLeading + zTrailing) < 24)
return -1; /* No - bail */
@@ -121,75 +121,75 @@
* grab from the per-translation literal pool.
*
* No additional register clobbering operation performed. Use this version when
- * 1) rDest is freshly returned from oatAllocTemp or
+ * 1) rDest is freshly returned from AllocTemp or
* 2) The codegen is under fixed register usage
*/
-LIR* loadConstantNoClobber(CompilationUnit* cUnit, int rDest, int value)
+LIR* LoadConstantNoClobber(CompilationUnit* cUnit, int rDest, int value)
{
LIR* res;
int modImm;
if (ARM_FPREG(rDest)) {
- return loadFPConstantValue(cUnit, rDest, value);
+ return LoadFPConstantValue(cUnit, rDest, value);
}
/* See if the value can be constructed cheaply */
if (ARM_LOWREG(rDest) && (value >= 0) && (value <= 255)) {
- return newLIR2(cUnit, kThumbMovImm, rDest, value);
+ return NewLIR2(cUnit, kThumbMovImm, rDest, value);
}
/* Check Modified immediate special cases */
- modImm = modifiedImmediate(value);
+ modImm = ModifiedImmediate(value);
if (modImm >= 0) {
- res = newLIR2(cUnit, kThumb2MovImmShift, rDest, modImm);
+ res = NewLIR2(cUnit, kThumb2MovImmShift, rDest, modImm);
return res;
}
- modImm = modifiedImmediate(~value);
+ modImm = ModifiedImmediate(~value);
if (modImm >= 0) {
- res = newLIR2(cUnit, kThumb2MvnImm12, rDest, modImm);
+ res = NewLIR2(cUnit, kThumb2MvnImm12, rDest, modImm);
return res;
}
/* 16-bit immediate? */
if ((value & 0xffff) == value) {
- res = newLIR2(cUnit, kThumb2MovImm16, rDest, value);
+ res = NewLIR2(cUnit, kThumb2MovImm16, rDest, value);
return res;
}
/* No shortcut - go ahead and use literal pool */
- LIR* dataTarget = scanLiteralPool(cUnit->literalList, value, 0);
+ LIR* dataTarget = ScanLiteralPool(cUnit->literalList, value, 0);
if (dataTarget == NULL) {
- dataTarget = addWordData(cUnit, &cUnit->literalList, value);
+ dataTarget = AddWordData(cUnit, &cUnit->literalList, value);
}
- LIR* loadPcRel = rawLIR(cUnit, cUnit->currentDalvikOffset,
+ LIR* loadPcRel = RawLIR(cUnit, cUnit->currentDalvikOffset,
kThumb2LdrPcRel12, rDest, 0, 0, 0, 0, dataTarget);
- setMemRefType(loadPcRel, true, kLiteral);
+ SetMemRefType(loadPcRel, true, kLiteral);
loadPcRel->aliasInfo = reinterpret_cast<uintptr_t>(dataTarget);
res = loadPcRel;
- oatAppendLIR(cUnit, loadPcRel);
+ AppendLIR(cUnit, loadPcRel);
/*
* To save space in the constant pool, we use the ADD_RRI8 instruction to
* add up to 255 to an existing constant value.
*/
if (dataTarget->operands[0] != value) {
- opRegImm(cUnit, kOpAdd, rDest, value - dataTarget->operands[0]);
+ OpRegImm(cUnit, kOpAdd, rDest, value - dataTarget->operands[0]);
}
return res;
}
-LIR* opBranchUnconditional(CompilationUnit* cUnit, OpKind op)
+LIR* OpBranchUnconditional(CompilationUnit* cUnit, OpKind op)
{
DCHECK_EQ(op, kOpUncondBr);
- return newLIR1(cUnit, kThumbBUncond, 0 /* offset to be patched */);
+ return NewLIR1(cUnit, kThumbBUncond, 0 /* offset to be patched */);
}
-LIR* opCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target)
+LIR* OpCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target)
{
- LIR* branch = newLIR2(cUnit, kThumb2BCond, 0 /* offset to be patched */,
- oatArmConditionEncoding(cc));
+ LIR* branch = NewLIR2(cUnit, kThumb2BCond, 0 /* offset to be patched */,
+ ArmConditionEncoding(cc));
branch->target = target;
return branch;
}
-LIR* opReg(CompilationUnit* cUnit, OpKind op, int rDestSrc)
+LIR* OpReg(CompilationUnit* cUnit, OpKind op, int rDestSrc)
{
ArmOpcode opcode = kThumbBkpt;
switch (op) {
@@ -199,10 +199,10 @@
default:
LOG(FATAL) << "Bad opcode " << op;
}
- return newLIR1(cUnit, opcode, rDestSrc);
+ return NewLIR1(cUnit, opcode, rDestSrc);
}
-LIR* opRegRegShift(CompilationUnit* cUnit, OpKind op, int rDestSrc1,
+LIR* OpRegRegShift(CompilationUnit* cUnit, OpKind op, int rDestSrc1,
int rSrc2, int shift)
{
bool thumbForm = ((shift == 0) && ARM_LOWREG(rDestSrc1) && ARM_LOWREG(rSrc2));
@@ -291,39 +291,39 @@
break;
case kOp2Byte:
DCHECK_EQ(shift, 0);
- return newLIR4(cUnit, kThumb2Sbfx, rDestSrc1, rSrc2, 0, 8);
+ return NewLIR4(cUnit, kThumb2Sbfx, rDestSrc1, rSrc2, 0, 8);
case kOp2Short:
DCHECK_EQ(shift, 0);
- return newLIR4(cUnit, kThumb2Sbfx, rDestSrc1, rSrc2, 0, 16);
+ return NewLIR4(cUnit, kThumb2Sbfx, rDestSrc1, rSrc2, 0, 16);
case kOp2Char:
DCHECK_EQ(shift, 0);
- return newLIR4(cUnit, kThumb2Ubfx, rDestSrc1, rSrc2, 0, 16);
+ return NewLIR4(cUnit, kThumb2Ubfx, rDestSrc1, rSrc2, 0, 16);
default:
LOG(FATAL) << "Bad opcode: " << op;
break;
}
DCHECK_GE(static_cast<int>(opcode), 0);
if (EncodingMap[opcode].flags & IS_BINARY_OP)
- return newLIR2(cUnit, opcode, rDestSrc1, rSrc2);
+ return NewLIR2(cUnit, opcode, rDestSrc1, rSrc2);
else if (EncodingMap[opcode].flags & IS_TERTIARY_OP) {
if (EncodingMap[opcode].fieldLoc[2].kind == kFmtShift)
- return newLIR3(cUnit, opcode, rDestSrc1, rSrc2, shift);
+ return NewLIR3(cUnit, opcode, rDestSrc1, rSrc2, shift);
else
- return newLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rSrc2);
+ return NewLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rSrc2);
} else if (EncodingMap[opcode].flags & IS_QUAD_OP)
- return newLIR4(cUnit, opcode, rDestSrc1, rDestSrc1, rSrc2, shift);
+ return NewLIR4(cUnit, opcode, rDestSrc1, rDestSrc1, rSrc2, shift);
else {
LOG(FATAL) << "Unexpected encoding operand count";
return NULL;
}
}
-LIR* opRegReg(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int rSrc2)
+LIR* OpRegReg(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int rSrc2)
{
- return opRegRegShift(cUnit, op, rDestSrc1, rSrc2, 0);
+ return OpRegRegShift(cUnit, op, rDestSrc1, rSrc2, 0);
}
-LIR* opRegRegRegShift(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1,
+LIR* OpRegRegRegShift(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1,
int rSrc2, int shift)
{
ArmOpcode opcode = kThumbBkpt;
@@ -383,20 +383,20 @@
}
DCHECK_GE(static_cast<int>(opcode), 0);
if (EncodingMap[opcode].flags & IS_QUAD_OP)
- return newLIR4(cUnit, opcode, rDest, rSrc1, rSrc2, shift);
+ return NewLIR4(cUnit, opcode, rDest, rSrc1, rSrc2, shift);
else {
DCHECK(EncodingMap[opcode].flags & IS_TERTIARY_OP);
- return newLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
+ return NewLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
}
}
-LIR* opRegRegReg(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1,
+LIR* OpRegRegReg(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1,
int rSrc2)
{
- return opRegRegRegShift(cUnit, op, rDest, rSrc1, rSrc2, 0);
+ return OpRegRegRegShift(cUnit, op, rDest, rSrc1, rSrc2, 0);
}
-LIR* opRegRegImm(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1,
+LIR* OpRegRegImm(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1,
int value)
{
LIR* res;
@@ -405,34 +405,34 @@
ArmOpcode opcode = kThumbBkpt;
ArmOpcode altOpcode = kThumbBkpt;
bool allLowRegs = (ARM_LOWREG(rDest) && ARM_LOWREG(rSrc1));
- int modImm = modifiedImmediate(value);
- int modImmNeg = modifiedImmediate(-value);
+ int modImm = ModifiedImmediate(value);
+ int modImmNeg = ModifiedImmediate(-value);
switch (op) {
case kOpLsl:
if (allLowRegs)
- return newLIR3(cUnit, kThumbLslRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumbLslRRI5, rDest, rSrc1, value);
else
- return newLIR3(cUnit, kThumb2LslRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumb2LslRRI5, rDest, rSrc1, value);
case kOpLsr:
if (allLowRegs)
- return newLIR3(cUnit, kThumbLsrRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumbLsrRRI5, rDest, rSrc1, value);
else
- return newLIR3(cUnit, kThumb2LsrRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumb2LsrRRI5, rDest, rSrc1, value);
case kOpAsr:
if (allLowRegs)
- return newLIR3(cUnit, kThumbAsrRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumbAsrRRI5, rDest, rSrc1, value);
else
- return newLIR3(cUnit, kThumb2AsrRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumb2AsrRRI5, rDest, rSrc1, value);
case kOpRor:
- return newLIR3(cUnit, kThumb2RorRRI5, rDest, rSrc1, value);
+ return NewLIR3(cUnit, kThumb2RorRRI5, rDest, rSrc1, value);
case kOpAdd:
if (ARM_LOWREG(rDest) && (rSrc1 == r13sp) &&
(value <= 1020) && ((value & 0x3)==0)) {
- return newLIR3(cUnit, kThumbAddSpRel, rDest, rSrc1, value >> 2);
+ return NewLIR3(cUnit, kThumbAddSpRel, rDest, rSrc1, value >> 2);
} else if (ARM_LOWREG(rDest) && (rSrc1 == r15pc) &&
(value <= 1020) && ((value & 0x3)==0)) {
- return newLIR3(cUnit, kThumbAddPcRel, rDest, rSrc1, value >> 2);
+ return NewLIR3(cUnit, kThumbAddPcRel, rDest, rSrc1, value >> 2);
}
// Note: intentional fallthrough
case kOpSub:
@@ -441,13 +441,13 @@
opcode = (neg) ? kThumbSubRRI3 : kThumbAddRRI3;
else
opcode = (neg) ? kThumbAddRRI3 : kThumbSubRRI3;
- return newLIR3(cUnit, opcode, rDest, rSrc1, absValue);
+ return NewLIR3(cUnit, opcode, rDest, rSrc1, absValue);
} else if ((absValue & 0xff) == absValue) {
if (op == kOpAdd)
opcode = (neg) ? kThumb2SubRRI12 : kThumb2AddRRI12;
else
opcode = (neg) ? kThumb2AddRRI12 : kThumb2SubRRI12;
- return newLIR3(cUnit, opcode, rDest, rSrc1, absValue);
+ return NewLIR3(cUnit, opcode, rDest, rSrc1, absValue);
}
if (modImmNeg >= 0) {
op = (op == kOpAdd) ? kOpSub : kOpAdd;
@@ -487,15 +487,15 @@
altOpcode = kThumb2MulRRR;
break;
case kOpCmp: {
- int modImm = modifiedImmediate(value);
+ int modImm = ModifiedImmediate(value);
LIR* res;
if (modImm >= 0) {
- res = newLIR2(cUnit, kThumb2CmpRI8, rSrc1, modImm);
+ res = NewLIR2(cUnit, kThumb2CmpRI8, rSrc1, modImm);
} else {
- int rTmp = oatAllocTemp(cUnit);
- res = loadConstant(cUnit, rTmp, value);
- opRegReg(cUnit, kOpCmp, rSrc1, rTmp);
- oatFreeTemp(cUnit, rTmp);
+ int rTmp = AllocTemp(cUnit);
+ res = LoadConstant(cUnit, rTmp, value);
+ OpRegReg(cUnit, kOpCmp, rSrc1, rTmp);
+ FreeTemp(cUnit, rTmp);
}
return res;
}
@@ -504,21 +504,21 @@
}
if (modImm >= 0) {
- return newLIR3(cUnit, opcode, rDest, rSrc1, modImm);
+ return NewLIR3(cUnit, opcode, rDest, rSrc1, modImm);
} else {
- int rScratch = oatAllocTemp(cUnit);
- loadConstant(cUnit, rScratch, value);
+ int rScratch = AllocTemp(cUnit);
+ LoadConstant(cUnit, rScratch, value);
if (EncodingMap[altOpcode].flags & IS_QUAD_OP)
- res = newLIR4(cUnit, altOpcode, rDest, rSrc1, rScratch, 0);
+ res = NewLIR4(cUnit, altOpcode, rDest, rSrc1, rScratch, 0);
else
- res = newLIR3(cUnit, altOpcode, rDest, rSrc1, rScratch);
- oatFreeTemp(cUnit, rScratch);
+ res = NewLIR3(cUnit, altOpcode, rDest, rSrc1, rScratch);
+ FreeTemp(cUnit, rScratch);
return res;
}
}
-/* Handle Thumb-only variants here - otherwise punt to opRegRegImm */
-LIR* opRegImm(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int value)
+/* Handle Thumb-only variants here - otherwise punt to OpRegRegImm */
+LIR* OpRegImm(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int value)
{
bool neg = (value < 0);
int absValue = (neg) ? -value : value;
@@ -528,7 +528,7 @@
case kOpAdd:
if ( !neg && (rDestSrc1 == r13sp) && (value <= 508)) { /* sp */
DCHECK_EQ((value & 0x3), 0);
- return newLIR1(cUnit, kThumbAddSpI7, value >> 2);
+ return NewLIR1(cUnit, kThumbAddSpI7, value >> 2);
} else if (shortForm) {
opcode = (neg) ? kThumbSubRI8 : kThumbAddRI8;
}
@@ -536,7 +536,7 @@
case kOpSub:
if (!neg && (rDestSrc1 == r13sp) && (value <= 508)) { /* sp */
DCHECK_EQ((value & 0x3), 0);
- return newLIR1(cUnit, kThumbSubSpI7, value >> 2);
+ return NewLIR1(cUnit, kThumbSubSpI7, value >> 2);
} else if (shortForm) {
opcode = (neg) ? kThumbAddRI8 : kThumbSubRI8;
}
@@ -552,14 +552,14 @@
}
break;
default:
- /* Punt to opRegRegImm - if bad case catch it there */
+ /* Punt to OpRegRegImm - if bad case catch it there */
shortForm = false;
break;
}
if (shortForm)
- return newLIR2(cUnit, opcode, rDestSrc1, absValue);
+ return NewLIR2(cUnit, opcode, rDestSrc1, absValue);
else {
- return opRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
+ return OpRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
}
}
@@ -567,7 +567,7 @@
* Determine whether value can be encoded as a Thumb2 floating point
* immediate. If not, return -1. If so return encoded 8-bit value.
*/
-int encodeImmDoubleHigh(int value)
+int EncodeImmDoubleHigh(int value)
{
int res;
int bitA = (value & 0x80000000) >> 31;
@@ -589,48 +589,48 @@
return res;
}
-int encodeImmDouble(int valLo, int valHi)
+int EncodeImmDouble(int valLo, int valHi)
{
int res = -1;
if (valLo == 0)
- res = encodeImmDoubleHigh(valHi);
+ res = EncodeImmDoubleHigh(valHi);
return res;
}
-LIR* loadConstantValueWide(CompilationUnit* cUnit, int rDestLo, int rDestHi,
+LIR* LoadConstantValueWide(CompilationUnit* cUnit, int rDestLo, int rDestHi,
int valLo, int valHi)
{
- int encodedImm = encodeImmDouble(valLo, valHi);
+ int encodedImm = EncodeImmDouble(valLo, valHi);
LIR* res;
if (ARM_FPREG(rDestLo)) {
if (encodedImm >= 0) {
- res = newLIR2(cUnit, kThumb2Vmovd_IMM8, s2d(rDestLo, rDestHi),
+ res = NewLIR2(cUnit, kThumb2Vmovd_IMM8, S2d(rDestLo, rDestHi),
encodedImm);
} else {
- LIR* dataTarget = scanLiteralPoolWide(cUnit->literalList, valLo, valHi);
+ LIR* dataTarget = ScanLiteralPoolWide(cUnit->literalList, valLo, valHi);
if (dataTarget == NULL) {
- dataTarget = addWideData(cUnit, &cUnit->literalList, valLo, valHi);
+ dataTarget = AddWideData(cUnit, &cUnit->literalList, valLo, valHi);
}
LIR* loadPcRel =
- rawLIR(cUnit, cUnit->currentDalvikOffset, kThumb2Vldrd,
- s2d(rDestLo, rDestHi), r15pc, 0, 0, 0, dataTarget);
- setMemRefType(loadPcRel, true, kLiteral);
+ RawLIR(cUnit, cUnit->currentDalvikOffset, kThumb2Vldrd,
+ S2d(rDestLo, rDestHi), r15pc, 0, 0, 0, dataTarget);
+ SetMemRefType(loadPcRel, true, kLiteral);
loadPcRel->aliasInfo = reinterpret_cast<uintptr_t>(dataTarget);
- oatAppendLIR(cUnit, loadPcRel);
+ AppendLIR(cUnit, loadPcRel);
res = loadPcRel;
}
} else {
- res = loadConstantNoClobber(cUnit, rDestLo, valLo);
- loadConstantNoClobber(cUnit, rDestHi, valHi);
+ res = LoadConstantNoClobber(cUnit, rDestLo, valLo);
+ LoadConstantNoClobber(cUnit, rDestHi, valHi);
}
return res;
}
-int encodeShift(int code, int amount) {
+int EncodeShift(int code, int amount) {
return ((amount & 0x1f) << 2) | code;
}
-LIR* loadBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rDest,
+LIR* LoadBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rDest,
int scale, OpSize size)
{
bool allLowRegs = ARM_LOWREG(rBase) && ARM_LOWREG(rIndex) && ARM_LOWREG(rDest);
@@ -659,15 +659,15 @@
switch (size) {
case kDouble: // fall-through
case kSingle:
- regPtr = oatAllocTemp(cUnit);
+ regPtr = AllocTemp(cUnit);
if (scale) {
- newLIR4(cUnit, kThumb2AddRRR, regPtr, rBase, rIndex,
- encodeShift(kArmLsl, scale));
+ NewLIR4(cUnit, kThumb2AddRRR, regPtr, rBase, rIndex,
+ EncodeShift(kArmLsl, scale));
} else {
- opRegRegReg(cUnit, kOpAdd, regPtr, rBase, rIndex);
+ OpRegRegReg(cUnit, kOpAdd, regPtr, rBase, rIndex);
}
- load = newLIR3(cUnit, opcode, rDest, regPtr, 0);
- oatFreeTemp(cUnit, regPtr);
+ load = NewLIR3(cUnit, opcode, rDest, regPtr, 0);
+ FreeTemp(cUnit, regPtr);
return load;
case kWord:
opcode = (thumbForm) ? kThumbLdrRRR : kThumb2LdrRRR;
@@ -688,14 +688,14 @@
LOG(FATAL) << "Bad size: " << size;
}
if (thumbForm)
- load = newLIR3(cUnit, opcode, rDest, rBase, rIndex);
+ load = NewLIR3(cUnit, opcode, rDest, rBase, rIndex);
else
- load = newLIR4(cUnit, opcode, rDest, rBase, rIndex, scale);
+ load = NewLIR4(cUnit, opcode, rDest, rBase, rIndex, scale);
return load;
}
-LIR* storeBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rSrc,
+LIR* StoreBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rSrc,
int scale, OpSize size)
{
bool allLowRegs = ARM_LOWREG(rBase) && ARM_LOWREG(rIndex) && ARM_LOWREG(rSrc);
@@ -724,15 +724,15 @@
switch (size) {
case kDouble: // fall-through
case kSingle:
- regPtr = oatAllocTemp(cUnit);
+ regPtr = AllocTemp(cUnit);
if (scale) {
- newLIR4(cUnit, kThumb2AddRRR, regPtr, rBase, rIndex,
- encodeShift(kArmLsl, scale));
+ NewLIR4(cUnit, kThumb2AddRRR, regPtr, rBase, rIndex,
+ EncodeShift(kArmLsl, scale));
} else {
- opRegRegReg(cUnit, kOpAdd, regPtr, rBase, rIndex);
+ OpRegRegReg(cUnit, kOpAdd, regPtr, rBase, rIndex);
}
- store = newLIR3(cUnit, opcode, rSrc, regPtr, 0);
- oatFreeTemp(cUnit, regPtr);
+ store = NewLIR3(cUnit, opcode, rSrc, regPtr, 0);
+ FreeTemp(cUnit, regPtr);
return store;
case kWord:
opcode = (thumbForm) ? kThumbStrRRR : kThumb2StrRRR;
@@ -749,9 +749,9 @@
LOG(FATAL) << "Bad size: " << size;
}
if (thumbForm)
- store = newLIR3(cUnit, opcode, rSrc, rBase, rIndex);
+ store = NewLIR3(cUnit, opcode, rSrc, rBase, rIndex);
else
- store = newLIR4(cUnit, opcode, rSrc, rBase, rIndex, scale);
+ store = NewLIR4(cUnit, opcode, rSrc, rBase, rIndex, scale);
return store;
}
@@ -761,7 +761,7 @@
* on base (which must have an associated sReg and MIR). If not
* performing null check, incoming MIR can be null.
*/
-LIR* loadBaseDispBody(CompilationUnit* cUnit, int rBase,
+LIR* LoadBaseDispBody(CompilationUnit* cUnit, int rBase,
int displacement, int rDest, int rDestHi, OpSize size,
int sReg)
{
@@ -780,7 +780,7 @@
if (ARM_FPREG(rDest)) {
if (ARM_SINGLEREG(rDest)) {
DCHECK(ARM_FPREG(rDestHi));
- rDest = s2d(rDest, rDestHi);
+ rDest = S2d(rDest, rDestHi);
}
opcode = kThumb2Vldrd;
if (displacement <= 1020) {
@@ -789,9 +789,9 @@
}
break;
} else {
- res = loadBaseDispBody(cUnit, rBase, displacement, rDest,
+ res = LoadBaseDispBody(cUnit, rBase, displacement, rDest,
-1, kWord, sReg);
- loadBaseDispBody(cUnit, rBase, displacement + 4, rDestHi,
+ LoadBaseDispBody(cUnit, rBase, displacement + 4, rDestHi,
-1, kWord, INVALID_SREG);
return res;
}
@@ -862,37 +862,37 @@
}
if (shortForm) {
- load = res = newLIR3(cUnit, opcode, rDest, rBase, encodedDisp);
+ load = res = NewLIR3(cUnit, opcode, rDest, rBase, encodedDisp);
} else {
- int regOffset = oatAllocTemp(cUnit);
- res = loadConstant(cUnit, regOffset, encodedDisp);
- load = loadBaseIndexed(cUnit, rBase, regOffset, rDest, 0, size);
- oatFreeTemp(cUnit, regOffset);
+ int regOffset = AllocTemp(cUnit);
+ res = LoadConstant(cUnit, regOffset, encodedDisp);
+ load = LoadBaseIndexed(cUnit, rBase, regOffset, rDest, 0, size);
+ FreeTemp(cUnit, regOffset);
}
// TODO: in future may need to differentiate Dalvik accesses w/ spills
if (rBase == rARM_SP) {
- annotateDalvikRegAccess(load, displacement >> 2, true /* isLoad */, is64bit);
+ AnnotateDalvikRegAccess(load, displacement >> 2, true /* isLoad */, is64bit);
}
return load;
}
-LIR* loadBaseDisp(CompilationUnit* cUnit, int rBase,
+LIR* LoadBaseDisp(CompilationUnit* cUnit, int rBase,
int displacement, int rDest, OpSize size, int sReg)
{
- return loadBaseDispBody(cUnit, rBase, displacement, rDest, -1, size,
+ return LoadBaseDispBody(cUnit, rBase, displacement, rDest, -1, size,
sReg);
}
- LIR* loadBaseDispWide(CompilationUnit* cUnit, int rBase,
+ LIR* LoadBaseDispWide(CompilationUnit* cUnit, int rBase,
int displacement, int rDestLo, int rDestHi, int sReg)
{
- return loadBaseDispBody(cUnit, rBase, displacement, rDestLo, rDestHi,
+ return LoadBaseDispBody(cUnit, rBase, displacement, rDestLo, rDestHi,
kLong, sReg);
}
-LIR* storeBaseDispBody(CompilationUnit* cUnit, int rBase, int displacement,
+LIR* StoreBaseDispBody(CompilationUnit* cUnit, int rBase, int displacement,
int rSrc, int rSrcHi, OpSize size)
{
LIR* res, *store;
@@ -907,13 +907,13 @@
case kDouble:
is64bit = true;
if (!ARM_FPREG(rSrc)) {
- res = storeBaseDispBody(cUnit, rBase, displacement, rSrc, -1, kWord);
- storeBaseDispBody(cUnit, rBase, displacement + 4, rSrcHi, -1, kWord);
+ res = StoreBaseDispBody(cUnit, rBase, displacement, rSrc, -1, kWord);
+ StoreBaseDispBody(cUnit, rBase, displacement + 4, rSrcHi, -1, kWord);
return res;
}
if (ARM_SINGLEREG(rSrc)) {
DCHECK(ARM_FPREG(rSrcHi));
- rSrc = s2d(rSrc, rSrcHi);
+ rSrc = S2d(rSrc, rSrcHi);
}
opcode = kThumb2Vstrd;
if (displacement <= 1020) {
@@ -968,40 +968,40 @@
LOG(FATAL) << "Bad size: " << size;
}
if (shortForm) {
- store = res = newLIR3(cUnit, opcode, rSrc, rBase, encodedDisp);
+ store = res = NewLIR3(cUnit, opcode, rSrc, rBase, encodedDisp);
} else {
- int rScratch = oatAllocTemp(cUnit);
- res = loadConstant(cUnit, rScratch, encodedDisp);
- store = storeBaseIndexed(cUnit, rBase, rScratch, rSrc, 0, size);
- oatFreeTemp(cUnit, rScratch);
+ int rScratch = AllocTemp(cUnit);
+ res = LoadConstant(cUnit, rScratch, encodedDisp);
+ store = StoreBaseIndexed(cUnit, rBase, rScratch, rSrc, 0, size);
+ FreeTemp(cUnit, rScratch);
}
// TODO: In future, may need to differentiate Dalvik & spill accesses
if (rBase == rARM_SP) {
- annotateDalvikRegAccess(store, displacement >> 2, false /* isLoad */,
+ AnnotateDalvikRegAccess(store, displacement >> 2, false /* isLoad */,
is64bit);
}
return res;
}
-LIR* storeBaseDisp(CompilationUnit* cUnit, int rBase, int displacement,
+LIR* StoreBaseDisp(CompilationUnit* cUnit, int rBase, int displacement,
int rSrc, OpSize size)
{
- return storeBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
+ return StoreBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
}
-LIR* storeBaseDispWide(CompilationUnit* cUnit, int rBase, int displacement,
+LIR* StoreBaseDispWide(CompilationUnit* cUnit, int rBase, int displacement,
int rSrcLo, int rSrcHi)
{
- return storeBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
+ return StoreBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
}
-void loadPair(CompilationUnit* cUnit, int base, int lowReg, int highReg)
+void LoadPair(CompilationUnit* cUnit, int base, int lowReg, int highReg)
{
- loadBaseDispWide(cUnit, base, 0, lowReg, highReg, INVALID_SREG);
+ LoadBaseDispWide(cUnit, base, 0, lowReg, highReg, INVALID_SREG);
}
-LIR* fpRegCopy(CompilationUnit* cUnit, int rDest, int rSrc)
+LIR* FpRegCopy(CompilationUnit* cUnit, int rDest, int rSrc)
{
int opcode;
DCHECK_EQ(ARM_DOUBLEREG(rDest), ARM_DOUBLEREG(rSrc));
@@ -1015,47 +1015,47 @@
opcode = kThumb2Fmrs;
}
}
- LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
+ LIR* res = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) && rDest == rSrc) {
res->flags.isNop = true;
}
return res;
}
-LIR* opThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset)
+LIR* OpThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset)
{
- LOG(FATAL) << "Unexpected use of opThreadMem for Arm";
+ LOG(FATAL) << "Unexpected use of OpThreadMem for Arm";
return NULL;
}
-LIR* opMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp)
+LIR* OpMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp)
{
- LOG(FATAL) << "Unexpected use of opMem for Arm";
+ LOG(FATAL) << "Unexpected use of OpMem for Arm";
return NULL;
}
-LIR* storeBaseIndexedDisp(CompilationUnit *cUnit,
+LIR* StoreBaseIndexedDisp(CompilationUnit *cUnit,
int rBase, int rIndex, int scale, int displacement,
int rSrc, int rSrcHi,
OpSize size, int sReg)
{
- LOG(FATAL) << "Unexpected use of storeBaseIndexedDisp for Arm";
+ LOG(FATAL) << "Unexpected use of StoreBaseIndexedDisp for Arm";
return NULL;
}
-LIR* opRegMem(CompilationUnit *cUnit, OpKind op, int rDest, int rBase,
+LIR* OpRegMem(CompilationUnit *cUnit, OpKind op, int rDest, int rBase,
int offset)
{
- LOG(FATAL) << "Unexpected use of opRegMem for Arm";
+ LOG(FATAL) << "Unexpected use of OpRegMem for Arm";
return NULL;
}
-LIR* loadBaseIndexedDisp(CompilationUnit *cUnit,
+LIR* LoadBaseIndexedDisp(CompilationUnit *cUnit,
int rBase, int rIndex, int scale, int displacement,
int rDest, int rDestHi,
OpSize size, int sReg)
{
- LOG(FATAL) << "Unexpected use of loadBaseIndexedDisp for Arm";
+ LOG(FATAL) << "Unexpected use of LoadBaseIndexedDisp for Arm";
return NULL;
}
diff --git a/src/compiler/codegen/codegen_util.cc b/src/compiler/codegen/codegen_util.cc
index c6c8af1..26bf613 100644
--- a/src/compiler/codegen/codegen_util.cc
+++ b/src/compiler/codegen/codegen_util.cc
@@ -24,16 +24,16 @@
namespace art {
/* Convert an instruction to a NOP */
-void oatNopLIR( LIR* lir)
+void NopLIR( LIR* lir)
{
lir->flags.isNop = true;
}
-void setMemRefType(LIR* lir, bool isLoad, int memType)
+void SetMemRefType(LIR* lir, bool isLoad, int memType)
{
uint64_t *maskPtr;
uint64_t mask = ENCODE_MEM;;
- DCHECK(getTargetInstFlags(lir->opcode) & (IS_LOAD | IS_STORE));
+ DCHECK(GetTargetInstFlags(lir->opcode) & (IS_LOAD | IS_STORE));
if (isLoad) {
maskPtr = &lir->useMask;
} else {
@@ -55,7 +55,7 @@
break;
case kMustNotAlias:
/* Currently only loads can be marked as kMustNotAlias */
- DCHECK(!(getTargetInstFlags(lir->opcode) & IS_STORE));
+ DCHECK(!(GetTargetInstFlags(lir->opcode) & IS_STORE));
*maskPtr |= ENCODE_MUST_NOT_ALIAS;
break;
default:
@@ -66,9 +66,9 @@
/*
* Mark load/store instructions that access Dalvik registers through the stack.
*/
-void annotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit)
+void AnnotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit)
{
- setMemRefType(lir, isLoad, kDalvikReg);
+ SetMemRefType(lir, isLoad, kDalvikReg);
/*
* Store the Dalvik register id in aliasInfo. Mark the MSB if it is a 64-bit
@@ -77,29 +77,18 @@
lir->aliasInfo = ENCODE_ALIAS_INFO(regId, is64bit);
}
-uint64_t oatGetRegMaskCommon(CompilationUnit* cUnit, int reg)
-{
- return getRegMaskCommon(cUnit, reg);
-}
-
/*
* Mark the corresponding bit(s).
*/
-inline void setupRegMask(CompilationUnit* cUnit, uint64_t* mask, int reg)
+void SetupRegMask(CompilationUnit* cUnit, uint64_t* mask, int reg)
{
- *mask |= getRegMaskCommon(cUnit, reg);
-}
-
-/* Exported version of setupRegMask */
-void oatSetupRegMask(CompilationUnit* cUnit, uint64_t* mask, int reg)
-{
- setupRegMask(cUnit, mask, reg);
+ *mask |= GetRegMaskCommon(cUnit, reg);
}
/*
* Set up the proper fields in the resource mask
*/
-void setupResourceMasks(CompilationUnit* cUnit, LIR* lir)
+void SetupResourceMasks(CompilationUnit* cUnit, LIR* lir)
{
int opcode = lir->opcode;
@@ -108,19 +97,19 @@
return;
}
- uint64_t flags = getTargetInstFlags(opcode);
+ uint64_t flags = GetTargetInstFlags(opcode);
if (flags & NEEDS_FIXUP) {
lir->flags.pcRelFixup = true;
}
/* Get the starting size of the instruction's template */
- lir->flags.size = oatGetInsnSize(lir);
+ lir->flags.size = GetInsnSize(lir);
/* Set up the mask for resources that are updated */
if (flags & (IS_LOAD | IS_STORE)) {
/* Default to heap - will catch specialized classes later */
- setMemRefType(lir, flags & IS_LOAD, kHeapRef);
+ SetMemRefType(lir, flags & IS_LOAD, kHeapRef);
}
/*
@@ -133,11 +122,11 @@
}
if (flags & REG_DEF0) {
- setupRegMask(cUnit, &lir->defMask, lir->operands[0]);
+ SetupRegMask(cUnit, &lir->defMask, lir->operands[0]);
}
if (flags & REG_DEF1) {
- setupRegMask(cUnit, &lir->defMask, lir->operands[1]);
+ SetupRegMask(cUnit, &lir->defMask, lir->operands[1]);
}
@@ -150,7 +139,7 @@
for (i = 0; i < 4; i++) {
if (flags & (1 << (kRegUse0 + i))) {
- setupRegMask(cUnit, &lir->useMask, lir->operands[i]);
+ SetupRegMask(cUnit, &lir->useMask, lir->operands[i]);
}
}
}
@@ -160,7 +149,7 @@
}
// Handle target-specific actions
- setupTargetResourceMasks(cUnit, lir);
+ SetupTargetResourceMasks(cUnit, lir);
}
/*
@@ -170,7 +159,7 @@
#define DUMP_SSA_REP(X)
/* Pretty-print a LIR instruction */
-void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* lir, unsigned char* baseAddr)
+void DumpLIRInsn(CompilationUnit* cUnit, LIR* lir, unsigned char* baseAddr)
{
int offset = lir->offset;
int dest = lir->operands[0];
@@ -239,9 +228,9 @@
if (lir->flags.isNop && !dumpNop) {
break;
} else {
- std::string op_name(buildInsnString(getTargetInstName(lir->opcode),
+ std::string op_name(BuildInsnString(GetTargetInstName(lir->opcode),
lir, baseAddr));
- std::string op_operands(buildInsnString(getTargetInstFmt(lir->opcode),
+ std::string op_operands(BuildInsnString(GetTargetInstFmt(lir->opcode),
lir, baseAddr));
LOG(INFO) << StringPrintf("%05x: %-9s%s%s",
reinterpret_cast<unsigned int>(baseAddr + offset),
@@ -252,21 +241,21 @@
}
if (lir->useMask && (!lir->flags.isNop || dumpNop)) {
- DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir, lir->useMask, "use"));
+ DUMP_RESOURCE_MASK(DumpResourceMask((LIR* ) lir, lir->useMask, "use"));
}
if (lir->defMask && (!lir->flags.isNop || dumpNop)) {
- DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir, lir->defMask, "def"));
+ DUMP_RESOURCE_MASK(DumpResourceMask((LIR* ) lir, lir->defMask, "def"));
}
}
-void oatDumpPromotionMap(CompilationUnit *cUnit)
+void DumpPromotionMap(CompilationUnit *cUnit)
{
int numRegs = cUnit->numDalvikRegisters + cUnit->numCompilerTemps + 1;
for (int i = 0; i < numRegs; i++) {
PromotionMap vRegMap = cUnit->promotionMap[i];
std::string buf;
if (vRegMap.fpLocation == kLocPhysReg) {
- StringAppendF(&buf, " : s%d", vRegMap.fpReg & fpRegMask());
+ StringAppendF(&buf, " : s%d", vRegMap.FpReg & FpRegMask());
}
std::string buf3;
@@ -281,13 +270,13 @@
LOG(INFO) << StringPrintf("V[%s] -> %s%d%s", buf3.c_str(),
vRegMap.coreLocation == kLocPhysReg ?
"r" : "SP+", vRegMap.coreLocation == kLocPhysReg ?
- vRegMap.coreReg : oatSRegOffset(cUnit, i),
+ vRegMap.coreReg : SRegOffset(cUnit, i),
buf.c_str());
}
}
/* Dump a mapping table */
-void dumpMappingTable(const char* table_name, const std::string& descriptor,
+void DumpMappingTable(const char* table_name, const std::string& descriptor,
const std::string& name, const std::string& signature,
const std::vector<uint32_t>& v) {
if (v.size() > 0) {
@@ -304,7 +293,7 @@
}
/* Dump instructions and constant pool contents */
-void oatCodegenDump(CompilationUnit* cUnit)
+void CodegenDump(CompilationUnit* cUnit)
{
LOG(INFO) << "Dumping LIR insns for "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file);
@@ -322,9 +311,9 @@
" bytes, Dalvik size is " << insnsSize * 2;
LOG(INFO) << "expansion factor: "
<< static_cast<float>(cUnit->totalSize) / static_cast<float>(insnsSize * 2);
- oatDumpPromotionMap(cUnit);
+ DumpPromotionMap(cUnit);
for (lirInsn = cUnit->firstLIRInsn; lirInsn; lirInsn = lirInsn->next) {
- oatDumpLIRInsn(cUnit, lirInsn, 0);
+ DumpLIRInsn(cUnit, lirInsn, 0);
}
for (lirInsn = cUnit->literalList; lirInsn; lirInsn = lirInsn->next) {
LOG(INFO) << StringPrintf("%x (%04x): .word (%#x)", lirInsn->offset, lirInsn->offset,
@@ -338,15 +327,15 @@
std::string descriptor(cUnit->dex_file->GetMethodDeclaringClassDescriptor(method_id));
// Dump mapping tables
- dumpMappingTable("PC2Dex_MappingTable", descriptor, name, signature, cUnit->pc2dexMappingTable);
- dumpMappingTable("Dex2PC_MappingTable", descriptor, name, signature, cUnit->dex2pcMappingTable);
+ DumpMappingTable("PC2Dex_MappingTable", descriptor, name, signature, cUnit->pc2dexMappingTable);
+ DumpMappingTable("Dex2PC_MappingTable", descriptor, name, signature, cUnit->dex2pcMappingTable);
}
-LIR* rawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0,
+LIR* RawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0,
int op1, int op2, int op3, int op4, LIR* target)
{
- LIR* insn = static_cast<LIR*>(oatNew(cUnit, sizeof(LIR), true, kAllocLIR));
+ LIR* insn = static_cast<LIR*>(NewMem(cUnit, sizeof(LIR), true, kAllocLIR));
insn->dalvikOffset = dalvikOffset;
insn->opcode = opcode;
insn->operands[0] = op0;
@@ -355,7 +344,7 @@
insn->operands[3] = op3;
insn->operands[4] = op4;
insn->target = target;
- oatSetupResourceMasks(cUnit, insn);
+ SetupResourceMasks(cUnit, insn);
if ((opcode == kPseudoTargetLabel) || (opcode == kPseudoSafepointPC) ||
(opcode == kPseudoExportedPC)) {
// Always make labels scheduling barriers
@@ -368,74 +357,74 @@
* The following are building blocks to construct low-level IRs with 0 - 4
* operands.
*/
-LIR* newLIR0(CompilationUnit* cUnit, int opcode)
+LIR* NewLIR0(CompilationUnit* cUnit, int opcode)
{
- DCHECK(isPseudoOpcode(opcode) || (getTargetInstFlags(opcode) & NO_OPERAND))
- << getTargetInstName(opcode) << " " << opcode << " "
+ DCHECK(isPseudoOpcode(opcode) || (GetTargetInstFlags(opcode) & NO_OPERAND))
+ << GetTargetInstName(opcode) << " " << opcode << " "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " "
<< cUnit->currentDalvikOffset;
- LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode);
- oatAppendLIR(cUnit, insn);
+ LIR* insn = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode);
+ AppendLIR(cUnit, insn);
return insn;
}
-LIR* newLIR1(CompilationUnit* cUnit, int opcode,
+LIR* NewLIR1(CompilationUnit* cUnit, int opcode,
int dest)
{
- DCHECK(isPseudoOpcode(opcode) || (getTargetInstFlags(opcode) & IS_UNARY_OP))
- << getTargetInstName(opcode) << " " << opcode << " "
+ DCHECK(isPseudoOpcode(opcode) || (GetTargetInstFlags(opcode) & IS_UNARY_OP))
+ << GetTargetInstName(opcode) << " " << opcode << " "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " "
<< cUnit->currentDalvikOffset;
- LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest);
- oatAppendLIR(cUnit, insn);
+ LIR* insn = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest);
+ AppendLIR(cUnit, insn);
return insn;
}
-LIR* newLIR2(CompilationUnit* cUnit, int opcode,
+LIR* NewLIR2(CompilationUnit* cUnit, int opcode,
int dest, int src1)
{
- DCHECK(isPseudoOpcode(opcode) || (getTargetInstFlags(opcode) & IS_BINARY_OP))
- << getTargetInstName(opcode) << " " << opcode << " "
+ DCHECK(isPseudoOpcode(opcode) || (GetTargetInstFlags(opcode) & IS_BINARY_OP))
+ << GetTargetInstName(opcode) << " " << opcode << " "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " "
<< cUnit->currentDalvikOffset;
- LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1);
- oatAppendLIR(cUnit, insn);
+ LIR* insn = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1);
+ AppendLIR(cUnit, insn);
return insn;
}
-LIR* newLIR3(CompilationUnit* cUnit, int opcode,
+LIR* NewLIR3(CompilationUnit* cUnit, int opcode,
int dest, int src1, int src2)
{
- DCHECK(isPseudoOpcode(opcode) || (getTargetInstFlags(opcode) & IS_TERTIARY_OP))
- << getTargetInstName(opcode) << " " << opcode << " "
+ DCHECK(isPseudoOpcode(opcode) || (GetTargetInstFlags(opcode) & IS_TERTIARY_OP))
+ << GetTargetInstName(opcode) << " " << opcode << " "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " "
<< cUnit->currentDalvikOffset;
- LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, src2);
- oatAppendLIR(cUnit, insn);
+ LIR* insn = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, src2);
+ AppendLIR(cUnit, insn);
return insn;
}
-LIR* newLIR4(CompilationUnit* cUnit, int opcode,
+LIR* NewLIR4(CompilationUnit* cUnit, int opcode,
int dest, int src1, int src2, int info)
{
- DCHECK(isPseudoOpcode(opcode) || (getTargetInstFlags(opcode) & IS_QUAD_OP))
- << getTargetInstName(opcode) << " " << opcode << " "
+ DCHECK(isPseudoOpcode(opcode) || (GetTargetInstFlags(opcode) & IS_QUAD_OP))
+ << GetTargetInstName(opcode) << " " << opcode << " "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " "
<< cUnit->currentDalvikOffset;
- LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, src2, info);
- oatAppendLIR(cUnit, insn);
+ LIR* insn = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, src2, info);
+ AppendLIR(cUnit, insn);
return insn;
}
-LIR* newLIR5(CompilationUnit* cUnit, int opcode,
+LIR* NewLIR5(CompilationUnit* cUnit, int opcode,
int dest, int src1, int src2, int info1, int info2)
{
- DCHECK(isPseudoOpcode(opcode) || (getTargetInstFlags(opcode) & IS_QUIN_OP))
- << getTargetInstName(opcode) << " " << opcode << " "
+ DCHECK(isPseudoOpcode(opcode) || (GetTargetInstFlags(opcode) & IS_QUIN_OP))
+ << GetTargetInstName(opcode) << " " << opcode << " "
<< PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " "
<< cUnit->currentDalvikOffset;
- LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, src2, info1, info2);
- oatAppendLIR(cUnit, insn);
+ LIR* insn = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, src2, info1, info2);
+ AppendLIR(cUnit, insn);
return insn;
}
@@ -443,7 +432,7 @@
* Search the existing constants in the literal pool for an exact or close match
* within specified delta (greater or equal to 0).
*/
-LIR* scanLiteralPool(LIR* dataTarget, int value, unsigned int delta)
+LIR* ScanLiteralPool(LIR* dataTarget, int value, unsigned int delta)
{
while (dataTarget) {
if ((static_cast<unsigned>(value - dataTarget->operands[0])) <= delta)
@@ -454,7 +443,7 @@
}
/* Search the existing constants in the literal pool for an exact wide match */
-LIR* scanLiteralPoolWide(LIR* dataTarget, int valLo, int valHi)
+LIR* ScanLiteralPoolWide(LIR* dataTarget, int valLo, int valHi)
{
bool loMatch = false;
LIR* loTarget = NULL;
@@ -478,11 +467,11 @@
*/
/* Add a 32-bit constant either in the constant pool */
-LIR* addWordData(CompilationUnit* cUnit, LIR* *constantListP, int value)
+LIR* AddWordData(CompilationUnit* cUnit, LIR* *constantListP, int value)
{
/* Add the constant to the literal pool */
if (constantListP) {
- LIR* newValue = static_cast<LIR*>(oatNew(cUnit, sizeof(LIR), true, kAllocData));
+ LIR* newValue = static_cast<LIR*>(NewMem(cUnit, sizeof(LIR), true, kAllocData));
newValue->operands[0] = value;
newValue->next = *constantListP;
*constantListP = newValue;
@@ -492,21 +481,21 @@
}
/* Add a 64-bit constant to the constant pool or mixed with code */
-LIR* addWideData(CompilationUnit* cUnit, LIR* *constantListP,
+LIR* AddWideData(CompilationUnit* cUnit, LIR* *constantListP,
int valLo, int valHi)
{
- addWordData(cUnit, constantListP, valHi);
- return addWordData(cUnit, constantListP, valLo);
+ AddWordData(cUnit, constantListP, valHi);
+ return AddWordData(cUnit, constantListP, valLo);
}
-void pushWord(std::vector<uint8_t>&buf, int data) {
+void PushWord(std::vector<uint8_t>&buf, int data) {
buf.push_back( data & 0xff);
buf.push_back( (data >> 8) & 0xff);
buf.push_back( (data >> 16) & 0xff);
buf.push_back( (data >> 24) & 0xff);
}
-void alignBuffer(std::vector<uint8_t>&buf, size_t offset) {
+void AlignBuffer(std::vector<uint8_t>&buf, size_t offset) {
while (buf.size() < offset) {
buf.push_back(0);
}
@@ -518,12 +507,12 @@
}
/* Write the literal pool to the output stream */
-void installLiteralPools(CompilationUnit* cUnit)
+void InstallLiteralPools(CompilationUnit* cUnit)
{
- alignBuffer(cUnit->codeBuffer, cUnit->dataOffset);
+ AlignBuffer(cUnit->codeBuffer, cUnit->dataOffset);
LIR* dataLIR = cUnit->literalList;
while (dataLIR != NULL) {
- pushWord(cUnit->codeBuffer, dataLIR->operands[0]);
+ PushWord(cUnit->codeBuffer, dataLIR->operands[0]);
dataLIR = NEXT_LIR(dataLIR);
}
// Push code and method literals, record offsets for the compiler to patch.
@@ -539,7 +528,7 @@
const DexFile::MethodId& id = cUnit->dex_file->GetMethodId(target);
// unique based on target to ensure code deduplication works
uint32_t unique_patch_value = reinterpret_cast<uint32_t>(&id);
- pushWord(cUnit->codeBuffer, unique_patch_value);
+ PushWord(cUnit->codeBuffer, unique_patch_value);
dataLIR = NEXT_LIR(dataLIR);
}
dataLIR = cUnit->methodLiteralList;
@@ -554,20 +543,20 @@
const DexFile::MethodId& id = cUnit->dex_file->GetMethodId(target);
// unique based on target to ensure code deduplication works
uint32_t unique_patch_value = reinterpret_cast<uint32_t>(&id);
- pushWord(cUnit->codeBuffer, unique_patch_value);
+ PushWord(cUnit->codeBuffer, unique_patch_value);
dataLIR = NEXT_LIR(dataLIR);
}
}
/* Write the switch tables to the output stream */
-void installSwitchTables(CompilationUnit* cUnit)
+void InstallSwitchTables(CompilationUnit* cUnit)
{
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->switchTables, &iterator);
+ GrowableListIteratorInit(&cUnit->switchTables, &iterator);
while (true) {
- SwitchTable* tabRec = reinterpret_cast<SwitchTable*>(oatGrowableListIteratorNext( &iterator));
+ SwitchTable* tabRec = reinterpret_cast<SwitchTable*>(GrowableListIteratorNext( &iterator));
if (tabRec == NULL) break;
- alignBuffer(cUnit->codeBuffer, tabRec->offset);
+ AlignBuffer(cUnit->codeBuffer, tabRec->offset);
/*
* For Arm, our reference point is the address of the bx
* instruction that does the launch, so we have to subtract
@@ -599,8 +588,8 @@
<< std::hex << keys[elems] << ", disp: 0x"
<< std::hex << disp;
}
- pushWord(cUnit->codeBuffer, keys[elems]);
- pushWord(cUnit->codeBuffer,
+ PushWord(cUnit->codeBuffer, keys[elems]);
+ PushWord(cUnit->codeBuffer,
tabRec->targets[elems]->offset - bxOffset);
}
} else {
@@ -612,22 +601,22 @@
LOG(INFO) << " Case[" << elems << "] disp: 0x"
<< std::hex << disp;
}
- pushWord(cUnit->codeBuffer, tabRec->targets[elems]->offset - bxOffset);
+ PushWord(cUnit->codeBuffer, tabRec->targets[elems]->offset - bxOffset);
}
}
}
}
/* Write the fill array dta to the output stream */
-void installFillArrayData(CompilationUnit* cUnit)
+void InstallFillArrayData(CompilationUnit* cUnit)
{
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->fillArrayData, &iterator);
+ GrowableListIteratorInit(&cUnit->fillArrayData, &iterator);
while (true) {
FillArrayData *tabRec =
- reinterpret_cast<FillArrayData*>(oatGrowableListIteratorNext( &iterator));
+ reinterpret_cast<FillArrayData*>(GrowableListIteratorNext( &iterator));
if (tabRec == NULL) break;
- alignBuffer(cUnit->codeBuffer, tabRec->offset);
+ AlignBuffer(cUnit->codeBuffer, tabRec->offset);
for (int i = 0; i < (tabRec->size + 1) / 2; i++) {
cUnit->codeBuffer.push_back( tabRec->table[i] & 0xFF);
cUnit->codeBuffer.push_back( (tabRec->table[i] >> 8) & 0xFF);
@@ -635,7 +624,7 @@
}
}
-int assignLiteralOffsetCommon(LIR* lir, int offset)
+int AssignLiteralOffsetCommon(LIR* lir, int offset)
{
for (;lir != NULL; lir = lir->next) {
lir->offset = offset;
@@ -645,7 +634,7 @@
}
// Make sure we have a code address for every declared catch entry
-bool verifyCatchEntries(CompilationUnit* cUnit)
+bool VerifyCatchEntries(CompilationUnit* cUnit)
{
bool success = true;
for (std::set<uint32_t>::const_iterator it = cUnit->catches.begin(); it != cUnit->catches.end(); ++it) {
@@ -678,7 +667,7 @@
return success;
}
-void createMappingTables(CompilationUnit* cUnit)
+void CreateMappingTables(CompilationUnit* cUnit)
{
for (LIR* tgtLIR = cUnit->firstLIRInsn; tgtLIR != NULL; tgtLIR = NEXT_LIR(tgtLIR)) {
if (!tgtLIR->flags.isNop && (tgtLIR->opcode == kPseudoSafepointPC)) {
@@ -690,7 +679,7 @@
cUnit->dex2pcMappingTable.push_back(tgtLIR->dalvikOffset);
}
}
- DCHECK(verifyCatchEntries(cUnit));
+ DCHECK(VerifyCatchEntries(cUnit));
cUnit->combinedMappingTable.push_back(cUnit->pc2dexMappingTable.size() +
cUnit->dex2pcMappingTable.size());
cUnit->combinedMappingTable.push_back(cUnit->pc2dexMappingTable.size());
@@ -780,7 +769,7 @@
std::vector<uint8_t>* const table_;
};
-static void createNativeGcMap(CompilationUnit* cUnit) {
+static void CreateNativeGcMap(CompilationUnit* cUnit) {
const std::vector<uint32_t>& mapping_table = cUnit->pc2dexMappingTable;
uint32_t max_native_offset = 0;
for (size_t i = 0; i < mapping_table.size(); i += 2) {
@@ -807,20 +796,20 @@
}
/* Determine the offset of each literal field */
-int assignLiteralOffset(CompilationUnit* cUnit, int offset)
+int AssignLiteralOffset(CompilationUnit* cUnit, int offset)
{
- offset = assignLiteralOffsetCommon(cUnit->literalList, offset);
- offset = assignLiteralOffsetCommon(cUnit->codeLiteralList, offset);
- offset = assignLiteralOffsetCommon(cUnit->methodLiteralList, offset);
+ offset = AssignLiteralOffsetCommon(cUnit->literalList, offset);
+ offset = AssignLiteralOffsetCommon(cUnit->codeLiteralList, offset);
+ offset = AssignLiteralOffsetCommon(cUnit->methodLiteralList, offset);
return offset;
}
-int assignSwitchTablesOffset(CompilationUnit* cUnit, int offset)
+int AssignSiwtchTablesOffset(CompilationUnit* cUnit, int offset)
{
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->switchTables, &iterator);
+ GrowableListIteratorInit(&cUnit->switchTables, &iterator);
while (true) {
- SwitchTable *tabRec = reinterpret_cast<SwitchTable*>(oatGrowableListIteratorNext(&iterator));
+ SwitchTable *tabRec = reinterpret_cast<SwitchTable*>(GrowableListIteratorNext(&iterator));
if (tabRec == NULL) break;
tabRec->offset = offset;
if (tabRec->table[0] == Instruction::kSparseSwitchSignature) {
@@ -834,13 +823,13 @@
return offset;
}
-int assignFillArrayDataOffset(CompilationUnit* cUnit, int offset)
+int AssignFillArrayDataOffset(CompilationUnit* cUnit, int offset)
{
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->fillArrayData, &iterator);
+ GrowableListIteratorInit(&cUnit->fillArrayData, &iterator);
while (true) {
FillArrayData *tabRec =
- reinterpret_cast<FillArrayData*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<FillArrayData*>(GrowableListIteratorNext(&iterator));
if (tabRec == NULL) break;
tabRec->offset = offset;
offset += tabRec->size;
@@ -854,9 +843,9 @@
* Walk the compilation unit and assign offsets to instructions
* and literals and compute the total size of the compiled unit.
*/
-void oatAssignOffsets(CompilationUnit* cUnit)
+void AssignOffsets(CompilationUnit* cUnit)
{
- int offset = oatAssignInsnOffsets(cUnit);
+ int offset = AssignInsnOffsets(cUnit);
/* Const values have to be word aligned */
offset = (offset + 3) & ~3;
@@ -864,11 +853,11 @@
/* Set up offsets for literals */
cUnit->dataOffset = offset;
- offset = assignLiteralOffset(cUnit, offset);
+ offset = AssignLiteralOffset(cUnit, offset);
- offset = assignSwitchTablesOffset(cUnit, offset);
+ offset = AssignSiwtchTablesOffset(cUnit, offset);
- offset = assignFillArrayDataOffset(cUnit, offset);
+ offset = AssignFillArrayDataOffset(cUnit, offset);
cUnit->totalSize = offset;
}
@@ -878,43 +867,43 @@
* before sending them off to the assembler. If out-of-range branch distance is
* seen rearrange the instructions a bit to correct it.
*/
-void oatAssembleLIR(CompilationUnit* cUnit)
+void AssembleLIR(CompilationUnit* cUnit)
{
- oatAssignOffsets(cUnit);
+ AssignOffsets(cUnit);
/*
* Assemble here. Note that we generate code with optimistic assumptions
* and if found now to work, we'll have to redo the sequence and retry.
*/
while (true) {
- AssemblerStatus res = oatAssembleInstructions(cUnit, 0);
+ AssemblerStatus res = AssembleInstructions(cUnit, 0);
if (res == kSuccess) {
break;
} else {
cUnit->assemblerRetries++;
if (cUnit->assemblerRetries > MAX_ASSEMBLER_RETRIES) {
- oatCodegenDump(cUnit);
+ CodegenDump(cUnit);
LOG(FATAL) << "Assembler error - too many retries";
}
// Redo offsets and try again
- oatAssignOffsets(cUnit);
+ AssignOffsets(cUnit);
cUnit->codeBuffer.clear();
}
}
// Install literals
- installLiteralPools(cUnit);
+ InstallLiteralPools(cUnit);
// Install switch tables
- installSwitchTables(cUnit);
+ InstallSwitchTables(cUnit);
// Install fill array data
- installFillArrayData(cUnit);
+ InstallFillArrayData(cUnit);
// Create the mapping table and native offset to reference map.
- createMappingTables(cUnit);
+ CreateMappingTables(cUnit);
- createNativeGcMap(cUnit);
+ CreateNativeGcMap(cUnit);
}
/*
@@ -924,22 +913,22 @@
* all resource flags on this to prevent code motion across
* target boundaries. KeyVal is just there for debugging.
*/
-LIR* insertCaseLabel(CompilationUnit* cUnit, int vaddr, int keyVal)
+LIR* InsertCaseLabel(CompilationUnit* cUnit, int vaddr, int keyVal)
{
SafeMap<unsigned int, LIR*>::iterator it;
it = cUnit->boundaryMap.find(vaddr);
if (it == cUnit->boundaryMap.end()) {
LOG(FATAL) << "Error: didn't find vaddr 0x" << std::hex << vaddr;
}
- LIR* newLabel = static_cast<LIR*>(oatNew(cUnit, sizeof(LIR), true, kAllocLIR));
+ LIR* newLabel = static_cast<LIR*>(NewMem(cUnit, sizeof(LIR), true, kAllocLIR));
newLabel->dalvikOffset = vaddr;
newLabel->opcode = kPseudoCaseLabel;
newLabel->operands[0] = keyVal;
- oatInsertLIRAfter(it->second, newLabel);
+ InsertLIRAfter(it->second, newLabel);
return newLabel;
}
-void markPackedCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
+void MarkPackedCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
{
const uint16_t* table = tabRec->table;
int baseVaddr = tabRec->vaddr;
@@ -947,11 +936,11 @@
int entries = table[1];
int lowKey = s4FromSwitchData(&table[2]);
for (int i = 0; i < entries; i++) {
- tabRec->targets[i] = insertCaseLabel(cUnit, baseVaddr + targets[i], i + lowKey);
+ tabRec->targets[i] = InsertCaseLabel(cUnit, baseVaddr + targets[i], i + lowKey);
}
}
-void markSparseCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
+void MarkSparseCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
{
const uint16_t* table = tabRec->table;
int baseVaddr = tabRec->vaddr;
@@ -959,29 +948,29 @@
const int* keys = reinterpret_cast<const int*>(&table[2]);
const int* targets = &keys[entries];
for (int i = 0; i < entries; i++) {
- tabRec->targets[i] = insertCaseLabel(cUnit, baseVaddr + targets[i], keys[i]);
+ tabRec->targets[i] = InsertCaseLabel(cUnit, baseVaddr + targets[i], keys[i]);
}
}
-void oatProcessSwitchTables(CompilationUnit* cUnit)
+void ProcessSwitchTables(CompilationUnit* cUnit)
{
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->switchTables, &iterator);
+ GrowableListIteratorInit(&cUnit->switchTables, &iterator);
while (true) {
SwitchTable *tabRec =
- reinterpret_cast<SwitchTable*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SwitchTable*>(GrowableListIteratorNext(&iterator));
if (tabRec == NULL) break;
if (tabRec->table[0] == Instruction::kPackedSwitchSignature) {
- markPackedCaseLabels(cUnit, tabRec);
+ MarkPackedCaseLabels(cUnit, tabRec);
} else if (tabRec->table[0] == Instruction::kSparseSwitchSignature) {
- markSparseCaseLabels(cUnit, tabRec);
+ MarkSparseCaseLabels(cUnit, tabRec);
} else {
LOG(FATAL) << "Invalid switch table";
}
}
}
-void dumpSparseSwitchTable(const uint16_t* table)
+void DumpSparseSwitchTable(const uint16_t* table)
/*
* Sparse switch data format:
* ushort ident = 0x0200 magic value
@@ -1003,7 +992,7 @@
}
}
-void dumpPackedSwitchTable(const uint16_t* table)
+void DumpPackedSwitchTable(const uint16_t* table)
/*
* Packed switch data format:
* ushort ident = 0x0100 magic value
@@ -1032,9 +1021,9 @@
* which we split a single Dalvik instruction, only the first MIR op
* associated with a Dalvik PC should be entered into the map.
*/
-LIR* markBoundary(CompilationUnit* cUnit, int offset, const char* instStr)
+LIR* MarkBoundary(CompilationUnit* cUnit, int offset, const char* instStr)
{
- LIR* res = newLIR1(cUnit, kPseudoDalvikByteCodeBoundary, reinterpret_cast<uintptr_t>(instStr));
+ LIR* res = NewLIR1(cUnit, kPseudoDalvikByteCodeBoundary, reinterpret_cast<uintptr_t>(instStr));
if (cUnit->boundaryMap.find(offset) == cUnit->boundaryMap.end()) {
cUnit->boundaryMap.Put(offset, res);
}
diff --git a/src/compiler/codegen/codegen_util.h b/src/compiler/codegen/codegen_util.h
index c50c0f0..9920014 100644
--- a/src/compiler/codegen/codegen_util.h
+++ b/src/compiler/codegen/codegen_util.h
@@ -21,32 +21,32 @@
inline int32_t s4FromSwitchData(const void* switchData) { return *reinterpret_cast<const int32_t*>(switchData); }
inline RegisterClass oatRegClassBySize(OpSize size) { return (size == kUnsignedHalf || size == kSignedHalf || size == kUnsignedByte || size == kSignedByte ) ? kCoreReg : kAnyReg; }
-void oatAssembleLIR(CompilationUnit* cUnit);
-void setMemRefType(LIR* lir, bool isLoad, int memType);
-void annotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit);
-uint64_t oatGetRegMaskCommon(CompilationUnit* cUnit, int reg);
-void oatSetupRegMask(CompilationUnit* cUnit, uint64_t* mask, int reg);
-void setupResourceMasks(CompilationUnit* cUnit, LIR* lir);
-void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr);
-void oatDumpPromotionMap(CompilationUnit *cUnit);
-void dumpMappingTable(const char* table_name, const std::string& descriptor, const std::string& name, const std::string& signature, const std::vector<uint32_t>& v);
-void oatCodegenDump(CompilationUnit* cUnit);
+void AssembleLIR(CompilationUnit* cUnit);
+void SetMemRefType(LIR* lir, bool isLoad, int memType);
+void AnnotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit);
+uint64_t GetRegMaskCommon(CompilationUnit* cUnit, int reg);
+void SetupRegMask(CompilationUnit* cUnit, uint64_t* mask, int reg);
+void SetupResourceMasks(CompilationUnit* cUnit, LIR* lir);
+void DumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr);
+void DumpPromotionMap(CompilationUnit *cUnit);
+void DumpMappingTable(const char* table_name, const std::string& descriptor, const std::string& name, const std::string& signature, const std::vector<uint32_t>& v);
+void CodegenDump(CompilationUnit* cUnit);
// TODO: remove default parameters
-LIR* rawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0 = 0, int op1 = 0, int op2 = 0, int op3 = 0, int op4 = 0, LIR* target = NULL);
-LIR* newLIR0(CompilationUnit* cUnit, int opcode);
-LIR* newLIR1(CompilationUnit* cUnit, int opcode, int dest);
-LIR* newLIR2(CompilationUnit* cUnit, int opcode, int dest, int src1);
-LIR* newLIR3(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2);
-LIR* newLIR4(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2, int info);
-LIR* newLIR5(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2, int info1, int info2);
-LIR* scanLiteralPool(LIR* dataTarget, int value, unsigned int delta);
-LIR* scanLiteralPoolWide(LIR* dataTarget, int valLo, int valHi);
-LIR* addWordData(CompilationUnit* cUnit, LIR* *constantListP, int value);
-LIR* addWideData(CompilationUnit* cUnit, LIR* *constantListP, int valLo, int valHi);
-void oatProcessSwitchTables(CompilationUnit* cUnit);
-void dumpSparseSwitchTable(const uint16_t* table);
-void dumpPackedSwitchTable(const uint16_t* table);
-LIR* markBoundary(CompilationUnit* cUnit, int offset, const char* instStr);
+LIR* RawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0 = 0, int op1 = 0, int op2 = 0, int op3 = 0, int op4 = 0, LIR* target = NULL);
+LIR* NewLIR0(CompilationUnit* cUnit, int opcode);
+LIR* NewLIR1(CompilationUnit* cUnit, int opcode, int dest);
+LIR* NewLIR2(CompilationUnit* cUnit, int opcode, int dest, int src1);
+LIR* NewLIR3(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2);
+LIR* NewLIR4(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2, int info);
+LIR* NewLIR5(CompilationUnit* cUnit, int opcode, int dest, int src1, int src2, int info1, int info2);
+LIR* ScanLiteralPool(LIR* dataTarget, int value, unsigned int delta);
+LIR* ScanLiteralPoolWide(LIR* dataTarget, int valLo, int valHi);
+LIR* AddWordData(CompilationUnit* cUnit, LIR* *constantListP, int value);
+LIR* AddWideData(CompilationUnit* cUnit, LIR* *constantListP, int valLo, int valHi);
+void ProcessSwitchTables(CompilationUnit* cUnit);
+void DumpSparseSwitchTable(const uint16_t* table);
+void DumpPackedSwitchTable(const uint16_t* table);
+LIR* MarkBoundary(CompilationUnit* cUnit, int offset, const char* instStr);
} // namespace art
diff --git a/src/compiler/codegen/gen_common.cc b/src/compiler/codegen/gen_common.cc
index 649ae82..af7d4e0 100644
--- a/src/compiler/codegen/gen_common.cc
+++ b/src/compiler/codegen/gen_common.cc
@@ -22,7 +22,7 @@
namespace art {
//TODO: remove decl.
-void genInvoke(CompilationUnit* cUnit, CallInfo* info);
+void GenInvoke(CompilationUnit* cUnit, CallInfo* info);
/*
* This source files contains "gen" codegen routines that should
@@ -30,10 +30,10 @@
* and "op" calls may be used here.
*/
-void markSafepointPC(CompilationUnit* cUnit, LIR* inst)
+void MarkSafepointPC(CompilationUnit* cUnit, LIR* inst)
{
inst->defMask = ENCODE_ALL;
- LIR* safepointPC = newLIR0(cUnit, kPseudoSafepointPC);
+ LIR* safepointPC = NewLIR0(cUnit, kPseudoSafepointPC);
DCHECK_EQ(safepointPC->defMask, ENCODE_ALL);
}
@@ -43,275 +43,275 @@
* has a memory call operation, part 1 is a NOP for x86. For other targets,
* load arguments between the two parts.
*/
-int callHelperSetup(CompilationUnit* cUnit, int helperOffset)
+int CallHelperSetup(CompilationUnit* cUnit, int helperOffset)
{
- return (cUnit->instructionSet == kX86) ? 0 : loadHelper(cUnit, helperOffset);
+ return (cUnit->instructionSet == kX86) ? 0 : LoadHelper(cUnit, helperOffset);
}
/* NOTE: if rTgt is a temp, it will be freed following use */
-LIR* callHelper(CompilationUnit* cUnit, int rTgt, int helperOffset, bool safepointPC)
+LIR* CallHelper(CompilationUnit* cUnit, int rTgt, int helperOffset, bool safepointPC)
{
LIR* callInst;
if (cUnit->instructionSet == kX86) {
- callInst = opThreadMem(cUnit, kOpBlx, helperOffset);
+ callInst = OpThreadMem(cUnit, kOpBlx, helperOffset);
} else {
- callInst = opReg(cUnit, kOpBlx, rTgt);
- oatFreeTemp(cUnit, rTgt);
+ callInst = OpReg(cUnit, kOpBlx, rTgt);
+ FreeTemp(cUnit, rTgt);
}
if (safepointPC) {
- markSafepointPC(cUnit, callInst);
+ MarkSafepointPC(cUnit, callInst);
}
return callInst;
}
-void callRuntimeHelperImm(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+void CallRuntimeHelperImm(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC) {
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperReg(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- opRegCopy(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+void CallRuntimeHelperReg(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC) {
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ OpRegCopy(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperRegLocation(CompilationUnit* cUnit, int helperOffset, RegLocation arg0,
+void CallRuntimeHelperRegLocation(CompilationUnit* cUnit, int helperOffset, RegLocation arg0,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
if (arg0.wide == 0) {
- loadValueDirectFixed(cUnit, arg0, targetReg(kArg0));
+ LoadValueDirectFixed(cUnit, arg0, TargetReg(kArg0));
} else {
- loadValueDirectWideFixed(cUnit, arg0, targetReg(kArg0), targetReg(kArg1));
+ LoadValueDirectWideFixed(cUnit, arg0, TargetReg(kArg0), TargetReg(kArg1));
}
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
+void CallRuntimeHelperImmImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadConstant(cUnit, targetReg(kArg0), arg0);
- loadConstant(cUnit, targetReg(kArg1), arg1);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ LoadConstant(cUnit, TargetReg(kArg1), arg1);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0,
+void CallRuntimeHelperImmRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0,
RegLocation arg1, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
if (arg1.wide == 0) {
- loadValueDirectFixed(cUnit, arg1, targetReg(kArg1));
+ LoadValueDirectFixed(cUnit, arg1, TargetReg(kArg1));
} else {
- loadValueDirectWideFixed(cUnit, arg1, targetReg(kArg1), targetReg(kArg2));
+ LoadValueDirectWideFixed(cUnit, arg1, TargetReg(kArg1), TargetReg(kArg2));
}
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperRegLocationImm(CompilationUnit* cUnit, int helperOffset, RegLocation arg0,
+void CallRuntimeHelperRegLocationImm(CompilationUnit* cUnit, int helperOffset, RegLocation arg0,
int arg1, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadValueDirectFixed(cUnit, arg0, targetReg(kArg0));
- loadConstant(cUnit, targetReg(kArg1), arg1);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadValueDirectFixed(cUnit, arg0, TargetReg(kArg0));
+ LoadConstant(cUnit, TargetReg(kArg1), arg1);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
+void CallRuntimeHelperImmReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- opRegCopy(cUnit, targetReg(kArg1), arg1);
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ OpRegCopy(cUnit, TargetReg(kArg1), arg1);
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
+void CallRuntimeHelperRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- opRegCopy(cUnit, targetReg(kArg0), arg0);
- loadConstant(cUnit, targetReg(kArg1), arg1);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ OpRegCopy(cUnit, TargetReg(kArg0), arg0);
+ LoadConstant(cUnit, TargetReg(kArg1), arg1);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmMethod(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadCurrMethodDirect(cUnit, targetReg(kArg1));
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+void CallRuntimeHelperImmMethod(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC) {
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg1));
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset,
+void CallRuntimeHelperRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset,
RegLocation arg0, RegLocation arg1, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
if (arg0.wide == 0) {
- loadValueDirectFixed(cUnit, arg0, arg0.fp ? targetReg(kFArg0) : targetReg(kArg0));
+ LoadValueDirectFixed(cUnit, arg0, arg0.fp ? TargetReg(kFArg0) : TargetReg(kArg0));
if (arg1.wide == 0) {
if (cUnit->instructionSet == kMips) {
- loadValueDirectFixed(cUnit, arg1, arg1.fp ? targetReg(kFArg2) : targetReg(kArg1));
+ LoadValueDirectFixed(cUnit, arg1, arg1.fp ? TargetReg(kFArg2) : TargetReg(kArg1));
} else {
- loadValueDirectFixed(cUnit, arg1, targetReg(kArg1));
+ LoadValueDirectFixed(cUnit, arg1, TargetReg(kArg1));
}
} else {
if (cUnit->instructionSet == kMips) {
- loadValueDirectWideFixed(cUnit, arg1, arg1.fp ? targetReg(kFArg2) : targetReg(kArg1), arg1.fp ? targetReg(kFArg3) : targetReg(kArg2));
+ LoadValueDirectWideFixed(cUnit, arg1, arg1.fp ? TargetReg(kFArg2) : TargetReg(kArg1), arg1.fp ? TargetReg(kFArg3) : TargetReg(kArg2));
} else {
- loadValueDirectWideFixed(cUnit, arg1, targetReg(kArg1), targetReg(kArg2));
+ LoadValueDirectWideFixed(cUnit, arg1, TargetReg(kArg1), TargetReg(kArg2));
}
}
} else {
- loadValueDirectWideFixed(cUnit, arg0, arg0.fp ? targetReg(kFArg0) : targetReg(kArg0), arg0.fp ? targetReg(kFArg1) : targetReg(kArg1));
+ LoadValueDirectWideFixed(cUnit, arg0, arg0.fp ? TargetReg(kFArg0) : TargetReg(kArg0), arg0.fp ? TargetReg(kFArg1) : TargetReg(kArg1));
if (arg1.wide == 0) {
- loadValueDirectFixed(cUnit, arg1, arg1.fp ? targetReg(kFArg2) : targetReg(kArg2));
+ LoadValueDirectFixed(cUnit, arg1, arg1.fp ? TargetReg(kFArg2) : TargetReg(kArg2));
} else {
- loadValueDirectWideFixed(cUnit, arg1, arg1.fp ? targetReg(kFArg2) : targetReg(kArg2), arg1.fp ? targetReg(kFArg3) : targetReg(kArg3));
+ LoadValueDirectWideFixed(cUnit, arg1, arg1.fp ? TargetReg(kFArg2) : TargetReg(kArg2), arg1.fp ? TargetReg(kFArg3) : TargetReg(kArg3));
}
}
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
+void CallRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- DCHECK_NE(targetReg(kArg0), arg1); // check copy into arg0 won't clobber arg1
- opRegCopy(cUnit, targetReg(kArg0), arg0);
- opRegCopy(cUnit, targetReg(kArg1), arg1);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ DCHECK_NE(TargetReg(kArg0), arg1); // check copy into arg0 won't clobber arg1
+ OpRegCopy(cUnit, TargetReg(kArg0), arg0);
+ OpRegCopy(cUnit, TargetReg(kArg1), arg1);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperRegRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
+void CallRuntimeHelperRegRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1,
int arg2, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- DCHECK_NE(targetReg(kArg0), arg1); // check copy into arg0 won't clobber arg1
- opRegCopy(cUnit, targetReg(kArg0), arg0);
- opRegCopy(cUnit, targetReg(kArg1), arg1);
- loadConstant(cUnit, targetReg(kArg2), arg2);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ DCHECK_NE(TargetReg(kArg0), arg1); // check copy into arg0 won't clobber arg1
+ OpRegCopy(cUnit, TargetReg(kArg0), arg0);
+ OpRegCopy(cUnit, TargetReg(kArg1), arg1);
+ LoadConstant(cUnit, TargetReg(kArg2), arg2);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmMethodRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0,
+void CallRuntimeHelperImmMethodRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0,
RegLocation arg2, bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadValueDirectFixed(cUnit, arg2, targetReg(kArg2));
- loadCurrMethodDirect(cUnit, targetReg(kArg1));
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadValueDirectFixed(cUnit, arg2, TargetReg(kArg2));
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg1));
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmMethodImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg2,
+void CallRuntimeHelperImmMethodImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg2,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadCurrMethodDirect(cUnit, targetReg(kArg1));
- loadConstant(cUnit, targetReg(kArg2), arg2);
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg1));
+ LoadConstant(cUnit, TargetReg(kArg2), arg2);
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
-void callRuntimeHelperImmRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset,
+void CallRuntimeHelperImmRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset,
int arg0, RegLocation arg1, RegLocation arg2,
bool safepointPC) {
- int rTgt = callHelperSetup(cUnit, helperOffset);
- loadValueDirectFixed(cUnit, arg1, targetReg(kArg1));
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ LoadValueDirectFixed(cUnit, arg1, TargetReg(kArg1));
if (arg2.wide == 0) {
- loadValueDirectFixed(cUnit, arg2, targetReg(kArg2));
+ LoadValueDirectFixed(cUnit, arg2, TargetReg(kArg2));
} else {
- loadValueDirectWideFixed(cUnit, arg2, targetReg(kArg2), targetReg(kArg3));
+ LoadValueDirectWideFixed(cUnit, arg2, TargetReg(kArg2), TargetReg(kArg3));
}
- loadConstant(cUnit, targetReg(kArg0), arg0);
- oatClobberCalleeSave(cUnit);
- callHelper(cUnit, rTgt, helperOffset, safepointPC);
+ LoadConstant(cUnit, TargetReg(kArg0), arg0);
+ ClobberCalleeSave(cUnit);
+ CallHelper(cUnit, rTgt, helperOffset, safepointPC);
}
/*
* Generate an kPseudoBarrier marker to indicate the boundary of special
* blocks.
*/
-void genBarrier(CompilationUnit* cUnit)
+void GenBarrier(CompilationUnit* cUnit)
{
- LIR* barrier = newLIR0(cUnit, kPseudoBarrier);
+ LIR* barrier = NewLIR0(cUnit, kPseudoBarrier);
/* Mark all resources as being clobbered */
barrier->defMask = -1;
}
/* Generate unconditional branch instructions */
-LIR* opUnconditionalBranch(CompilationUnit* cUnit, LIR* target)
+LIR* OpUnconditionalBranch(CompilationUnit* cUnit, LIR* target)
{
- LIR* branch = opBranchUnconditional(cUnit, kOpUncondBr);
+ LIR* branch = OpBranchUnconditional(cUnit, kOpUncondBr);
branch->target = target;
return branch;
}
// FIXME: need to do some work to split out targets with
// condition codes and those without
-LIR* genCheck(CompilationUnit* cUnit, ConditionCode cCode,
+LIR* GenCheck(CompilationUnit* cUnit, ConditionCode cCode,
ThrowKind kind)
{
DCHECK_NE(cUnit->instructionSet, kMips);
- LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kind,
+ LIR* tgt = RawLIR(cUnit, 0, kPseudoThrowTarget, kind,
cUnit->currentDalvikOffset);
- LIR* branch = opCondBranch(cUnit, cCode, tgt);
+ LIR* branch = OpCondBranch(cUnit, cCode, tgt);
// Remember branch target - will process later
- oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
+ InsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
return branch;
}
-LIR* genImmedCheck(CompilationUnit* cUnit, ConditionCode cCode,
+LIR* GenImmedCheck(CompilationUnit* cUnit, ConditionCode cCode,
int reg, int immVal, ThrowKind kind)
{
- LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kind,
+ LIR* tgt = RawLIR(cUnit, 0, kPseudoThrowTarget, kind,
cUnit->currentDalvikOffset);
LIR* branch;
if (cCode == kCondAl) {
- branch = opUnconditionalBranch(cUnit, tgt);
+ branch = OpUnconditionalBranch(cUnit, tgt);
} else {
- branch = opCmpImmBranch(cUnit, cCode, reg, immVal, tgt);
+ branch = OpCmpImmBranch(cUnit, cCode, reg, immVal, tgt);
}
// Remember branch target - will process later
- oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
+ InsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
return branch;
}
/* Perform null-check on a register. */
-LIR* genNullCheck(CompilationUnit* cUnit, int sReg, int mReg, int optFlags)
+LIR* GenNullCheck(CompilationUnit* cUnit, int sReg, int mReg, int optFlags)
{
if (!(cUnit->disableOpt & (1 << kNullCheckElimination)) &&
optFlags & MIR_IGNORE_NULL_CHECK) {
return NULL;
}
- return genImmedCheck(cUnit, kCondEq, mReg, 0, kThrowNullPointer);
+ return GenImmedCheck(cUnit, kCondEq, mReg, 0, kThrowNullPointer);
}
/* Perform check on two registers */
-LIR* genRegRegCheck(CompilationUnit* cUnit, ConditionCode cCode,
+LIR* GenRegRegCheck(CompilationUnit* cUnit, ConditionCode cCode,
int reg1, int reg2, ThrowKind kind)
{
- LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kind,
+ LIR* tgt = RawLIR(cUnit, 0, kPseudoThrowTarget, kind,
cUnit->currentDalvikOffset, reg1, reg2);
- LIR* branch = opCmpBranch(cUnit, cCode, reg1, reg2, tgt);
+ LIR* branch = OpCmpBranch(cUnit, cCode, reg1, reg2, tgt);
// Remember branch target - will process later
- oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
+ InsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
return branch;
}
-void genCompareAndBranch(CompilationUnit* cUnit, Instruction::Code opcode,
+void GenCompareAndBranch(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlSrc1, RegLocation rlSrc2, LIR* taken,
LIR* fallThrough)
{
ConditionCode cond;
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
switch (opcode) {
case Instruction::IF_EQ:
cond = kCondEq;
@@ -335,15 +335,15 @@
cond = static_cast<ConditionCode>(0);
LOG(FATAL) << "Unexpected opcode " << opcode;
}
- opCmpBranch(cUnit, cond, rlSrc1.lowReg, rlSrc2.lowReg, taken);
- opUnconditionalBranch(cUnit, fallThrough);
+ OpCmpBranch(cUnit, cond, rlSrc1.lowReg, rlSrc2.lowReg, taken);
+ OpUnconditionalBranch(cUnit, fallThrough);
}
-void genCompareZeroAndBranch(CompilationUnit* cUnit, Instruction::Code opcode,
+void GenCompareZeroAndBranch(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlSrc, LIR* taken, LIR* fallThrough)
{
ConditionCode cond;
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
switch (opcode) {
case Instruction::IF_EQZ:
cond = kCondEq;
@@ -368,32 +368,32 @@
LOG(FATAL) << "Unexpected opcode " << opcode;
}
if (cUnit->instructionSet == kThumb2) {
- opRegImm(cUnit, kOpCmp, rlSrc.lowReg, 0);
- opCondBranch(cUnit, cond, taken);
+ OpRegImm(cUnit, kOpCmp, rlSrc.lowReg, 0);
+ OpCondBranch(cUnit, cond, taken);
} else {
- opCmpImmBranch(cUnit, cond, rlSrc.lowReg, 0, taken);
+ OpCmpImmBranch(cUnit, cond, rlSrc.lowReg, 0, taken);
}
- opUnconditionalBranch(cUnit, fallThrough);
+ OpUnconditionalBranch(cUnit, fallThrough);
}
-void genIntToLong(CompilationUnit* cUnit, RegLocation rlDest,
+void GenIntToLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (rlSrc.location == kLocPhysReg) {
- opRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
+ OpRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
} else {
- loadValueDirect(cUnit, rlSrc, rlResult.lowReg);
+ LoadValueDirect(cUnit, rlSrc, rlResult.lowReg);
}
- opRegRegImm(cUnit, kOpAsr, rlResult.highReg, rlResult.lowReg, 31);
- storeValueWide(cUnit, rlDest, rlResult);
+ OpRegRegImm(cUnit, kOpAsr, rlResult.highReg, rlResult.lowReg, 31);
+ StoreValueWide(cUnit, rlDest, rlResult);
}
-void genIntNarrowing(CompilationUnit* cUnit, Instruction::Code opcode,
+void GenIntNarrowing(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc)
{
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
OpKind op = kOpInvalid;
switch (opcode) {
case Instruction::INT_TO_BYTE:
@@ -408,8 +408,8 @@
default:
LOG(ERROR) << "Bad int conversion type";
}
- opRegReg(cUnit, op, rlResult.lowReg, rlSrc.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ OpRegReg(cUnit, op, rlResult.lowReg, rlSrc.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
/*
@@ -417,10 +417,10 @@
* Array::AllocFromCode(type_idx, method, count);
* Note: AllocFromCode will handle checks for errNegativeArraySize.
*/
-void genNewArray(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest,
+void GenNewArray(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest,
RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit); /* Everything to home location */
+ FlushAllRegs(cUnit); /* Everything to home location */
int funcOffset;
if (cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
*cUnit->dex_file,
@@ -429,22 +429,22 @@
} else {
funcOffset= ENTRYPOINT_OFFSET(pAllocArrayFromCodeWithAccessCheck);
}
- callRuntimeHelperImmMethodRegLocation(cUnit, funcOffset, type_idx, rlSrc, true);
- RegLocation rlResult = oatGetReturn(cUnit, false);
- storeValue(cUnit, rlDest, rlResult);
+ CallRuntimeHelperImmMethodRegLocation(cUnit, funcOffset, type_idx, rlSrc, true);
+ RegLocation rlResult = GetReturn(cUnit, false);
+ StoreValue(cUnit, rlDest, rlResult);
}
/*
- * Similar to genNewArray, but with post-allocation initialization.
+ * Similar to GenNewArray, but with post-allocation initialization.
* Verifier guarantees we're dealing with an array class. Current
* code throws runtime exception "bad Filled array req" for 'D' and 'J'.
* Current code also throws internal unimp if not 'L', '[' or 'I'.
*/
-void genFilledNewArray(CompilationUnit* cUnit, CallInfo* info)
+void GenFilledNewArray(CompilationUnit* cUnit, CallInfo* info)
{
int elems = info->numArgWords;
int typeIdx = info->index;
- oatFlushAllRegs(cUnit); /* Everything to home location */
+ FlushAllRegs(cUnit); /* Everything to home location */
int funcOffset;
if (cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
*cUnit->dex_file,
@@ -453,9 +453,9 @@
} else {
funcOffset = ENTRYPOINT_OFFSET(pCheckAndAllocArrayFromCodeWithAccessCheck);
}
- callRuntimeHelperImmMethodImm(cUnit, funcOffset, typeIdx, elems, true);
- oatFreeTemp(cUnit, targetReg(kArg2));
- oatFreeTemp(cUnit, targetReg(kArg1));
+ CallRuntimeHelperImmMethodImm(cUnit, funcOffset, typeIdx, elems, true);
+ FreeTemp(cUnit, TargetReg(kArg2));
+ FreeTemp(cUnit, TargetReg(kArg1));
/*
* NOTE: the implicit target for Instruction::FILLED_NEW_ARRAY is the
* return region. Because AllocFromCode placed the new array
@@ -463,7 +463,7 @@
* added, it may be necessary to additionally copy all return
* values to a home location in thread-local storage
*/
- oatLockTemp(cUnit, targetReg(kRet0));
+ LockTemp(cUnit, TargetReg(kRet0));
// TODO: use the correct component size, currently all supported types
// share array alignment with ints (see comment at head of function)
@@ -480,9 +480,9 @@
* home location.
*/
for (int i = 0; i < elems; i++) {
- RegLocation loc = oatUpdateLoc(cUnit, info->args[i]);
+ RegLocation loc = UpdateLoc(cUnit, info->args[i]);
if (loc.location == kLocPhysReg) {
- storeBaseDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, loc.sRegLow),
+ StoreBaseDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, loc.sRegLow),
loc.lowReg, kWord);
}
}
@@ -491,62 +491,62 @@
* this is an uncommon operation and isn't especially performance
* critical.
*/
- int rSrc = oatAllocTemp(cUnit);
- int rDst = oatAllocTemp(cUnit);
- int rIdx = oatAllocTemp(cUnit);
+ int rSrc = AllocTemp(cUnit);
+ int rDst = AllocTemp(cUnit);
+ int rIdx = AllocTemp(cUnit);
int rVal = INVALID_REG;
switch(cUnit->instructionSet) {
case kThumb2:
- rVal = targetReg(kLr);
+ rVal = TargetReg(kLr);
break;
case kX86:
- oatFreeTemp(cUnit, targetReg(kRet0));
- rVal = oatAllocTemp(cUnit);
+ FreeTemp(cUnit, TargetReg(kRet0));
+ rVal = AllocTemp(cUnit);
break;
case kMips:
- rVal = oatAllocTemp(cUnit);
+ rVal = AllocTemp(cUnit);
break;
default: LOG(FATAL) << "Unexpected instruction set: " << cUnit->instructionSet;
}
// Set up source pointer
RegLocation rlFirst = info->args[0];
- opRegRegImm(cUnit, kOpAdd, rSrc, targetReg(kSp),
- oatSRegOffset(cUnit, rlFirst.sRegLow));
+ OpRegRegImm(cUnit, kOpAdd, rSrc, TargetReg(kSp),
+ SRegOffset(cUnit, rlFirst.sRegLow));
// Set up the target pointer
- opRegRegImm(cUnit, kOpAdd, rDst, targetReg(kRet0),
+ OpRegRegImm(cUnit, kOpAdd, rDst, TargetReg(kRet0),
Array::DataOffset(component_size).Int32Value());
// Set up the loop counter (known to be > 0)
- loadConstant(cUnit, rIdx, elems - 1);
+ LoadConstant(cUnit, rIdx, elems - 1);
// Generate the copy loop. Going backwards for convenience
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
// Copy next element
- loadBaseIndexed(cUnit, rSrc, rIdx, rVal, 2, kWord);
- storeBaseIndexed(cUnit, rDst, rIdx, rVal, 2, kWord);
- oatFreeTemp(cUnit, rVal);
- opDecAndBranch(cUnit, kCondGe, rIdx, target);
+ LoadBaseIndexed(cUnit, rSrc, rIdx, rVal, 2, kWord);
+ StoreBaseIndexed(cUnit, rDst, rIdx, rVal, 2, kWord);
+ FreeTemp(cUnit, rVal);
+ OpDecAndBranch(cUnit, kCondGe, rIdx, target);
if (cUnit->instructionSet == kX86) {
// Restore the target pointer
- opRegRegImm(cUnit, kOpAdd, targetReg(kRet0), rDst, -Array::DataOffset(component_size).Int32Value());
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kRet0), rDst, -Array::DataOffset(component_size).Int32Value());
}
} else if (!info->isRange) {
// TUNING: interleave
for (int i = 0; i < elems; i++) {
- RegLocation rlArg = loadValue(cUnit, info->args[i], kCoreReg);
- storeBaseDisp(cUnit, targetReg(kRet0),
+ RegLocation rlArg = LoadValue(cUnit, info->args[i], kCoreReg);
+ StoreBaseDisp(cUnit, TargetReg(kRet0),
Array::DataOffset(component_size).Int32Value() +
i * 4, rlArg.lowReg, kWord);
- // If the loadValue caused a temp to be allocated, free it
- if (oatIsTemp(cUnit, rlArg.lowReg)) {
- oatFreeTemp(cUnit, rlArg.lowReg);
+ // If the LoadValue caused a temp to be allocated, free it
+ if (IsTemp(cUnit, rlArg.lowReg)) {
+ FreeTemp(cUnit, rlArg.lowReg);
}
}
}
if (info->result.location != kLocInvalid) {
- storeValue(cUnit, info->result, oatGetReturn(cUnit, false /* not fp */));
+ StoreValue(cUnit, info->result, GetReturn(cUnit, false /* not fp */));
}
}
-void genSput(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlSrc,
+void GenSput(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlSrc,
bool isLongOrDouble, bool isObject)
{
int fieldOffset;
@@ -567,78 +567,78 @@
int rBase;
if (isReferrersClass) {
// Fast path, static storage base is this method's class
- RegLocation rlMethod = loadCurrMethod(cUnit);
- rBase = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rlMethod.lowReg,
+ RegLocation rlMethod = LoadCurrMethod(cUnit);
+ rBase = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rlMethod.lowReg,
AbstractMethod::DeclaringClassOffset().Int32Value(), rBase);
- if (oatIsTemp(cUnit, rlMethod.lowReg)) {
- oatFreeTemp(cUnit, rlMethod.lowReg);
+ if (IsTemp(cUnit, rlMethod.lowReg)) {
+ FreeTemp(cUnit, rlMethod.lowReg);
}
} else {
// Medium path, static storage base in a different class which
// requires checks that the other class is initialized.
DCHECK_GE(ssbIndex, 0);
// May do runtime call so everything to home locations.
- oatFlushAllRegs(cUnit);
+ FlushAllRegs(cUnit);
// Using fixed register to sync with possible call to runtime
// support.
- int rMethod = targetReg(kArg1);
- oatLockTemp(cUnit, rMethod);
- loadCurrMethodDirect(cUnit, rMethod);
- rBase = targetReg(kArg0);
- oatLockTemp(cUnit, rBase);
- loadWordDisp(cUnit, rMethod,
+ int rMethod = TargetReg(kArg1);
+ LockTemp(cUnit, rMethod);
+ LoadCurrMethodDirect(cUnit, rMethod);
+ rBase = TargetReg(kArg0);
+ LockTemp(cUnit, rBase);
+ LoadWordDisp(cUnit, rMethod,
AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
- loadWordDisp(cUnit, rBase,
+ LoadWordDisp(cUnit, rBase,
Array::DataOffset(sizeof(Object*)).Int32Value() +
sizeof(int32_t*) * ssbIndex, rBase);
// rBase now points at appropriate static storage base (Class*)
// or NULL if not initialized. Check for NULL and call helper if NULL.
// TUNING: fast path should fall through
- LIR* branchOver = opCmpImmBranch(cUnit, kCondNe, rBase, 0, NULL);
- loadConstant(cUnit, targetReg(kArg0), ssbIndex);
- callRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeStaticStorage), ssbIndex, true);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondNe, rBase, 0, NULL);
+ LoadConstant(cUnit, TargetReg(kArg0), ssbIndex);
+ CallRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeStaticStorage), ssbIndex, true);
if (cUnit->instructionSet == kMips) {
// For Arm, kRet0 = kArg0 = rBase, for Mips, we need to copy
- opRegCopy(cUnit, rBase, targetReg(kRet0));
+ OpRegCopy(cUnit, rBase, TargetReg(kRet0));
}
- LIR* skipTarget = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* skipTarget = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = skipTarget;
- oatFreeTemp(cUnit, rMethod);
+ FreeTemp(cUnit, rMethod);
}
// rBase now holds static storage base
if (isLongOrDouble) {
- rlSrc = loadValueWide(cUnit, rlSrc, kAnyReg);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kAnyReg);
} else {
- rlSrc = loadValue(cUnit, rlSrc, kAnyReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kAnyReg);
}
if (isVolatile) {
- oatGenMemBarrier(cUnit, kStoreStore);
+ GenMemBarrier(cUnit, kStoreStore);
}
if (isLongOrDouble) {
- storeBaseDispWide(cUnit, rBase, fieldOffset, rlSrc.lowReg,
+ StoreBaseDispWide(cUnit, rBase, fieldOffset, rlSrc.lowReg,
rlSrc.highReg);
} else {
- storeWordDisp(cUnit, rBase, fieldOffset, rlSrc.lowReg);
+ StoreWordDisp(cUnit, rBase, fieldOffset, rlSrc.lowReg);
}
if (isVolatile) {
- oatGenMemBarrier(cUnit, kStoreLoad);
+ GenMemBarrier(cUnit, kStoreLoad);
}
if (isObject) {
- markGCCard(cUnit, rlSrc.lowReg, rBase);
+ MarkGCCard(cUnit, rlSrc.lowReg, rBase);
}
- oatFreeTemp(cUnit, rBase);
+ FreeTemp(cUnit, rBase);
} else {
- oatFlushAllRegs(cUnit); // Everything to home locations
+ FlushAllRegs(cUnit); // Everything to home locations
int setterOffset = isLongOrDouble ? ENTRYPOINT_OFFSET(pSet64Static) :
(isObject ? ENTRYPOINT_OFFSET(pSetObjStatic)
: ENTRYPOINT_OFFSET(pSet32Static));
- callRuntimeHelperImmRegLocation(cUnit, setterOffset, fieldIdx, rlSrc, true);
+ CallRuntimeHelperImmRegLocation(cUnit, setterOffset, fieldIdx, rlSrc, true);
}
}
-void genSget(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlDest,
+void GenSget(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlDest,
bool isLongOrDouble, bool isObject)
{
int fieldOffset;
@@ -661,134 +661,134 @@
int rBase;
if (isReferrersClass) {
// Fast path, static storage base is this method's class
- RegLocation rlMethod = loadCurrMethod(cUnit);
- rBase = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rlMethod.lowReg,
+ RegLocation rlMethod = LoadCurrMethod(cUnit);
+ rBase = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rlMethod.lowReg,
AbstractMethod::DeclaringClassOffset().Int32Value(), rBase);
} else {
// Medium path, static storage base in a different class which
// requires checks that the other class is initialized
DCHECK_GE(ssbIndex, 0);
// May do runtime call so everything to home locations.
- oatFlushAllRegs(cUnit);
+ FlushAllRegs(cUnit);
// Using fixed register to sync with possible call to runtime
// support
- int rMethod = targetReg(kArg1);
- oatLockTemp(cUnit, rMethod);
- loadCurrMethodDirect(cUnit, rMethod);
- rBase = targetReg(kArg0);
- oatLockTemp(cUnit, rBase);
- loadWordDisp(cUnit, rMethod,
+ int rMethod = TargetReg(kArg1);
+ LockTemp(cUnit, rMethod);
+ LoadCurrMethodDirect(cUnit, rMethod);
+ rBase = TargetReg(kArg0);
+ LockTemp(cUnit, rBase);
+ LoadWordDisp(cUnit, rMethod,
AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(),
rBase);
- loadWordDisp(cUnit, rBase,
+ LoadWordDisp(cUnit, rBase,
Array::DataOffset(sizeof(Object*)).Int32Value() +
sizeof(int32_t*) * ssbIndex, rBase);
// rBase now points at appropriate static storage base (Class*)
// or NULL if not initialized. Check for NULL and call helper if NULL.
// TUNING: fast path should fall through
- LIR* branchOver = opCmpImmBranch(cUnit, kCondNe, rBase, 0, NULL);
- callRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeStaticStorage), ssbIndex, true);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondNe, rBase, 0, NULL);
+ CallRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeStaticStorage), ssbIndex, true);
if (cUnit->instructionSet == kMips) {
// For Arm, kRet0 = kArg0 = rBase, for Mips, we need to copy
- opRegCopy(cUnit, rBase, targetReg(kRet0));
+ OpRegCopy(cUnit, rBase, TargetReg(kRet0));
}
- LIR* skipTarget = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* skipTarget = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = skipTarget;
- oatFreeTemp(cUnit, rMethod);
+ FreeTemp(cUnit, rMethod);
}
// rBase now holds static storage base
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kLoadLoad);
+ GenMemBarrier(cUnit, kLoadLoad);
}
if (isLongOrDouble) {
- loadBaseDispWide(cUnit, rBase, fieldOffset, rlResult.lowReg,
+ LoadBaseDispWide(cUnit, rBase, fieldOffset, rlResult.lowReg,
rlResult.highReg, INVALID_SREG);
} else {
- loadWordDisp(cUnit, rBase, fieldOffset, rlResult.lowReg);
+ LoadWordDisp(cUnit, rBase, fieldOffset, rlResult.lowReg);
}
- oatFreeTemp(cUnit, rBase);
+ FreeTemp(cUnit, rBase);
if (isLongOrDouble) {
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
}
} else {
- oatFlushAllRegs(cUnit); // Everything to home locations
+ FlushAllRegs(cUnit); // Everything to home locations
int getterOffset = isLongOrDouble ? ENTRYPOINT_OFFSET(pGet64Static) :
(isObject ? ENTRYPOINT_OFFSET(pGetObjStatic)
: ENTRYPOINT_OFFSET(pGet32Static));
- callRuntimeHelperImm(cUnit, getterOffset, fieldIdx, true);
+ CallRuntimeHelperImm(cUnit, getterOffset, fieldIdx, true);
if (isLongOrDouble) {
- RegLocation rlResult = oatGetReturnWide(cUnit, rlDest.fp);
- storeValueWide(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturnWide(cUnit, rlDest.fp);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- RegLocation rlResult = oatGetReturn(cUnit, rlDest.fp);
- storeValue(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturn(cUnit, rlDest.fp);
+ StoreValue(cUnit, rlDest, rlResult);
}
}
}
// Debugging routine - if null target, branch to DebugMe
-void genShowTarget(CompilationUnit* cUnit)
+void GenShowTarget(CompilationUnit* cUnit)
{
- DCHECK_NE(cUnit->instructionSet, kX86) << "unimplemented genShowTarget";
- LIR* branchOver = opCmpImmBranch(cUnit, kCondNe, targetReg(kInvokeTgt), 0, NULL);
- loadWordDisp(cUnit, targetReg(kSelf), ENTRYPOINT_OFFSET(pDebugMe), targetReg(kInvokeTgt));
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ DCHECK_NE(cUnit->instructionSet, kX86) << "unimplemented GenShowTarget";
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondNe, TargetReg(kInvokeTgt), 0, NULL);
+ LoadWordDisp(cUnit, TargetReg(kSelf), ENTRYPOINT_OFFSET(pDebugMe), TargetReg(kInvokeTgt));
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
}
-void handleSuspendLaunchpads(CompilationUnit *cUnit)
+void HandleSuspendLaunchPads(CompilationUnit *cUnit)
{
LIR** suspendLabel = reinterpret_cast<LIR**>(cUnit->suspendLaunchpads.elemList);
int numElems = cUnit->suspendLaunchpads.numUsed;
int helperOffset = ENTRYPOINT_OFFSET(pTestSuspendFromCode);
for (int i = 0; i < numElems; i++) {
- oatResetRegPool(cUnit);
- oatResetDefTracking(cUnit);
+ ResetRegPool(cUnit);
+ ResetDefTracking(cUnit);
LIR* lab = suspendLabel[i];
LIR* resumeLab = reinterpret_cast<LIR*>(lab->operands[0]);
cUnit->currentDalvikOffset = lab->operands[1];
- oatAppendLIR(cUnit, lab);
- int rTgt = callHelperSetup(cUnit, helperOffset);
- callHelper(cUnit, rTgt, helperOffset, true /* markSafepointPC */);
- opUnconditionalBranch(cUnit, resumeLab);
+ AppendLIR(cUnit, lab);
+ int rTgt = CallHelperSetup(cUnit, helperOffset);
+ CallHelper(cUnit, rTgt, helperOffset, true /* MarkSafepointPC */);
+ OpUnconditionalBranch(cUnit, resumeLab);
}
}
-void handleIntrinsicLaunchpads(CompilationUnit *cUnit)
+void HandleIntrinsicLaunchPads(CompilationUnit *cUnit)
{
LIR** intrinsicLabel = reinterpret_cast<LIR**>(cUnit->intrinsicLaunchpads.elemList);
int numElems = cUnit->intrinsicLaunchpads.numUsed;
for (int i = 0; i < numElems; i++) {
- oatResetRegPool(cUnit);
- oatResetDefTracking(cUnit);
+ ResetRegPool(cUnit);
+ ResetDefTracking(cUnit);
LIR* lab = intrinsicLabel[i];
CallInfo* info = reinterpret_cast<CallInfo*>(lab->operands[0]);
cUnit->currentDalvikOffset = info->offset;
- oatAppendLIR(cUnit, lab);
- // NOTE: genInvoke handles markSafepointPC
- genInvoke(cUnit, info);
+ AppendLIR(cUnit, lab);
+ // NOTE: GenInvoke handles MarkSafepointPC
+ GenInvoke(cUnit, info);
LIR* resumeLab = reinterpret_cast<LIR*>(lab->operands[2]);
if (resumeLab != NULL) {
- opUnconditionalBranch(cUnit, resumeLab);
+ OpUnconditionalBranch(cUnit, resumeLab);
}
}
}
-void handleThrowLaunchpads(CompilationUnit *cUnit)
+void HandleThrowLaunchPads(CompilationUnit *cUnit)
{
LIR** throwLabel = reinterpret_cast<LIR**>(cUnit->throwLaunchpads.elemList);
int numElems = cUnit->throwLaunchpads.numUsed;
for (int i = 0; i < numElems; i++) {
- oatResetRegPool(cUnit);
- oatResetDefTracking(cUnit);
+ ResetRegPool(cUnit);
+ ResetDefTracking(cUnit);
LIR* lab = throwLabel[i];
cUnit->currentDalvikOffset = lab->operands[1];
- oatAppendLIR(cUnit, lab);
+ AppendLIR(cUnit, lab);
int funcOffset = 0;
int v1 = lab->operands[2];
int v2 = lab->operands[3];
@@ -799,33 +799,33 @@
break;
case kThrowArrayBounds:
// Move v1 (array index) to kArg0 and v2 (array length) to kArg1
- if (v2 != targetReg(kArg0)) {
- opRegCopy(cUnit, targetReg(kArg0), v1);
+ if (v2 != TargetReg(kArg0)) {
+ OpRegCopy(cUnit, TargetReg(kArg0), v1);
if (targetX86) {
// x86 leaves the array pointer in v2, so load the array length that the handler expects
- opRegMem(cUnit, kOpMov, targetReg(kArg1), v2, Array::LengthOffset().Int32Value());
+ OpRegMem(cUnit, kOpMov, TargetReg(kArg1), v2, Array::LengthOffset().Int32Value());
} else {
- opRegCopy(cUnit, targetReg(kArg1), v2);
+ OpRegCopy(cUnit, TargetReg(kArg1), v2);
}
} else {
- if (v1 == targetReg(kArg1)) {
+ if (v1 == TargetReg(kArg1)) {
// Swap v1 and v2, using kArg2 as a temp
- opRegCopy(cUnit, targetReg(kArg2), v1);
+ OpRegCopy(cUnit, TargetReg(kArg2), v1);
if (targetX86) {
// x86 leaves the array pointer in v2; load the array length that the handler expects
- opRegMem(cUnit, kOpMov, targetReg(kArg1), v2, Array::LengthOffset().Int32Value());
+ OpRegMem(cUnit, kOpMov, TargetReg(kArg1), v2, Array::LengthOffset().Int32Value());
} else {
- opRegCopy(cUnit, targetReg(kArg1), v2);
+ OpRegCopy(cUnit, TargetReg(kArg1), v2);
}
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg2));
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg2));
} else {
if (targetX86) {
// x86 leaves the array pointer in v2; load the array length that the handler expects
- opRegMem(cUnit, kOpMov, targetReg(kArg1), v2, Array::LengthOffset().Int32Value());
+ OpRegMem(cUnit, kOpMov, TargetReg(kArg1), v2, Array::LengthOffset().Int32Value());
} else {
- opRegCopy(cUnit, targetReg(kArg1), v2);
+ OpRegCopy(cUnit, TargetReg(kArg1), v2);
}
- opRegCopy(cUnit, targetReg(kArg0), v1);
+ OpRegCopy(cUnit, TargetReg(kArg0), v1);
}
}
funcOffset = ENTRYPOINT_OFFSET(pThrowArrayBoundsFromCode);
@@ -834,7 +834,7 @@
funcOffset = ENTRYPOINT_OFFSET(pThrowDivZeroFromCode);
break;
case kThrowNoSuchMethod:
- opRegCopy(cUnit, targetReg(kArg0), v1);
+ OpRegCopy(cUnit, TargetReg(kArg0), v1);
funcOffset =
ENTRYPOINT_OFFSET(pThrowNoSuchMethodFromCode);
break;
@@ -842,27 +842,21 @@
funcOffset = ENTRYPOINT_OFFSET(pThrowStackOverflowFromCode);
// Restore stack alignment
if (targetX86) {
- opRegImm(cUnit, kOpAdd, targetReg(kSp), cUnit->frameSize);
+ OpRegImm(cUnit, kOpAdd, TargetReg(kSp), cUnit->frameSize);
} else {
- opRegImm(cUnit, kOpAdd, targetReg(kSp), (cUnit->numCoreSpills + cUnit->numFPSpills) * 4);
+ OpRegImm(cUnit, kOpAdd, TargetReg(kSp), (cUnit->numCoreSpills + cUnit->numFPSpills) * 4);
}
break;
default:
LOG(FATAL) << "Unexpected throw kind: " << lab->operands[0];
}
- oatClobberCalleeSave(cUnit);
- int rTgt = callHelperSetup(cUnit, funcOffset);
- callHelper(cUnit, rTgt, funcOffset, true /* markSafepointPC */);
+ ClobberCalleeSave(cUnit);
+ int rTgt = CallHelperSetup(cUnit, funcOffset);
+ CallHelper(cUnit, rTgt, funcOffset, true /* MarkSafepointPC */);
}
}
-/* Needed by the Assembler */
-void oatSetupResourceMasks(CompilationUnit* cUnit, LIR* lir)
-{
- setupResourceMasks(cUnit, lir);
-}
-
-bool fastInstance(CompilationUnit* cUnit, uint32_t fieldIdx,
+bool FastInstance(CompilationUnit* cUnit, uint32_t fieldIdx,
int& fieldOffset, bool& isVolatile, bool isPut)
{
OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker,
@@ -873,176 +867,176 @@
fieldOffset, isVolatile, isPut);
}
-void genIGet(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size,
+void GenIGet(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size,
RegLocation rlDest, RegLocation rlObj,
bool isLongOrDouble, bool isObject)
{
int fieldOffset;
bool isVolatile;
- bool fastPath = fastInstance(cUnit, fieldIdx, fieldOffset, isVolatile, false);
+ bool fastPath = FastInstance(cUnit, fieldIdx, fieldOffset, isVolatile, false);
if (fastPath && !SLOW_FIELD_PATH) {
RegLocation rlResult;
RegisterClass regClass = oatRegClassBySize(size);
DCHECK_GE(fieldOffset, 0);
- rlObj = loadValue(cUnit, rlObj, kCoreReg);
+ rlObj = LoadValue(cUnit, rlObj, kCoreReg);
if (isLongOrDouble) {
DCHECK(rlDest.wide);
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
if (cUnit->instructionSet == kX86) {
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
- loadBaseDispWide(cUnit, rlObj.lowReg, fieldOffset, rlResult.lowReg,
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
+ LoadBaseDispWide(cUnit, rlObj.lowReg, fieldOffset, rlResult.lowReg,
rlResult.highReg, rlObj.sRegLow);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kLoadLoad);
+ GenMemBarrier(cUnit, kLoadLoad);
}
} else {
- int regPtr = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpAdd, regPtr, rlObj.lowReg, fieldOffset);
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
- loadPair(cUnit, regPtr, rlResult.lowReg, rlResult.highReg);
+ int regPtr = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpAdd, regPtr, rlObj.lowReg, fieldOffset);
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
+ LoadPair(cUnit, regPtr, rlResult.lowReg, rlResult.highReg);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kLoadLoad);
+ GenMemBarrier(cUnit, kLoadLoad);
}
- oatFreeTemp(cUnit, regPtr);
+ FreeTemp(cUnit, regPtr);
}
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
- loadBaseDisp(cUnit, rlObj.lowReg, fieldOffset, rlResult.lowReg,
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
+ LoadBaseDisp(cUnit, rlObj.lowReg, fieldOffset, rlResult.lowReg,
kWord, rlObj.sRegLow);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kLoadLoad);
+ GenMemBarrier(cUnit, kLoadLoad);
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
}
} else {
int getterOffset = isLongOrDouble ? ENTRYPOINT_OFFSET(pGet64Instance) :
(isObject ? ENTRYPOINT_OFFSET(pGetObjInstance)
: ENTRYPOINT_OFFSET(pGet32Instance));
- callRuntimeHelperImmRegLocation(cUnit, getterOffset, fieldIdx, rlObj, true);
+ CallRuntimeHelperImmRegLocation(cUnit, getterOffset, fieldIdx, rlObj, true);
if (isLongOrDouble) {
- RegLocation rlResult = oatGetReturnWide(cUnit, rlDest.fp);
- storeValueWide(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturnWide(cUnit, rlDest.fp);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- RegLocation rlResult = oatGetReturn(cUnit, rlDest.fp);
- storeValue(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturn(cUnit, rlDest.fp);
+ StoreValue(cUnit, rlDest, rlResult);
}
}
}
-void genIPut(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size,
+void GenIPut(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size,
RegLocation rlSrc, RegLocation rlObj, bool isLongOrDouble, bool isObject)
{
int fieldOffset;
bool isVolatile;
- bool fastPath = fastInstance(cUnit, fieldIdx, fieldOffset, isVolatile,
+ bool fastPath = FastInstance(cUnit, fieldIdx, fieldOffset, isVolatile,
true);
if (fastPath && !SLOW_FIELD_PATH) {
RegisterClass regClass = oatRegClassBySize(size);
DCHECK_GE(fieldOffset, 0);
- rlObj = loadValue(cUnit, rlObj, kCoreReg);
+ rlObj = LoadValue(cUnit, rlObj, kCoreReg);
if (isLongOrDouble) {
int regPtr;
- rlSrc = loadValueWide(cUnit, rlSrc, kAnyReg);
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
- regPtr = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpAdd, regPtr, rlObj.lowReg, fieldOffset);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kAnyReg);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
+ regPtr = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpAdd, regPtr, rlObj.lowReg, fieldOffset);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kStoreStore);
+ GenMemBarrier(cUnit, kStoreStore);
}
- storeBaseDispWide(cUnit, regPtr, 0, rlSrc.lowReg, rlSrc.highReg);
+ StoreBaseDispWide(cUnit, regPtr, 0, rlSrc.lowReg, rlSrc.highReg);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kLoadLoad);
+ GenMemBarrier(cUnit, kLoadLoad);
}
- oatFreeTemp(cUnit, regPtr);
+ FreeTemp(cUnit, regPtr);
} else {
- rlSrc = loadValue(cUnit, rlSrc, regClass);
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
+ rlSrc = LoadValue(cUnit, rlSrc, regClass);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, optFlags);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kStoreStore);
+ GenMemBarrier(cUnit, kStoreStore);
}
- storeBaseDisp(cUnit, rlObj.lowReg, fieldOffset, rlSrc.lowReg, kWord);
+ StoreBaseDisp(cUnit, rlObj.lowReg, fieldOffset, rlSrc.lowReg, kWord);
if (isVolatile) {
- oatGenMemBarrier(cUnit, kLoadLoad);
+ GenMemBarrier(cUnit, kLoadLoad);
}
if (isObject) {
- markGCCard(cUnit, rlSrc.lowReg, rlObj.lowReg);
+ MarkGCCard(cUnit, rlSrc.lowReg, rlObj.lowReg);
}
}
} else {
int setterOffset = isLongOrDouble ? ENTRYPOINT_OFFSET(pSet64Instance) :
(isObject ? ENTRYPOINT_OFFSET(pSetObjInstance)
: ENTRYPOINT_OFFSET(pSet32Instance));
- callRuntimeHelperImmRegLocationRegLocation(cUnit, setterOffset, fieldIdx, rlObj, rlSrc, true);
+ CallRuntimeHelperImmRegLocationRegLocation(cUnit, setterOffset, fieldIdx, rlObj, rlSrc, true);
}
}
-void genConstClass(CompilationUnit* cUnit, uint32_t type_idx,
+void GenConstClass(CompilationUnit* cUnit, uint32_t type_idx,
RegLocation rlDest)
{
- RegLocation rlMethod = loadCurrMethod(cUnit);
- int resReg = oatAllocTemp(cUnit);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ RegLocation rlMethod = LoadCurrMethod(cUnit);
+ int resReg = AllocTemp(cUnit);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
*cUnit->dex_file,
type_idx)) {
// Call out to helper which resolves type and verifies access.
// Resolved type returned in kRet0.
- callRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeAndVerifyAccessFromCode),
+ CallRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeAndVerifyAccessFromCode),
type_idx, rlMethod.lowReg, true);
- RegLocation rlResult = oatGetReturn(cUnit, false);
- storeValue(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturn(cUnit, false);
+ StoreValue(cUnit, rlDest, rlResult);
} else {
// We're don't need access checks, load type from dex cache
int32_t dex_cache_offset =
AbstractMethod::DexCacheResolvedTypesOffset().Int32Value();
- loadWordDisp(cUnit, rlMethod.lowReg, dex_cache_offset, resReg);
+ LoadWordDisp(cUnit, rlMethod.lowReg, dex_cache_offset, resReg);
int32_t offset_of_type =
Array::DataOffset(sizeof(Class*)).Int32Value() + (sizeof(Class*)
* type_idx);
- loadWordDisp(cUnit, resReg, offset_of_type, rlResult.lowReg);
+ LoadWordDisp(cUnit, resReg, offset_of_type, rlResult.lowReg);
if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache(*cUnit->dex_file,
type_idx) || SLOW_TYPE_PATH) {
// Slow path, at runtime test if type is null and if so initialize
- oatFlushAllRegs(cUnit);
- LIR* branch1 = opCmpImmBranch(cUnit, kCondEq, rlResult.lowReg, 0, NULL);
+ FlushAllRegs(cUnit);
+ LIR* branch1 = OpCmpImmBranch(cUnit, kCondEq, rlResult.lowReg, 0, NULL);
// Resolved, store and hop over following code
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
/*
* Because we have stores of the target value on two paths,
* clobber temp tracking for the destination using the ssa name
*/
- oatClobberSReg(cUnit, rlDest.sRegLow);
- LIR* branch2 = opUnconditionalBranch(cUnit,0);
+ ClobberSReg(cUnit, rlDest.sRegLow);
+ LIR* branch2 = OpUnconditionalBranch(cUnit,0);
// TUNING: move slow path to end & remove unconditional branch
- LIR* target1 = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target1 = NewLIR0(cUnit, kPseudoTargetLabel);
// Call out to helper, which will return resolved type in kArg0
- callRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeFromCode), type_idx,
+ CallRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeFromCode), type_idx,
rlMethod.lowReg, true);
- RegLocation rlResult = oatGetReturn(cUnit, false);
- storeValue(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturn(cUnit, false);
+ StoreValue(cUnit, rlDest, rlResult);
/*
* Because we have stores of the target value on two paths,
* clobber temp tracking for the destination using the ssa name
*/
- oatClobberSReg(cUnit, rlDest.sRegLow);
+ ClobberSReg(cUnit, rlDest.sRegLow);
// Rejoin code paths
- LIR* target2 = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target2 = NewLIR0(cUnit, kPseudoTargetLabel);
branch1->target = target1;
branch2->target = target2;
} else {
// Fast path, we're done - just store result
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
}
}
}
-void genConstString(CompilationUnit* cUnit, uint32_t string_idx,
+void GenConstString(CompilationUnit* cUnit, uint32_t string_idx,
RegLocation rlDest)
{
/* NOTE: Most strings should be available at compile time */
@@ -1051,48 +1045,48 @@
if (!cUnit->compiler->CanAssumeStringIsPresentInDexCache(
*cUnit->dex_file, string_idx) || SLOW_STRING_PATH) {
// slow path, resolve string if not in dex cache
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Using explicit registers
- loadCurrMethodDirect(cUnit, targetReg(kArg2));
- loadWordDisp(cUnit, targetReg(kArg2),
- AbstractMethod::DexCacheStringsOffset().Int32Value(), targetReg(kArg0));
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Using explicit registers
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg2));
+ LoadWordDisp(cUnit, TargetReg(kArg2),
+ AbstractMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0));
// Might call out to helper, which will return resolved string in kRet0
- int rTgt = callHelperSetup(cUnit, ENTRYPOINT_OFFSET(pResolveStringFromCode));
- loadWordDisp(cUnit, targetReg(kArg0), offset_of_string, targetReg(kRet0));
- loadConstant(cUnit, targetReg(kArg1), string_idx);
+ int rTgt = CallHelperSetup(cUnit, ENTRYPOINT_OFFSET(pResolveStringFromCode));
+ LoadWordDisp(cUnit, TargetReg(kArg0), offset_of_string, TargetReg(kRet0));
+ LoadConstant(cUnit, TargetReg(kArg1), string_idx);
if (cUnit->instructionSet == kThumb2) {
- opRegImm(cUnit, kOpCmp, targetReg(kRet0), 0); // Is resolved?
- genBarrier(cUnit);
+ OpRegImm(cUnit, kOpCmp, TargetReg(kRet0), 0); // Is resolved?
+ GenBarrier(cUnit);
// For testing, always force through helper
if (!EXERCISE_SLOWEST_STRING_PATH) {
- opIT(cUnit, kArmCondEq, "T");
+ OpIT(cUnit, kArmCondEq, "T");
}
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg2)); // .eq
- LIR* callInst = opReg(cUnit, kOpBlx, rTgt); // .eq, helper(Method*, string_idx)
- markSafepointPC(cUnit, callInst);
- oatFreeTemp(cUnit, rTgt);
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg2)); // .eq
+ LIR* callInst = OpReg(cUnit, kOpBlx, rTgt); // .eq, helper(Method*, string_idx)
+ MarkSafepointPC(cUnit, callInst);
+ FreeTemp(cUnit, rTgt);
} else if (cUnit->instructionSet == kMips) {
- LIR* branch = opCmpImmBranch(cUnit, kCondNe, targetReg(kRet0), 0, NULL);
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg2)); // .eq
- LIR* callInst = opReg(cUnit, kOpBlx, rTgt);
- markSafepointPC(cUnit, callInst);
- oatFreeTemp(cUnit, rTgt);
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* branch = OpCmpImmBranch(cUnit, kCondNe, TargetReg(kRet0), 0, NULL);
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg2)); // .eq
+ LIR* callInst = OpReg(cUnit, kOpBlx, rTgt);
+ MarkSafepointPC(cUnit, callInst);
+ FreeTemp(cUnit, rTgt);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branch->target = target;
} else {
DCHECK_EQ(cUnit->instructionSet, kX86);
- callRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pResolveStringFromCode), targetReg(kArg2), targetReg(kArg1), true);
+ CallRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pResolveStringFromCode), TargetReg(kArg2), TargetReg(kArg1), true);
}
- genBarrier(cUnit);
- storeValue(cUnit, rlDest, oatGetReturn(cUnit, false));
+ GenBarrier(cUnit);
+ StoreValue(cUnit, rlDest, GetReturn(cUnit, false));
} else {
- RegLocation rlMethod = loadCurrMethod(cUnit);
- int resReg = oatAllocTemp(cUnit);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- loadWordDisp(cUnit, rlMethod.lowReg,
+ RegLocation rlMethod = LoadCurrMethod(cUnit);
+ int resReg = AllocTemp(cUnit);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ LoadWordDisp(cUnit, rlMethod.lowReg,
AbstractMethod::DexCacheStringsOffset().Int32Value(), resReg);
- loadWordDisp(cUnit, resReg, offset_of_string, rlResult.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ LoadWordDisp(cUnit, resReg, offset_of_string, rlResult.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
}
@@ -1100,9 +1094,9 @@
* Let helper function take care of everything. Will
* call Class::NewInstanceFromCode(type_idx, method);
*/
-void genNewInstance(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest)
+void GenNewInstance(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest)
{
- oatFlushAllRegs(cUnit); /* Everything to home location */
+ FlushAllRegs(cUnit); /* Everything to home location */
// alloc will always check for resolution, do we also need to verify
// access because the verifier was unable to?
int funcOffset;
@@ -1112,181 +1106,181 @@
} else {
funcOffset = ENTRYPOINT_OFFSET(pAllocObjectFromCodeWithAccessCheck);
}
- callRuntimeHelperImmMethod(cUnit, funcOffset, type_idx, true);
- RegLocation rlResult = oatGetReturn(cUnit, false);
- storeValue(cUnit, rlDest, rlResult);
+ CallRuntimeHelperImmMethod(cUnit, funcOffset, type_idx, true);
+ RegLocation rlResult = GetReturn(cUnit, false);
+ StoreValue(cUnit, rlDest, rlResult);
}
-void genMoveException(CompilationUnit* cUnit, RegLocation rlDest)
+void GenMoveException(CompilationUnit* cUnit, RegLocation rlDest)
{
- oatFlushAllRegs(cUnit); /* Everything to home location */
+ FlushAllRegs(cUnit); /* Everything to home location */
int funcOffset = ENTRYPOINT_OFFSET(pGetAndClearException);
if (cUnit->instructionSet == kX86) {
// Runtime helper will load argument for x86.
- callRuntimeHelperReg(cUnit, funcOffset, targetReg(kArg0), false);
+ CallRuntimeHelperReg(cUnit, funcOffset, TargetReg(kArg0), false);
} else {
- callRuntimeHelperReg(cUnit, funcOffset, targetReg(kSelf), false);
+ CallRuntimeHelperReg(cUnit, funcOffset, TargetReg(kSelf), false);
}
- RegLocation rlResult = oatGetReturn(cUnit, false);
- storeValue(cUnit, rlDest, rlResult);
+ RegLocation rlResult = GetReturn(cUnit, false);
+ StoreValue(cUnit, rlDest, rlResult);
}
-void genThrow(CompilationUnit* cUnit, RegLocation rlSrc)
+void GenThrow(CompilationUnit* cUnit, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- callRuntimeHelperRegLocation(cUnit, ENTRYPOINT_OFFSET(pDeliverException), rlSrc, true);
+ FlushAllRegs(cUnit);
+ CallRuntimeHelperRegLocation(cUnit, ENTRYPOINT_OFFSET(pDeliverException), rlSrc, true);
}
-void genInstanceof(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest,
+void GenInstanceof(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest,
RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
+ FlushAllRegs(cUnit);
// May generate a call - use explicit registers
- oatLockCallTemps(cUnit);
- loadCurrMethodDirect(cUnit, targetReg(kArg1)); // kArg1 <= current Method*
- int classReg = targetReg(kArg2); // kArg2 will hold the Class*
+ LockCallTemps(cUnit);
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg1)); // kArg1 <= current Method*
+ int classReg = TargetReg(kArg2); // kArg2 will hold the Class*
if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
*cUnit->dex_file,
type_idx)) {
// Check we have access to type_idx and if not throw IllegalAccessError,
// returns Class* in kArg0
- callRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeAndVerifyAccessFromCode),
+ CallRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeAndVerifyAccessFromCode),
type_idx, true);
- opRegCopy(cUnit, classReg, targetReg(kRet0)); // Align usage with fast path
- loadValueDirectFixed(cUnit, rlSrc, targetReg(kArg0)); // kArg0 <= ref
+ OpRegCopy(cUnit, classReg, TargetReg(kRet0)); // Align usage with fast path
+ LoadValueDirectFixed(cUnit, rlSrc, TargetReg(kArg0)); // kArg0 <= ref
} else {
// Load dex cache entry into classReg (kArg2)
- loadValueDirectFixed(cUnit, rlSrc, targetReg(kArg0)); // kArg0 <= ref
- loadWordDisp(cUnit, targetReg(kArg1),
+ LoadValueDirectFixed(cUnit, rlSrc, TargetReg(kArg0)); // kArg0 <= ref
+ LoadWordDisp(cUnit, TargetReg(kArg1),
AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), classReg);
int32_t offset_of_type =
Array::DataOffset(sizeof(Class*)).Int32Value() + (sizeof(Class*)
* type_idx);
- loadWordDisp(cUnit, classReg, offset_of_type, classReg);
+ LoadWordDisp(cUnit, classReg, offset_of_type, classReg);
if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache(
*cUnit->dex_file, type_idx)) {
// Need to test presence of type in dex cache at runtime
- LIR* hopBranch = opCmpImmBranch(cUnit, kCondNe, classReg, 0, NULL);
+ LIR* hopBranch = OpCmpImmBranch(cUnit, kCondNe, classReg, 0, NULL);
// Not resolved
// Call out to helper, which will return resolved type in kRet0
- callRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeFromCode), type_idx, true);
- opRegCopy(cUnit, targetReg(kArg2), targetReg(kRet0)); // Align usage with fast path
- loadValueDirectFixed(cUnit, rlSrc, targetReg(kArg0)); /* reload Ref */
+ CallRuntimeHelperImm(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeFromCode), type_idx, true);
+ OpRegCopy(cUnit, TargetReg(kArg2), TargetReg(kRet0)); // Align usage with fast path
+ LoadValueDirectFixed(cUnit, rlSrc, TargetReg(kArg0)); /* reload Ref */
// Rejoin code paths
- LIR* hopTarget = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* hopTarget = NewLIR0(cUnit, kPseudoTargetLabel);
hopBranch->target = hopTarget;
}
}
/* kArg0 is ref, kArg2 is class. If ref==null, use directly as bool result */
- RegLocation rlResult = oatGetReturn(cUnit, false);
+ RegLocation rlResult = GetReturn(cUnit, false);
if (cUnit->instructionSet == kMips) {
- loadConstant(cUnit, rlResult.lowReg, 0); // store false result for if branch is taken
+ LoadConstant(cUnit, rlResult.lowReg, 0); // store false result for if branch is taken
}
- LIR* branch1 = opCmpImmBranch(cUnit, kCondEq, targetReg(kArg0), 0, NULL);
+ LIR* branch1 = OpCmpImmBranch(cUnit, kCondEq, TargetReg(kArg0), 0, NULL);
/* load object->klass_ */
DCHECK_EQ(Object::ClassOffset().Int32Value(), 0);
- loadWordDisp(cUnit, targetReg(kArg0), Object::ClassOffset().Int32Value(), targetReg(kArg1));
+ LoadWordDisp(cUnit, TargetReg(kArg0), Object::ClassOffset().Int32Value(), TargetReg(kArg1));
/* kArg0 is ref, kArg1 is ref->klass_, kArg2 is class */
LIR* callInst;
LIR* branchover = NULL;
if (cUnit->instructionSet == kThumb2) {
/* Uses conditional nullification */
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pInstanceofNonTrivialFromCode));
- opRegReg(cUnit, kOpCmp, targetReg(kArg1), targetReg(kArg2)); // Same?
- opIT(cUnit, kArmCondEq, "EE"); // if-convert the test
- loadConstant(cUnit, targetReg(kArg0), 1); // .eq case - load true
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg2)); // .ne case - arg0 <= class
- callInst = opReg(cUnit, kOpBlx, rTgt); // .ne case: helper(class, ref->class)
- oatFreeTemp(cUnit, rTgt);
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pInstanceofNonTrivialFromCode));
+ OpRegReg(cUnit, kOpCmp, TargetReg(kArg1), TargetReg(kArg2)); // Same?
+ OpIT(cUnit, kArmCondEq, "EE"); // if-convert the test
+ LoadConstant(cUnit, TargetReg(kArg0), 1); // .eq case - load true
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg2)); // .ne case - arg0 <= class
+ callInst = OpReg(cUnit, kOpBlx, rTgt); // .ne case: helper(class, ref->class)
+ FreeTemp(cUnit, rTgt);
} else {
/* Uses branchovers */
- loadConstant(cUnit, rlResult.lowReg, 1); // assume true
- branchover = opCmpBranch(cUnit, kCondEq, targetReg(kArg1), targetReg(kArg2), NULL);
+ LoadConstant(cUnit, rlResult.lowReg, 1); // assume true
+ branchover = OpCmpBranch(cUnit, kCondEq, TargetReg(kArg1), TargetReg(kArg2), NULL);
if (cUnit->instructionSet != kX86) {
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pInstanceofNonTrivialFromCode));
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg2)); // .ne case - arg0 <= class
- callInst = opReg(cUnit, kOpBlx, rTgt); // .ne case: helper(class, ref->class)
- oatFreeTemp(cUnit, rTgt);
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pInstanceofNonTrivialFromCode));
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg2)); // .ne case - arg0 <= class
+ callInst = OpReg(cUnit, kOpBlx, rTgt); // .ne case: helper(class, ref->class)
+ FreeTemp(cUnit, rTgt);
} else {
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg2));
- callInst = opThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pInstanceofNonTrivialFromCode));
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg2));
+ callInst = OpThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pInstanceofNonTrivialFromCode));
}
}
- markSafepointPC(cUnit, callInst);
- oatClobberCalleeSave(cUnit);
+ MarkSafepointPC(cUnit, callInst);
+ ClobberCalleeSave(cUnit);
/* branch targets here */
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
- storeValue(cUnit, rlDest, rlResult);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
+ StoreValue(cUnit, rlDest, rlResult);
branch1->target = target;
if (cUnit->instructionSet != kThumb2) {
branchover->target = target;
}
}
-void genCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc)
+void GenCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
+ FlushAllRegs(cUnit);
// May generate a call - use explicit registers
- oatLockCallTemps(cUnit);
- loadCurrMethodDirect(cUnit, targetReg(kArg1)); // kArg1 <= current Method*
- int classReg = targetReg(kArg2); // kArg2 will hold the Class*
+ LockCallTemps(cUnit);
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg1)); // kArg1 <= current Method*
+ int classReg = TargetReg(kArg2); // kArg2 will hold the Class*
if (!cUnit->compiler->CanAccessTypeWithoutChecks(cUnit->method_idx,
*cUnit->dex_file,
type_idx)) {
// Check we have access to type_idx and if not throw IllegalAccessError,
// returns Class* in kRet0
// InitializeTypeAndVerifyAccess(idx, method)
- callRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeAndVerifyAccessFromCode),
- type_idx, targetReg(kArg1), true);
- opRegCopy(cUnit, classReg, targetReg(kRet0)); // Align usage with fast path
+ CallRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeAndVerifyAccessFromCode),
+ type_idx, TargetReg(kArg1), true);
+ OpRegCopy(cUnit, classReg, TargetReg(kRet0)); // Align usage with fast path
} else {
// Load dex cache entry into classReg (kArg2)
- loadWordDisp(cUnit, targetReg(kArg1),
+ LoadWordDisp(cUnit, TargetReg(kArg1),
AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), classReg);
int32_t offset_of_type =
Array::DataOffset(sizeof(Class*)).Int32Value() +
(sizeof(Class*) * type_idx);
- loadWordDisp(cUnit, classReg, offset_of_type, classReg);
+ LoadWordDisp(cUnit, classReg, offset_of_type, classReg);
if (!cUnit->compiler->CanAssumeTypeIsPresentInDexCache(
*cUnit->dex_file, type_idx)) {
// Need to test presence of type in dex cache at runtime
- LIR* hopBranch = opCmpImmBranch(cUnit, kCondNe, classReg, 0, NULL);
+ LIR* hopBranch = OpCmpImmBranch(cUnit, kCondNe, classReg, 0, NULL);
// Not resolved
// Call out to helper, which will return resolved type in kArg0
// InitializeTypeFromCode(idx, method)
- callRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeFromCode), type_idx, targetReg(kArg1),
+ CallRuntimeHelperImmReg(cUnit, ENTRYPOINT_OFFSET(pInitializeTypeFromCode), type_idx, TargetReg(kArg1),
true);
- opRegCopy(cUnit, classReg, targetReg(kRet0)); // Align usage with fast path
+ OpRegCopy(cUnit, classReg, TargetReg(kRet0)); // Align usage with fast path
// Rejoin code paths
- LIR* hopTarget = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* hopTarget = NewLIR0(cUnit, kPseudoTargetLabel);
hopBranch->target = hopTarget;
}
}
// At this point, classReg (kArg2) has class
- loadValueDirectFixed(cUnit, rlSrc, targetReg(kArg0)); // kArg0 <= ref
+ LoadValueDirectFixed(cUnit, rlSrc, TargetReg(kArg0)); // kArg0 <= ref
/* Null is OK - continue */
- LIR* branch1 = opCmpImmBranch(cUnit, kCondEq, targetReg(kArg0), 0, NULL);
+ LIR* branch1 = OpCmpImmBranch(cUnit, kCondEq, TargetReg(kArg0), 0, NULL);
/* load object->klass_ */
DCHECK_EQ(Object::ClassOffset().Int32Value(), 0);
- loadWordDisp(cUnit, targetReg(kArg0), Object::ClassOffset().Int32Value(), targetReg(kArg1));
+ LoadWordDisp(cUnit, TargetReg(kArg0), Object::ClassOffset().Int32Value(), TargetReg(kArg1));
/* kArg1 now contains object->klass_ */
LIR* branch2;
if (cUnit->instructionSet == kThumb2) {
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pCheckCastFromCode));
- opRegReg(cUnit, kOpCmp, targetReg(kArg1), classReg);
- branch2 = opCondBranch(cUnit, kCondEq, NULL); /* If eq, trivial yes */
- opRegCopy(cUnit, targetReg(kArg0), targetReg(kArg1));
- opRegCopy(cUnit, targetReg(kArg1), targetReg(kArg2));
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rTgt);
- markSafepointPC(cUnit, callInst);
- oatFreeTemp(cUnit, rTgt);
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pCheckCastFromCode));
+ OpRegReg(cUnit, kOpCmp, TargetReg(kArg1), classReg);
+ branch2 = OpCondBranch(cUnit, kCondEq, NULL); /* If eq, trivial yes */
+ OpRegCopy(cUnit, TargetReg(kArg0), TargetReg(kArg1));
+ OpRegCopy(cUnit, TargetReg(kArg1), TargetReg(kArg2));
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rTgt);
+ MarkSafepointPC(cUnit, callInst);
+ FreeTemp(cUnit, rTgt);
} else {
- branch2 = opCmpBranch(cUnit, kCondEq, targetReg(kArg1), classReg, NULL);
- callRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pCheckCastFromCode), targetReg(kArg1), targetReg(kArg2), true);
+ branch2 = OpCmpBranch(cUnit, kCondEq, TargetReg(kArg1), classReg, NULL);
+ CallRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pCheckCastFromCode), TargetReg(kArg1), TargetReg(kArg2), true);
}
/* branch target here */
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branch1->target = target;
branch2->target = target;
}
@@ -1295,76 +1289,76 @@
* Generate array store
*
*/
-void genArrayObjPut(CompilationUnit* cUnit, int optFlags, RegLocation rlArray,
+void GenArrayObjPut(CompilationUnit* cUnit, int optFlags, RegLocation rlArray,
RegLocation rlIndex, RegLocation rlSrc, int scale)
{
int lenOffset = Array::LengthOffset().Int32Value();
int dataOffset = Array::DataOffset(sizeof(Object*)).Int32Value();
- oatFlushAllRegs(cUnit); // Use explicit registers
- oatLockCallTemps(cUnit);
+ FlushAllRegs(cUnit); // Use explicit registers
+ LockCallTemps(cUnit);
- int rValue = targetReg(kArg0); // Register holding value
- int rArrayClass = targetReg(kArg1); // Register holding array's Class
- int rArray = targetReg(kArg2); // Register holding array
- int rIndex = targetReg(kArg3); // Register holding index into array
+ int rValue = TargetReg(kArg0); // Register holding value
+ int rArrayClass = TargetReg(kArg1); // Register holding array's Class
+ int rArray = TargetReg(kArg2); // Register holding array
+ int rIndex = TargetReg(kArg3); // Register holding index into array
- loadValueDirectFixed(cUnit, rlArray, rArray); // Grab array
- loadValueDirectFixed(cUnit, rlSrc, rValue); // Grab value
- loadValueDirectFixed(cUnit, rlIndex, rIndex); // Grab index
+ LoadValueDirectFixed(cUnit, rlArray, rArray); // Grab array
+ LoadValueDirectFixed(cUnit, rlSrc, rValue); // Grab value
+ LoadValueDirectFixed(cUnit, rlIndex, rIndex); // Grab index
- genNullCheck(cUnit, rlArray.sRegLow, rArray, optFlags); // NPE?
+ GenNullCheck(cUnit, rlArray.sRegLow, rArray, optFlags); // NPE?
// Store of null?
- LIR* null_value_check = opCmpImmBranch(cUnit, kCondEq, rValue, 0, NULL);
+ LIR* null_value_check = OpCmpImmBranch(cUnit, kCondEq, rValue, 0, NULL);
// Get the array's class.
- loadWordDisp(cUnit, rArray, Object::ClassOffset().Int32Value(), rArrayClass);
- callRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pCanPutArrayElementFromCode), rValue,
+ LoadWordDisp(cUnit, rArray, Object::ClassOffset().Int32Value(), rArrayClass);
+ CallRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pCanPutArrayElementFromCode), rValue,
rArrayClass, true);
- // Redo loadValues in case they didn't survive the call.
- loadValueDirectFixed(cUnit, rlArray, rArray); // Reload array
- loadValueDirectFixed(cUnit, rlIndex, rIndex); // Reload index
- loadValueDirectFixed(cUnit, rlSrc, rValue); // Reload value
+ // Redo LoadValues in case they didn't survive the call.
+ LoadValueDirectFixed(cUnit, rlArray, rArray); // Reload array
+ LoadValueDirectFixed(cUnit, rlIndex, rIndex); // Reload index
+ LoadValueDirectFixed(cUnit, rlSrc, rValue); // Reload value
rArrayClass = INVALID_REG;
// Branch here if value to be stored == null
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
null_value_check->target = target;
if (cUnit->instructionSet == kX86) {
// make an extra temp available for card mark below
- oatFreeTemp(cUnit, targetReg(kArg1));
+ FreeTemp(cUnit, TargetReg(kArg1));
if (!(optFlags & MIR_IGNORE_RANGE_CHECK)) {
/* if (rlIndex >= [rlArray + lenOffset]) goto kThrowArrayBounds */
- genRegMemCheck(cUnit, kCondUge, rIndex, rArray, lenOffset, kThrowArrayBounds);
+ GenRegMemCheck(cUnit, kCondUge, rIndex, rArray, lenOffset, kThrowArrayBounds);
}
- storeBaseIndexedDisp(cUnit, rArray, rIndex, scale,
+ StoreBaseIndexedDisp(cUnit, rArray, rIndex, scale,
dataOffset, rValue, INVALID_REG, kWord, INVALID_SREG);
} else {
bool needsRangeCheck = (!(optFlags & MIR_IGNORE_RANGE_CHECK));
int regLen = INVALID_REG;
if (needsRangeCheck) {
- regLen = targetReg(kArg1);
- loadWordDisp(cUnit, rArray, lenOffset, regLen); // Get len
+ regLen = TargetReg(kArg1);
+ LoadWordDisp(cUnit, rArray, lenOffset, regLen); // Get len
}
/* rPtr -> array data */
- int rPtr = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpAdd, rPtr, rArray, dataOffset);
+ int rPtr = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpAdd, rPtr, rArray, dataOffset);
if (needsRangeCheck) {
- genRegRegCheck(cUnit, kCondCs, rIndex, regLen, kThrowArrayBounds);
+ GenRegRegCheck(cUnit, kCondCs, rIndex, regLen, kThrowArrayBounds);
}
- storeBaseIndexed(cUnit, rPtr, rIndex, rValue, scale, kWord);
- oatFreeTemp(cUnit, rPtr);
+ StoreBaseIndexed(cUnit, rPtr, rIndex, rValue, scale, kWord);
+ FreeTemp(cUnit, rPtr);
}
- oatFreeTemp(cUnit, rIndex);
- markGCCard(cUnit, rValue, rArray);
+ FreeTemp(cUnit, rIndex);
+ MarkGCCard(cUnit, rValue, rArray);
}
/*
* Generate array load
*/
-void genArrayGet(CompilationUnit* cUnit, int optFlags, OpSize size,
+void GenArrayGet(CompilationUnit* cUnit, int optFlags, OpSize size,
RegLocation rlArray, RegLocation rlIndex,
RegLocation rlDest, int scale)
{
@@ -1372,8 +1366,8 @@
int lenOffset = Array::LengthOffset().Int32Value();
int dataOffset;
RegLocation rlResult;
- rlArray = loadValue(cUnit, rlArray, kCoreReg);
- rlIndex = loadValue(cUnit, rlIndex, kCoreReg);
+ rlArray = LoadValue(cUnit, rlArray, kCoreReg);
+ rlIndex = LoadValue(cUnit, rlIndex, kCoreReg);
if (size == kLong || size == kDouble) {
dataOffset = Array::DataOffset(sizeof(int64_t)).Int32Value();
@@ -1382,79 +1376,79 @@
}
/* null object? */
- genNullCheck(cUnit, rlArray.sRegLow, rlArray.lowReg, optFlags);
+ GenNullCheck(cUnit, rlArray.sRegLow, rlArray.lowReg, optFlags);
if (cUnit->instructionSet == kX86) {
if (!(optFlags & MIR_IGNORE_RANGE_CHECK)) {
/* if (rlIndex >= [rlArray + lenOffset]) goto kThrowArrayBounds */
- genRegMemCheck(cUnit, kCondUge, rlIndex.lowReg, rlArray.lowReg,
+ GenRegMemCheck(cUnit, kCondUge, rlIndex.lowReg, rlArray.lowReg,
lenOffset, kThrowArrayBounds);
}
if ((size == kLong) || (size == kDouble)) {
- int regAddr = oatAllocTemp(cUnit);
- opLea(cUnit, regAddr, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset);
- oatFreeTemp(cUnit, rlArray.lowReg);
- oatFreeTemp(cUnit, rlIndex.lowReg);
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
- loadBaseIndexedDisp(cUnit, regAddr, INVALID_REG, 0, 0, rlResult.lowReg,
+ int regAddr = AllocTemp(cUnit);
+ OpLea(cUnit, regAddr, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset);
+ FreeTemp(cUnit, rlArray.lowReg);
+ FreeTemp(cUnit, rlIndex.lowReg);
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
+ LoadBaseIndexedDisp(cUnit, regAddr, INVALID_REG, 0, 0, rlResult.lowReg,
rlResult.highReg, size, INVALID_SREG);
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
- loadBaseIndexedDisp(cUnit, rlArray.lowReg, rlIndex.lowReg, scale,
+ LoadBaseIndexedDisp(cUnit, rlArray.lowReg, rlIndex.lowReg, scale,
dataOffset, rlResult.lowReg, INVALID_REG, size,
INVALID_SREG);
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
}
} else {
- int regPtr = oatAllocTemp(cUnit);
+ int regPtr = AllocTemp(cUnit);
bool needsRangeCheck = (!(optFlags & MIR_IGNORE_RANGE_CHECK));
int regLen = INVALID_REG;
if (needsRangeCheck) {
- regLen = oatAllocTemp(cUnit);
+ regLen = AllocTemp(cUnit);
/* Get len */
- loadWordDisp(cUnit, rlArray.lowReg, lenOffset, regLen);
+ LoadWordDisp(cUnit, rlArray.lowReg, lenOffset, regLen);
}
/* regPtr -> array data */
- opRegRegImm(cUnit, kOpAdd, regPtr, rlArray.lowReg, dataOffset);
- oatFreeTemp(cUnit, rlArray.lowReg);
+ OpRegRegImm(cUnit, kOpAdd, regPtr, rlArray.lowReg, dataOffset);
+ FreeTemp(cUnit, rlArray.lowReg);
if ((size == kLong) || (size == kDouble)) {
if (scale) {
- int rNewIndex = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpLsl, rNewIndex, rlIndex.lowReg, scale);
- opRegReg(cUnit, kOpAdd, regPtr, rNewIndex);
- oatFreeTemp(cUnit, rNewIndex);
+ int rNewIndex = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpLsl, rNewIndex, rlIndex.lowReg, scale);
+ OpRegReg(cUnit, kOpAdd, regPtr, rNewIndex);
+ FreeTemp(cUnit, rNewIndex);
} else {
- opRegReg(cUnit, kOpAdd, regPtr, rlIndex.lowReg);
+ OpRegReg(cUnit, kOpAdd, regPtr, rlIndex.lowReg);
}
- oatFreeTemp(cUnit, rlIndex.lowReg);
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
+ FreeTemp(cUnit, rlIndex.lowReg);
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
if (needsRangeCheck) {
// TODO: change kCondCS to a more meaningful name, is the sense of
// carry-set/clear flipped?
- genRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
- oatFreeTemp(cUnit, regLen);
+ GenRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
+ FreeTemp(cUnit, regLen);
}
- loadPair(cUnit, regPtr, rlResult.lowReg, rlResult.highReg);
+ LoadPair(cUnit, regPtr, rlResult.lowReg, rlResult.highReg);
- oatFreeTemp(cUnit, regPtr);
- storeValueWide(cUnit, rlDest, rlResult);
+ FreeTemp(cUnit, regPtr);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
+ rlResult = EvalLoc(cUnit, rlDest, regClass, true);
if (needsRangeCheck) {
// TODO: change kCondCS to a more meaningful name, is the sense of
// carry-set/clear flipped?
- genRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
- oatFreeTemp(cUnit, regLen);
+ GenRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
+ FreeTemp(cUnit, regLen);
}
- loadBaseIndexed(cUnit, regPtr, rlIndex.lowReg, rlResult.lowReg, scale, size);
+ LoadBaseIndexed(cUnit, regPtr, rlIndex.lowReg, rlResult.lowReg, scale, size);
- oatFreeTemp(cUnit, regPtr);
- storeValue(cUnit, rlDest, rlResult);
+ FreeTemp(cUnit, regPtr);
+ StoreValue(cUnit, rlDest, rlResult);
}
}
}
@@ -1463,7 +1457,7 @@
* Generate array store
*
*/
-void genArrayPut(CompilationUnit* cUnit, int optFlags, OpSize size,
+void GenArrayPut(CompilationUnit* cUnit, int optFlags, OpSize size,
RegLocation rlArray, RegLocation rlIndex,
RegLocation rlSrc, int scale)
{
@@ -1477,87 +1471,87 @@
dataOffset = Array::DataOffset(sizeof(int32_t)).Int32Value();
}
- rlArray = loadValue(cUnit, rlArray, kCoreReg);
- rlIndex = loadValue(cUnit, rlIndex, kCoreReg);
+ rlArray = LoadValue(cUnit, rlArray, kCoreReg);
+ rlIndex = LoadValue(cUnit, rlIndex, kCoreReg);
int regPtr = INVALID_REG;
if (cUnit->instructionSet != kX86) {
- if (oatIsTemp(cUnit, rlArray.lowReg)) {
- oatClobber(cUnit, rlArray.lowReg);
+ if (IsTemp(cUnit, rlArray.lowReg)) {
+ Clobber(cUnit, rlArray.lowReg);
regPtr = rlArray.lowReg;
} else {
- regPtr = oatAllocTemp(cUnit);
- opRegCopy(cUnit, regPtr, rlArray.lowReg);
+ regPtr = AllocTemp(cUnit);
+ OpRegCopy(cUnit, regPtr, rlArray.lowReg);
}
}
/* null object? */
- genNullCheck(cUnit, rlArray.sRegLow, rlArray.lowReg, optFlags);
+ GenNullCheck(cUnit, rlArray.sRegLow, rlArray.lowReg, optFlags);
if (cUnit->instructionSet == kX86) {
if (!(optFlags & MIR_IGNORE_RANGE_CHECK)) {
/* if (rlIndex >= [rlArray + lenOffset]) goto kThrowArrayBounds */
- genRegMemCheck(cUnit, kCondUge, rlIndex.lowReg, rlArray.lowReg, lenOffset, kThrowArrayBounds);
+ GenRegMemCheck(cUnit, kCondUge, rlIndex.lowReg, rlArray.lowReg, lenOffset, kThrowArrayBounds);
}
if ((size == kLong) || (size == kDouble)) {
- rlSrc = loadValueWide(cUnit, rlSrc, regClass);
+ rlSrc = LoadValueWide(cUnit, rlSrc, regClass);
} else {
- rlSrc = loadValue(cUnit, rlSrc, regClass);
+ rlSrc = LoadValue(cUnit, rlSrc, regClass);
}
// If the src reg can't be byte accessed, move it to a temp first.
if ((size == kSignedByte || size == kUnsignedByte) && rlSrc.lowReg >= 4) {
- int temp = oatAllocTemp(cUnit);
- opRegCopy(cUnit, temp, rlSrc.lowReg);
- storeBaseIndexedDisp(cUnit, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset, temp,
+ int temp = AllocTemp(cUnit);
+ OpRegCopy(cUnit, temp, rlSrc.lowReg);
+ StoreBaseIndexedDisp(cUnit, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset, temp,
INVALID_REG, size, INVALID_SREG);
} else {
- storeBaseIndexedDisp(cUnit, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset, rlSrc.lowReg,
+ StoreBaseIndexedDisp(cUnit, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset, rlSrc.lowReg,
rlSrc.highReg, size, INVALID_SREG);
}
} else {
bool needsRangeCheck = (!(optFlags & MIR_IGNORE_RANGE_CHECK));
int regLen = INVALID_REG;
if (needsRangeCheck) {
- regLen = oatAllocTemp(cUnit);
+ regLen = AllocTemp(cUnit);
//NOTE: max live temps(4) here.
/* Get len */
- loadWordDisp(cUnit, rlArray.lowReg, lenOffset, regLen);
+ LoadWordDisp(cUnit, rlArray.lowReg, lenOffset, regLen);
}
/* regPtr -> array data */
- opRegImm(cUnit, kOpAdd, regPtr, dataOffset);
+ OpRegImm(cUnit, kOpAdd, regPtr, dataOffset);
/* at this point, regPtr points to array, 2 live temps */
if ((size == kLong) || (size == kDouble)) {
//TUNING: specific wide routine that can handle fp regs
if (scale) {
- int rNewIndex = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpLsl, rNewIndex, rlIndex.lowReg, scale);
- opRegReg(cUnit, kOpAdd, regPtr, rNewIndex);
- oatFreeTemp(cUnit, rNewIndex);
+ int rNewIndex = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpLsl, rNewIndex, rlIndex.lowReg, scale);
+ OpRegReg(cUnit, kOpAdd, regPtr, rNewIndex);
+ FreeTemp(cUnit, rNewIndex);
} else {
- opRegReg(cUnit, kOpAdd, regPtr, rlIndex.lowReg);
+ OpRegReg(cUnit, kOpAdd, regPtr, rlIndex.lowReg);
}
- rlSrc = loadValueWide(cUnit, rlSrc, regClass);
+ rlSrc = LoadValueWide(cUnit, rlSrc, regClass);
if (needsRangeCheck) {
- genRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
- oatFreeTemp(cUnit, regLen);
+ GenRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
+ FreeTemp(cUnit, regLen);
}
- storeBaseDispWide(cUnit, regPtr, 0, rlSrc.lowReg, rlSrc.highReg);
+ StoreBaseDispWide(cUnit, regPtr, 0, rlSrc.lowReg, rlSrc.highReg);
- oatFreeTemp(cUnit, regPtr);
+ FreeTemp(cUnit, regPtr);
} else {
- rlSrc = loadValue(cUnit, rlSrc, regClass);
+ rlSrc = LoadValue(cUnit, rlSrc, regClass);
if (needsRangeCheck) {
- genRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
- oatFreeTemp(cUnit, regLen);
+ GenRegRegCheck(cUnit, kCondCs, rlIndex.lowReg, regLen, kThrowArrayBounds);
+ FreeTemp(cUnit, regLen);
}
- storeBaseIndexed(cUnit, regPtr, rlIndex.lowReg, rlSrc.lowReg,
+ StoreBaseIndexed(cUnit, regPtr, rlIndex.lowReg, rlSrc.lowReg,
scale, size);
}
}
}
-void genLong3Addr(CompilationUnit* cUnit, OpKind firstOp,
+void GenLong3Addr(CompilationUnit* cUnit, OpKind firstOp,
OpKind secondOp, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
@@ -1571,42 +1565,42 @@
* lr is used explicitly elsewhere in the code generator and cannot
* normally be used as a general temp register.
*/
- oatMarkTemp(cUnit, targetReg(kLr)); // Add lr to the temp pool
- oatFreeTemp(cUnit, targetReg(kLr)); // and make it available
+ MarkTemp(cUnit, TargetReg(kLr)); // Add lr to the temp pool
+ FreeTemp(cUnit, TargetReg(kLr)); // and make it available
}
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
// The longs may overlap - use intermediate temp if so
if ((rlResult.lowReg == rlSrc1.highReg) || (rlResult.lowReg == rlSrc2.highReg)){
- int tReg = oatAllocTemp(cUnit);
- opRegRegReg(cUnit, firstOp, tReg, rlSrc1.lowReg, rlSrc2.lowReg);
- opRegRegReg(cUnit, secondOp, rlResult.highReg, rlSrc1.highReg, rlSrc2.highReg);
- opRegCopy(cUnit, rlResult.lowReg, tReg);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegReg(cUnit, firstOp, tReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ OpRegRegReg(cUnit, secondOp, rlResult.highReg, rlSrc1.highReg, rlSrc2.highReg);
+ OpRegCopy(cUnit, rlResult.lowReg, tReg);
+ FreeTemp(cUnit, tReg);
} else {
- opRegRegReg(cUnit, firstOp, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
- opRegRegReg(cUnit, secondOp, rlResult.highReg, rlSrc1.highReg,
+ OpRegRegReg(cUnit, firstOp, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ OpRegRegReg(cUnit, secondOp, rlResult.highReg, rlSrc1.highReg,
rlSrc2.highReg);
}
/*
* NOTE: If rlDest refers to a frame variable in a large frame, the
- * following storeValueWide might need to allocate a temp register.
+ * following StoreValueWide might need to allocate a temp register.
* To further work around the lack of a spill capability, explicitly
* free any temps from rlSrc1 & rlSrc2 that aren't still live in rlResult.
* Remove when spill is functional.
*/
- freeRegLocTemps(cUnit, rlResult, rlSrc1);
- freeRegLocTemps(cUnit, rlResult, rlSrc2);
- storeValueWide(cUnit, rlDest, rlResult);
+ FreeRegLocTemps(cUnit, rlResult, rlSrc1);
+ FreeRegLocTemps(cUnit, rlResult, rlSrc2);
+ StoreValueWide(cUnit, rlDest, rlResult);
if (cUnit->instructionSet == kThumb2) {
- oatClobber(cUnit, targetReg(kLr));
- oatUnmarkTemp(cUnit, targetReg(kLr)); // Remove lr from the temp pool
+ Clobber(cUnit, TargetReg(kLr));
+ UnmarkTemp(cUnit, TargetReg(kLr)); // Remove lr from the temp pool
}
}
-bool genShiftOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenShiftOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlShift)
{
int funcOffset;
@@ -1628,15 +1622,15 @@
LOG(FATAL) << "Unexpected case";
return true;
}
- oatFlushAllRegs(cUnit); /* Send everything to home location */
- callRuntimeHelperRegLocationRegLocation(cUnit, funcOffset, rlSrc1, rlShift, false);
- RegLocation rlResult = oatGetReturnWide(cUnit, false);
- storeValueWide(cUnit, rlDest, rlResult);
+ FlushAllRegs(cUnit); /* Send everything to home location */
+ CallRuntimeHelperRegLocationRegLocation(cUnit, funcOffset, rlSrc1, rlShift, false);
+ RegLocation rlResult = GetReturnWide(cUnit, false);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genArithOpInt(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenArithOpInt(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
OpKind op = kOpBkpt;
@@ -1711,58 +1705,58 @@
}
if (!isDivRem) {
if (unary) {
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg);
} else {
if (shiftOp) {
int tReg = INVALID_REG;
if (cUnit->instructionSet == kX86) {
// X86 doesn't require masking and must use ECX
- tReg = targetReg(kCount); // rCX
- loadValueDirectFixed(cUnit, rlSrc2, tReg);
+ tReg = TargetReg(kCount); // rCX
+ LoadValueDirectFixed(cUnit, rlSrc2, tReg);
} else {
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
- tReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpAnd, tReg, rlSrc2.lowReg, 31);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
+ tReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpAnd, tReg, rlSrc2.lowReg, 31);
}
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, tReg);
- oatFreeTemp(cUnit, tReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, tReg);
+ FreeTemp(cUnit, tReg);
} else {
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
}
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
} else {
if (cUnit->instructionSet == kMips) {
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
if (checkZero) {
- genImmedCheck(cUnit, kCondEq, rlSrc2.lowReg, 0, kThrowDivZero);
+ GenImmedCheck(cUnit, kCondEq, rlSrc2.lowReg, 0, kThrowDivZero);
}
- rlResult = genDivRem(cUnit, rlDest, rlSrc1.lowReg, rlSrc2.lowReg, op == kOpDiv);
+ rlResult = GenDivRem(cUnit, rlDest, rlSrc1.lowReg, rlSrc2.lowReg, op == kOpDiv);
} else {
int funcOffset = ENTRYPOINT_OFFSET(pIdivmod);
- oatFlushAllRegs(cUnit); /* Send everything to home location */
- loadValueDirectFixed(cUnit, rlSrc2, targetReg(kArg1));
- int rTgt = callHelperSetup(cUnit, funcOffset);
- loadValueDirectFixed(cUnit, rlSrc1, targetReg(kArg0));
+ FlushAllRegs(cUnit); /* Send everything to home location */
+ LoadValueDirectFixed(cUnit, rlSrc2, TargetReg(kArg1));
+ int rTgt = CallHelperSetup(cUnit, funcOffset);
+ LoadValueDirectFixed(cUnit, rlSrc1, TargetReg(kArg0));
if (checkZero) {
- genImmedCheck(cUnit, kCondEq, targetReg(kArg1), 0, kThrowDivZero);
+ GenImmedCheck(cUnit, kCondEq, TargetReg(kArg1), 0, kThrowDivZero);
}
// NOTE: callout here is not a safepoint
- callHelper(cUnit, rTgt, funcOffset, false /* not a safepoint */ );
+ CallHelper(cUnit, rTgt, funcOffset, false /* not a safepoint */ );
if (op == kOpDiv)
- rlResult = oatGetReturn(cUnit, false);
+ rlResult = GetReturn(cUnit, false);
else
- rlResult = oatGetReturnAlt(cUnit);
+ rlResult = GetReturnAlt(cUnit);
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
}
return false;
}
@@ -1773,20 +1767,20 @@
* or produce corresponding Thumb instructions directly.
*/
-bool isPowerOfTwo(int x)
+bool IsPowerOfTwo(int x)
{
return (x & (x - 1)) == 0;
}
// Returns true if no more than two bits are set in 'x'.
-bool isPopCountLE2(unsigned int x)
+bool IsPopCountLE2(unsigned int x)
{
x &= x - 1;
return (x & (x - 1)) == 0;
}
// Returns the index of the lowest set bit in 'x'.
-int lowestSetBit(unsigned int x) {
+int LowestSetBit(unsigned int x) {
int bit_posn = 0;
while ((x & 0xf) == 0) {
bit_posn += 4;
@@ -1801,61 +1795,61 @@
// Returns true if it added instructions to 'cUnit' to divide 'rlSrc' by 'lit'
// and store the result in 'rlDest'.
-bool handleEasyDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
+bool HandleEasyDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
RegLocation rlSrc, RegLocation rlDest, int lit)
{
- if ((lit < 2) || ((cUnit->instructionSet != kThumb2) && !isPowerOfTwo(lit))) {
+ if ((lit < 2) || ((cUnit->instructionSet != kThumb2) && !IsPowerOfTwo(lit))) {
return false;
}
// No divide instruction for Arm, so check for more special cases
- if ((cUnit->instructionSet == kThumb2) && !isPowerOfTwo(lit)) {
- return smallLiteralDivide(cUnit, dalvikOpcode, rlSrc, rlDest, lit);
+ if ((cUnit->instructionSet == kThumb2) && !IsPowerOfTwo(lit)) {
+ return SmallLiteralDivide(cUnit, dalvikOpcode, rlSrc, rlDest, lit);
}
- int k = lowestSetBit(lit);
+ int k = LowestSetBit(lit);
if (k >= 30) {
// Avoid special cases.
return false;
}
bool div = (dalvikOpcode == Instruction::DIV_INT_LIT8 ||
dalvikOpcode == Instruction::DIV_INT_LIT16);
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (div) {
- int tReg = oatAllocTemp(cUnit);
+ int tReg = AllocTemp(cUnit);
if (lit == 2) {
// Division by 2 is by far the most common division by constant.
- opRegRegImm(cUnit, kOpLsr, tReg, rlSrc.lowReg, 32 - k);
- opRegRegReg(cUnit, kOpAdd, tReg, tReg, rlSrc.lowReg);
- opRegRegImm(cUnit, kOpAsr, rlResult.lowReg, tReg, k);
+ OpRegRegImm(cUnit, kOpLsr, tReg, rlSrc.lowReg, 32 - k);
+ OpRegRegReg(cUnit, kOpAdd, tReg, tReg, rlSrc.lowReg);
+ OpRegRegImm(cUnit, kOpAsr, rlResult.lowReg, tReg, k);
} else {
- opRegRegImm(cUnit, kOpAsr, tReg, rlSrc.lowReg, 31);
- opRegRegImm(cUnit, kOpLsr, tReg, tReg, 32 - k);
- opRegRegReg(cUnit, kOpAdd, tReg, tReg, rlSrc.lowReg);
- opRegRegImm(cUnit, kOpAsr, rlResult.lowReg, tReg, k);
+ OpRegRegImm(cUnit, kOpAsr, tReg, rlSrc.lowReg, 31);
+ OpRegRegImm(cUnit, kOpLsr, tReg, tReg, 32 - k);
+ OpRegRegReg(cUnit, kOpAdd, tReg, tReg, rlSrc.lowReg);
+ OpRegRegImm(cUnit, kOpAsr, rlResult.lowReg, tReg, k);
}
} else {
- int tReg1 = oatAllocTemp(cUnit);
- int tReg2 = oatAllocTemp(cUnit);
+ int tReg1 = AllocTemp(cUnit);
+ int tReg2 = AllocTemp(cUnit);
if (lit == 2) {
- opRegRegImm(cUnit, kOpLsr, tReg1, rlSrc.lowReg, 32 - k);
- opRegRegReg(cUnit, kOpAdd, tReg2, tReg1, rlSrc.lowReg);
- opRegRegImm(cUnit, kOpAnd, tReg2, tReg2, lit -1);
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg2, tReg1);
+ OpRegRegImm(cUnit, kOpLsr, tReg1, rlSrc.lowReg, 32 - k);
+ OpRegRegReg(cUnit, kOpAdd, tReg2, tReg1, rlSrc.lowReg);
+ OpRegRegImm(cUnit, kOpAnd, tReg2, tReg2, lit -1);
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg2, tReg1);
} else {
- opRegRegImm(cUnit, kOpAsr, tReg1, rlSrc.lowReg, 31);
- opRegRegImm(cUnit, kOpLsr, tReg1, tReg1, 32 - k);
- opRegRegReg(cUnit, kOpAdd, tReg2, tReg1, rlSrc.lowReg);
- opRegRegImm(cUnit, kOpAnd, tReg2, tReg2, lit - 1);
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg2, tReg1);
+ OpRegRegImm(cUnit, kOpAsr, tReg1, rlSrc.lowReg, 31);
+ OpRegRegImm(cUnit, kOpLsr, tReg1, tReg1, 32 - k);
+ OpRegRegReg(cUnit, kOpAdd, tReg2, tReg1, rlSrc.lowReg);
+ OpRegRegImm(cUnit, kOpAnd, tReg2, tReg2, lit - 1);
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg2, tReg1);
}
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
// Returns true if it added instructions to 'cUnit' to multiply 'rlSrc' by 'lit'
// and store the result in 'rlDest'.
-bool handleEasyMultiply(CompilationUnit* cUnit, RegLocation rlSrc,
+bool HandleEasyMultiply(CompilationUnit* cUnit, RegLocation rlSrc,
RegLocation rlDest, int lit)
{
// Can we simplify this multiplication?
@@ -1865,40 +1859,40 @@
if (lit < 2) {
// Avoid special cases.
return false;
- } else if (isPowerOfTwo(lit)) {
+ } else if (IsPowerOfTwo(lit)) {
powerOfTwo = true;
- } else if (isPopCountLE2(lit)) {
+ } else if (IsPopCountLE2(lit)) {
popCountLE2 = true;
- } else if (isPowerOfTwo(lit + 1)) {
+ } else if (IsPowerOfTwo(lit + 1)) {
powerOfTwoMinusOne = true;
} else {
return false;
}
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (powerOfTwo) {
// Shift.
- opRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlSrc.lowReg,
- lowestSetBit(lit));
+ OpRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlSrc.lowReg,
+ LowestSetBit(lit));
} else if (popCountLE2) {
// Shift and add and shift.
- int firstBit = lowestSetBit(lit);
- int secondBit = lowestSetBit(lit ^ (1 << firstBit));
- genMultiplyByTwoBitMultiplier(cUnit, rlSrc, rlResult, lit,
+ int firstBit = LowestSetBit(lit);
+ int secondBit = LowestSetBit(lit ^ (1 << firstBit));
+ GenMultiplyByTwoBitMultiplier(cUnit, rlSrc, rlResult, lit,
firstBit, secondBit);
} else {
// Reverse subtract: (src << (shift + 1)) - src.
DCHECK(powerOfTwoMinusOne);
- // TUNING: rsb dst, src, src lsl#lowestSetBit(lit + 1)
- int tReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpLsl, tReg, rlSrc.lowReg, lowestSetBit(lit + 1));
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg, rlSrc.lowReg);
+ // TUNING: rsb dst, src, src lsl#LowestSetBit(lit + 1)
+ int tReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpLsl, tReg, rlSrc.lowReg, LowestSetBit(lit + 1));
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg, rlSrc.lowReg);
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-bool genArithOpIntLit(CompilationUnit* cUnit, Instruction::Code opcode,
+bool GenArithOpIntLit(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc, int lit)
{
RegLocation rlResult;
@@ -1911,12 +1905,12 @@
case Instruction::RSUB_INT: {
int tReg;
//TUNING: add support for use of Arm rsub op
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- tReg = oatAllocTemp(cUnit);
- loadConstant(cUnit, tReg, lit);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg, rlSrc.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ tReg = AllocTemp(cUnit);
+ LoadConstant(cUnit, tReg, lit);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, tReg, rlSrc.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
break;
}
@@ -1927,7 +1921,7 @@
break;
case Instruction::MUL_INT_LIT8:
case Instruction::MUL_INT_LIT16: {
- if (handleEasyMultiply(cUnit, rlSrc, rlDest, lit)) {
+ if (HandleEasyMultiply(cUnit, rlSrc, rlDest, lit)) {
return false;
}
op = kOpMul;
@@ -1969,10 +1963,10 @@
case Instruction::REM_INT_LIT8:
case Instruction::REM_INT_LIT16: {
if (lit == 0) {
- genImmedCheck(cUnit, kCondAl, 0, 0, kThrowDivZero);
+ GenImmedCheck(cUnit, kCondAl, 0, 0, kThrowDivZero);
return false;
}
- if (handleEasyDivide(cUnit, opcode, rlSrc, rlDest, lit)) {
+ if (HandleEasyDivide(cUnit, opcode, rlSrc, rlDest, lit)) {
return false;
}
if ((opcode == Instruction::DIV_INT_LIT8) ||
@@ -1982,39 +1976,39 @@
isDiv = false;
}
if (cUnit->instructionSet == kMips) {
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- rlResult = genDivRemLit(cUnit, rlDest, rlSrc.lowReg, lit, isDiv);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ rlResult = GenDivRemLit(cUnit, rlDest, rlSrc.lowReg, lit, isDiv);
} else {
- oatFlushAllRegs(cUnit); /* Everything to home location */
- loadValueDirectFixed(cUnit, rlSrc, targetReg(kArg0));
- oatClobber(cUnit, targetReg(kArg0));
+ FlushAllRegs(cUnit); /* Everything to home location */
+ LoadValueDirectFixed(cUnit, rlSrc, TargetReg(kArg0));
+ Clobber(cUnit, TargetReg(kArg0));
int funcOffset = ENTRYPOINT_OFFSET(pIdivmod);
- callRuntimeHelperRegImm(cUnit, funcOffset, targetReg(kArg0), lit, false);
+ CallRuntimeHelperRegImm(cUnit, funcOffset, TargetReg(kArg0), lit, false);
if (isDiv)
- rlResult = oatGetReturn(cUnit, false);
+ rlResult = GetReturn(cUnit, false);
else
- rlResult = oatGetReturnAlt(cUnit);
+ rlResult = GetReturnAlt(cUnit);
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
break;
}
default:
return true;
}
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
// Avoid shifts by literal 0 - no support in Thumb. Change to copy
if (shiftOp && (lit == 0)) {
- opRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
+ OpRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
} else {
- opRegRegImm(cUnit, op, rlResult.lowReg, rlSrc.lowReg, lit);
+ OpRegRegImm(cUnit, op, rlResult.lowReg, rlSrc.lowReg, lit);
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-bool genArithOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenArithOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
RegLocation rlResult;
@@ -2023,30 +2017,30 @@
bool callOut = false;
bool checkZero = false;
int funcOffset;
- int retReg = targetReg(kRet0);
+ int retReg = TargetReg(kRet0);
switch (opcode) {
case Instruction::NOT_LONG:
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
// Check for destructive overlap
if (rlResult.lowReg == rlSrc2.highReg) {
- int tReg = oatAllocTemp(cUnit);
- opRegCopy(cUnit, tReg, rlSrc2.highReg);
- opRegReg(cUnit, kOpMvn, rlResult.lowReg, rlSrc2.lowReg);
- opRegReg(cUnit, kOpMvn, rlResult.highReg, tReg);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegCopy(cUnit, tReg, rlSrc2.highReg);
+ OpRegReg(cUnit, kOpMvn, rlResult.lowReg, rlSrc2.lowReg);
+ OpRegReg(cUnit, kOpMvn, rlResult.highReg, tReg);
+ FreeTemp(cUnit, tReg);
} else {
- opRegReg(cUnit, kOpMvn, rlResult.lowReg, rlSrc2.lowReg);
- opRegReg(cUnit, kOpMvn, rlResult.highReg, rlSrc2.highReg);
+ OpRegReg(cUnit, kOpMvn, rlResult.lowReg, rlSrc2.lowReg);
+ OpRegReg(cUnit, kOpMvn, rlResult.highReg, rlSrc2.highReg);
}
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
break;
case Instruction::ADD_LONG:
case Instruction::ADD_LONG_2ADDR:
if (cUnit->instructionSet != kThumb2) {
- return genAddLong(cUnit, rlDest, rlSrc1, rlSrc2);
+ return GenAddLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
firstOp = kOpAdd;
secondOp = kOpAdc;
@@ -2054,7 +2048,7 @@
case Instruction::SUB_LONG:
case Instruction::SUB_LONG_2ADDR:
if (cUnit->instructionSet != kThumb2) {
- return genSubLong(cUnit, rlDest, rlSrc1, rlSrc2);
+ return GenSubLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
firstOp = kOpSub;
secondOp = kOpSbc;
@@ -2062,14 +2056,14 @@
case Instruction::MUL_LONG:
case Instruction::MUL_LONG_2ADDR:
callOut = true;
- retReg = targetReg(kRet0);
+ retReg = TargetReg(kRet0);
funcOffset = ENTRYPOINT_OFFSET(pLmul);
break;
case Instruction::DIV_LONG:
case Instruction::DIV_LONG_2ADDR:
callOut = true;
checkZero = true;
- retReg = targetReg(kRet0);
+ retReg = TargetReg(kRet0);
funcOffset = ENTRYPOINT_OFFSET(pLdiv);
break;
case Instruction::REM_LONG:
@@ -2078,12 +2072,12 @@
checkZero = true;
funcOffset = ENTRYPOINT_OFFSET(pLdivmod);
/* NOTE - for Arm, result is in kArg2/kArg3 instead of kRet0/kRet1 */
- retReg = (cUnit->instructionSet == kThumb2) ? targetReg(kArg2) : targetReg(kRet0);
+ retReg = (cUnit->instructionSet == kThumb2) ? TargetReg(kArg2) : TargetReg(kRet0);
break;
case Instruction::AND_LONG_2ADDR:
case Instruction::AND_LONG:
if (cUnit->instructionSet == kX86) {
- return genAndLong(cUnit, rlDest, rlSrc1, rlSrc2);
+ return GenAndLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
firstOp = kOpAnd;
secondOp = kOpAnd;
@@ -2091,7 +2085,7 @@
case Instruction::OR_LONG:
case Instruction::OR_LONG_2ADDR:
if (cUnit->instructionSet == kX86) {
- return genOrLong(cUnit, rlDest, rlSrc1, rlSrc2);
+ return GenOrLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
firstOp = kOpOr;
secondOp = kOpOr;
@@ -2099,70 +2093,70 @@
case Instruction::XOR_LONG:
case Instruction::XOR_LONG_2ADDR:
if (cUnit->instructionSet == kX86) {
- return genXorLong(cUnit, rlDest, rlSrc1, rlSrc2);
+ return GenXorLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
firstOp = kOpXor;
secondOp = kOpXor;
break;
case Instruction::NEG_LONG: {
- return genNegLong(cUnit, rlDest, rlSrc2);
+ return GenNegLong(cUnit, rlDest, rlSrc2);
}
default:
LOG(FATAL) << "Invalid long arith op";
}
if (!callOut) {
- genLong3Addr(cUnit, firstOp, secondOp, rlDest, rlSrc1, rlSrc2);
+ GenLong3Addr(cUnit, firstOp, secondOp, rlDest, rlSrc1, rlSrc2);
} else {
- oatFlushAllRegs(cUnit); /* Send everything to home location */
+ FlushAllRegs(cUnit); /* Send everything to home location */
if (checkZero) {
- loadValueDirectWideFixed(cUnit, rlSrc2, targetReg(kArg2), targetReg(kArg3));
- int rTgt = callHelperSetup(cUnit, funcOffset);
- genDivZeroCheck(cUnit, targetReg(kArg2), targetReg(kArg3));
- loadValueDirectWideFixed(cUnit, rlSrc1, targetReg(kArg0), targetReg(kArg1));
+ LoadValueDirectWideFixed(cUnit, rlSrc2, TargetReg(kArg2), TargetReg(kArg3));
+ int rTgt = CallHelperSetup(cUnit, funcOffset);
+ GenDivZeroCheck(cUnit, TargetReg(kArg2), TargetReg(kArg3));
+ LoadValueDirectWideFixed(cUnit, rlSrc1, TargetReg(kArg0), TargetReg(kArg1));
// NOTE: callout here is not a safepoint
- callHelper(cUnit, rTgt, funcOffset, false /* not safepoint */);
+ CallHelper(cUnit, rTgt, funcOffset, false /* not safepoint */);
} else {
- callRuntimeHelperRegLocationRegLocation(cUnit, funcOffset,
+ CallRuntimeHelperRegLocationRegLocation(cUnit, funcOffset,
rlSrc1, rlSrc2, false);
}
// Adjust return regs in to handle case of rem returning kArg2/kArg3
- if (retReg == targetReg(kRet0))
- rlResult = oatGetReturnWide(cUnit, false);
+ if (retReg == TargetReg(kRet0))
+ rlResult = GetReturnWide(cUnit, false);
else
- rlResult = oatGetReturnWideAlt(cUnit);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlResult = GetReturnWideAlt(cUnit);
+ StoreValueWide(cUnit, rlDest, rlResult);
}
return false;
}
-bool genConversionCall(CompilationUnit* cUnit, int funcOffset,
+bool GenConversionCall(CompilationUnit* cUnit, int funcOffset,
RegLocation rlDest, RegLocation rlSrc)
{
/*
* Don't optimize the register usage since it calls out to support
* functions
*/
- oatFlushAllRegs(cUnit); /* Send everything to home location */
+ FlushAllRegs(cUnit); /* Send everything to home location */
if (rlSrc.wide) {
- loadValueDirectWideFixed(cUnit, rlSrc, rlSrc.fp ? targetReg(kFArg0) : targetReg(kArg0),
- rlSrc.fp ? targetReg(kFArg1) : targetReg(kArg1));
+ LoadValueDirectWideFixed(cUnit, rlSrc, rlSrc.fp ? TargetReg(kFArg0) : TargetReg(kArg0),
+ rlSrc.fp ? TargetReg(kFArg1) : TargetReg(kArg1));
} else {
- loadValueDirectFixed(cUnit, rlSrc, rlSrc.fp ? targetReg(kFArg0) : targetReg(kArg0));
+ LoadValueDirectFixed(cUnit, rlSrc, rlSrc.fp ? TargetReg(kFArg0) : TargetReg(kArg0));
}
- callRuntimeHelperRegLocation(cUnit, funcOffset, rlSrc, false);
+ CallRuntimeHelperRegLocation(cUnit, funcOffset, rlSrc, false);
if (rlDest.wide) {
RegLocation rlResult;
- rlResult = oatGetReturnWide(cUnit, rlDest.fp);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlResult = GetReturnWide(cUnit, rlDest.fp);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
RegLocation rlResult;
- rlResult = oatGetReturn(cUnit, rlDest.fp);
- storeValue(cUnit, rlDest, rlResult);
+ rlResult = GetReturn(cUnit, rlDest.fp);
+ StoreValue(cUnit, rlDest, rlResult);
}
return false;
}
-bool genArithOpFloatPortable(CompilationUnit* cUnit, Instruction::Code opcode,
+bool GenArithOpFloatPortable(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc1,
RegLocation rlSrc2)
{
@@ -2191,20 +2185,20 @@
funcOffset = ENTRYPOINT_OFFSET(pFmodf);
break;
case Instruction::NEG_FLOAT: {
- genNegFloat(cUnit, rlDest, rlSrc1);
+ GenNegFloat(cUnit, rlDest, rlSrc1);
return false;
}
default:
return true;
}
- oatFlushAllRegs(cUnit); /* Send everything to home location */
- callRuntimeHelperRegLocationRegLocation(cUnit, funcOffset, rlSrc1, rlSrc2, false);
- rlResult = oatGetReturn(cUnit, true);
- storeValue(cUnit, rlDest, rlResult);
+ FlushAllRegs(cUnit); /* Send everything to home location */
+ CallRuntimeHelperRegLocationRegLocation(cUnit, funcOffset, rlSrc1, rlSrc2, false);
+ rlResult = GetReturn(cUnit, true);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-bool genArithOpDoublePortable(CompilationUnit* cUnit, Instruction::Code opcode,
+bool GenArithOpDoublePortable(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc1,
RegLocation rlSrc2)
{
@@ -2233,53 +2227,53 @@
funcOffset = ENTRYPOINT_OFFSET(pFmod);
break;
case Instruction::NEG_DOUBLE: {
- genNegDouble(cUnit, rlDest, rlSrc1);
+ GenNegDouble(cUnit, rlDest, rlSrc1);
return false;
}
default:
return true;
}
- oatFlushAllRegs(cUnit); /* Send everything to home location */
- callRuntimeHelperRegLocationRegLocation(cUnit, funcOffset, rlSrc1, rlSrc2, false);
- rlResult = oatGetReturnWide(cUnit, true);
- storeValueWide(cUnit, rlDest, rlResult);
+ FlushAllRegs(cUnit); /* Send everything to home location */
+ CallRuntimeHelperRegLocationRegLocation(cUnit, funcOffset, rlSrc1, rlSrc2, false);
+ rlResult = GetReturnWide(cUnit, true);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genConversionPortable(CompilationUnit* cUnit, Instruction::Code opcode,
+bool GenConversionPortable(CompilationUnit* cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc)
{
switch (opcode) {
case Instruction::INT_TO_FLOAT:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pI2f),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pI2f),
rlDest, rlSrc);
case Instruction::FLOAT_TO_INT:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pF2iz),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pF2iz),
rlDest, rlSrc);
case Instruction::DOUBLE_TO_FLOAT:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pD2f),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pD2f),
rlDest, rlSrc);
case Instruction::FLOAT_TO_DOUBLE:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pF2d),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pF2d),
rlDest, rlSrc);
case Instruction::INT_TO_DOUBLE:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pI2d),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pI2d),
rlDest, rlSrc);
case Instruction::DOUBLE_TO_INT:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pD2iz),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pD2iz),
rlDest, rlSrc);
case Instruction::FLOAT_TO_LONG:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pF2l),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pF2l),
rlDest, rlSrc);
case Instruction::LONG_TO_FLOAT:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pL2f),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pL2f),
rlDest, rlSrc);
case Instruction::DOUBLE_TO_LONG:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pD2l),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pD2l),
rlDest, rlSrc);
case Instruction::LONG_TO_DOUBLE:
- return genConversionCall(cUnit, ENTRYPOINT_OFFSET(pL2d),
+ return GenConversionCall(cUnit, ENTRYPOINT_OFFSET(pL2d),
rlDest, rlSrc);
default:
return true;
@@ -2288,34 +2282,34 @@
}
/* Check if we need to check for pending suspend request */
-void genSuspendTest(CompilationUnit* cUnit, int optFlags)
+void GenSuspendTest(CompilationUnit* cUnit, int optFlags)
{
if (NO_SUSPEND || (optFlags & MIR_IGNORE_SUSPEND_CHECK)) {
return;
}
- oatFlushAllRegs(cUnit);
- LIR* branch = opTestSuspend(cUnit, NULL);
- LIR* retLab = newLIR0(cUnit, kPseudoTargetLabel);
- LIR* target = rawLIR(cUnit, cUnit->currentDalvikOffset, kPseudoSuspendTarget,
+ FlushAllRegs(cUnit);
+ LIR* branch = OpTestSuspend(cUnit, NULL);
+ LIR* retLab = NewLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = RawLIR(cUnit, cUnit->currentDalvikOffset, kPseudoSuspendTarget,
reinterpret_cast<uintptr_t>(retLab), cUnit->currentDalvikOffset);
branch->target = target;
- oatInsertGrowableList(cUnit, &cUnit->suspendLaunchpads, reinterpret_cast<uintptr_t>(target));
+ InsertGrowableList(cUnit, &cUnit->suspendLaunchpads, reinterpret_cast<uintptr_t>(target));
}
/* Check if we need to check for pending suspend request */
-void genSuspendTestAndBranch(CompilationUnit* cUnit, int optFlags, LIR* target)
+void GenSuspendTestAndBranch(CompilationUnit* cUnit, int optFlags, LIR* target)
{
if (NO_SUSPEND || (optFlags & MIR_IGNORE_SUSPEND_CHECK)) {
- opUnconditionalBranch(cUnit, target);
+ OpUnconditionalBranch(cUnit, target);
return;
}
- opTestSuspend(cUnit, target);
+ OpTestSuspend(cUnit, target);
LIR* launchPad =
- rawLIR(cUnit, cUnit->currentDalvikOffset, kPseudoSuspendTarget,
+ RawLIR(cUnit, cUnit->currentDalvikOffset, kPseudoSuspendTarget,
reinterpret_cast<uintptr_t>(target), cUnit->currentDalvikOffset);
- oatFlushAllRegs(cUnit);
- opUnconditionalBranch(cUnit, launchPad);
- oatInsertGrowableList(cUnit, &cUnit->suspendLaunchpads, reinterpret_cast<uintptr_t>(launchPad));
+ FlushAllRegs(cUnit);
+ OpUnconditionalBranch(cUnit, launchPad);
+ InsertGrowableList(cUnit, &cUnit->suspendLaunchpads, reinterpret_cast<uintptr_t>(launchPad));
}
} // namespace art
diff --git a/src/compiler/codegen/gen_common.h b/src/compiler/codegen/gen_common.h
index db4b74c..04e32f2 100644
--- a/src/compiler/codegen/gen_common.h
+++ b/src/compiler/codegen/gen_common.h
@@ -17,66 +17,66 @@
#ifndef ART_SRC_COMPILER_CODEGEN_GENCOMMON_H_
#define ART_SRC_COMPILER_CODEGEN_GENCOMMON_H_
-void markSafepointPC(CompilationUnit* cUnit, LIR* inst);
-void callRuntimeHelperImm(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC);
-void callRuntimeHelperReg(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC);
-void callRuntimeHelperRegLocation(CompilationUnit* cUnit, int helperOffset, RegLocation arg0, bool safepointPC);
-void callRuntimeHelperImmImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
-void callRuntimeHelperImmRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0, RegLocation arg1, bool safepointPC);
-void callRuntimeHelperRegLocationImm(CompilationUnit* cUnit, int helperOffset, RegLocation arg0, int arg1, bool safepointPC);
-void callRuntimeHelperImmReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
-void callRuntimeHelperRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
-void callRuntimeHelperImmMethod(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC);
-void callRuntimeHelperRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset, RegLocation arg0, RegLocation arg1, bool safepointPC);
-void callRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
-void callRuntimeHelperRegRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, int arg2, bool safepointPC);
-void callRuntimeHelperImmMethodRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0, RegLocation arg2, bool safepointPC);
-void callRuntimeHelperImmMethodImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg2, bool safepointPC);
-void callRuntimeHelperImmRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0, RegLocation arg1, RegLocation arg2, bool safepointPC);
-void genBarrier(CompilationUnit* cUnit);
-LIR* opUnconditionalBranch(CompilationUnit* cUnit, LIR* target);
-LIR* genCheck(CompilationUnit* cUnit, ConditionCode cCode, ThrowKind kind);
-LIR* genImmedCheck(CompilationUnit* cUnit, ConditionCode cCode, int reg, int immVal, ThrowKind kind);
-LIR* genNullCheck(CompilationUnit* cUnit, int sReg, int mReg, int optFlags);
-LIR* genRegRegCheck(CompilationUnit* cUnit, ConditionCode cCode, int reg1, int reg2, ThrowKind kind);
-void genCompareAndBranch(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlSrc1, RegLocation rlSrc2, LIR* taken, LIR* fallThrough);
-void genCompareZeroAndBranch(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlSrc, LIR* taken, LIR* fallThrough);
-void genIntToLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
-void genIntNarrowing(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc);
-void genNewArray(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest, RegLocation rlSrc);
-void genFilledNewArray(CompilationUnit* cUnit, CallInfo* info);
-void genSput(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlSrc, bool isLongOrDouble, bool isObject);
-void genSget(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlDest, bool isLongOrDouble, bool isObject);
-void genShowTarget(CompilationUnit* cUnit);
-void handleSuspendLaunchpads(CompilationUnit *cUnit);
-void handleIntrinsicLaunchpads(CompilationUnit *cUnit);
-void handleThrowLaunchpads(CompilationUnit *cUnit);
-void oatSetupResourceMasks(CompilationUnit* cUnit, LIR* lir);
-bool fastInstance(CompilationUnit* cUnit, uint32_t fieldIdx, int& fieldOffset, bool& isVolatile, bool isPut);
-void genIGet(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size, RegLocation rlDest, RegLocation rlObj, bool isLongOrDouble, bool isObject);
-void genIPut(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size, RegLocation rlSrc, RegLocation rlObj, bool isLongOrDouble, bool isObject);
-void genConstClass(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest);
-void genConstString(CompilationUnit* cUnit, uint32_t string_idx, RegLocation rlDest);
-void genNewInstance(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest);
-void genMoveException(CompilationUnit* cUnit, RegLocation rlDest);
-void genThrow(CompilationUnit* cUnit, RegLocation rlSrc);
-void genInstanceof(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest, RegLocation rlSrc);
-void genCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc);
-void genArrayObjPut(CompilationUnit* cUnit, int optFlags, RegLocation rlArray, RegLocation rlIndex, RegLocation rlSrc, int scale);
-void genArrayGet(CompilationUnit* cUnit, int optFlags, OpSize size, RegLocation rlArray, RegLocation rlIndex, RegLocation rlDest, int scale);
-void genArrayPut(CompilationUnit* cUnit, int optFlags, OpSize size, RegLocation rlArray, RegLocation rlIndex, RegLocation rlSrc, int scale);
-void genLong3Addr(CompilationUnit* cUnit, OpKind firstOp, OpKind secondOp, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genShiftOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlShift);
-bool genArithOpInt(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool handleEasyDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode, RegLocation rlSrc, RegLocation rlDest, int lit);
-bool handleEasyMultiply(CompilationUnit* cUnit, RegLocation rlSrc, RegLocation rlDest, int lit);
-bool genArithOpIntLit(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc, int lit);
-bool genArithOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genConversionCall(CompilationUnit* cUnit, int funcOffset, RegLocation rlDest, RegLocation rlSrc);
-bool genArithOpFloatPortable(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genArithOpDoublePortable(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genConversionPortable(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc);
-void genSuspendTest(CompilationUnit* cUnit, int optFlags);
-void genSuspendTestAndBranch(CompilationUnit* cUnit, int optFlags, LIR* target);
+void MarkSafepointPC(CompilationUnit* cUnit, LIR* inst);
+void CallRuntimeHelperImm(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC);
+void CallRuntimeHelperReg(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC);
+void CallRuntimeHelperRegLocation(CompilationUnit* cUnit, int helperOffset, RegLocation arg0, bool safepointPC);
+void CallRuntimeHelperImmImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
+void CallRuntimeHelperImmRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0, RegLocation arg1, bool safepointPC);
+void CallRuntimeHelperRegLocationImm(CompilationUnit* cUnit, int helperOffset, RegLocation arg0, int arg1, bool safepointPC);
+void CallRuntimeHelperImmReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
+void CallRuntimeHelperRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
+void CallRuntimeHelperImmMethod(CompilationUnit* cUnit, int helperOffset, int arg0, bool safepointPC);
+void CallRuntimeHelperRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset, RegLocation arg0, RegLocation arg1, bool safepointPC);
+void CallRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, bool safepointPC);
+void CallRuntimeHelperRegRegImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg1, int arg2, bool safepointPC);
+void CallRuntimeHelperImmMethodRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0, RegLocation arg2, bool safepointPC);
+void CallRuntimeHelperImmMethodImm(CompilationUnit* cUnit, int helperOffset, int arg0, int arg2, bool safepointPC);
+void CallRuntimeHelperImmRegLocationRegLocation(CompilationUnit* cUnit, int helperOffset, int arg0, RegLocation arg1, RegLocation arg2, bool safepointPC);
+void GenBarrier(CompilationUnit* cUnit);
+LIR* OpUnconditionalBranch(CompilationUnit* cUnit, LIR* target);
+LIR* GenCheck(CompilationUnit* cUnit, ConditionCode cCode, ThrowKind kind);
+LIR* GenImmedCheck(CompilationUnit* cUnit, ConditionCode cCode, int reg, int immVal, ThrowKind kind);
+LIR* GenNullCheck(CompilationUnit* cUnit, int sReg, int mReg, int optFlags);
+LIR* GenRegRegCheck(CompilationUnit* cUnit, ConditionCode cCode, int reg1, int reg2, ThrowKind kind);
+void GenCompareAndBranch(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlSrc1, RegLocation rlSrc2, LIR* taken, LIR* fallThrough);
+void GenCompareZeroAndBranch(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlSrc, LIR* taken, LIR* fallThrough);
+void GenIntToLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
+void GenIntNarrowing(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc);
+void GenNewArray(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest, RegLocation rlSrc);
+void GenFilledNewArray(CompilationUnit* cUnit, CallInfo* info);
+void GenSput(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlSrc, bool isLongOrDouble, bool isObject);
+void GenSget(CompilationUnit* cUnit, uint32_t fieldIdx, RegLocation rlDest, bool isLongOrDouble, bool isObject);
+void GenShowTarget(CompilationUnit* cUnit);
+void HandleSuspendLaunchPads(CompilationUnit *cUnit);
+void HandleIntrinsicLaunchPads(CompilationUnit *cUnit);
+void HandleThrowLaunchPads(CompilationUnit *cUnit);
+void SetupResourceMasks(CompilationUnit* cUnit, LIR* lir);
+bool FastInstance(CompilationUnit* cUnit, uint32_t fieldIdx, int& fieldOffset, bool& isVolatile, bool isPut);
+void GenIGet(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size, RegLocation rlDest, RegLocation rlObj, bool isLongOrDouble, bool isObject);
+void GenIPut(CompilationUnit* cUnit, uint32_t fieldIdx, int optFlags, OpSize size, RegLocation rlSrc, RegLocation rlObj, bool isLongOrDouble, bool isObject);
+void GenConstClass(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest);
+void GenConstString(CompilationUnit* cUnit, uint32_t string_idx, RegLocation rlDest);
+void GenNewInstance(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest);
+void GenMoveException(CompilationUnit* cUnit, RegLocation rlDest);
+void GenThrow(CompilationUnit* cUnit, RegLocation rlSrc);
+void GenInstanceof(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest, RegLocation rlSrc);
+void GenCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc);
+void GenArrayObjPut(CompilationUnit* cUnit, int optFlags, RegLocation rlArray, RegLocation rlIndex, RegLocation rlSrc, int scale);
+void GenArrayGet(CompilationUnit* cUnit, int optFlags, OpSize size, RegLocation rlArray, RegLocation rlIndex, RegLocation rlDest, int scale);
+void GenArrayPut(CompilationUnit* cUnit, int optFlags, OpSize size, RegLocation rlArray, RegLocation rlIndex, RegLocation rlSrc, int scale);
+void GenLong3Addr(CompilationUnit* cUnit, OpKind firstOp, OpKind secondOp, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenShiftOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlShift);
+bool GenArithOpInt(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool HandleEasyDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode, RegLocation rlSrc, RegLocation rlDest, int lit);
+bool HandleEasyMultiply(CompilationUnit* cUnit, RegLocation rlSrc, RegLocation rlDest, int lit);
+bool GenArithOpIntLit(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc, int lit);
+bool GenArithOpLong(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenConversionCall(CompilationUnit* cUnit, int funcOffset, RegLocation rlDest, RegLocation rlSrc);
+bool GenArithOpFloatPortable(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenArithOpDoublePortable(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenConversionPortable(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc);
+void GenSuspendTest(CompilationUnit* cUnit, int optFlags);
+void GenSuspendTestAndBranch(CompilationUnit* cUnit, int optFlags, LIR* target);
#endif // ART_SRC_COMPILER_CODEGEN_GENCOMMON_H_
diff --git a/src/compiler/codegen/gen_invoke.cc b/src/compiler/codegen/gen_invoke.cc
index 90fc14b..6f8b092 100644
--- a/src/compiler/codegen/gen_invoke.cc
+++ b/src/compiler/codegen/gen_invoke.cc
@@ -32,10 +32,10 @@
* to a callee-save register, flush them to the frame. Perform intial
* assignment of promoted arguments.
*
- * argLocs is an array of location records describing the incoming arguments
+ * ArgLocs is an array of location records describing the incoming arguments
* with one location record per word of argument.
*/
-void flushIns(CompilationUnit* cUnit, RegLocation* argLocs, RegLocation rlMethod)
+void FlushIns(CompilationUnit* cUnit, RegLocation* ArgLocs, RegLocation rlMethod)
{
/*
* Dummy up a RegLocation for the incoming Method*
@@ -44,13 +44,13 @@
*/
RegLocation rlSrc = rlMethod;
rlSrc.location = kLocPhysReg;
- rlSrc.lowReg = targetReg(kArg0);
+ rlSrc.lowReg = TargetReg(kArg0);
rlSrc.home = false;
- oatMarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
- storeValue(cUnit, rlMethod, rlSrc);
+ MarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
+ StoreValue(cUnit, rlMethod, rlSrc);
// If Method* has been promoted, explicitly flush
if (rlMethod.location == kLocPhysReg) {
- storeWordDisp(cUnit, targetReg(kSp), 0, targetReg(kArg0));
+ StoreWordDisp(cUnit, TargetReg(kSp), 0, TargetReg(kArg0));
}
if (cUnit->numIns == 0)
@@ -75,12 +75,12 @@
if (i < numArgRegs) {
// If arriving in register
bool needFlush = true;
- RegLocation* tLoc = &argLocs[i];
+ RegLocation* tLoc = &ArgLocs[i];
if ((vMap->coreLocation == kLocPhysReg) && !tLoc->fp) {
- opRegCopy(cUnit, vMap->coreReg, targetReg(argRegs[i]));
+ OpRegCopy(cUnit, vMap->coreReg, TargetReg(argRegs[i]));
needFlush = false;
} else if ((vMap->fpLocation == kLocPhysReg) && tLoc->fp) {
- opRegCopy(cUnit, vMap->fpReg, targetReg(argRegs[i]));
+ OpRegCopy(cUnit, vMap->FpReg, TargetReg(argRegs[i]));
needFlush = false;
} else {
needFlush = true;
@@ -93,24 +93,24 @@
(pMap->fpLocation != vMap->fpLocation);
}
if (needFlush) {
- storeBaseDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, startVReg + i),
- targetReg(argRegs[i]), kWord);
+ StoreBaseDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, startVReg + i),
+ TargetReg(argRegs[i]), kWord);
}
} else {
// If arriving in frame & promoted
if (vMap->coreLocation == kLocPhysReg) {
- loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, startVReg + i),
+ LoadWordDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, startVReg + i),
vMap->coreReg);
}
if (vMap->fpLocation == kLocPhysReg) {
- loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, startVReg + i),
- vMap->fpReg);
+ LoadWordDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, startVReg + i),
+ vMap->FpReg);
}
}
}
}
-void scanMethodLiteralPool(CompilationUnit* cUnit, LIR** methodTarget, LIR** codeTarget,
+void ScanMethodLiteralPool(CompilationUnit* cUnit, LIR** methodTarget, LIR** codeTarget,
const DexFile* dexFile, uint32_t dexMethodIdx)
{
LIR* curTarget = cUnit->methodLiteralList;
@@ -134,7 +134,7 @@
* Bit of a hack here - in the absence of a real scheduling pass,
* emit the next instruction in static & direct invoke sequences.
*/
-int nextSDCallInsn(CompilationUnit* cUnit, CallInfo* info,
+int NextSDCallInsn(CompilationUnit* cUnit, CallInfo* info,
int state, uint32_t dexIdx, uint32_t unused,
uintptr_t directCode, uintptr_t directMethod,
InvokeType type)
@@ -148,27 +148,27 @@
switch (state) {
case 0: // Get the current Method* [sets kArg0]
if (directCode != static_cast<unsigned int>(-1)) {
- loadConstant(cUnit, targetReg(kInvokeTgt), directCode);
+ LoadConstant(cUnit, TargetReg(kInvokeTgt), directCode);
} else {
- LIR* dataTarget = scanLiteralPool(cUnit->codeLiteralList, dexIdx, 0);
+ LIR* dataTarget = ScanLiteralPool(cUnit->codeLiteralList, dexIdx, 0);
if (dataTarget == NULL) {
- dataTarget = addWordData(cUnit, &cUnit->codeLiteralList, dexIdx);
+ dataTarget = AddWordData(cUnit, &cUnit->codeLiteralList, dexIdx);
dataTarget->operands[1] = type;
}
- LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kInvokeTgt), dataTarget);
- oatAppendLIR(cUnit, loadPcRel);
+ LIR* loadPcRel = OpPcRelLoad(cUnit, TargetReg(kInvokeTgt), dataTarget);
+ AppendLIR(cUnit, loadPcRel);
DCHECK_EQ(cUnit->instructionSet, kThumb2) << reinterpret_cast<void*>(dataTarget);
}
if (directMethod != static_cast<unsigned int>(-1)) {
- loadConstant(cUnit, targetReg(kArg0), directMethod);
+ LoadConstant(cUnit, TargetReg(kArg0), directMethod);
} else {
- LIR* dataTarget = scanLiteralPool(cUnit->methodLiteralList, dexIdx, 0);
+ LIR* dataTarget = ScanLiteralPool(cUnit->methodLiteralList, dexIdx, 0);
if (dataTarget == NULL) {
- dataTarget = addWordData(cUnit, &cUnit->methodLiteralList, dexIdx);
+ dataTarget = AddWordData(cUnit, &cUnit->methodLiteralList, dexIdx);
dataTarget->operands[1] = type;
}
- LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kArg0), dataTarget);
- oatAppendLIR(cUnit, loadPcRel);
+ LIR* loadPcRel = OpPcRelLoad(cUnit, TargetReg(kArg0), dataTarget);
+ AppendLIR(cUnit, loadPcRel);
DCHECK_EQ(cUnit->instructionSet, kThumb2) << reinterpret_cast<void*>(dataTarget);
}
break;
@@ -179,36 +179,36 @@
switch (state) {
case 0: // Get the current Method* [sets kArg0]
// TUNING: we can save a reg copy if Method* has been promoted.
- loadCurrMethodDirect(cUnit, targetReg(kArg0));
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg0));
break;
case 1: // Get method->dex_cache_resolved_methods_
- loadWordDisp(cUnit, targetReg(kArg0),
- AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(), targetReg(kArg0));
+ LoadWordDisp(cUnit, TargetReg(kArg0),
+ AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(), TargetReg(kArg0));
// Set up direct code if known.
if (directCode != 0) {
if (directCode != static_cast<unsigned int>(-1)) {
- loadConstant(cUnit, targetReg(kInvokeTgt), directCode);
+ LoadConstant(cUnit, TargetReg(kInvokeTgt), directCode);
} else {
- LIR* dataTarget = scanLiteralPool(cUnit->codeLiteralList, dexIdx, 0);
+ LIR* dataTarget = ScanLiteralPool(cUnit->codeLiteralList, dexIdx, 0);
if (dataTarget == NULL) {
- dataTarget = addWordData(cUnit, &cUnit->codeLiteralList, dexIdx);
+ dataTarget = AddWordData(cUnit, &cUnit->codeLiteralList, dexIdx);
dataTarget->operands[1] = type;
}
- LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kInvokeTgt), dataTarget);
- oatAppendLIR(cUnit, loadPcRel);
+ LIR* loadPcRel = OpPcRelLoad(cUnit, TargetReg(kInvokeTgt), dataTarget);
+ AppendLIR(cUnit, loadPcRel);
DCHECK_EQ(cUnit->instructionSet, kThumb2) << reinterpret_cast<void*>(dataTarget);
}
}
break;
case 2: // Grab target method*
- loadWordDisp(cUnit, targetReg(kArg0),
- Array::DataOffset(sizeof(Object*)).Int32Value() + dexIdx * 4, targetReg(kArg0));
+ LoadWordDisp(cUnit, TargetReg(kArg0),
+ Array::DataOffset(sizeof(Object*)).Int32Value() + dexIdx * 4, TargetReg(kArg0));
break;
case 3: // Grab the code from the method*
if (cUnit->instructionSet != kX86) {
if (directCode == 0) {
- loadWordDisp(cUnit, targetReg(kArg0), AbstractMethod::GetCodeOffset().Int32Value(),
- targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kArg0), AbstractMethod::GetCodeOffset().Int32Value(),
+ TargetReg(kInvokeTgt));
}
break;
}
@@ -225,9 +225,9 @@
* emit the next instruction in a virtual invoke sequence.
* We can use kLr as a temp prior to target address loading
* Note also that we'll load the first argument ("this") into
- * kArg1 here rather than the standard loadArgRegs.
+ * kArg1 here rather than the standard LoadArgRegs.
*/
-int nextVCallInsn(CompilationUnit* cUnit, CallInfo* info,
+int NextVCallInsn(CompilationUnit* cUnit, CallInfo* info,
int state, uint32_t dexIdx, uint32_t methodIdx,
uintptr_t unused, uintptr_t unused2, InvokeType unused3)
{
@@ -238,27 +238,27 @@
switch (state) {
case 0: { // Get "this" [set kArg1]
RegLocation rlArg = info->args[0];
- loadValueDirectFixed(cUnit, rlArg, targetReg(kArg1));
+ LoadValueDirectFixed(cUnit, rlArg, TargetReg(kArg1));
break;
}
case 1: // Is "this" null? [use kArg1]
- genNullCheck(cUnit, info->args[0].sRegLow, targetReg(kArg1), info->optFlags);
+ GenNullCheck(cUnit, info->args[0].sRegLow, TargetReg(kArg1), info->optFlags);
// get this->klass_ [use kArg1, set kInvokeTgt]
- loadWordDisp(cUnit, targetReg(kArg1), Object::ClassOffset().Int32Value(),
- targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kArg1), Object::ClassOffset().Int32Value(),
+ TargetReg(kInvokeTgt));
break;
case 2: // Get this->klass_->vtable [usr kInvokeTgt, set kInvokeTgt]
- loadWordDisp(cUnit, targetReg(kInvokeTgt), Class::VTableOffset().Int32Value(),
- targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kInvokeTgt), Class::VTableOffset().Int32Value(),
+ TargetReg(kInvokeTgt));
break;
case 3: // Get target method [use kInvokeTgt, set kArg0]
- loadWordDisp(cUnit, targetReg(kInvokeTgt), (methodIdx * 4) +
- Array::DataOffset(sizeof(Object*)).Int32Value(), targetReg(kArg0));
+ LoadWordDisp(cUnit, TargetReg(kInvokeTgt), (methodIdx * 4) +
+ Array::DataOffset(sizeof(Object*)).Int32Value(), TargetReg(kArg0));
break;
case 4: // Get the compiled code address [uses kArg0, sets kInvokeTgt]
if (cUnit->instructionSet != kX86) {
- loadWordDisp(cUnit, targetReg(kArg0), AbstractMethod::GetCodeOffset().Int32Value(),
- targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kArg0), AbstractMethod::GetCodeOffset().Int32Value(),
+ TargetReg(kInvokeTgt));
break;
}
// Intentional fallthrough for X86
@@ -272,7 +272,7 @@
* All invoke-interface calls bounce off of art_invoke_interface_trampoline,
* which will locate the target and continue on via a tail call.
*/
-int nextInterfaceCallInsn(CompilationUnit* cUnit, CallInfo* info, int state,
+int NextInterfaceCallInsn(CompilationUnit* cUnit, CallInfo* info, int state,
uint32_t dexIdx, uint32_t unused, uintptr_t unused2,
uintptr_t directMethod, InvokeType unused4)
{
@@ -287,19 +287,19 @@
switch (state) {
case 0: // Load the trampoline target [sets kInvokeTgt].
if (cUnit->instructionSet != kX86) {
- loadWordDisp(cUnit, targetReg(kSelf), trampoline, targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kSelf), trampoline, TargetReg(kInvokeTgt));
}
// Get the interface Method* [sets kArg0]
if (directMethod != static_cast<unsigned int>(-1)) {
- loadConstant(cUnit, targetReg(kArg0), directMethod);
+ LoadConstant(cUnit, TargetReg(kArg0), directMethod);
} else {
- LIR* dataTarget = scanLiteralPool(cUnit->methodLiteralList, dexIdx, 0);
+ LIR* dataTarget = ScanLiteralPool(cUnit->methodLiteralList, dexIdx, 0);
if (dataTarget == NULL) {
- dataTarget = addWordData(cUnit, &cUnit->methodLiteralList, dexIdx);
+ dataTarget = AddWordData(cUnit, &cUnit->methodLiteralList, dexIdx);
dataTarget->operands[1] = kInterface;
}
- LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kArg0), dataTarget);
- oatAppendLIR(cUnit, loadPcRel);
+ LIR* loadPcRel = OpPcRelLoad(cUnit, TargetReg(kArg0), dataTarget);
+ AppendLIR(cUnit, loadPcRel);
DCHECK_EQ(cUnit->instructionSet, kThumb2) << reinterpret_cast<void*>(dataTarget);
}
break;
@@ -310,21 +310,21 @@
switch (state) {
case 0:
// Get the current Method* [sets kArg0] - TUNING: remove copy of method if it is promoted.
- loadCurrMethodDirect(cUnit, targetReg(kArg0));
+ LoadCurrMethodDirect(cUnit, TargetReg(kArg0));
// Load the trampoline target [sets kInvokeTgt].
if (cUnit->instructionSet != kX86) {
- loadWordDisp(cUnit, targetReg(kSelf), trampoline, targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kSelf), trampoline, TargetReg(kInvokeTgt));
}
break;
case 1: // Get method->dex_cache_resolved_methods_ [set/use kArg0]
- loadWordDisp(cUnit, targetReg(kArg0),
+ LoadWordDisp(cUnit, TargetReg(kArg0),
AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(),
- targetReg(kArg0));
+ TargetReg(kArg0));
break;
case 2: // Grab target method* [set/use kArg0]
- loadWordDisp(cUnit, targetReg(kArg0),
+ LoadWordDisp(cUnit, TargetReg(kArg0),
Array::DataOffset(sizeof(Object*)).Int32Value() + dexIdx * 4,
- targetReg(kArg0));
+ TargetReg(kArg0));
break;
default:
return -1;
@@ -333,7 +333,7 @@
return state + 1;
}
-int nextInvokeInsnSP(CompilationUnit* cUnit, CallInfo* info, int trampoline,
+int NextInvokeInsnSP(CompilationUnit* cUnit, CallInfo* info, int trampoline,
int state, uint32_t dexIdx, uint32_t methodIdx)
{
/*
@@ -343,65 +343,65 @@
if (state == 0) {
if (cUnit->instructionSet != kX86) {
// Load trampoline target
- loadWordDisp(cUnit, targetReg(kSelf), trampoline, targetReg(kInvokeTgt));
+ LoadWordDisp(cUnit, TargetReg(kSelf), trampoline, TargetReg(kInvokeTgt));
}
// Load kArg0 with method index
- loadConstant(cUnit, targetReg(kArg0), dexIdx);
+ LoadConstant(cUnit, TargetReg(kArg0), dexIdx);
return 1;
}
return -1;
}
-int nextStaticCallInsnSP(CompilationUnit* cUnit, CallInfo* info,
+int NextStaticCallInsnSP(CompilationUnit* cUnit, CallInfo* info,
int state, uint32_t dexIdx, uint32_t methodIdx,
uintptr_t unused, uintptr_t unused2,
InvokeType unused3)
{
int trampoline = ENTRYPOINT_OFFSET(pInvokeStaticTrampolineWithAccessCheck);
- return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
+ return NextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
}
-int nextDirectCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
+int NextDirectCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
uintptr_t unused2, InvokeType unused3)
{
int trampoline = ENTRYPOINT_OFFSET(pInvokeDirectTrampolineWithAccessCheck);
- return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
+ return NextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
}
-int nextSuperCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
+int NextSuperCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
uintptr_t unused2, InvokeType unused3)
{
int trampoline = ENTRYPOINT_OFFSET(pInvokeSuperTrampolineWithAccessCheck);
- return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
+ return NextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
}
-int nextVCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
+int NextVCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
uintptr_t unused2, InvokeType unused3)
{
int trampoline = ENTRYPOINT_OFFSET(pInvokeVirtualTrampolineWithAccessCheck);
- return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
+ return NextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
}
-int nextInterfaceCallInsnWithAccessCheck(CompilationUnit* cUnit,
+int NextInterfaceCallInsnWithAccessCheck(CompilationUnit* cUnit,
CallInfo* info, int state,
uint32_t dexIdx, uint32_t unused,
uintptr_t unused2, uintptr_t unused3,
InvokeType unused4)
{
int trampoline = ENTRYPOINT_OFFSET(pInvokeInterfaceTrampolineWithAccessCheck);
- return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
+ return NextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
}
-int loadArgRegs(CompilationUnit* cUnit, CallInfo* info, int callState,
+int LoadArgRegs(CompilationUnit* cUnit, CallInfo* info, int callState,
NextCallInsn nextCallInsn, uint32_t dexIdx,
uint32_t methodIdx, uintptr_t directCode,
uintptr_t directMethod, InvokeType type, bool skipThis)
{
- int lastArgReg = targetReg(kArg3);
- int nextReg = targetReg(kArg1);
+ int lastArgReg = TargetReg(kArg3);
+ int nextReg = TargetReg(kArg1);
int nextArg = 0;
if (skipThis) {
nextReg++;
@@ -409,14 +409,14 @@
}
for (; (nextReg <= lastArgReg) && (nextArg < info->numArgWords); nextReg++) {
RegLocation rlArg = info->args[nextArg++];
- rlArg = oatUpdateRawLoc(cUnit, rlArg);
- if (rlArg.wide && (nextReg <= targetReg(kArg2))) {
- loadValueDirectWideFixed(cUnit, rlArg, nextReg, nextReg + 1);
+ rlArg = UpdateRawLoc(cUnit, rlArg);
+ if (rlArg.wide && (nextReg <= TargetReg(kArg2))) {
+ LoadValueDirectWideFixed(cUnit, rlArg, nextReg, nextReg + 1);
nextReg++;
nextArg++;
} else {
rlArg.wide = false;
- loadValueDirectFixed(cUnit, rlArg, nextReg);
+ LoadValueDirectFixed(cUnit, rlArg, nextReg);
}
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
@@ -431,7 +431,7 @@
* the target method pointer. Note, this may also be called
* for "range" variants if the number of arguments is 5 or fewer.
*/
-int genDalvikArgsNoRange(CompilationUnit* cUnit, CallInfo* info,
+int GenDalvikArgsNoRange(CompilationUnit* cUnit, CallInfo* info,
int callState,
LIR** pcrLabel, NextCallInsn nextCallInsn,
uint32_t dexIdx, uint32_t methodIdx,
@@ -458,18 +458,18 @@
rlUse2.wide) {
int reg = -1;
// Wide spans, we need the 2nd half of uses[2].
- rlArg = oatUpdateLocWide(cUnit, rlUse2);
+ rlArg = UpdateLocWide(cUnit, rlUse2);
if (rlArg.location == kLocPhysReg) {
reg = rlArg.highReg;
} else {
// kArg2 & rArg3 can safely be used here
- reg = targetReg(kArg3);
- loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, rlArg.sRegLow) + 4, reg);
+ reg = TargetReg(kArg3);
+ LoadWordDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, rlArg.sRegLow) + 4, reg);
callState = nextCallInsn(cUnit, info, callState, dexIdx,
methodIdx, directCode, directMethod, type);
}
- storeBaseDisp(cUnit, targetReg(kSp), (nextUse + 1) * 4, reg, kWord);
- storeBaseDisp(cUnit, targetReg(kSp), 16 /* (3+1)*4 */, reg, kWord);
+ StoreBaseDisp(cUnit, TargetReg(kSp), (nextUse + 1) * 4, reg, kWord);
+ StoreBaseDisp(cUnit, TargetReg(kSp), 16 /* (3+1)*4 */, reg, kWord);
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
nextUse++;
@@ -479,27 +479,27 @@
int lowReg;
int highReg = -1;
rlArg = info->args[nextUse];
- rlArg = oatUpdateRawLoc(cUnit, rlArg);
+ rlArg = UpdateRawLoc(cUnit, rlArg);
if (rlArg.location == kLocPhysReg) {
lowReg = rlArg.lowReg;
highReg = rlArg.highReg;
} else {
- lowReg = targetReg(kArg2);
+ lowReg = TargetReg(kArg2);
if (rlArg.wide) {
- highReg = targetReg(kArg3);
- loadValueDirectWideFixed(cUnit, rlArg, lowReg, highReg);
+ highReg = TargetReg(kArg3);
+ LoadValueDirectWideFixed(cUnit, rlArg, lowReg, highReg);
} else {
- loadValueDirectFixed(cUnit, rlArg, lowReg);
+ LoadValueDirectFixed(cUnit, rlArg, lowReg);
}
callState = nextCallInsn(cUnit, info, callState, dexIdx,
methodIdx, directCode, directMethod, type);
}
int outsOffset = (nextUse + 1) * 4;
if (rlArg.wide) {
- storeBaseDispWide(cUnit, targetReg(kSp), outsOffset, lowReg, highReg);
+ StoreBaseDispWide(cUnit, TargetReg(kSp), outsOffset, lowReg, highReg);
nextUse += 2;
} else {
- storeWordDisp(cUnit, targetReg(kSp), outsOffset, lowReg);
+ StoreWordDisp(cUnit, TargetReg(kSp), outsOffset, lowReg);
nextUse++;
}
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
@@ -507,12 +507,12 @@
}
}
- callState = loadArgRegs(cUnit, info, callState, nextCallInsn,
+ callState = LoadArgRegs(cUnit, info, callState, nextCallInsn,
dexIdx, methodIdx, directCode, directMethod,
type, skipThis);
if (pcrLabel) {
- *pcrLabel = genNullCheck(cUnit, info->args[0].sRegLow, targetReg(kArg1), info->optFlags);
+ *pcrLabel = GenNullCheck(cUnit, info->args[0].sRegLow, TargetReg(kArg1), info->optFlags);
}
return callState;
}
@@ -532,7 +532,7 @@
* Pass arg0, arg1 & arg2 in kArg1-kArg3
*
*/
-int genDalvikArgsRange(CompilationUnit* cUnit, CallInfo* info, int callState,
+int GenDalvikArgsRange(CompilationUnit* cUnit, CallInfo* info, int callState,
LIR** pcrLabel, NextCallInsn nextCallInsn,
uint32_t dexIdx, uint32_t methodIdx,
uintptr_t directCode, uintptr_t directMethod,
@@ -541,7 +541,7 @@
// If we can treat it as non-range (Jumbo ops will use range form)
if (info->numArgWords <= 5)
- return genDalvikArgsNoRange(cUnit, info, callState, pcrLabel,
+ return GenDalvikArgsNoRange(cUnit, info, callState, pcrLabel,
nextCallInsn, dexIdx, methodIdx,
directCode, directMethod, type, skipThis);
/*
@@ -554,96 +554,96 @@
for (int nextArg = 0; nextArg < info->numArgWords;) {
RegLocation loc = info->args[nextArg];
if (loc.wide) {
- loc = oatUpdateLocWide(cUnit, loc);
+ loc = UpdateLocWide(cUnit, loc);
if ((nextArg >= 2) && (loc.location == kLocPhysReg)) {
- storeBaseDispWide(cUnit, targetReg(kSp), oatSRegOffset(cUnit, loc.sRegLow),
+ StoreBaseDispWide(cUnit, TargetReg(kSp), SRegOffset(cUnit, loc.sRegLow),
loc.lowReg, loc.highReg);
}
nextArg += 2;
} else {
- loc = oatUpdateLoc(cUnit, loc);
+ loc = UpdateLoc(cUnit, loc);
if ((nextArg >= 3) && (loc.location == kLocPhysReg)) {
- storeBaseDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, loc.sRegLow),
+ StoreBaseDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, loc.sRegLow),
loc.lowReg, kWord);
}
nextArg++;
}
}
- int startOffset = oatSRegOffset(cUnit, info->args[3].sRegLow);
+ int startOffset = SRegOffset(cUnit, info->args[3].sRegLow);
int outsOffset = 4 /* Method* */ + (3 * 4);
if (cUnit->instructionSet != kThumb2) {
// Generate memcpy
- opRegRegImm(cUnit, kOpAdd, targetReg(kArg0), targetReg(kSp), outsOffset);
- opRegRegImm(cUnit, kOpAdd, targetReg(kArg1), targetReg(kSp), startOffset);
- callRuntimeHelperRegRegImm(cUnit, ENTRYPOINT_OFFSET(pMemcpy), targetReg(kArg0),
- targetReg(kArg1), (info->numArgWords - 3) * 4, false);
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kArg0), TargetReg(kSp), outsOffset);
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kArg1), TargetReg(kSp), startOffset);
+ CallRuntimeHelperRegRegImm(cUnit, ENTRYPOINT_OFFSET(pMemcpy), TargetReg(kArg0),
+ TargetReg(kArg1), (info->numArgWords - 3) * 4, false);
} else {
if (info->numArgWords >= 20) {
// Generate memcpy
- opRegRegImm(cUnit, kOpAdd, targetReg(kArg0), targetReg(kSp), outsOffset);
- opRegRegImm(cUnit, kOpAdd, targetReg(kArg1), targetReg(kSp), startOffset);
- callRuntimeHelperRegRegImm(cUnit, ENTRYPOINT_OFFSET(pMemcpy), targetReg(kArg0),
- targetReg(kArg1), (info->numArgWords - 3) * 4, false);
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kArg0), TargetReg(kSp), outsOffset);
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kArg1), TargetReg(kSp), startOffset);
+ CallRuntimeHelperRegRegImm(cUnit, ENTRYPOINT_OFFSET(pMemcpy), TargetReg(kArg0),
+ TargetReg(kArg1), (info->numArgWords - 3) * 4, false);
} else {
// Use vldm/vstm pair using kArg3 as a temp
int regsLeft = std::min(info->numArgWords - 3, 16);
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
- opRegRegImm(cUnit, kOpAdd, targetReg(kArg3), targetReg(kSp), startOffset);
- LIR* ld = opVldm(cUnit, targetReg(kArg3), regsLeft);
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kArg3), TargetReg(kSp), startOffset);
+ LIR* ld = OpVldm(cUnit, TargetReg(kArg3), regsLeft);
//TUNING: loosen barrier
ld->defMask = ENCODE_ALL;
- setMemRefType(ld, true /* isLoad */, kDalvikReg);
+ SetMemRefType(ld, true /* isLoad */, kDalvikReg);
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
- opRegRegImm(cUnit, kOpAdd, targetReg(kArg3), targetReg(kSp), 4 /* Method* */ + (3 * 4));
+ OpRegRegImm(cUnit, kOpAdd, TargetReg(kArg3), TargetReg(kSp), 4 /* Method* */ + (3 * 4));
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
- LIR* st = opVstm(cUnit, targetReg(kArg3), regsLeft);
- setMemRefType(st, false /* isLoad */, kDalvikReg);
+ LIR* st = OpVstm(cUnit, TargetReg(kArg3), regsLeft);
+ SetMemRefType(st, false /* isLoad */, kDalvikReg);
st->defMask = ENCODE_ALL;
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
}
}
- callState = loadArgRegs(cUnit, info, callState, nextCallInsn,
+ callState = LoadArgRegs(cUnit, info, callState, nextCallInsn,
dexIdx, methodIdx, directCode, directMethod,
type, skipThis);
callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
directCode, directMethod, type);
if (pcrLabel) {
- *pcrLabel = genNullCheck(cUnit, info->args[0].sRegLow, targetReg(kArg1),
+ *pcrLabel = GenNullCheck(cUnit, info->args[0].sRegLow, TargetReg(kArg1),
info->optFlags);
}
return callState;
}
-RegLocation inlineTarget(CompilationUnit* cUnit, CallInfo* info)
+RegLocation InlineTarget(CompilationUnit* cUnit, CallInfo* info)
{
RegLocation res;
if (info->result.location == kLocInvalid) {
- res = oatGetReturn(cUnit, false);
+ res = GetReturn(cUnit, false);
} else {
res = info->result;
}
return res;
}
-RegLocation inlineTargetWide(CompilationUnit* cUnit, CallInfo* info)
+RegLocation InlineTargetWide(CompilationUnit* cUnit, CallInfo* info)
{
RegLocation res;
if (info->result.location == kLocInvalid) {
- res = oatGetReturnWide(cUnit, false);
+ res = GetReturnWide(cUnit, false);
} else {
res = info->result;
}
return res;
}
-bool genInlinedCharAt(CompilationUnit* cUnit, CallInfo* info)
+bool GenInlinedCharAt(CompilationUnit* cUnit, CallInfo* info)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
@@ -660,59 +660,59 @@
RegLocation rlObj = info->args[0];
RegLocation rlIdx = info->args[1];
- rlObj = loadValue(cUnit, rlObj, kCoreReg);
- rlIdx = loadValue(cUnit, rlIdx, kCoreReg);
+ rlObj = LoadValue(cUnit, rlObj, kCoreReg);
+ rlIdx = LoadValue(cUnit, rlIdx, kCoreReg);
int regMax;
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, info->optFlags);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, info->optFlags);
bool rangeCheck = (!(info->optFlags & MIR_IGNORE_RANGE_CHECK));
LIR* launchPad = NULL;
int regOff = INVALID_REG;
int regPtr = INVALID_REG;
if (cUnit->instructionSet != kX86) {
- regOff = oatAllocTemp(cUnit);
- regPtr = oatAllocTemp(cUnit);
+ regOff = AllocTemp(cUnit);
+ regPtr = AllocTemp(cUnit);
if (rangeCheck) {
- regMax = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rlObj.lowReg, countOffset, regMax);
+ regMax = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rlObj.lowReg, countOffset, regMax);
}
- loadWordDisp(cUnit, rlObj.lowReg, offsetOffset, regOff);
- loadWordDisp(cUnit, rlObj.lowReg, valueOffset, regPtr);
+ LoadWordDisp(cUnit, rlObj.lowReg, offsetOffset, regOff);
+ LoadWordDisp(cUnit, rlObj.lowReg, valueOffset, regPtr);
if (rangeCheck) {
// Set up a launch pad to allow retry in case of bounds violation */
- launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
- oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
+ launchPad = RawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
+ InsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
reinterpret_cast<uintptr_t>(launchPad));
- opRegReg(cUnit, kOpCmp, rlIdx.lowReg, regMax);
- oatFreeTemp(cUnit, regMax);
- opCondBranch(cUnit, kCondCs, launchPad);
+ OpRegReg(cUnit, kOpCmp, rlIdx.lowReg, regMax);
+ FreeTemp(cUnit, regMax);
+ OpCondBranch(cUnit, kCondCs, launchPad);
}
} else {
if (rangeCheck) {
- regMax = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rlObj.lowReg, countOffset, regMax);
+ regMax = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rlObj.lowReg, countOffset, regMax);
// Set up a launch pad to allow retry in case of bounds violation */
- launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
- oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
+ launchPad = RawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
+ InsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
reinterpret_cast<uintptr_t>(launchPad));
- opRegReg(cUnit, kOpCmp, rlIdx.lowReg, regMax);
- oatFreeTemp(cUnit, regMax);
- opCondBranch(cUnit, kCondCc, launchPad);
+ OpRegReg(cUnit, kOpCmp, rlIdx.lowReg, regMax);
+ FreeTemp(cUnit, regMax);
+ OpCondBranch(cUnit, kCondCc, launchPad);
}
- regOff = oatAllocTemp(cUnit);
- regPtr = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rlObj.lowReg, offsetOffset, regOff);
- loadWordDisp(cUnit, rlObj.lowReg, valueOffset, regPtr);
+ regOff = AllocTemp(cUnit);
+ regPtr = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rlObj.lowReg, offsetOffset, regOff);
+ LoadWordDisp(cUnit, rlObj.lowReg, valueOffset, regPtr);
}
- opRegImm(cUnit, kOpAdd, regPtr, dataOffset);
- opRegReg(cUnit, kOpAdd, regOff, rlIdx.lowReg);
- oatFreeTemp(cUnit, rlObj.lowReg);
- oatFreeTemp(cUnit, rlIdx.lowReg);
- RegLocation rlDest = inlineTarget(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- loadBaseIndexed(cUnit, regPtr, regOff, rlResult.lowReg, 1, kUnsignedHalf);
- oatFreeTemp(cUnit, regOff);
- oatFreeTemp(cUnit, regPtr);
- storeValue(cUnit, rlDest, rlResult);
+ OpRegImm(cUnit, kOpAdd, regPtr, dataOffset);
+ OpRegReg(cUnit, kOpAdd, regOff, rlIdx.lowReg);
+ FreeTemp(cUnit, rlObj.lowReg);
+ FreeTemp(cUnit, rlIdx.lowReg);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ LoadBaseIndexed(cUnit, regPtr, regOff, rlResult.lowReg, 1, kUnsignedHalf);
+ FreeTemp(cUnit, regOff);
+ FreeTemp(cUnit, regPtr);
+ StoreValue(cUnit, rlDest, rlResult);
if (rangeCheck) {
launchPad->operands[2] = 0; // no resumption
}
@@ -722,7 +722,7 @@
}
// Generates an inlined String.isEmpty or String.length.
-bool genInlinedStringIsEmptyOrLength(CompilationUnit* cUnit, CallInfo* info,
+bool GenInlinedStringIsEmptyOrLength(CompilationUnit* cUnit, CallInfo* info,
bool isEmpty)
{
if (cUnit->instructionSet == kMips) {
@@ -731,48 +731,48 @@
}
// dst = src.length();
RegLocation rlObj = info->args[0];
- rlObj = loadValue(cUnit, rlObj, kCoreReg);
- RegLocation rlDest = inlineTarget(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, info->optFlags);
- loadWordDisp(cUnit, rlObj.lowReg, String::CountOffset().Int32Value(),
+ rlObj = LoadValue(cUnit, rlObj, kCoreReg);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ GenNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, info->optFlags);
+ LoadWordDisp(cUnit, rlObj.lowReg, String::CountOffset().Int32Value(),
rlResult.lowReg);
if (isEmpty) {
// dst = (dst == 0);
if (cUnit->instructionSet == kThumb2) {
- int tReg = oatAllocTemp(cUnit);
- opRegReg(cUnit, kOpNeg, tReg, rlResult.lowReg);
- opRegRegReg(cUnit, kOpAdc, rlResult.lowReg, rlResult.lowReg, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegReg(cUnit, kOpNeg, tReg, rlResult.lowReg);
+ OpRegRegReg(cUnit, kOpAdc, rlResult.lowReg, rlResult.lowReg, tReg);
} else {
DCHECK_EQ(cUnit->instructionSet, kX86);
- opRegImm(cUnit, kOpSub, rlResult.lowReg, 1);
- opRegImm(cUnit, kOpLsr, rlResult.lowReg, 31);
+ OpRegImm(cUnit, kOpSub, rlResult.lowReg, 1);
+ OpRegImm(cUnit, kOpLsr, rlResult.lowReg, 31);
}
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-bool genInlinedAbsInt(CompilationUnit *cUnit, CallInfo* info)
+bool GenInlinedAbsInt(CompilationUnit *cUnit, CallInfo* info)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
return false;
}
RegLocation rlSrc = info->args[0];
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- RegLocation rlDest = inlineTarget(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- int signReg = oatAllocTemp(cUnit);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ int signReg = AllocTemp(cUnit);
// abs(x) = y<=x>>31, (x+y)^y.
- opRegRegImm(cUnit, kOpAsr, signReg, rlSrc.lowReg, 31);
- opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, signReg);
- opRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
- storeValue(cUnit, rlDest, rlResult);
+ OpRegRegImm(cUnit, kOpAsr, signReg, rlSrc.lowReg, 31);
+ OpRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, signReg);
+ OpRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-bool genInlinedAbsLong(CompilationUnit *cUnit, CallInfo* info)
+bool GenInlinedAbsLong(CompilationUnit *cUnit, CallInfo* info)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
@@ -780,61 +780,61 @@
}
if (cUnit->instructionSet == kThumb2) {
RegLocation rlSrc = info->args[0];
- rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
- RegLocation rlDest = inlineTargetWide(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- int signReg = oatAllocTemp(cUnit);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kCoreReg);
+ RegLocation rlDest = InlineTargetWide(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ int signReg = AllocTemp(cUnit);
// abs(x) = y<=x>>31, (x+y)^y.
- opRegRegImm(cUnit, kOpAsr, signReg, rlSrc.highReg, 31);
- opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, signReg);
- opRegRegReg(cUnit, kOpAdc, rlResult.highReg, rlSrc.highReg, signReg);
- opRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
- opRegReg(cUnit, kOpXor, rlResult.highReg, signReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ OpRegRegImm(cUnit, kOpAsr, signReg, rlSrc.highReg, 31);
+ OpRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, signReg);
+ OpRegRegReg(cUnit, kOpAdc, rlResult.highReg, rlSrc.highReg, signReg);
+ OpRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
+ OpRegReg(cUnit, kOpXor, rlResult.highReg, signReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
return true;
} else {
DCHECK_EQ(cUnit->instructionSet, kX86);
// Reuse source registers to avoid running out of temps
RegLocation rlSrc = info->args[0];
- rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
- RegLocation rlDest = inlineTargetWide(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegCopyWide(cUnit, rlResult.lowReg, rlResult.highReg, rlSrc.lowReg, rlSrc.highReg);
- oatFreeTemp(cUnit, rlSrc.lowReg);
- oatFreeTemp(cUnit, rlSrc.highReg);
- int signReg = oatAllocTemp(cUnit);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kCoreReg);
+ RegLocation rlDest = InlineTargetWide(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegCopyWide(cUnit, rlResult.lowReg, rlResult.highReg, rlSrc.lowReg, rlSrc.highReg);
+ FreeTemp(cUnit, rlSrc.lowReg);
+ FreeTemp(cUnit, rlSrc.highReg);
+ int signReg = AllocTemp(cUnit);
// abs(x) = y<=x>>31, (x+y)^y.
- opRegRegImm(cUnit, kOpAsr, signReg, rlResult.highReg, 31);
- opRegReg(cUnit, kOpAdd, rlResult.lowReg, signReg);
- opRegReg(cUnit, kOpAdc, rlResult.highReg, signReg);
- opRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
- opRegReg(cUnit, kOpXor, rlResult.highReg, signReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ OpRegRegImm(cUnit, kOpAsr, signReg, rlResult.highReg, 31);
+ OpRegReg(cUnit, kOpAdd, rlResult.lowReg, signReg);
+ OpRegReg(cUnit, kOpAdc, rlResult.highReg, signReg);
+ OpRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
+ OpRegReg(cUnit, kOpXor, rlResult.highReg, signReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
return true;
}
}
-bool genInlinedFloatCvt(CompilationUnit *cUnit, CallInfo* info)
+bool GenInlinedFloatCvt(CompilationUnit *cUnit, CallInfo* info)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
return false;
}
RegLocation rlSrc = info->args[0];
- RegLocation rlDest = inlineTarget(cUnit, info);
- storeValue(cUnit, rlDest, rlSrc);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ StoreValue(cUnit, rlDest, rlSrc);
return true;
}
-bool genInlinedDoubleCvt(CompilationUnit *cUnit, CallInfo* info)
+bool GenInlinedDoubleCvt(CompilationUnit *cUnit, CallInfo* info)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
return false;
}
RegLocation rlSrc = info->args[0];
- RegLocation rlDest = inlineTargetWide(cUnit, info);
- storeValueWide(cUnit, rlDest, rlSrc);
+ RegLocation rlDest = InlineTargetWide(cUnit, info);
+ StoreValueWide(cUnit, rlDest, rlSrc);
return true;
}
@@ -842,89 +842,89 @@
* Fast string.indexOf(I) & (II). Tests for simple case of char <= 0xffff,
* otherwise bails to standard library code.
*/
-bool genInlinedIndexOf(CompilationUnit* cUnit, CallInfo* info,
+bool GenInlinedIndexOf(CompilationUnit* cUnit, CallInfo* info,
bool zeroBased)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
return false;
}
- oatClobberCalleeSave(cUnit);
- oatLockCallTemps(cUnit); // Using fixed registers
- int regPtr = targetReg(kArg0);
- int regChar = targetReg(kArg1);
- int regStart = targetReg(kArg2);
+ ClobberCalleeSave(cUnit);
+ LockCallTemps(cUnit); // Using fixed registers
+ int regPtr = TargetReg(kArg0);
+ int regChar = TargetReg(kArg1);
+ int regStart = TargetReg(kArg2);
RegLocation rlObj = info->args[0];
RegLocation rlChar = info->args[1];
RegLocation rlStart = info->args[2];
- loadValueDirectFixed(cUnit, rlObj, regPtr);
- loadValueDirectFixed(cUnit, rlChar, regChar);
+ LoadValueDirectFixed(cUnit, rlObj, regPtr);
+ LoadValueDirectFixed(cUnit, rlChar, regChar);
if (zeroBased) {
- loadConstant(cUnit, regStart, 0);
+ LoadConstant(cUnit, regStart, 0);
} else {
- loadValueDirectFixed(cUnit, rlStart, regStart);
+ LoadValueDirectFixed(cUnit, rlStart, regStart);
}
- int rTgt = (cUnit->instructionSet != kX86) ? loadHelper(cUnit, ENTRYPOINT_OFFSET(pIndexOf)) : 0;
- genNullCheck(cUnit, rlObj.sRegLow, regPtr, info->optFlags);
- LIR* launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
- oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads, reinterpret_cast<uintptr_t>(launchPad));
- opCmpImmBranch(cUnit, kCondGt, regChar, 0xFFFF, launchPad);
+ int rTgt = (cUnit->instructionSet != kX86) ? LoadHelper(cUnit, ENTRYPOINT_OFFSET(pIndexOf)) : 0;
+ GenNullCheck(cUnit, rlObj.sRegLow, regPtr, info->optFlags);
+ LIR* launchPad = RawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
+ InsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads, reinterpret_cast<uintptr_t>(launchPad));
+ OpCmpImmBranch(cUnit, kCondGt, regChar, 0xFFFF, launchPad);
// NOTE: not a safepoint
if (cUnit->instructionSet != kX86) {
- opReg(cUnit, kOpBlx, rTgt);
+ OpReg(cUnit, kOpBlx, rTgt);
} else {
- opThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pIndexOf));
+ OpThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pIndexOf));
}
- LIR* resumeTgt = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* resumeTgt = NewLIR0(cUnit, kPseudoTargetLabel);
launchPad->operands[2] = reinterpret_cast<uintptr_t>(resumeTgt);
// Record that we've already inlined & null checked
info->optFlags |= (MIR_INLINED | MIR_IGNORE_NULL_CHECK);
- RegLocation rlReturn = oatGetReturn(cUnit, false);
- RegLocation rlDest = inlineTarget(cUnit, info);
- storeValue(cUnit, rlDest, rlReturn);
+ RegLocation rlReturn = GetReturn(cUnit, false);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ StoreValue(cUnit, rlDest, rlReturn);
return true;
}
/* Fast string.compareTo(Ljava/lang/string;)I. */
-bool genInlinedStringCompareTo(CompilationUnit* cUnit, CallInfo* info)
+bool GenInlinedStringCompareTo(CompilationUnit* cUnit, CallInfo* info)
{
if (cUnit->instructionSet == kMips) {
// TODO - add Mips implementation
return false;
}
- oatClobberCalleeSave(cUnit);
- oatLockCallTemps(cUnit); // Using fixed registers
- int regThis = targetReg(kArg0);
- int regCmp = targetReg(kArg1);
+ ClobberCalleeSave(cUnit);
+ LockCallTemps(cUnit); // Using fixed registers
+ int regThis = TargetReg(kArg0);
+ int regCmp = TargetReg(kArg1);
RegLocation rlThis = info->args[0];
RegLocation rlCmp = info->args[1];
- loadValueDirectFixed(cUnit, rlThis, regThis);
- loadValueDirectFixed(cUnit, rlCmp, regCmp);
+ LoadValueDirectFixed(cUnit, rlThis, regThis);
+ LoadValueDirectFixed(cUnit, rlCmp, regCmp);
int rTgt = (cUnit->instructionSet != kX86) ?
- loadHelper(cUnit, ENTRYPOINT_OFFSET(pStringCompareTo)) : 0;
- genNullCheck(cUnit, rlThis.sRegLow, regThis, info->optFlags);
+ LoadHelper(cUnit, ENTRYPOINT_OFFSET(pStringCompareTo)) : 0;
+ GenNullCheck(cUnit, rlThis.sRegLow, regThis, info->optFlags);
//TUNING: check if rlCmp.sRegLow is already null checked
- LIR* launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
- oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads, reinterpret_cast<uintptr_t>(launchPad));
- opCmpImmBranch(cUnit, kCondEq, regCmp, 0, launchPad);
+ LIR* launchPad = RawLIR(cUnit, 0, kPseudoIntrinsicRetry, reinterpret_cast<uintptr_t>(info));
+ InsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads, reinterpret_cast<uintptr_t>(launchPad));
+ OpCmpImmBranch(cUnit, kCondEq, regCmp, 0, launchPad);
// NOTE: not a safepoint
if (cUnit->instructionSet != kX86) {
- opReg(cUnit, kOpBlx, rTgt);
+ OpReg(cUnit, kOpBlx, rTgt);
} else {
- opThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pStringCompareTo));
+ OpThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pStringCompareTo));
}
launchPad->operands[2] = 0; // No return possible
// Record that we've already inlined & null checked
info->optFlags |= (MIR_INLINED | MIR_IGNORE_NULL_CHECK);
- RegLocation rlReturn = oatGetReturn(cUnit, false);
- RegLocation rlDest = inlineTarget(cUnit, info);
- storeValue(cUnit, rlDest, rlReturn);
+ RegLocation rlReturn = GetReturn(cUnit, false);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ StoreValue(cUnit, rlDest, rlReturn);
return true;
}
-bool genIntrinsic(CompilationUnit* cUnit, CallInfo* info)
+bool GenIntrinsic(CompilationUnit* cUnit, CallInfo* info)
{
if (info->optFlags & MIR_INLINED) {
return false;
@@ -942,69 +942,69 @@
std::string tgtMethod(PrettyMethod(info->index, *cUnit->dex_file));
if (tgtMethod.find(" java.lang") != std::string::npos) {
if (tgtMethod == "long java.lang.Double.doubleToRawLongBits(double)") {
- return genInlinedDoubleCvt(cUnit, info);
+ return GenInlinedDoubleCvt(cUnit, info);
}
if (tgtMethod == "double java.lang.Double.longBitsToDouble(long)") {
- return genInlinedDoubleCvt(cUnit, info);
+ return GenInlinedDoubleCvt(cUnit, info);
}
if (tgtMethod == "int java.lang.Float.floatToRawIntBits(float)") {
- return genInlinedFloatCvt(cUnit, info);
+ return GenInlinedFloatCvt(cUnit, info);
}
if (tgtMethod == "float java.lang.Float.intBitsToFloat(int)") {
- return genInlinedFloatCvt(cUnit, info);
+ return GenInlinedFloatCvt(cUnit, info);
}
if (tgtMethod == "int java.lang.Math.abs(int)" ||
tgtMethod == "int java.lang.StrictMath.abs(int)") {
- return genInlinedAbsInt(cUnit, info);
+ return GenInlinedAbsInt(cUnit, info);
}
if (tgtMethod == "long java.lang.Math.abs(long)" ||
tgtMethod == "long java.lang.StrictMath.abs(long)") {
- return genInlinedAbsLong(cUnit, info);
+ return GenInlinedAbsLong(cUnit, info);
}
if (tgtMethod == "int java.lang.Math.max(int, int)" ||
tgtMethod == "int java.lang.StrictMath.max(int, int)") {
- return genInlinedMinMaxInt(cUnit, info, false /* isMin */);
+ return GenInlinedMinMaxInt(cUnit, info, false /* isMin */);
}
if (tgtMethod == "int java.lang.Math.min(int, int)" ||
tgtMethod == "int java.lang.StrictMath.min(int, int)") {
- return genInlinedMinMaxInt(cUnit, info, true /* isMin */);
+ return GenInlinedMinMaxInt(cUnit, info, true /* isMin */);
}
if (tgtMethod == "double java.lang.Math.sqrt(double)" ||
tgtMethod == "double java.lang.StrictMath.sqrt(double)") {
- return genInlinedSqrt(cUnit, info);
+ return GenInlinedSqrt(cUnit, info);
}
if (tgtMethod == "char java.lang.String.charAt(int)") {
- return genInlinedCharAt(cUnit, info);
+ return GenInlinedCharAt(cUnit, info);
}
if (tgtMethod == "int java.lang.String.compareTo(java.lang.String)") {
- return genInlinedStringCompareTo(cUnit, info);
+ return GenInlinedStringCompareTo(cUnit, info);
}
if (tgtMethod == "boolean java.lang.String.isEmpty()") {
- return genInlinedStringIsEmptyOrLength(cUnit, info, true /* isEmpty */);
+ return GenInlinedStringIsEmptyOrLength(cUnit, info, true /* isEmpty */);
}
if (tgtMethod == "int java.lang.String.indexOf(int, int)") {
- return genInlinedIndexOf(cUnit, info, false /* base 0 */);
+ return GenInlinedIndexOf(cUnit, info, false /* base 0 */);
}
if (tgtMethod == "int java.lang.String.indexOf(int)") {
- return genInlinedIndexOf(cUnit, info, true /* base 0 */);
+ return GenInlinedIndexOf(cUnit, info, true /* base 0 */);
}
if (tgtMethod == "int java.lang.String.length()") {
- return genInlinedStringIsEmptyOrLength(cUnit, info, false /* isEmpty */);
+ return GenInlinedStringIsEmptyOrLength(cUnit, info, false /* isEmpty */);
}
} else if (tgtMethod.find("boolean sun.misc.Unsafe.compareAndSwap") != std::string::npos) {
if (tgtMethod == "boolean sun.misc.Unsafe.compareAndSwapInt(java.lang.Object, long, int, int)") {
- return genInlinedCas32(cUnit, info, false);
+ return GenInlinedCas32(cUnit, info, false);
}
if (tgtMethod == "boolean sun.misc.Unsafe.compareAndSwapObject(java.lang.Object, long, java.lang.Object, java.lang.Object)") {
- return genInlinedCas32(cUnit, info, true);
+ return GenInlinedCas32(cUnit, info, true);
}
}
return false;
}
-void genInvoke(CompilationUnit* cUnit, CallInfo* info)
+void GenInvoke(CompilationUnit* cUnit, CallInfo* info)
{
- if (genIntrinsic(cUnit, info)) {
+ if (GenIntrinsic(cUnit, info)) {
return;
}
InvokeType originalType = info->type; // avoiding mutation by ComputeInvokeInfo
@@ -1012,9 +1012,9 @@
LIR* nullCk;
LIR** pNullCk = NULL;
NextCallInsn nextCallInsn;
- oatFlushAllRegs(cUnit); /* Everything to home location */
+ FlushAllRegs(cUnit); /* Everything to home location */
// Explicit register usage
- oatLockCallTemps(cUnit);
+ LockCallTemps(cUnit);
OatCompilationUnit mUnit(cUnit->class_loader, cUnit->class_linker,
*cUnit->dex_file,
@@ -1035,34 +1035,34 @@
if (fastPath) {
pNullCk = &nullCk;
}
- nextCallInsn = fastPath ? nextInterfaceCallInsn
- : nextInterfaceCallInsnWithAccessCheck;
+ nextCallInsn = fastPath ? NextInterfaceCallInsn
+ : NextInterfaceCallInsnWithAccessCheck;
skipThis = false;
} else if (info->type == kDirect) {
if (fastPath) {
pNullCk = &nullCk;
}
- nextCallInsn = fastPath ? nextSDCallInsn : nextDirectCallInsnSP;
+ nextCallInsn = fastPath ? NextSDCallInsn : NextDirectCallInsnSP;
skipThis = false;
} else if (info->type == kStatic) {
- nextCallInsn = fastPath ? nextSDCallInsn : nextStaticCallInsnSP;
+ nextCallInsn = fastPath ? NextSDCallInsn : NextStaticCallInsnSP;
skipThis = false;
} else if (info->type == kSuper) {
DCHECK(!fastPath); // Fast path is a direct call.
- nextCallInsn = nextSuperCallInsnSP;
+ nextCallInsn = NextSuperCallInsnSP;
skipThis = false;
} else {
DCHECK_EQ(info->type, kVirtual);
- nextCallInsn = fastPath ? nextVCallInsn : nextVCallInsnSP;
+ nextCallInsn = fastPath ? NextVCallInsn : NextVCallInsnSP;
skipThis = fastPath;
}
if (!info->isRange) {
- callState = genDalvikArgsNoRange(cUnit, info, callState, pNullCk,
+ callState = GenDalvikArgsNoRange(cUnit, info, callState, pNullCk,
nextCallInsn, dexMethodIdx,
vtableIdx, directCode, directMethod,
originalType, skipThis);
} else {
- callState = genDalvikArgsRange(cUnit, info, callState, pNullCk,
+ callState = GenDalvikArgsRange(cUnit, info, callState, pNullCk,
nextCallInsn, dexMethodIdx, vtableIdx,
directCode, directMethod, originalType,
skipThis);
@@ -1074,14 +1074,14 @@
originalType);
}
if (cUnit->enableDebug & (1 << kDebugDisplayMissingTargets)) {
- genShowTarget(cUnit);
+ GenShowTarget(cUnit);
}
LIR* callInst;
if (cUnit->instructionSet != kX86) {
- callInst = opReg(cUnit, kOpBlx, targetReg(kInvokeTgt));
+ callInst = OpReg(cUnit, kOpBlx, TargetReg(kInvokeTgt));
} else {
if (fastPath && info->type != kInterface) {
- callInst = opMem(cUnit, kOpBlx, targetReg(kArg0),
+ callInst = OpMem(cUnit, kOpBlx, TargetReg(kArg0),
AbstractMethod::GetCodeOffset().Int32Value());
} else {
int trampoline = 0;
@@ -1105,20 +1105,20 @@
default:
LOG(FATAL) << "Unexpected invoke type";
}
- callInst = opThreadMem(cUnit, kOpBlx, trampoline);
+ callInst = OpThreadMem(cUnit, kOpBlx, trampoline);
}
}
- markSafepointPC(cUnit, callInst);
+ MarkSafepointPC(cUnit, callInst);
- oatClobberCalleeSave(cUnit);
+ ClobberCalleeSave(cUnit);
if (info->result.location != kLocInvalid) {
// We have a following MOVE_RESULT - do it now.
if (info->result.wide) {
- RegLocation retLoc = oatGetReturnWide(cUnit, info->result.fp);
- storeValueWide(cUnit, info->result, retLoc);
+ RegLocation retLoc = GetReturnWide(cUnit, info->result.fp);
+ StoreValueWide(cUnit, info->result, retLoc);
} else {
- RegLocation retLoc = oatGetReturn(cUnit, info->result.fp);
- storeValue(cUnit, info->result, retLoc);
+ RegLocation retLoc = GetReturn(cUnit, info->result.fp);
+ StoreValue(cUnit, info->result, retLoc);
}
}
}
@@ -1129,22 +1129,22 @@
* high-word loc for wide arguments. Also pull up any following
* MOVE_RESULT and incorporate it into the invoke.
*/
-CallInfo* oatNewCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+CallInfo* NewMemCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
InvokeType type, bool isRange)
{
- CallInfo* info = static_cast<CallInfo*>(oatNew(cUnit, sizeof(CallInfo), true, kAllocMisc));
- MIR* moveResultMIR = oatFindMoveResult(cUnit, bb, mir);
+ CallInfo* info = static_cast<CallInfo*>(NewMem(cUnit, sizeof(CallInfo), true, kAllocMisc));
+ MIR* moveResultMIR = FindMoveResult(cUnit, bb, mir);
if (moveResultMIR == NULL) {
info->result.location = kLocInvalid;
} else {
- info->result = oatGetRawDest(cUnit, moveResultMIR);
+ info->result = GetRawDest(cUnit, moveResultMIR);
moveResultMIR->dalvikInsn.opcode = Instruction::NOP;
}
info->numArgWords = mir->ssaRep->numUses;
info->args = (info->numArgWords == 0) ? NULL : static_cast<RegLocation*>
- (oatNew(cUnit, sizeof(RegLocation) * info->numArgWords, false, kAllocMisc));
+ (NewMem(cUnit, sizeof(RegLocation) * info->numArgWords, false, kAllocMisc));
for (int i = 0; i < info->numArgWords; i++) {
- info->args[i] = oatGetRawSrc(cUnit, mir, i);
+ info->args[i] = GetRawSrc(cUnit, mir, i);
}
info->optFlags = mir->optimizationFlags;
info->type = type;
diff --git a/src/compiler/codegen/gen_invoke.h b/src/compiler/codegen/gen_invoke.h
index ffff0b8..a20746d 100644
--- a/src/compiler/codegen/gen_invoke.h
+++ b/src/compiler/codegen/gen_invoke.h
@@ -21,21 +21,21 @@
uint32_t methodIdx, uintptr_t directCode,
uintptr_t directMethod, InvokeType type);
-void flushIns(CompilationUnit* cUnit, RegLocation* argLocs, RegLocation rlMethod);
-int genDalvikArgsNoRange(CompilationUnit* cUnit, CallInfo* info, int callState, LIR** pcrLabel, NextCallInsn nextCallInsn, uint32_t dexIdx, uint32_t methodIdx, uintptr_t directCode, uintptr_t directMethod, InvokeType type, bool skipThis);
-int genDalvikArgsRange(CompilationUnit* cUnit, CallInfo* info, int callState, LIR** pcrLabel, NextCallInsn nextCallInsn, uint32_t dexIdx, uint32_t methodIdx, uintptr_t directCode, uintptr_t directMethod, InvokeType type, bool skipThis);
-RegLocation inlineTarget(CompilationUnit* cUnit, CallInfo* info);
-RegLocation inlineTargetWide(CompilationUnit* cUnit, CallInfo* info);
-bool genInlinedCharAt(CompilationUnit* cUnit, CallInfo* info);
-bool genInlinedStringIsEmptyOrLength(CompilationUnit* cUnit, CallInfo* info, bool isEmpty);
-bool genInlinedAbsInt(CompilationUnit *cUnit, CallInfo* info);
-bool genInlinedAbsLong(CompilationUnit *cUnit, CallInfo* info);
-bool genInlinedFloatCvt(CompilationUnit *cUnit, CallInfo* info);
-bool genInlinedDoubleCvt(CompilationUnit *cUnit, CallInfo* info);
-bool genInlinedIndexOf(CompilationUnit* cUnit, CallInfo* info, bool zeroBased);
-bool genInlinedStringCompareTo(CompilationUnit* cUnit, CallInfo* info);
-bool genIntrinsic(CompilationUnit* cUnit, CallInfo* info);
-void genInvoke(CompilationUnit* cUnit, CallInfo* info);
-CallInfo* oatNewCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, InvokeType type, bool isRange);
+void FlushIns(CompilationUnit* cUnit, RegLocation* ArgLocs, RegLocation rlMethod);
+int GenDalvikArgsNoRange(CompilationUnit* cUnit, CallInfo* info, int callState, LIR** pcrLabel, NextCallInsn nextCallInsn, uint32_t dexIdx, uint32_t methodIdx, uintptr_t directCode, uintptr_t directMethod, InvokeType type, bool skipThis);
+int GenDalvikArgsRange(CompilationUnit* cUnit, CallInfo* info, int callState, LIR** pcrLabel, NextCallInsn nextCallInsn, uint32_t dexIdx, uint32_t methodIdx, uintptr_t directCode, uintptr_t directMethod, InvokeType type, bool skipThis);
+RegLocation InlineTarget(CompilationUnit* cUnit, CallInfo* info);
+RegLocation InlineTargetWide(CompilationUnit* cUnit, CallInfo* info);
+bool GenInlinedCharAt(CompilationUnit* cUnit, CallInfo* info);
+bool GenInlinedStringIsEmptyOrLength(CompilationUnit* cUnit, CallInfo* info, bool isEmpty);
+bool GenInlinedAbsInt(CompilationUnit *cUnit, CallInfo* info);
+bool GenInlinedAbsLong(CompilationUnit *cUnit, CallInfo* info);
+bool GenInlinedFloatCvt(CompilationUnit *cUnit, CallInfo* info);
+bool GenInlinedDoubleCvt(CompilationUnit *cUnit, CallInfo* info);
+bool GenInlinedIndexOf(CompilationUnit* cUnit, CallInfo* info, bool zeroBased);
+bool GenInlinedStringCompareTo(CompilationUnit* cUnit, CallInfo* info);
+bool GenIntrinsic(CompilationUnit* cUnit, CallInfo* info);
+void GenInvoke(CompilationUnit* cUnit, CallInfo* info);
+CallInfo* NewMemCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, InvokeType type, bool isRange);
#endif // ART_SRC_COMPILER_CODEGEN_GENINVOKE_H_
diff --git a/src/compiler/codegen/gen_loadstore.cc b/src/compiler/codegen/gen_loadstore.cc
index 996b5b7..8c3f059 100644
--- a/src/compiler/codegen/gen_loadstore.cc
+++ b/src/compiler/codegen/gen_loadstore.cc
@@ -26,27 +26,27 @@
* Load an immediate value into a fixed or temp register. Target
* register is clobbered, and marked inUse.
*/
-LIR* loadConstant(CompilationUnit* cUnit, int rDest, int value)
+LIR* LoadConstant(CompilationUnit* cUnit, int rDest, int value)
{
- if (oatIsTemp(cUnit, rDest)) {
- oatClobber(cUnit, rDest);
- oatMarkInUse(cUnit, rDest);
+ if (IsTemp(cUnit, rDest)) {
+ Clobber(cUnit, rDest);
+ MarkInUse(cUnit, rDest);
}
- return loadConstantNoClobber(cUnit, rDest, value);
+ return LoadConstantNoClobber(cUnit, rDest, value);
}
/* Load a word at base + displacement. Displacement must be word multiple */
-LIR* loadWordDisp(CompilationUnit* cUnit, int rBase, int displacement,
+LIR* LoadWordDisp(CompilationUnit* cUnit, int rBase, int displacement,
int rDest)
{
- return loadBaseDisp(cUnit, rBase, displacement, rDest, kWord,
+ return LoadBaseDisp(cUnit, rBase, displacement, rDest, kWord,
INVALID_SREG);
}
-LIR* storeWordDisp(CompilationUnit* cUnit, int rBase, int displacement,
+LIR* StoreWordDisp(CompilationUnit* cUnit, int rBase, int displacement,
int rSrc)
{
- return storeBaseDisp(cUnit, rBase, displacement, rSrc, kWord);
+ return StoreBaseDisp(cUnit, rBase, displacement, rSrc, kWord);
}
/*
@@ -54,28 +54,28 @@
* using this routine, as it doesn't perform any bookkeeping regarding
* register liveness. That is the responsibility of the caller.
*/
-void loadValueDirect(CompilationUnit* cUnit, RegLocation rlSrc, int rDest)
+void LoadValueDirect(CompilationUnit* cUnit, RegLocation rlSrc, int rDest)
{
- rlSrc = oatUpdateLoc(cUnit, rlSrc);
+ rlSrc = UpdateLoc(cUnit, rlSrc);
if (rlSrc.location == kLocPhysReg) {
- opRegCopy(cUnit, rDest, rlSrc.lowReg);
+ OpRegCopy(cUnit, rDest, rlSrc.lowReg);
} else {
DCHECK((rlSrc.location == kLocDalvikFrame) ||
(rlSrc.location == kLocCompilerTemp));
- loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, rlSrc.sRegLow), rDest);
+ LoadWordDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, rlSrc.sRegLow), rDest);
}
}
/*
- * Similar to loadValueDirect, but clobbers and allocates the target
+ * Similar to LoadValueDirect, but clobbers and allocates the target
* register. Should be used when loading to a fixed register (for example,
* loading arguments to an out of line call.
*/
-void loadValueDirectFixed(CompilationUnit* cUnit, RegLocation rlSrc, int rDest)
+void LoadValueDirectFixed(CompilationUnit* cUnit, RegLocation rlSrc, int rDest)
{
- oatClobber(cUnit, rDest);
- oatMarkInUse(cUnit, rDest);
- loadValueDirect(cUnit, rlSrc, rDest);
+ Clobber(cUnit, rDest);
+ MarkInUse(cUnit, rDest);
+ LoadValueDirect(cUnit, rlSrc, rDest);
}
/*
@@ -83,56 +83,56 @@
* using this routine, as it doesn't perform any bookkeeping regarding
* register liveness. That is the responsibility of the caller.
*/
-void loadValueDirectWide(CompilationUnit* cUnit, RegLocation rlSrc, int regLo,
+void LoadValueDirectWide(CompilationUnit* cUnit, RegLocation rlSrc, int regLo,
int regHi)
{
- rlSrc = oatUpdateLocWide(cUnit, rlSrc);
+ rlSrc = UpdateLocWide(cUnit, rlSrc);
if (rlSrc.location == kLocPhysReg) {
- opRegCopyWide(cUnit, regLo, regHi, rlSrc.lowReg, rlSrc.highReg);
+ OpRegCopyWide(cUnit, regLo, regHi, rlSrc.lowReg, rlSrc.highReg);
} else {
DCHECK((rlSrc.location == kLocDalvikFrame) ||
(rlSrc.location == kLocCompilerTemp));
- loadBaseDispWide(cUnit, targetReg(kSp), oatSRegOffset(cUnit, rlSrc.sRegLow),
+ LoadBaseDispWide(cUnit, TargetReg(kSp), SRegOffset(cUnit, rlSrc.sRegLow),
regLo, regHi, INVALID_SREG);
}
}
/*
- * Similar to loadValueDirect, but clobbers and allocates the target
+ * Similar to LoadValueDirect, but clobbers and allocates the target
* registers. Should be used when loading to a fixed registers (for example,
* loading arguments to an out of line call.
*/
-void loadValueDirectWideFixed(CompilationUnit* cUnit, RegLocation rlSrc,
+void LoadValueDirectWideFixed(CompilationUnit* cUnit, RegLocation rlSrc,
int regLo, int regHi)
{
- oatClobber(cUnit, regLo);
- oatClobber(cUnit, regHi);
- oatMarkInUse(cUnit, regLo);
- oatMarkInUse(cUnit, regHi);
- loadValueDirectWide(cUnit, rlSrc, regLo, regHi);
+ Clobber(cUnit, regLo);
+ Clobber(cUnit, regHi);
+ MarkInUse(cUnit, regLo);
+ MarkInUse(cUnit, regHi);
+ LoadValueDirectWide(cUnit, rlSrc, regLo, regHi);
}
-RegLocation loadValue(CompilationUnit* cUnit, RegLocation rlSrc,
+RegLocation LoadValue(CompilationUnit* cUnit, RegLocation rlSrc,
RegisterClass opKind)
{
- rlSrc = oatEvalLoc(cUnit, rlSrc, opKind, false);
+ rlSrc = EvalLoc(cUnit, rlSrc, opKind, false);
if (rlSrc.location != kLocPhysReg) {
DCHECK((rlSrc.location == kLocDalvikFrame) ||
(rlSrc.location == kLocCompilerTemp));
- loadValueDirect(cUnit, rlSrc, rlSrc.lowReg);
+ LoadValueDirect(cUnit, rlSrc, rlSrc.lowReg);
rlSrc.location = kLocPhysReg;
- oatMarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
+ MarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
}
return rlSrc;
}
-void storeValue(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
+void StoreValue(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
#ifndef NDEBUG
/*
* Sanity checking - should never try to store to the same
* ssa name during the compilation of a single instruction
- * without an intervening oatClobberSReg().
+ * without an intervening ClobberSReg().
*/
DCHECK((cUnit->liveSReg == INVALID_SREG) ||
(rlDest.sRegLow != cUnit->liveSReg));
@@ -142,68 +142,68 @@
LIR* defEnd;
DCHECK(!rlDest.wide);
DCHECK(!rlSrc.wide);
- rlSrc = oatUpdateLoc(cUnit, rlSrc);
- rlDest = oatUpdateLoc(cUnit, rlDest);
+ rlSrc = UpdateLoc(cUnit, rlSrc);
+ rlDest = UpdateLoc(cUnit, rlDest);
if (rlSrc.location == kLocPhysReg) {
- if (oatIsLive(cUnit, rlSrc.lowReg) ||
- oatIsPromoted(cUnit, rlSrc.lowReg) ||
+ if (IsLive(cUnit, rlSrc.lowReg) ||
+ IsPromoted(cUnit, rlSrc.lowReg) ||
(rlDest.location == kLocPhysReg)) {
// Src is live/promoted or Dest has assigned reg.
- rlDest = oatEvalLoc(cUnit, rlDest, kAnyReg, false);
- opRegCopy(cUnit, rlDest.lowReg, rlSrc.lowReg);
+ rlDest = EvalLoc(cUnit, rlDest, kAnyReg, false);
+ OpRegCopy(cUnit, rlDest.lowReg, rlSrc.lowReg);
} else {
// Just re-assign the registers. Dest gets Src's regs
rlDest.lowReg = rlSrc.lowReg;
- oatClobber(cUnit, rlSrc.lowReg);
+ Clobber(cUnit, rlSrc.lowReg);
}
} else {
// Load Src either into promoted Dest or temps allocated for Dest
- rlDest = oatEvalLoc(cUnit, rlDest, kAnyReg, false);
- loadValueDirect(cUnit, rlSrc, rlDest.lowReg);
+ rlDest = EvalLoc(cUnit, rlDest, kAnyReg, false);
+ LoadValueDirect(cUnit, rlSrc, rlDest.lowReg);
}
// Dest is now live and dirty (until/if we flush it to home location)
- oatMarkLive(cUnit, rlDest.lowReg, rlDest.sRegLow);
- oatMarkDirty(cUnit, rlDest);
+ MarkLive(cUnit, rlDest.lowReg, rlDest.sRegLow);
+ MarkDirty(cUnit, rlDest);
- oatResetDefLoc(cUnit, rlDest);
- if (oatIsDirty(cUnit, rlDest.lowReg) &&
+ ResetDefLoc(cUnit, rlDest);
+ if (IsDirty(cUnit, rlDest.lowReg) &&
oatLiveOut(cUnit, rlDest.sRegLow)) {
defStart = cUnit->lastLIRInsn;
- storeBaseDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, rlDest.sRegLow),
+ StoreBaseDisp(cUnit, TargetReg(kSp), SRegOffset(cUnit, rlDest.sRegLow),
rlDest.lowReg, kWord);
- oatMarkClean(cUnit, rlDest);
+ MarkClean(cUnit, rlDest);
defEnd = cUnit->lastLIRInsn;
- oatMarkDef(cUnit, rlDest, defStart, defEnd);
+ MarkDef(cUnit, rlDest, defStart, defEnd);
}
}
-RegLocation loadValueWide(CompilationUnit* cUnit, RegLocation rlSrc,
+RegLocation LoadValueWide(CompilationUnit* cUnit, RegLocation rlSrc,
RegisterClass opKind)
{
DCHECK(rlSrc.wide);
- rlSrc = oatEvalLoc(cUnit, rlSrc, opKind, false);
+ rlSrc = EvalLoc(cUnit, rlSrc, opKind, false);
if (rlSrc.location != kLocPhysReg) {
DCHECK((rlSrc.location == kLocDalvikFrame) ||
(rlSrc.location == kLocCompilerTemp));
- loadValueDirectWide(cUnit, rlSrc, rlSrc.lowReg, rlSrc.highReg);
+ LoadValueDirectWide(cUnit, rlSrc, rlSrc.lowReg, rlSrc.highReg);
rlSrc.location = kLocPhysReg;
- oatMarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
- oatMarkLive(cUnit, rlSrc.highReg,
+ MarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
+ MarkLive(cUnit, rlSrc.highReg,
oatSRegHi(rlSrc.sRegLow));
}
return rlSrc;
}
-void storeValueWide(CompilationUnit* cUnit, RegLocation rlDest,
+void StoreValueWide(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
#ifndef NDEBUG
/*
* Sanity checking - should never try to store to the same
* ssa name during the compilation of a single instruction
- * without an intervening oatClobberSReg().
+ * without an intervening ClobberSReg().
*/
DCHECK((cUnit->liveSReg == INVALID_SREG) ||
(rlDest.sRegLow != cUnit->liveSReg));
@@ -211,67 +211,67 @@
#endif
LIR* defStart;
LIR* defEnd;
- DCHECK_EQ(fpReg(rlSrc.lowReg), fpReg(rlSrc.highReg));
+ DCHECK_EQ(FpReg(rlSrc.lowReg), FpReg(rlSrc.highReg));
DCHECK(rlDest.wide);
DCHECK(rlSrc.wide);
if (rlSrc.location == kLocPhysReg) {
- if (oatIsLive(cUnit, rlSrc.lowReg) ||
- oatIsLive(cUnit, rlSrc.highReg) ||
- oatIsPromoted(cUnit, rlSrc.lowReg) ||
- oatIsPromoted(cUnit, rlSrc.highReg) ||
+ if (IsLive(cUnit, rlSrc.lowReg) ||
+ IsLive(cUnit, rlSrc.highReg) ||
+ IsPromoted(cUnit, rlSrc.lowReg) ||
+ IsPromoted(cUnit, rlSrc.highReg) ||
(rlDest.location == kLocPhysReg)) {
// Src is live or promoted or Dest has assigned reg.
- rlDest = oatEvalLoc(cUnit, rlDest, kAnyReg, false);
- opRegCopyWide(cUnit, rlDest.lowReg, rlDest.highReg,
+ rlDest = EvalLoc(cUnit, rlDest, kAnyReg, false);
+ OpRegCopyWide(cUnit, rlDest.lowReg, rlDest.highReg,
rlSrc.lowReg, rlSrc.highReg);
} else {
// Just re-assign the registers. Dest gets Src's regs
rlDest.lowReg = rlSrc.lowReg;
rlDest.highReg = rlSrc.highReg;
- oatClobber(cUnit, rlSrc.lowReg);
- oatClobber(cUnit, rlSrc.highReg);
+ Clobber(cUnit, rlSrc.lowReg);
+ Clobber(cUnit, rlSrc.highReg);
}
} else {
// Load Src either into promoted Dest or temps allocated for Dest
- rlDest = oatEvalLoc(cUnit, rlDest, kAnyReg, false);
- loadValueDirectWide(cUnit, rlSrc, rlDest.lowReg, rlDest.highReg);
+ rlDest = EvalLoc(cUnit, rlDest, kAnyReg, false);
+ LoadValueDirectWide(cUnit, rlSrc, rlDest.lowReg, rlDest.highReg);
}
// Dest is now live and dirty (until/if we flush it to home location)
- oatMarkLive(cUnit, rlDest.lowReg, rlDest.sRegLow);
- oatMarkLive(cUnit, rlDest.highReg, oatSRegHi(rlDest.sRegLow));
- oatMarkDirty(cUnit, rlDest);
- oatMarkPair(cUnit, rlDest.lowReg, rlDest.highReg);
+ MarkLive(cUnit, rlDest.lowReg, rlDest.sRegLow);
+ MarkLive(cUnit, rlDest.highReg, oatSRegHi(rlDest.sRegLow));
+ MarkDirty(cUnit, rlDest);
+ MarkPair(cUnit, rlDest.lowReg, rlDest.highReg);
- oatResetDefLocWide(cUnit, rlDest);
- if ((oatIsDirty(cUnit, rlDest.lowReg) ||
- oatIsDirty(cUnit, rlDest.highReg)) &&
+ ResetDefLocWide(cUnit, rlDest);
+ if ((IsDirty(cUnit, rlDest.lowReg) ||
+ IsDirty(cUnit, rlDest.highReg)) &&
(oatLiveOut(cUnit, rlDest.sRegLow) ||
oatLiveOut(cUnit, oatSRegHi(rlDest.sRegLow)))) {
defStart = cUnit->lastLIRInsn;
DCHECK_EQ((SRegToVReg(cUnit, rlDest.sRegLow)+1),
SRegToVReg(cUnit, oatSRegHi(rlDest.sRegLow)));
- storeBaseDispWide(cUnit, targetReg(kSp), oatSRegOffset(cUnit, rlDest.sRegLow),
+ StoreBaseDispWide(cUnit, TargetReg(kSp), SRegOffset(cUnit, rlDest.sRegLow),
rlDest.lowReg, rlDest.highReg);
- oatMarkClean(cUnit, rlDest);
+ MarkClean(cUnit, rlDest);
defEnd = cUnit->lastLIRInsn;
- oatMarkDefWide(cUnit, rlDest, defStart, defEnd);
+ MarkDefWide(cUnit, rlDest, defStart, defEnd);
}
}
/* Utilities to load the current Method* */
-void loadCurrMethodDirect(CompilationUnit *cUnit, int rTgt)
+void LoadCurrMethodDirect(CompilationUnit *cUnit, int rTgt)
{
- loadValueDirectFixed(cUnit, cUnit->methodLoc, rTgt);
+ LoadValueDirectFixed(cUnit, cUnit->methodLoc, rTgt);
}
-RegLocation loadCurrMethod(CompilationUnit *cUnit)
+RegLocation LoadCurrMethod(CompilationUnit *cUnit)
{
- return loadValue(cUnit, cUnit->methodLoc, kCoreReg);
+ return LoadValue(cUnit, cUnit->methodLoc, kCoreReg);
}
-bool methodStarInReg(CompilationUnit* cUnit)
+bool MethodStarInReg(CompilationUnit* cUnit)
{
return (cUnit->methodLoc.location == kLocPhysReg);
}
diff --git a/src/compiler/codegen/gen_loadstore.h b/src/compiler/codegen/gen_loadstore.h
index a06ed79..12c8011 100644
--- a/src/compiler/codegen/gen_loadstore.h
+++ b/src/compiler/codegen/gen_loadstore.h
@@ -17,19 +17,19 @@
#ifndef ART_SRC_COMPILER_CODEGEN_GENLOADSTORE_H_
#define ART_SRC_COMPILER_CODEGEN_GENLOADSTORE_H_
-LIR* loadConstant(CompilationUnit* cUnit, int rDest, int value);
-LIR* loadWordDisp(CompilationUnit* cUnit, int rBase, int displacement, int rDest);
-LIR* storeWordDisp(CompilationUnit* cUnit, int rBase, int displacement, int rSrc);
-void loadValueDirect(CompilationUnit* cUnit, RegLocation rlSrc, int rDest);
-void loadValueDirectFixed(CompilationUnit* cUnit, RegLocation rlSrc, int rDest);
-void loadValueDirectWide(CompilationUnit* cUnit, RegLocation rlSrc, int regLo, int regHi);
-void loadValueDirectWideFixed(CompilationUnit* cUnit, RegLocation rlSrc, int regLo, int regHi);
-RegLocation loadValue(CompilationUnit* cUnit, RegLocation rlSrc, RegisterClass opKind);
-void storeValue(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
-RegLocation loadValueWide(CompilationUnit* cUnit, RegLocation rlSrc, RegisterClass opKind);
-void storeValueWide(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
-void loadCurrMethodDirect(CompilationUnit *cUnit, int rTgt);
-RegLocation loadCurrMethod(CompilationUnit *cUnit);
-bool methodStarInReg(CompilationUnit* cUnit);
+LIR* LoadConstant(CompilationUnit* cUnit, int rDest, int value);
+LIR* LoadWordDisp(CompilationUnit* cUnit, int rBase, int displacement, int rDest);
+LIR* StoreWordDisp(CompilationUnit* cUnit, int rBase, int displacement, int rSrc);
+void LoadValueDirect(CompilationUnit* cUnit, RegLocation rlSrc, int rDest);
+void LoadValueDirectFixed(CompilationUnit* cUnit, RegLocation rlSrc, int rDest);
+void LoadValueDirectWide(CompilationUnit* cUnit, RegLocation rlSrc, int regLo, int regHi);
+void LoadValueDirectWideFixed(CompilationUnit* cUnit, RegLocation rlSrc, int regLo, int regHi);
+RegLocation LoadValue(CompilationUnit* cUnit, RegLocation rlSrc, RegisterClass opKind);
+void StoreValue(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
+RegLocation LoadValueWide(CompilationUnit* cUnit, RegLocation rlSrc, RegisterClass opKind);
+void StoreValueWide(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
+void LoadCurrMethodDirect(CompilationUnit *cUnit, int rTgt);
+RegLocation LoadCurrMethod(CompilationUnit *cUnit);
+bool MethodStarInReg(CompilationUnit* cUnit);
#endif // ART_SRC_COMPILER_CODEGEN_GENLOADSTORE_H_
diff --git a/src/compiler/codegen/local_optimizations.cc b/src/compiler/codegen/local_optimizations.cc
index 7956c05..d3897e7 100644
--- a/src/compiler/codegen/local_optimizations.cc
+++ b/src/compiler/codegen/local_optimizations.cc
@@ -29,7 +29,7 @@
#define LDLD_DISTANCE 4
#define LD_LATENCY 2
-inline bool isDalvikRegisterClobbered(LIR* lir1, LIR* lir2)
+inline bool IsDalvikRegisterClobbered(LIR* lir1, LIR* lir2)
{
int reg1Lo = DECODE_ALIAS_INFO_REG(lir1->aliasInfo);
int reg1Hi = reg1Lo + DECODE_ALIAS_INFO_WIDE(lir1->aliasInfo);
@@ -40,19 +40,19 @@
}
/* Convert a more expensive instruction (ie load) into a move */
-void convertMemOpIntoMove(CompilationUnit* cUnit, LIR* origLIR, int dest,
+void ConvertMemOpIntoMove(CompilationUnit* cUnit, LIR* origLIR, int dest,
int src)
{
/* Insert a move to replace the load */
LIR* moveLIR;
- moveLIR = opRegCopyNoInsert( cUnit, dest, src);
+ moveLIR = OpRegCopyNoInsert( cUnit, dest, src);
/*
* Insert the converted instruction after the original since the
* optimization is scannng in the top-down order and the new instruction
* will need to be re-checked (eg the new dest clobbers the src used in
* thisLIR).
*/
- oatInsertLIRAfter(origLIR, moveLIR);
+ InsertLIRAfter(origLIR, moveLIR);
}
/*
@@ -73,7 +73,7 @@
* 1) They are must-aliases
* 2) The memory location is not written to in between
*/
-void applyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR,
+void ApplyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR,
LIR* tailLIR)
{
LIR* thisLIR;
@@ -88,20 +88,20 @@
/* Skip non-interesting instructions */
if ((thisLIR->flags.isNop == true) ||
isPseudoOpcode(thisLIR->opcode) ||
- (getTargetInstFlags(thisLIR->opcode) & IS_BRANCH) ||
- !(getTargetInstFlags(thisLIR->opcode) & (IS_LOAD | IS_STORE))) {
+ (GetTargetInstFlags(thisLIR->opcode) & IS_BRANCH) ||
+ !(GetTargetInstFlags(thisLIR->opcode) & (IS_LOAD | IS_STORE))) {
continue;
}
int nativeRegId;
if (cUnit->instructionSet == kX86) {
// If x86, location differs depending on whether memory/reg operation.
- nativeRegId = (getTargetInstFlags(thisLIR->opcode) & IS_STORE) ? thisLIR->operands[2]
+ nativeRegId = (GetTargetInstFlags(thisLIR->opcode) & IS_STORE) ? thisLIR->operands[2]
: thisLIR->operands[0];
} else {
nativeRegId = thisLIR->operands[0];
}
- bool isThisLIRLoad = getTargetInstFlags(thisLIR->opcode) & IS_LOAD;
+ bool isThisLIRLoad = GetTargetInstFlags(thisLIR->opcode) & IS_LOAD;
LIR* checkLIR;
/* Use the mem mask to determine the rough memory location */
uint64_t thisMemMask = (thisLIR->useMask | thisLIR->defMask) & ENCODE_MEM;
@@ -123,7 +123,7 @@
* region bits since stopMask is used to check data/control
* dependencies.
*/
- stopUseRegMask = (getPCUseDefEncoding() | thisLIR->useMask) & ~ENCODE_MEM;
+ stopUseRegMask = (GetPCUseDefEncoding() | thisLIR->useMask) & ~ENCODE_MEM;
}
for (checkLIR = NEXT_LIR(thisLIR);
@@ -144,22 +144,22 @@
* Potential aliases seen - check the alias relations
*/
if (checkMemMask != ENCODE_MEM && aliasCondition != 0) {
- bool isCheckLIRLoad = getTargetInstFlags(checkLIR->opcode) & IS_LOAD;
+ bool isCheckLIRLoad = GetTargetInstFlags(checkLIR->opcode) & IS_LOAD;
if (aliasCondition == ENCODE_LITERAL) {
/*
* Should only see literal loads in the instruction
* stream.
*/
- DCHECK(!(getTargetInstFlags(checkLIR->opcode) & IS_STORE));
+ DCHECK(!(GetTargetInstFlags(checkLIR->opcode) & IS_STORE));
/* Same value && same register type */
if (checkLIR->aliasInfo == thisLIR->aliasInfo &&
- sameRegType(checkLIR->operands[0], nativeRegId)) {
+ SameRegType(checkLIR->operands[0], nativeRegId)) {
/*
* Different destination register - insert
* a move
*/
if (checkLIR->operands[0] != nativeRegId) {
- convertMemOpIntoMove(cUnit, checkLIR, checkLIR->operands[0],
+ ConvertMemOpIntoMove(cUnit, checkLIR, checkLIR->operands[0],
nativeRegId);
}
checkLIR->flags.isNop = true;
@@ -168,7 +168,7 @@
/* Must alias */
if (checkLIR->aliasInfo == thisLIR->aliasInfo) {
/* Only optimize compatible registers */
- bool regCompatible = sameRegType(checkLIR->operands[0], nativeRegId);
+ bool regCompatible = SameRegType(checkLIR->operands[0], nativeRegId);
if ((isThisLIRLoad && isCheckLIRLoad) ||
(!isThisLIRLoad && isCheckLIRLoad)) {
/* RAR or RAW */
@@ -179,7 +179,7 @@
*/
if (checkLIR->operands[0] !=
nativeRegId) {
- convertMemOpIntoMove(cUnit, checkLIR, checkLIR->operands[0],
+ ConvertMemOpIntoMove(cUnit, checkLIR, checkLIR->operands[0],
nativeRegId);
}
checkLIR->flags.isNop = true;
@@ -200,7 +200,7 @@
stopHere = true;
}
/* Partial overlap */
- } else if (isDalvikRegisterClobbered(thisLIR, checkLIR)) {
+ } else if (IsDalvikRegisterClobbered(thisLIR, checkLIR)) {
/*
* It is actually ok to continue if checkLIR
* is a read. But it is hard to make a test
@@ -233,7 +233,7 @@
if (cUnit->instructionSet == kX86) {
// Prevent stores from being sunk between ops that generate ccodes and
// ops that use them.
- uint64_t flags = getTargetInstFlags(checkLIR->opcode);
+ uint64_t flags = GetTargetInstFlags(checkLIR->opcode);
if (sinkDistance > 0 && (flags & IS_BRANCH) && (flags & USES_CCODES)) {
checkLIR = PREV_LIR(checkLIR);
sinkDistance--;
@@ -242,14 +242,14 @@
DEBUG_OPT(dumpDependentInsnPair(thisLIR, checkLIR, "REG CLOBBERED"));
/* Only sink store instructions */
if (sinkDistance && !isThisLIRLoad) {
- LIR* newStoreLIR = static_cast<LIR*>(oatNew(cUnit, sizeof(LIR), true, kAllocLIR));
+ LIR* newStoreLIR = static_cast<LIR*>(NewMem(cUnit, sizeof(LIR), true, kAllocLIR));
*newStoreLIR = *thisLIR;
/*
* Stop point found - insert *before* the checkLIR
* since the instruction list is scanned in the
* top-down order.
*/
- oatInsertLIRBefore(checkLIR, newStoreLIR);
+ InsertLIRBefore(checkLIR, newStoreLIR);
thisLIR->flags.isNop = true;
}
break;
@@ -264,7 +264,7 @@
* Perform a pass of bottom-up walk, from the second instruction in the
* superblock, to try to hoist loads to earlier slots.
*/
-void applyLoadHoisting(CompilationUnit* cUnit, LIR* headLIR, LIR* tailLIR)
+void ApplyLoadHoisting(CompilationUnit* cUnit, LIR* headLIR, LIR* tailLIR)
{
LIR* thisLIR, *checkLIR;
/*
@@ -284,7 +284,7 @@
/* Skip non-interesting instructions */
if ((thisLIR->flags.isNop == true) ||
isPseudoOpcode(thisLIR->opcode) ||
- !(getTargetInstFlags(thisLIR->opcode) & IS_LOAD)) {
+ !(GetTargetInstFlags(thisLIR->opcode) & IS_LOAD)) {
continue;
}
@@ -298,7 +298,7 @@
* conservatively here.
*/
if (stopUseAllMask & ENCODE_HEAP_REF) {
- stopUseAllMask |= getPCUseDefEncoding();
+ stopUseAllMask |= GetPCUseDefEncoding();
}
}
@@ -330,7 +330,7 @@
if (aliasCondition == ENCODE_DALVIK_REG) {
/* Must alias or partually overlap */
if ((checkLIR->aliasInfo == thisLIR->aliasInfo) ||
- isDalvikRegisterClobbered(thisLIR, checkLIR)) {
+ IsDalvikRegisterClobbered(thisLIR, checkLIR)) {
stopHere = true;
}
/* Conservatively treat all heap refs as may-alias */
@@ -384,7 +384,7 @@
LIR* depLIR = prevInstList[nextSlot-1];
/* If there is ld-ld dependency, wait LDLD_DISTANCE cycles */
if (!isPseudoOpcode(depLIR->opcode) &&
- (getTargetInstFlags(depLIR->opcode) & IS_LOAD)) {
+ (GetTargetInstFlags(depLIR->opcode) & IS_LOAD)) {
firstSlot -= LDLD_DISTANCE;
}
/*
@@ -401,7 +401,7 @@
* If the first instruction is a load, don't hoist anything
* above it since it is unlikely to be beneficial.
*/
- if (getTargetInstFlags(curLIR->opcode) & IS_LOAD) continue;
+ if (GetTargetInstFlags(curLIR->opcode) & IS_LOAD) continue;
/*
* If the remaining number of slots is less than LD_LATENCY,
* insert the hoisted load here.
@@ -421,7 +421,7 @@
* the remaining instructions are less than LD_LATENCY.
*/
bool prevIsLoad = isPseudoOpcode(prevLIR->opcode) ? false :
- (getTargetInstFlags(prevLIR->opcode) & IS_LOAD);
+ (GetTargetInstFlags(prevLIR->opcode) & IS_LOAD);
if (((curLIR->useMask & prevLIR->defMask) && prevIsLoad) || (slot < LD_LATENCY)) {
break;
}
@@ -430,27 +430,27 @@
/* Found a slot to hoist to */
if (slot >= 0) {
LIR* curLIR = prevInstList[slot];
- LIR* newLoadLIR = static_cast<LIR*>(oatNew(cUnit, sizeof(LIR), true, kAllocLIR));
+ LIR* newLoadLIR = static_cast<LIR*>(NewMem(cUnit, sizeof(LIR), true, kAllocLIR));
*newLoadLIR = *thisLIR;
/*
* Insertion is guaranteed to succeed since checkLIR
* is never the first LIR on the list
*/
- oatInsertLIRBefore(curLIR, newLoadLIR);
+ InsertLIRBefore(curLIR, newLoadLIR);
thisLIR->flags.isNop = true;
}
}
}
}
-void oatApplyLocalOptimizations(CompilationUnit* cUnit, LIR* headLIR,
+void ApplyLocalOptimizations(CompilationUnit* cUnit, LIR* headLIR,
LIR* tailLIR)
{
if (!(cUnit->disableOpt & (1 << kLoadStoreElimination))) {
- applyLoadStoreElimination(cUnit, headLIR, tailLIR);
+ ApplyLoadStoreElimination(cUnit, headLIR, tailLIR);
}
if (!(cUnit->disableOpt & (1 << kLoadHoisting))) {
- applyLoadHoisting(cUnit, headLIR, tailLIR);
+ ApplyLoadHoisting(cUnit, headLIR, tailLIR);
}
}
@@ -459,14 +459,14 @@
* Note: new redundant branches may be inserted later, and we'll
* use a check in final instruction assembly to nop those out.
*/
-void removeRedundantBranches(CompilationUnit* cUnit)
+void RemoveRedundantBranches(CompilationUnit* cUnit)
{
LIR* thisLIR;
for (thisLIR = cUnit->firstLIRInsn; thisLIR != cUnit->lastLIRInsn; thisLIR = NEXT_LIR(thisLIR)) {
/* Branch to the next instruction */
- if (branchUnconditional(thisLIR)) {
+ if (BranchUnconditional(thisLIR)) {
LIR* nextLIR = thisLIR;
while (true) {
diff --git a/src/compiler/codegen/local_optimizations.h b/src/compiler/codegen/local_optimizations.h
index 5f0c17b..e740b13 100644
--- a/src/compiler/codegen/local_optimizations.h
+++ b/src/compiler/codegen/local_optimizations.h
@@ -19,8 +19,8 @@
namespace art {
-void oatApplyLocalOptimizations(CompilationUnit* cUnit, LIR* headLIR, LIR* tailLIR);
-void removeRedundantBranches(CompilationUnit* cUnit);
+void ApplyLocalOptimizations(CompilationUnit* cUnit, LIR* headLIR, LIR* tailLIR);
+void RemoveRedundantBranches(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/codegen/method_bitcode.cc b/src/compiler/codegen/method_bitcode.cc
index 72e3e68..0115484 100644
--- a/src/compiler/codegen/method_bitcode.cc
+++ b/src/compiler/codegen/method_bitcode.cc
@@ -43,22 +43,22 @@
const RegLocation badLoc = {kLocDalvikFrame, 0, 0, 0, 0, 0, 0, 0, 0,
INVALID_REG, INVALID_REG, INVALID_SREG,
INVALID_SREG};
-RegLocation getLoc(CompilationUnit* cUnit, llvm::Value* val);
+RegLocation GetLoc(CompilationUnit* cUnit, llvm::Value* val);
-llvm::BasicBlock* getLLVMBlock(CompilationUnit* cUnit, int id)
+llvm::BasicBlock* GetLLVMBlock(CompilationUnit* cUnit, int id)
{
return cUnit->idToBlockMap.Get(id);
}
-llvm::Value* getLLVMValue(CompilationUnit* cUnit, int sReg)
+llvm::Value* GetLLVMValue(CompilationUnit* cUnit, int sReg)
{
- return reinterpret_cast<llvm::Value*>(oatGrowableListGetElement(&cUnit->llvmValues, sReg));
+ return reinterpret_cast<llvm::Value*>(GrowableListGetElement(&cUnit->llvmValues, sReg));
}
// Replace the placeholder value with the real definition
-void defineValue(CompilationUnit* cUnit, llvm::Value* val, int sReg)
+void DefineValue(CompilationUnit* cUnit, llvm::Value* val, int sReg)
{
- llvm::Value* placeholder = getLLVMValue(cUnit, sReg);
+ llvm::Value* placeholder = GetLLVMValue(cUnit, sReg);
if (placeholder == NULL) {
// This can happen on instruction rewrite on verification failure
LOG(WARNING) << "Null placeholder";
@@ -83,7 +83,7 @@
}
}
-llvm::Type* llvmTypeFromLocRec(CompilationUnit* cUnit, RegLocation loc)
+llvm::Type* LlvmTypeFromLocRec(CompilationUnit* cUnit, RegLocation loc)
{
llvm::Type* res = NULL;
if (loc.wide) {
@@ -105,7 +105,7 @@
}
/* Create an in-memory RegLocation from an llvm Value. */
-void createLocFromValue(CompilationUnit* cUnit, llvm::Value* val)
+void CreateLocFromValue(CompilationUnit* cUnit, llvm::Value* val)
{
// NOTE: llvm takes shortcuts with c_str() - get to std::string firstt
std::string s(val->getName().str());
@@ -135,7 +135,7 @@
if (ty == cUnit->irb->getFloatTy()) {
loc.fp = true;
if (pMap.fpLocation == kLocPhysReg) {
- loc.lowReg = pMap.fpReg;
+ loc.lowReg = pMap.FpReg;
loc.location = kLocPhysReg;
loc.home = true;
}
@@ -144,10 +144,10 @@
PromotionMap pMapHigh = cUnit->promotionMap[baseSReg + 1];
if ((pMap.fpLocation == kLocPhysReg) &&
(pMapHigh.fpLocation == kLocPhysReg) &&
- ((pMap.fpReg & 0x1) == 0) &&
- (pMap.fpReg + 1 == pMapHigh.fpReg)) {
- loc.lowReg = pMap.fpReg;
- loc.highReg = pMapHigh.fpReg;
+ ((pMap.FpReg & 0x1) == 0) &&
+ (pMap.FpReg + 1 == pMapHigh.FpReg)) {
+ loc.lowReg = pMap.FpReg;
+ loc.highReg = pMapHigh.FpReg;
loc.location = kLocPhysReg;
loc.home = true;
}
@@ -186,7 +186,7 @@
}
cUnit->locMap.Put(val, loc);
}
-void initIR(CompilationUnit* cUnit)
+void InitIR(CompilationUnit* cUnit)
{
LLVMInfo* llvmInfo = cUnit->llvm_info;
if (llvmInfo == NULL) {
@@ -204,33 +204,33 @@
cUnit->irb = llvmInfo->GetIRBuilder();
}
-const char* llvmSSAName(CompilationUnit* cUnit, int ssaReg) {
+const char* LlvmSSAName(CompilationUnit* cUnit, int ssaReg) {
return GET_ELEM_N(cUnit->ssaStrings, char*, ssaReg);
}
-llvm::BasicBlock* findCaseTarget(CompilationUnit* cUnit, uint32_t vaddr)
+llvm::BasicBlock* FindCaseTarget(CompilationUnit* cUnit, uint32_t vaddr)
{
- BasicBlock* bb = oatFindBlock(cUnit, vaddr);
+ BasicBlock* bb = FindBlock(cUnit, vaddr);
DCHECK(bb != NULL);
- return getLLVMBlock(cUnit, bb->id);
+ return GetLLVMBlock(cUnit, bb->id);
}
-void convertPackedSwitch(CompilationUnit* cUnit, BasicBlock* bb,
+void ConvertPackedSwitch(CompilationUnit* cUnit, BasicBlock* bb,
int32_t tableOffset, RegLocation rlSrc)
{
const Instruction::PackedSwitchPayload* payload =
reinterpret_cast<const Instruction::PackedSwitchPayload*>(
cUnit->insns + cUnit->currentDalvikOffset + tableOffset);
- llvm::Value* value = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* value = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::SwitchInst* sw =
- cUnit->irb->CreateSwitch(value, getLLVMBlock(cUnit, bb->fallThrough->id),
+ cUnit->irb->CreateSwitch(value, GetLLVMBlock(cUnit, bb->fallThrough->id),
payload->case_count);
for (uint16_t i = 0; i < payload->case_count; ++i) {
llvm::BasicBlock* llvmBB =
- findCaseTarget(cUnit, cUnit->currentDalvikOffset + payload->targets[i]);
+ FindCaseTarget(cUnit, cUnit->currentDalvikOffset + payload->targets[i]);
sw->addCase(cUnit->irb->getInt32(payload->first_key + i), llvmBB);
}
llvm::MDNode* switchNode =
@@ -240,7 +240,7 @@
bb->fallThrough = NULL;
}
-void convertSparseSwitch(CompilationUnit* cUnit, BasicBlock* bb,
+void ConvertSparseSwitch(CompilationUnit* cUnit, BasicBlock* bb,
int32_t tableOffset, RegLocation rlSrc)
{
const Instruction::SparseSwitchPayload* payload =
@@ -250,15 +250,15 @@
const int32_t* keys = payload->GetKeys();
const int32_t* targets = payload->GetTargets();
- llvm::Value* value = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* value = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::SwitchInst* sw =
- cUnit->irb->CreateSwitch(value, getLLVMBlock(cUnit, bb->fallThrough->id),
+ cUnit->irb->CreateSwitch(value, GetLLVMBlock(cUnit, bb->fallThrough->id),
payload->case_count);
for (size_t i = 0; i < payload->case_count; ++i) {
llvm::BasicBlock* llvmBB =
- findCaseTarget(cUnit, cUnit->currentDalvikOffset + targets[i]);
+ FindCaseTarget(cUnit, cUnit->currentDalvikOffset + targets[i]);
sw->addCase(cUnit->irb->getInt32(keys[i]), llvmBB);
}
llvm::MDNode* switchNode =
@@ -268,40 +268,40 @@
bb->fallThrough = NULL;
}
-void convertSget(CompilationUnit* cUnit, int32_t fieldIndex,
+void ConvertSget(CompilationUnit* cUnit, int32_t fieldIndex,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest)
{
llvm::Constant* fieldIdx = cUnit->irb->getInt32(fieldIndex);
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* res = cUnit->irb->CreateCall(intr, fieldIdx);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertSput(CompilationUnit* cUnit, int32_t fieldIndex,
+void ConvertSput(CompilationUnit* cUnit, int32_t fieldIndex,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlSrc)
{
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(fieldIndex));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
cUnit->irb->CreateCall(intr, args);
}
-void convertFillArrayData(CompilationUnit* cUnit, int32_t offset,
+void ConvertFillArrayData(CompilationUnit* cUnit, int32_t offset,
RegLocation rlArray)
{
greenland::IntrinsicHelper::IntrinsicId id;
id = greenland::IntrinsicHelper::HLFillArrayData;
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(offset));
- args.push_back(getLLVMValue(cUnit, rlArray.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlArray.origSReg));
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
cUnit->irb->CreateCall(intr, args);
}
-llvm::Value* emitConst(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
+llvm::Value* EmitConst(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
RegLocation loc)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -324,14 +324,14 @@
return cUnit->irb->CreateCall(intr, src);
}
-void emitPopShadowFrame(CompilationUnit* cUnit)
+void EmitPopShadowFrame(CompilationUnit* cUnit)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(
greenland::IntrinsicHelper::PopShadowFrame);
cUnit->irb->CreateCall(intr);
}
-llvm::Value* emitCopy(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
+llvm::Value* EmitCopy(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
RegLocation loc)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -354,46 +354,46 @@
return cUnit->irb->CreateCall(intr, src);
}
-void convertMoveException(CompilationUnit* cUnit, RegLocation rlDest)
+void ConvertMoveException(CompilationUnit* cUnit, RegLocation rlDest)
{
llvm::Function* func = cUnit->intrinsic_helper->GetIntrinsicFunction(
greenland::IntrinsicHelper::GetException);
llvm::Value* res = cUnit->irb->CreateCall(func);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertThrow(CompilationUnit* cUnit, RegLocation rlSrc)
+void ConvertThrow(CompilationUnit* cUnit, RegLocation rlSrc)
{
- llvm::Value* src = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Function* func = cUnit->intrinsic_helper->GetIntrinsicFunction(
greenland::IntrinsicHelper::HLThrowException);
cUnit->irb->CreateCall(func, src);
}
-void convertMonitorEnterExit(CompilationUnit* cUnit, int optFlags,
+void ConvertMonitorEnterExit(CompilationUnit* cUnit, int optFlags,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlSrc)
{
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(optFlags));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
llvm::Function* func = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
cUnit->irb->CreateCall(func, args);
}
-void convertArrayLength(CompilationUnit* cUnit, int optFlags,
+void ConvertArrayLength(CompilationUnit* cUnit, int optFlags,
RegLocation rlDest, RegLocation rlSrc)
{
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(optFlags));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
llvm::Function* func = cUnit->intrinsic_helper->GetIntrinsicFunction(
greenland::IntrinsicHelper::OptArrayLength);
llvm::Value* res = cUnit->irb->CreateCall(func, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void emitSuspendCheck(CompilationUnit* cUnit)
+void EmitSuspendCheck(CompilationUnit* cUnit)
{
greenland::IntrinsicHelper::IntrinsicId id =
greenland::IntrinsicHelper::CheckSuspend;
@@ -401,7 +401,7 @@
cUnit->irb->CreateCall(intr);
}
-llvm::Value* convertCompare(CompilationUnit* cUnit, ConditionCode cc,
+llvm::Value* ConvertCompare(CompilationUnit* cUnit, ConditionCode cc,
llvm::Value* src1, llvm::Value* src2)
{
llvm::Value* res = NULL;
@@ -418,44 +418,44 @@
return res;
}
-void convertCompareAndBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void ConvertCompareAndBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
ConditionCode cc, RegLocation rlSrc1,
RegLocation rlSrc2)
{
if (bb->taken->startOffset <= mir->offset) {
- emitSuspendCheck(cUnit);
+ EmitSuspendCheck(cUnit);
}
- llvm::Value* src1 = getLLVMValue(cUnit, rlSrc1.origSReg);
- llvm::Value* src2 = getLLVMValue(cUnit, rlSrc2.origSReg);
- llvm::Value* condValue = convertCompare(cUnit, cc, src1, src2);
+ llvm::Value* src1 = GetLLVMValue(cUnit, rlSrc1.origSReg);
+ llvm::Value* src2 = GetLLVMValue(cUnit, rlSrc2.origSReg);
+ llvm::Value* condValue = ConvertCompare(cUnit, cc, src1, src2);
condValue->setName(StringPrintf("t%d", cUnit->tempName++));
- cUnit->irb->CreateCondBr(condValue, getLLVMBlock(cUnit, bb->taken->id),
- getLLVMBlock(cUnit, bb->fallThrough->id));
+ cUnit->irb->CreateCondBr(condValue, GetLLVMBlock(cUnit, bb->taken->id),
+ GetLLVMBlock(cUnit, bb->fallThrough->id));
// Don't redo the fallthrough branch in the BB driver
bb->fallThrough = NULL;
}
-void convertCompareZeroAndBranch(CompilationUnit* cUnit, BasicBlock* bb,
+void ConvertCompareZeroAndBranch(CompilationUnit* cUnit, BasicBlock* bb,
MIR* mir, ConditionCode cc, RegLocation rlSrc1)
{
if (bb->taken->startOffset <= mir->offset) {
- emitSuspendCheck(cUnit);
+ EmitSuspendCheck(cUnit);
}
- llvm::Value* src1 = getLLVMValue(cUnit, rlSrc1.origSReg);
+ llvm::Value* src1 = GetLLVMValue(cUnit, rlSrc1.origSReg);
llvm::Value* src2;
if (rlSrc1.ref) {
src2 = cUnit->irb->GetJNull();
} else {
src2 = cUnit->irb->getInt32(0);
}
- llvm::Value* condValue = convertCompare(cUnit, cc, src1, src2);
- cUnit->irb->CreateCondBr(condValue, getLLVMBlock(cUnit, bb->taken->id),
- getLLVMBlock(cUnit, bb->fallThrough->id));
+ llvm::Value* condValue = ConvertCompare(cUnit, cc, src1, src2);
+ cUnit->irb->CreateCondBr(condValue, GetLLVMBlock(cUnit, bb->taken->id),
+ GetLLVMBlock(cUnit, bb->fallThrough->id));
// Don't redo the fallthrough branch in the BB driver
bb->fallThrough = NULL;
}
-llvm::Value* genDivModOp(CompilationUnit* cUnit, bool isDiv, bool isLong,
+llvm::Value* GenDivModOp(CompilationUnit* cUnit, bool isDiv, bool isLong,
llvm::Value* src1, llvm::Value* src2)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -479,7 +479,7 @@
return cUnit->irb->CreateCall(intr, args);
}
-llvm::Value* genArithOp(CompilationUnit* cUnit, OpKind op, bool isLong,
+llvm::Value* GenArithOp(CompilationUnit* cUnit, OpKind op, bool isLong,
llvm::Value* src1, llvm::Value* src2)
{
llvm::Value* res = NULL;
@@ -491,8 +491,8 @@
case kOpOr: res = cUnit->irb->CreateOr(src1, src2); break;
case kOpAnd: res = cUnit->irb->CreateAnd(src1, src2); break;
case kOpXor: res = cUnit->irb->CreateXor(src1, src2); break;
- case kOpDiv: res = genDivModOp(cUnit, true, isLong, src1, src2); break;
- case kOpRem: res = genDivModOp(cUnit, false, isLong, src1, src2); break;
+ case kOpDiv: res = GenDivModOp(cUnit, true, isLong, src1, src2); break;
+ case kOpRem: res = GenDivModOp(cUnit, false, isLong, src1, src2); break;
case kOpLsl: res = cUnit->irb->CreateShl(src1, src2); break;
case kOpLsr: res = cUnit->irb->CreateLShr(src1, src2); break;
case kOpAsr: res = cUnit->irb->CreateAShr(src1, src2); break;
@@ -502,11 +502,11 @@
return res;
}
-void convertFPArithOp(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
+void ConvertFPArithOp(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- llvm::Value* src1 = getLLVMValue(cUnit, rlSrc1.origSReg);
- llvm::Value* src2 = getLLVMValue(cUnit, rlSrc2.origSReg);
+ llvm::Value* src1 = GetLLVMValue(cUnit, rlSrc1.origSReg);
+ llvm::Value* src2 = GetLLVMValue(cUnit, rlSrc2.origSReg);
llvm::Value* res = NULL;
switch(op) {
case kOpAdd: res = cUnit->irb->CreateFAdd(src1, src2); break;
@@ -517,48 +517,48 @@
default:
LOG(FATAL) << "Invalid op " << op;
}
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertShift(CompilationUnit* cUnit,
+void ConvertShift(CompilationUnit* cUnit,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::SmallVector<llvm::Value*, 2>args;
- args.push_back(getLLVMValue(cUnit, rlSrc1.origSReg));
- args.push_back(getLLVMValue(cUnit, rlSrc2.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc1.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc2.origSReg));
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertShiftLit(CompilationUnit* cUnit,
+void ConvertShiftLit(CompilationUnit* cUnit,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest, RegLocation rlSrc, int shiftAmount)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::SmallVector<llvm::Value*, 2>args;
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
args.push_back(cUnit->irb->getInt32(shiftAmount));
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertArithOp(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
+void ConvertArithOp(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- llvm::Value* src1 = getLLVMValue(cUnit, rlSrc1.origSReg);
- llvm::Value* src2 = getLLVMValue(cUnit, rlSrc2.origSReg);
+ llvm::Value* src1 = GetLLVMValue(cUnit, rlSrc1.origSReg);
+ llvm::Value* src2 = GetLLVMValue(cUnit, rlSrc2.origSReg);
DCHECK_EQ(src1->getType(), src2->getType());
- llvm::Value* res = genArithOp(cUnit, op, rlDest.wide, src1, src2);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = GenArithOp(cUnit, op, rlDest.wide, src1, src2);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void setShadowFrameEntry(CompilationUnit* cUnit, llvm::Value* newVal)
+void SetShadowFrameEntry(CompilationUnit* cUnit, llvm::Value* newVal)
{
int index = -1;
DCHECK(newVal != NULL);
- int vReg = SRegToVReg(cUnit, getLoc(cUnit, newVal).origSReg);
+ int vReg = SRegToVReg(cUnit, GetLoc(cUnit, newVal).origSReg);
for (int i = 0; i < cUnit->numShadowFrameEntries; i++) {
if (cUnit->shadowMap[i] == vReg) {
index = i;
@@ -582,13 +582,13 @@
cUnit->irb->CreateCall(func, args);
}
-void convertArithOpLit(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
+void ConvertArithOpLit(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
RegLocation rlSrc1, int32_t imm)
{
- llvm::Value* src1 = getLLVMValue(cUnit, rlSrc1.origSReg);
+ llvm::Value* src1 = GetLLVMValue(cUnit, rlSrc1.origSReg);
llvm::Value* src2 = cUnit->irb->getInt32(imm);
- llvm::Value* res = genArithOp(cUnit, op, rlDest.wide, src1, src2);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = GenArithOp(cUnit, op, rlDest.wide, src1, src2);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
/*
@@ -596,10 +596,10 @@
* collect and process arguments for NEW_FILLED_ARRAY and NEW_FILLED_ARRAY_RANGE.
* The requirements are similar.
*/
-void convertInvoke(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void ConvertInvoke(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
InvokeType invokeType, bool isRange, bool isFilledNewArray)
{
- CallInfo* info = oatNewCallInfo(cUnit, bb, mir, invokeType, isRange);
+ CallInfo* info = NewMemCallInfo(cUnit, bb, mir, invokeType, isRange);
llvm::SmallVector<llvm::Value*, 10> args;
// Insert the invokeType
args.push_back(cUnit->irb->getInt32(static_cast<int>(invokeType)));
@@ -609,7 +609,7 @@
args.push_back(cUnit->irb->getInt32(info->optFlags));
// Now, insert the actual arguments
for (int i = 0; i < info->numArgWords;) {
- llvm::Value* val = getLLVMValue(cUnit, info->args[i].origSReg);
+ llvm::Value* val = GetLLVMValue(cUnit, info->args[i].origSReg);
args.push_back(val);
i += info->args[i].wide ? 2 : 1;
}
@@ -641,25 +641,25 @@
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
if (info->result.location != kLocInvalid) {
- defineValue(cUnit, res, info->result.origSReg);
+ DefineValue(cUnit, res, info->result.origSReg);
if (info->result.ref) {
- setShadowFrameEntry(cUnit, reinterpret_cast<llvm::Value*>
+ SetShadowFrameEntry(cUnit, reinterpret_cast<llvm::Value*>
(cUnit->llvmValues.elemList[info->result.origSReg]));
}
}
}
-void convertConstObject(CompilationUnit* cUnit, uint32_t idx,
+void ConvertConstObject(CompilationUnit* cUnit, uint32_t idx,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* index = cUnit->irb->getInt32(idx);
llvm::Value* res = cUnit->irb->CreateCall(intr, index);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertCheckCast(CompilationUnit* cUnit, uint32_t type_idx,
+void ConvertCheckCast(CompilationUnit* cUnit, uint32_t type_idx,
RegLocation rlSrc)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -667,11 +667,11 @@
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(type_idx));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
cUnit->irb->CreateCall(intr, args);
}
-void convertNewInstance(CompilationUnit* cUnit, uint32_t type_idx,
+void ConvertNewInstance(CompilationUnit* cUnit, uint32_t type_idx,
RegLocation rlDest)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -679,10 +679,10 @@
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* index = cUnit->irb->getInt32(type_idx);
llvm::Value* res = cUnit->irb->CreateCall(intr, index);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertNewArray(CompilationUnit* cUnit, uint32_t type_idx,
+void ConvertNewArray(CompilationUnit* cUnit, uint32_t type_idx,
RegLocation rlDest, RegLocation rlSrc)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -690,64 +690,64 @@
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(type_idx));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertAget(CompilationUnit* cUnit, int optFlags,
+void ConvertAget(CompilationUnit* cUnit, int optFlags,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest, RegLocation rlArray, RegLocation rlIndex)
{
llvm::SmallVector<llvm::Value*, 3> args;
args.push_back(cUnit->irb->getInt32(optFlags));
- args.push_back(getLLVMValue(cUnit, rlArray.origSReg));
- args.push_back(getLLVMValue(cUnit, rlIndex.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlArray.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlIndex.origSReg));
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertAput(CompilationUnit* cUnit, int optFlags,
+void ConvertAput(CompilationUnit* cUnit, int optFlags,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlSrc, RegLocation rlArray, RegLocation rlIndex)
{
llvm::SmallVector<llvm::Value*, 4> args;
args.push_back(cUnit->irb->getInt32(optFlags));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
- args.push_back(getLLVMValue(cUnit, rlArray.origSReg));
- args.push_back(getLLVMValue(cUnit, rlIndex.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlArray.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlIndex.origSReg));
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
cUnit->irb->CreateCall(intr, args);
}
-void convertIget(CompilationUnit* cUnit, int optFlags,
+void ConvertIget(CompilationUnit* cUnit, int optFlags,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest, RegLocation rlObj, int fieldIndex)
{
llvm::SmallVector<llvm::Value*, 3> args;
args.push_back(cUnit->irb->getInt32(optFlags));
- args.push_back(getLLVMValue(cUnit, rlObj.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlObj.origSReg));
args.push_back(cUnit->irb->getInt32(fieldIndex));
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertIput(CompilationUnit* cUnit, int optFlags,
+void ConvertIput(CompilationUnit* cUnit, int optFlags,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlSrc, RegLocation rlObj, int fieldIndex)
{
llvm::SmallVector<llvm::Value*, 4> args;
args.push_back(cUnit->irb->getInt32(optFlags));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
- args.push_back(getLLVMValue(cUnit, rlObj.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlObj.origSReg));
args.push_back(cUnit->irb->getInt32(fieldIndex));
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
cUnit->irb->CreateCall(intr, args);
}
-void convertInstanceOf(CompilationUnit* cUnit, uint32_t type_idx,
+void ConvertInstanceOf(CompilationUnit* cUnit, uint32_t type_idx,
RegLocation rlDest, RegLocation rlSrc)
{
greenland::IntrinsicHelper::IntrinsicId id;
@@ -755,44 +755,44 @@
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(type_idx));
- args.push_back(getLLVMValue(cUnit, rlSrc.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc.origSReg));
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertIntToLong(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertIntToLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- llvm::Value* res = cUnit->irb->CreateSExt(getLLVMValue(cUnit, rlSrc.origSReg),
+ llvm::Value* res = cUnit->irb->CreateSExt(GetLLVMValue(cUnit, rlSrc.origSReg),
cUnit->irb->getInt64Ty());
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertLongToInt(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertLongToInt(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- llvm::Value* src = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateTrunc(src, cUnit->irb->getInt32Ty());
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertFloatToDouble(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertFloatToDouble(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- llvm::Value* src = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateFPExt(src, cUnit->irb->getDoubleTy());
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertDoubleToFloat(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertDoubleToFloat(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- llvm::Value* src = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateFPTrunc(src, cUnit->irb->getFloatTy());
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertWideComparison(CompilationUnit* cUnit,
+void ConvertWideComparison(CompilationUnit* cUnit,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest, RegLocation rlSrc1,
RegLocation rlSrc2)
@@ -801,62 +801,62 @@
DCHECK_EQ(rlSrc1.wide, rlSrc2.wide);
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::SmallVector<llvm::Value*, 2> args;
- args.push_back(getLLVMValue(cUnit, rlSrc1.origSReg));
- args.push_back(getLLVMValue(cUnit, rlSrc2.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc1.origSReg));
+ args.push_back(GetLLVMValue(cUnit, rlSrc2.origSReg));
llvm::Value* res = cUnit->irb->CreateCall(intr, args);
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertIntNarrowing(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertIntNarrowing(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc,
greenland::IntrinsicHelper::IntrinsicId id)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* res =
- cUnit->irb->CreateCall(intr, getLLVMValue(cUnit, rlSrc.origSReg));
- defineValue(cUnit, res, rlDest.origSReg);
+ cUnit->irb->CreateCall(intr, GetLLVMValue(cUnit, rlSrc.origSReg));
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertNeg(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertNeg(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- llvm::Value* res = cUnit->irb->CreateNeg(getLLVMValue(cUnit, rlSrc.origSReg));
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = cUnit->irb->CreateNeg(GetLLVMValue(cUnit, rlSrc.origSReg));
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertIntToFP(CompilationUnit* cUnit, llvm::Type* ty, RegLocation rlDest,
+void ConvertIntToFP(CompilationUnit* cUnit, llvm::Type* ty, RegLocation rlDest,
RegLocation rlSrc)
{
llvm::Value* res =
- cUnit->irb->CreateSIToFP(getLLVMValue(cUnit, rlSrc.origSReg), ty);
- defineValue(cUnit, res, rlDest.origSReg);
+ cUnit->irb->CreateSIToFP(GetLLVMValue(cUnit, rlSrc.origSReg), ty);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertFPToInt(CompilationUnit* cUnit,
+void ConvertFPToInt(CompilationUnit* cUnit,
greenland::IntrinsicHelper::IntrinsicId id,
RegLocation rlDest,
RegLocation rlSrc)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
- llvm::Value* res = cUnit->irb->CreateCall(intr, getLLVMValue(cUnit, rlSrc.origSReg));
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = cUnit->irb->CreateCall(intr, GetLLVMValue(cUnit, rlSrc.origSReg));
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertNegFP(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertNegFP(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
llvm::Value* res =
- cUnit->irb->CreateFNeg(getLLVMValue(cUnit, rlSrc.origSReg));
- defineValue(cUnit, res, rlDest.origSReg);
+ cUnit->irb->CreateFNeg(GetLLVMValue(cUnit, rlSrc.origSReg));
+ DefineValue(cUnit, res, rlDest.origSReg);
}
-void convertNot(CompilationUnit* cUnit, RegLocation rlDest,
+void ConvertNot(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- llvm::Value* src = getLLVMValue(cUnit, rlSrc.origSReg);
+ llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateXor(src, static_cast<uint64_t>(-1));
- defineValue(cUnit, res, rlDest.origSReg);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
/*
@@ -864,7 +864,7 @@
* load/store utilities here, or target-dependent genXX() handlers
* when necessary.
*/
-bool convertMIRNode(CompilationUnit* cUnit, MIR* mir, BasicBlock* bb,
+bool ConvertMIRNode(CompilationUnit* cUnit, MIR* mir, BasicBlock* bb,
llvm::BasicBlock* llvmBB, LIR* labelList)
{
bool res = false; // Assume success
@@ -893,34 +893,34 @@
rlSrc[0] = rlSrc[1] = rlSrc[2] = badLoc;
if (attrs & DF_UA) {
if (attrs & DF_A_WIDE) {
- rlSrc[nextLoc++] = oatGetSrcWide(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrcWide(cUnit, mir, nextSreg);
nextSreg+= 2;
} else {
- rlSrc[nextLoc++] = oatGetSrc(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrc(cUnit, mir, nextSreg);
nextSreg++;
}
}
if (attrs & DF_UB) {
if (attrs & DF_B_WIDE) {
- rlSrc[nextLoc++] = oatGetSrcWide(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrcWide(cUnit, mir, nextSreg);
nextSreg+= 2;
} else {
- rlSrc[nextLoc++] = oatGetSrc(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrc(cUnit, mir, nextSreg);
nextSreg++;
}
}
if (attrs & DF_UC) {
if (attrs & DF_C_WIDE) {
- rlSrc[nextLoc++] = oatGetSrcWide(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrcWide(cUnit, mir, nextSreg);
} else {
- rlSrc[nextLoc++] = oatGetSrc(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrc(cUnit, mir, nextSreg);
}
}
if (attrs & DF_DA) {
if (attrs & DF_A_WIDE) {
- rlDest = oatGetDestWide(cUnit, mir);
+ rlDest = GetDestWide(cUnit, mir);
} else {
- rlDest = oatGetDest(cUnit, mir);
+ rlDest = GetDest(cUnit, mir);
if (rlDest.ref) {
objectDefinition = true;
}
@@ -947,9 +947,9 @@
* Insert a dummy intrinsic copy call, which will be recognized
* by the quick path and removed by the portable path.
*/
- llvm::Value* src = getLLVMValue(cUnit, rlSrc[0].origSReg);
- llvm::Value* res = emitCopy(cUnit, src, rlDest);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* src = GetLLVMValue(cUnit, rlSrc[0].origSReg);
+ llvm::Value* res = EmitCopy(cUnit, src, rlDest);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
break;
@@ -960,8 +960,8 @@
objectDefinition = true;
}
llvm::Constant* immValue = cUnit->irb->GetJInt(vB);
- llvm::Value* res = emitConst(cUnit, immValue, rlDest);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = EmitConst(cUnit, immValue, rlDest);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
break;
@@ -970,96 +970,96 @@
// Sign extend to 64 bits
int64_t imm = static_cast<int32_t>(vB);
llvm::Constant* immValue = cUnit->irb->GetJLong(imm);
- llvm::Value* res = emitConst(cUnit, immValue, rlDest);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = EmitConst(cUnit, immValue, rlDest);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
break;
case Instruction::CONST_HIGH16: {
llvm::Constant* immValue = cUnit->irb->GetJInt(vB << 16);
- llvm::Value* res = emitConst(cUnit, immValue, rlDest);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = EmitConst(cUnit, immValue, rlDest);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
break;
case Instruction::CONST_WIDE: {
llvm::Constant* immValue =
cUnit->irb->GetJLong(mir->dalvikInsn.vB_wide);
- llvm::Value* res = emitConst(cUnit, immValue, rlDest);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = EmitConst(cUnit, immValue, rlDest);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
break;
case Instruction::CONST_WIDE_HIGH16: {
int64_t imm = static_cast<int64_t>(vB) << 48;
llvm::Constant* immValue = cUnit->irb->GetJLong(imm);
- llvm::Value* res = emitConst(cUnit, immValue, rlDest);
- defineValue(cUnit, res, rlDest.origSReg);
+ llvm::Value* res = EmitConst(cUnit, immValue, rlDest);
+ DefineValue(cUnit, res, rlDest.origSReg);
}
break;
case Instruction::SPUT_OBJECT:
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputObject,
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputObject,
rlSrc[0]);
break;
case Instruction::SPUT:
if (rlSrc[0].fp) {
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputFloat,
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputFloat,
rlSrc[0]);
} else {
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSput, rlSrc[0]);
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSput, rlSrc[0]);
}
break;
case Instruction::SPUT_BOOLEAN:
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputBoolean,
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputBoolean,
rlSrc[0]);
break;
case Instruction::SPUT_BYTE:
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputByte, rlSrc[0]);
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputByte, rlSrc[0]);
break;
case Instruction::SPUT_CHAR:
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputChar, rlSrc[0]);
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputChar, rlSrc[0]);
break;
case Instruction::SPUT_SHORT:
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputShort, rlSrc[0]);
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputShort, rlSrc[0]);
break;
case Instruction::SPUT_WIDE:
if (rlSrc[0].fp) {
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputDouble,
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputDouble,
rlSrc[0]);
} else {
- convertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputWide,
+ ConvertSput(cUnit, vB, greenland::IntrinsicHelper::HLSputWide,
rlSrc[0]);
}
break;
case Instruction::SGET_OBJECT:
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetObject, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetObject, rlDest);
break;
case Instruction::SGET:
if (rlDest.fp) {
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetFloat, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetFloat, rlDest);
} else {
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSget, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSget, rlDest);
}
break;
case Instruction::SGET_BOOLEAN:
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetBoolean, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetBoolean, rlDest);
break;
case Instruction::SGET_BYTE:
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetByte, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetByte, rlDest);
break;
case Instruction::SGET_CHAR:
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetChar, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetChar, rlDest);
break;
case Instruction::SGET_SHORT:
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetShort, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetShort, rlDest);
break;
case Instruction::SGET_WIDE:
if (rlDest.fp) {
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetDouble,
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetDouble,
rlDest);
} else {
- convertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetWide, rlDest);
+ ConvertSget(cUnit, vB, greenland::IntrinsicHelper::HLSgetWide, rlDest);
}
break;
@@ -1067,68 +1067,68 @@
case Instruction::RETURN:
case Instruction::RETURN_OBJECT: {
if (!(cUnit->attrs & METHOD_IS_LEAF)) {
- emitSuspendCheck(cUnit);
+ EmitSuspendCheck(cUnit);
}
- emitPopShadowFrame(cUnit);
- cUnit->irb->CreateRet(getLLVMValue(cUnit, rlSrc[0].origSReg));
+ EmitPopShadowFrame(cUnit);
+ cUnit->irb->CreateRet(GetLLVMValue(cUnit, rlSrc[0].origSReg));
bb->hasReturn = true;
}
break;
case Instruction::RETURN_VOID: {
if (!(cUnit->attrs & METHOD_IS_LEAF)) {
- emitSuspendCheck(cUnit);
+ EmitSuspendCheck(cUnit);
}
- emitPopShadowFrame(cUnit);
+ EmitPopShadowFrame(cUnit);
cUnit->irb->CreateRetVoid();
bb->hasReturn = true;
}
break;
case Instruction::IF_EQ:
- convertCompareAndBranch(cUnit, bb, mir, kCondEq, rlSrc[0], rlSrc[1]);
+ ConvertCompareAndBranch(cUnit, bb, mir, kCondEq, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_NE:
- convertCompareAndBranch(cUnit, bb, mir, kCondNe, rlSrc[0], rlSrc[1]);
+ ConvertCompareAndBranch(cUnit, bb, mir, kCondNe, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_LT:
- convertCompareAndBranch(cUnit, bb, mir, kCondLt, rlSrc[0], rlSrc[1]);
+ ConvertCompareAndBranch(cUnit, bb, mir, kCondLt, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_GE:
- convertCompareAndBranch(cUnit, bb, mir, kCondGe, rlSrc[0], rlSrc[1]);
+ ConvertCompareAndBranch(cUnit, bb, mir, kCondGe, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_GT:
- convertCompareAndBranch(cUnit, bb, mir, kCondGt, rlSrc[0], rlSrc[1]);
+ ConvertCompareAndBranch(cUnit, bb, mir, kCondGt, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_LE:
- convertCompareAndBranch(cUnit, bb, mir, kCondLe, rlSrc[0], rlSrc[1]);
+ ConvertCompareAndBranch(cUnit, bb, mir, kCondLe, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_EQZ:
- convertCompareZeroAndBranch(cUnit, bb, mir, kCondEq, rlSrc[0]);
+ ConvertCompareZeroAndBranch(cUnit, bb, mir, kCondEq, rlSrc[0]);
break;
case Instruction::IF_NEZ:
- convertCompareZeroAndBranch(cUnit, bb, mir, kCondNe, rlSrc[0]);
+ ConvertCompareZeroAndBranch(cUnit, bb, mir, kCondNe, rlSrc[0]);
break;
case Instruction::IF_LTZ:
- convertCompareZeroAndBranch(cUnit, bb, mir, kCondLt, rlSrc[0]);
+ ConvertCompareZeroAndBranch(cUnit, bb, mir, kCondLt, rlSrc[0]);
break;
case Instruction::IF_GEZ:
- convertCompareZeroAndBranch(cUnit, bb, mir, kCondGe, rlSrc[0]);
+ ConvertCompareZeroAndBranch(cUnit, bb, mir, kCondGe, rlSrc[0]);
break;
case Instruction::IF_GTZ:
- convertCompareZeroAndBranch(cUnit, bb, mir, kCondGt, rlSrc[0]);
+ ConvertCompareZeroAndBranch(cUnit, bb, mir, kCondGt, rlSrc[0]);
break;
case Instruction::IF_LEZ:
- convertCompareZeroAndBranch(cUnit, bb, mir, kCondLe, rlSrc[0]);
+ ConvertCompareZeroAndBranch(cUnit, bb, mir, kCondLe, rlSrc[0]);
break;
case Instruction::GOTO:
case Instruction::GOTO_16:
case Instruction::GOTO_32: {
if (bb->taken->startOffset <= bb->startOffset) {
- emitSuspendCheck(cUnit);
+ EmitSuspendCheck(cUnit);
}
- cUnit->irb->CreateBr(getLLVMBlock(cUnit, bb->taken->id));
+ cUnit->irb->CreateBr(GetLLVMBlock(cUnit, bb->taken->id));
}
break;
@@ -1136,123 +1136,123 @@
case Instruction::ADD_LONG_2ADDR:
case Instruction::ADD_INT:
case Instruction::ADD_INT_2ADDR:
- convertArithOp(cUnit, kOpAdd, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpAdd, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SUB_LONG:
case Instruction::SUB_LONG_2ADDR:
case Instruction::SUB_INT:
case Instruction::SUB_INT_2ADDR:
- convertArithOp(cUnit, kOpSub, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpSub, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::MUL_LONG:
case Instruction::MUL_LONG_2ADDR:
case Instruction::MUL_INT:
case Instruction::MUL_INT_2ADDR:
- convertArithOp(cUnit, kOpMul, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpMul, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::DIV_LONG:
case Instruction::DIV_LONG_2ADDR:
case Instruction::DIV_INT:
case Instruction::DIV_INT_2ADDR:
- convertArithOp(cUnit, kOpDiv, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpDiv, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::REM_LONG:
case Instruction::REM_LONG_2ADDR:
case Instruction::REM_INT:
case Instruction::REM_INT_2ADDR:
- convertArithOp(cUnit, kOpRem, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpRem, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::AND_LONG:
case Instruction::AND_LONG_2ADDR:
case Instruction::AND_INT:
case Instruction::AND_INT_2ADDR:
- convertArithOp(cUnit, kOpAnd, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpAnd, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::OR_LONG:
case Instruction::OR_LONG_2ADDR:
case Instruction::OR_INT:
case Instruction::OR_INT_2ADDR:
- convertArithOp(cUnit, kOpOr, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpOr, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::XOR_LONG:
case Instruction::XOR_LONG_2ADDR:
case Instruction::XOR_INT:
case Instruction::XOR_INT_2ADDR:
- convertArithOp(cUnit, kOpXor, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertArithOp(cUnit, kOpXor, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SHL_LONG:
case Instruction::SHL_LONG_2ADDR:
- convertShift(cUnit, greenland::IntrinsicHelper::SHLLong,
+ ConvertShift(cUnit, greenland::IntrinsicHelper::SHLLong,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SHL_INT:
case Instruction::SHL_INT_2ADDR:
- convertShift(cUnit, greenland::IntrinsicHelper::SHLInt,
+ ConvertShift(cUnit, greenland::IntrinsicHelper::SHLInt,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SHR_LONG:
case Instruction::SHR_LONG_2ADDR:
- convertShift(cUnit, greenland::IntrinsicHelper::SHRLong,
+ ConvertShift(cUnit, greenland::IntrinsicHelper::SHRLong,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SHR_INT:
case Instruction::SHR_INT_2ADDR:
- convertShift(cUnit, greenland::IntrinsicHelper::SHRInt,
+ ConvertShift(cUnit, greenland::IntrinsicHelper::SHRInt,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::USHR_LONG:
case Instruction::USHR_LONG_2ADDR:
- convertShift(cUnit, greenland::IntrinsicHelper::USHRLong,
+ ConvertShift(cUnit, greenland::IntrinsicHelper::USHRLong,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::USHR_INT:
case Instruction::USHR_INT_2ADDR:
- convertShift(cUnit, greenland::IntrinsicHelper::USHRInt,
+ ConvertShift(cUnit, greenland::IntrinsicHelper::USHRInt,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::ADD_INT_LIT16:
case Instruction::ADD_INT_LIT8:
- convertArithOpLit(cUnit, kOpAdd, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpAdd, rlDest, rlSrc[0], vC);
break;
case Instruction::RSUB_INT:
case Instruction::RSUB_INT_LIT8:
- convertArithOpLit(cUnit, kOpRsub, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpRsub, rlDest, rlSrc[0], vC);
break;
case Instruction::MUL_INT_LIT16:
case Instruction::MUL_INT_LIT8:
- convertArithOpLit(cUnit, kOpMul, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpMul, rlDest, rlSrc[0], vC);
break;
case Instruction::DIV_INT_LIT16:
case Instruction::DIV_INT_LIT8:
- convertArithOpLit(cUnit, kOpDiv, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpDiv, rlDest, rlSrc[0], vC);
break;
case Instruction::REM_INT_LIT16:
case Instruction::REM_INT_LIT8:
- convertArithOpLit(cUnit, kOpRem, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpRem, rlDest, rlSrc[0], vC);
break;
case Instruction::AND_INT_LIT16:
case Instruction::AND_INT_LIT8:
- convertArithOpLit(cUnit, kOpAnd, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpAnd, rlDest, rlSrc[0], vC);
break;
case Instruction::OR_INT_LIT16:
case Instruction::OR_INT_LIT8:
- convertArithOpLit(cUnit, kOpOr, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpOr, rlDest, rlSrc[0], vC);
break;
case Instruction::XOR_INT_LIT16:
case Instruction::XOR_INT_LIT8:
- convertArithOpLit(cUnit, kOpXor, rlDest, rlSrc[0], vC);
+ ConvertArithOpLit(cUnit, kOpXor, rlDest, rlSrc[0], vC);
break;
case Instruction::SHL_INT_LIT8:
- convertShiftLit(cUnit, greenland::IntrinsicHelper::SHLInt,
+ ConvertShiftLit(cUnit, greenland::IntrinsicHelper::SHLInt,
rlDest, rlSrc[0], vC & 0x1f);
break;
case Instruction::SHR_INT_LIT8:
- convertShiftLit(cUnit, greenland::IntrinsicHelper::SHRInt,
+ ConvertShiftLit(cUnit, greenland::IntrinsicHelper::SHRInt,
rlDest, rlSrc[0], vC & 0x1f);
break;
case Instruction::USHR_INT_LIT8:
- convertShiftLit(cUnit, greenland::IntrinsicHelper::USHRInt,
+ ConvertShiftLit(cUnit, greenland::IntrinsicHelper::USHRInt,
rlDest, rlSrc[0], vC & 0x1f);
break;
@@ -1260,115 +1260,115 @@
case Instruction::ADD_FLOAT_2ADDR:
case Instruction::ADD_DOUBLE:
case Instruction::ADD_DOUBLE_2ADDR:
- convertFPArithOp(cUnit, kOpAdd, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertFPArithOp(cUnit, kOpAdd, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SUB_FLOAT:
case Instruction::SUB_FLOAT_2ADDR:
case Instruction::SUB_DOUBLE:
case Instruction::SUB_DOUBLE_2ADDR:
- convertFPArithOp(cUnit, kOpSub, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertFPArithOp(cUnit, kOpSub, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::MUL_FLOAT:
case Instruction::MUL_FLOAT_2ADDR:
case Instruction::MUL_DOUBLE:
case Instruction::MUL_DOUBLE_2ADDR:
- convertFPArithOp(cUnit, kOpMul, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertFPArithOp(cUnit, kOpMul, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::DIV_FLOAT:
case Instruction::DIV_FLOAT_2ADDR:
case Instruction::DIV_DOUBLE:
case Instruction::DIV_DOUBLE_2ADDR:
- convertFPArithOp(cUnit, kOpDiv, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertFPArithOp(cUnit, kOpDiv, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::REM_FLOAT:
case Instruction::REM_FLOAT_2ADDR:
case Instruction::REM_DOUBLE:
case Instruction::REM_DOUBLE_2ADDR:
- convertFPArithOp(cUnit, kOpRem, rlDest, rlSrc[0], rlSrc[1]);
+ ConvertFPArithOp(cUnit, kOpRem, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::INVOKE_STATIC:
- convertInvoke(cUnit, bb, mir, kStatic, false /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kStatic, false /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_STATIC_RANGE:
- convertInvoke(cUnit, bb, mir, kStatic, true /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kStatic, true /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_DIRECT:
- convertInvoke(cUnit, bb, mir, kDirect, false /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kDirect, false /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_DIRECT_RANGE:
- convertInvoke(cUnit, bb, mir, kDirect, true /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kDirect, true /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_VIRTUAL:
- convertInvoke(cUnit, bb, mir, kVirtual, false /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kVirtual, false /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_VIRTUAL_RANGE:
- convertInvoke(cUnit, bb, mir, kVirtual, true /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kVirtual, true /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_SUPER:
- convertInvoke(cUnit, bb, mir, kSuper, false /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kSuper, false /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_SUPER_RANGE:
- convertInvoke(cUnit, bb, mir, kSuper, true /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kSuper, true /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_INTERFACE:
- convertInvoke(cUnit, bb, mir, kInterface, false /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kInterface, false /*range*/,
false /* NewFilledArray */);
break;
case Instruction::INVOKE_INTERFACE_RANGE:
- convertInvoke(cUnit, bb, mir, kInterface, true /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kInterface, true /*range*/,
false /* NewFilledArray */);
break;
case Instruction::FILLED_NEW_ARRAY:
- convertInvoke(cUnit, bb, mir, kInterface, false /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kInterface, false /*range*/,
true /* NewFilledArray */);
break;
case Instruction::FILLED_NEW_ARRAY_RANGE:
- convertInvoke(cUnit, bb, mir, kInterface, true /*range*/,
+ ConvertInvoke(cUnit, bb, mir, kInterface, true /*range*/,
true /* NewFilledArray */);
break;
case Instruction::CONST_STRING:
case Instruction::CONST_STRING_JUMBO:
- convertConstObject(cUnit, vB, greenland::IntrinsicHelper::ConstString,
+ ConvertConstObject(cUnit, vB, greenland::IntrinsicHelper::ConstString,
rlDest);
break;
case Instruction::CONST_CLASS:
- convertConstObject(cUnit, vB, greenland::IntrinsicHelper::ConstClass,
+ ConvertConstObject(cUnit, vB, greenland::IntrinsicHelper::ConstClass,
rlDest);
break;
case Instruction::CHECK_CAST:
- convertCheckCast(cUnit, vB, rlSrc[0]);
+ ConvertCheckCast(cUnit, vB, rlSrc[0]);
break;
case Instruction::NEW_INSTANCE:
- convertNewInstance(cUnit, vB, rlDest);
+ ConvertNewInstance(cUnit, vB, rlDest);
break;
case Instruction::MOVE_EXCEPTION:
- convertMoveException(cUnit, rlDest);
+ ConvertMoveException(cUnit, rlDest);
break;
case Instruction::THROW:
- convertThrow(cUnit, rlSrc[0]);
+ ConvertThrow(cUnit, rlSrc[0]);
/*
* If this throw is standalone, terminate.
* If it might rethrow, force termination
@@ -1392,291 +1392,291 @@
break;
case Instruction::MONITOR_ENTER:
- convertMonitorEnterExit(cUnit, optFlags,
+ ConvertMonitorEnterExit(cUnit, optFlags,
greenland::IntrinsicHelper::MonitorEnter,
rlSrc[0]);
break;
case Instruction::MONITOR_EXIT:
- convertMonitorEnterExit(cUnit, optFlags,
+ ConvertMonitorEnterExit(cUnit, optFlags,
greenland::IntrinsicHelper::MonitorExit,
rlSrc[0]);
break;
case Instruction::ARRAY_LENGTH:
- convertArrayLength(cUnit, optFlags, rlDest, rlSrc[0]);
+ ConvertArrayLength(cUnit, optFlags, rlDest, rlSrc[0]);
break;
case Instruction::NEW_ARRAY:
- convertNewArray(cUnit, vC, rlDest, rlSrc[0]);
+ ConvertNewArray(cUnit, vC, rlDest, rlSrc[0]);
break;
case Instruction::INSTANCE_OF:
- convertInstanceOf(cUnit, vC, rlDest, rlSrc[0]);
+ ConvertInstanceOf(cUnit, vC, rlDest, rlSrc[0]);
break;
case Instruction::AGET:
if (rlDest.fp) {
- convertAget(cUnit, optFlags,
+ ConvertAget(cUnit, optFlags,
greenland::IntrinsicHelper::HLArrayGetFloat,
rlDest, rlSrc[0], rlSrc[1]);
} else {
- convertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGet,
+ ConvertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGet,
rlDest, rlSrc[0], rlSrc[1]);
}
break;
case Instruction::AGET_OBJECT:
- convertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetObject,
+ ConvertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetObject,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::AGET_BOOLEAN:
- convertAget(cUnit, optFlags,
+ ConvertAget(cUnit, optFlags,
greenland::IntrinsicHelper::HLArrayGetBoolean,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::AGET_BYTE:
- convertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetByte,
+ ConvertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetByte,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::AGET_CHAR:
- convertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetChar,
+ ConvertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetChar,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::AGET_SHORT:
- convertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetShort,
+ ConvertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetShort,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::AGET_WIDE:
if (rlDest.fp) {
- convertAget(cUnit, optFlags,
+ ConvertAget(cUnit, optFlags,
greenland::IntrinsicHelper::HLArrayGetDouble,
rlDest, rlSrc[0], rlSrc[1]);
} else {
- convertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetWide,
+ ConvertAget(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayGetWide,
rlDest, rlSrc[0], rlSrc[1]);
}
break;
case Instruction::APUT:
if (rlSrc[0].fp) {
- convertAput(cUnit, optFlags,
+ ConvertAput(cUnit, optFlags,
greenland::IntrinsicHelper::HLArrayPutFloat,
rlSrc[0], rlSrc[1], rlSrc[2]);
} else {
- convertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPut,
+ ConvertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPut,
rlSrc[0], rlSrc[1], rlSrc[2]);
}
break;
case Instruction::APUT_OBJECT:
- convertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutObject,
+ ConvertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutObject,
rlSrc[0], rlSrc[1], rlSrc[2]);
break;
case Instruction::APUT_BOOLEAN:
- convertAput(cUnit, optFlags,
+ ConvertAput(cUnit, optFlags,
greenland::IntrinsicHelper::HLArrayPutBoolean,
rlSrc[0], rlSrc[1], rlSrc[2]);
break;
case Instruction::APUT_BYTE:
- convertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutByte,
+ ConvertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutByte,
rlSrc[0], rlSrc[1], rlSrc[2]);
break;
case Instruction::APUT_CHAR:
- convertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutChar,
+ ConvertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutChar,
rlSrc[0], rlSrc[1], rlSrc[2]);
break;
case Instruction::APUT_SHORT:
- convertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutShort,
+ ConvertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutShort,
rlSrc[0], rlSrc[1], rlSrc[2]);
break;
case Instruction::APUT_WIDE:
if (rlSrc[0].fp) {
- convertAput(cUnit, optFlags,
+ ConvertAput(cUnit, optFlags,
greenland::IntrinsicHelper::HLArrayPutDouble,
rlSrc[0], rlSrc[1], rlSrc[2]);
} else {
- convertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutWide,
+ ConvertAput(cUnit, optFlags, greenland::IntrinsicHelper::HLArrayPutWide,
rlSrc[0], rlSrc[1], rlSrc[2]);
}
break;
case Instruction::IGET:
if (rlDest.fp) {
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetFloat,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetFloat,
rlDest, rlSrc[0], vC);
} else {
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGet,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGet,
rlDest, rlSrc[0], vC);
}
break;
case Instruction::IGET_OBJECT:
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetObject,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetObject,
rlDest, rlSrc[0], vC);
break;
case Instruction::IGET_BOOLEAN:
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetBoolean,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetBoolean,
rlDest, rlSrc[0], vC);
break;
case Instruction::IGET_BYTE:
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetByte,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetByte,
rlDest, rlSrc[0], vC);
break;
case Instruction::IGET_CHAR:
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetChar,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetChar,
rlDest, rlSrc[0], vC);
break;
case Instruction::IGET_SHORT:
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetShort,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetShort,
rlDest, rlSrc[0], vC);
break;
case Instruction::IGET_WIDE:
if (rlDest.fp) {
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetDouble,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetDouble,
rlDest, rlSrc[0], vC);
} else {
- convertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetWide,
+ ConvertIget(cUnit, optFlags, greenland::IntrinsicHelper::HLIGetWide,
rlDest, rlSrc[0], vC);
}
break;
case Instruction::IPUT:
if (rlSrc[0].fp) {
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutFloat,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutFloat,
rlSrc[0], rlSrc[1], vC);
} else {
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPut,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPut,
rlSrc[0], rlSrc[1], vC);
}
break;
case Instruction::IPUT_OBJECT:
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutObject,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutObject,
rlSrc[0], rlSrc[1], vC);
break;
case Instruction::IPUT_BOOLEAN:
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutBoolean,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutBoolean,
rlSrc[0], rlSrc[1], vC);
break;
case Instruction::IPUT_BYTE:
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutByte,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutByte,
rlSrc[0], rlSrc[1], vC);
break;
case Instruction::IPUT_CHAR:
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutChar,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutChar,
rlSrc[0], rlSrc[1], vC);
break;
case Instruction::IPUT_SHORT:
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutShort,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutShort,
rlSrc[0], rlSrc[1], vC);
break;
case Instruction::IPUT_WIDE:
if (rlSrc[0].fp) {
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutDouble,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutDouble,
rlSrc[0], rlSrc[1], vC);
} else {
- convertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutWide,
+ ConvertIput(cUnit, optFlags, greenland::IntrinsicHelper::HLIPutWide,
rlSrc[0], rlSrc[1], vC);
}
break;
case Instruction::FILL_ARRAY_DATA:
- convertFillArrayData(cUnit, vB, rlSrc[0]);
+ ConvertFillArrayData(cUnit, vB, rlSrc[0]);
break;
case Instruction::LONG_TO_INT:
- convertLongToInt(cUnit, rlDest, rlSrc[0]);
+ ConvertLongToInt(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::INT_TO_LONG:
- convertIntToLong(cUnit, rlDest, rlSrc[0]);
+ ConvertIntToLong(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::INT_TO_CHAR:
- convertIntNarrowing(cUnit, rlDest, rlSrc[0],
+ ConvertIntNarrowing(cUnit, rlDest, rlSrc[0],
greenland::IntrinsicHelper::IntToChar);
break;
case Instruction::INT_TO_BYTE:
- convertIntNarrowing(cUnit, rlDest, rlSrc[0],
+ ConvertIntNarrowing(cUnit, rlDest, rlSrc[0],
greenland::IntrinsicHelper::IntToByte);
break;
case Instruction::INT_TO_SHORT:
- convertIntNarrowing(cUnit, rlDest, rlSrc[0],
+ ConvertIntNarrowing(cUnit, rlDest, rlSrc[0],
greenland::IntrinsicHelper::IntToShort);
break;
case Instruction::INT_TO_FLOAT:
case Instruction::LONG_TO_FLOAT:
- convertIntToFP(cUnit, cUnit->irb->getFloatTy(), rlDest, rlSrc[0]);
+ ConvertIntToFP(cUnit, cUnit->irb->getFloatTy(), rlDest, rlSrc[0]);
break;
case Instruction::INT_TO_DOUBLE:
case Instruction::LONG_TO_DOUBLE:
- convertIntToFP(cUnit, cUnit->irb->getDoubleTy(), rlDest, rlSrc[0]);
+ ConvertIntToFP(cUnit, cUnit->irb->getDoubleTy(), rlDest, rlSrc[0]);
break;
case Instruction::FLOAT_TO_DOUBLE:
- convertFloatToDouble(cUnit, rlDest, rlSrc[0]);
+ ConvertFloatToDouble(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::DOUBLE_TO_FLOAT:
- convertDoubleToFloat(cUnit, rlDest, rlSrc[0]);
+ ConvertDoubleToFloat(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::NEG_LONG:
case Instruction::NEG_INT:
- convertNeg(cUnit, rlDest, rlSrc[0]);
+ ConvertNeg(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::NEG_FLOAT:
case Instruction::NEG_DOUBLE:
- convertNegFP(cUnit, rlDest, rlSrc[0]);
+ ConvertNegFP(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::NOT_LONG:
case Instruction::NOT_INT:
- convertNot(cUnit, rlDest, rlSrc[0]);
+ ConvertNot(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::FLOAT_TO_INT:
- convertFPToInt(cUnit, greenland::IntrinsicHelper::F2I, rlDest, rlSrc[0]);
+ ConvertFPToInt(cUnit, greenland::IntrinsicHelper::F2I, rlDest, rlSrc[0]);
break;
case Instruction::DOUBLE_TO_INT:
- convertFPToInt(cUnit, greenland::IntrinsicHelper::D2I, rlDest, rlSrc[0]);
+ ConvertFPToInt(cUnit, greenland::IntrinsicHelper::D2I, rlDest, rlSrc[0]);
break;
case Instruction::FLOAT_TO_LONG:
- convertFPToInt(cUnit, greenland::IntrinsicHelper::F2L, rlDest, rlSrc[0]);
+ ConvertFPToInt(cUnit, greenland::IntrinsicHelper::F2L, rlDest, rlSrc[0]);
break;
case Instruction::DOUBLE_TO_LONG:
- convertFPToInt(cUnit, greenland::IntrinsicHelper::D2L, rlDest, rlSrc[0]);
+ ConvertFPToInt(cUnit, greenland::IntrinsicHelper::D2L, rlDest, rlSrc[0]);
break;
case Instruction::CMPL_FLOAT:
- convertWideComparison(cUnit, greenland::IntrinsicHelper::CmplFloat,
+ ConvertWideComparison(cUnit, greenland::IntrinsicHelper::CmplFloat,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::CMPG_FLOAT:
- convertWideComparison(cUnit, greenland::IntrinsicHelper::CmpgFloat,
+ ConvertWideComparison(cUnit, greenland::IntrinsicHelper::CmpgFloat,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::CMPL_DOUBLE:
- convertWideComparison(cUnit, greenland::IntrinsicHelper::CmplDouble,
+ ConvertWideComparison(cUnit, greenland::IntrinsicHelper::CmplDouble,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::CMPG_DOUBLE:
- convertWideComparison(cUnit, greenland::IntrinsicHelper::CmpgDouble,
+ ConvertWideComparison(cUnit, greenland::IntrinsicHelper::CmpgDouble,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::CMP_LONG:
- convertWideComparison(cUnit, greenland::IntrinsicHelper::CmpLong,
+ ConvertWideComparison(cUnit, greenland::IntrinsicHelper::CmpLong,
rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::PACKED_SWITCH:
- convertPackedSwitch(cUnit, bb, vB, rlSrc[0]);
+ ConvertPackedSwitch(cUnit, bb, vB, rlSrc[0]);
break;
case Instruction::SPARSE_SWITCH:
- convertSparseSwitch(cUnit, bb, vB, rlSrc[0]);
+ ConvertSparseSwitch(cUnit, bb, vB, rlSrc[0]);
break;
default:
@@ -1684,14 +1684,14 @@
res = true;
}
if (objectDefinition) {
- setShadowFrameEntry(cUnit, reinterpret_cast<llvm::Value*>
+ SetShadowFrameEntry(cUnit, reinterpret_cast<llvm::Value*>
(cUnit->llvmValues.elemList[rlDest.origSReg]));
}
return res;
}
/* Extended MIR instructions like PHI */
-void convertExtendedMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void ConvertExtendedMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
llvm::BasicBlock* llvmBB)
{
@@ -1710,12 +1710,12 @@
}
int* incoming = reinterpret_cast<int*>(mir->dalvikInsn.vB);
llvm::Type* phiType =
- llvmTypeFromLocRec(cUnit, rlDest);
+ LlvmTypeFromLocRec(cUnit, rlDest);
llvm::PHINode* phi = cUnit->irb->CreatePHI(phiType, mir->ssaRep->numUses);
for (int i = 0; i < mir->ssaRep->numUses; i++) {
RegLocation loc;
// Don't check width here.
- loc = oatGetRawSrc(cUnit, mir, i);
+ loc = GetRawSrc(cUnit, mir, i);
DCHECK_EQ(rlDest.wide, loc.wide);
DCHECK_EQ(rlDest.wide & rlDest.highWord, loc.wide & loc.highWord);
DCHECK_EQ(rlDest.fp, loc.fp);
@@ -1724,10 +1724,10 @@
SafeMap<unsigned int, unsigned int>::iterator it;
it = cUnit->blockIdMap.find(incoming[i]);
DCHECK(it != cUnit->blockIdMap.end());
- phi->addIncoming(getLLVMValue(cUnit, loc.origSReg),
- getLLVMBlock(cUnit, it->second));
+ phi->addIncoming(GetLLVMValue(cUnit, loc.origSReg),
+ GetLLVMBlock(cUnit, it->second));
}
- defineValue(cUnit, phi, rlDest.origSReg);
+ DefineValue(cUnit, phi, rlDest.origSReg);
break;
}
case kMirOpCopy: {
@@ -1762,7 +1762,7 @@
}
}
-void setDexOffset(CompilationUnit* cUnit, int32_t offset)
+void SetDexOffset(CompilationUnit* cUnit, int32_t offset)
{
cUnit->currentDalvikOffset = offset;
llvm::SmallVector<llvm::Value*, 1> arrayRef;
@@ -1772,7 +1772,7 @@
}
// Attach method info as metadata to special intrinsic
-void setMethodInfo(CompilationUnit* cUnit)
+void SetMethodInfo(CompilationUnit* cUnit)
{
// We don't want dex offset on this
cUnit->irb->SetDexOffset(NULL);
@@ -1793,7 +1793,7 @@
for (int i = 0; i < promoSize; i++) {
PromotionMap* p = &cUnit->promotionMap[i];
int32_t mapData = ((p->firstInPair & 0xff) << 24) |
- ((p->fpReg & 0xff) << 16) |
+ ((p->FpReg & 0xff) << 16) |
((p->coreReg & 0xff) << 8) |
((p->fpLocation & 0xf) << 4) |
(p->coreLocation & 0xf);
@@ -1801,19 +1801,19 @@
}
llvm::MDNode* mapNode = llvm::MDNode::get(*cUnit->context, pmap);
inst->setMetadata("PromotionMap", mapNode);
- setDexOffset(cUnit, cUnit->currentDalvikOffset);
+ SetDexOffset(cUnit, cUnit->currentDalvikOffset);
}
/* Handle the content in each basic block */
-bool methodBlockBitcodeConversion(CompilationUnit* cUnit, BasicBlock* bb)
+bool MethodBlockBitcodeConversion(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb->blockType == kDead) return false;
- llvm::BasicBlock* llvmBB = getLLVMBlock(cUnit, bb->id);
+ llvm::BasicBlock* llvmBB = GetLLVMBlock(cUnit, bb->id);
if (llvmBB == NULL) {
CHECK(bb->blockType == kExitBlock);
} else {
cUnit->irb->SetInsertPoint(llvmBB);
- setDexOffset(cUnit, bb->startOffset);
+ SetDexOffset(cUnit, bb->startOffset);
}
if (cUnit->printMe) {
@@ -1827,8 +1827,8 @@
}
if (bb->blockType == kEntryBlock) {
- setMethodInfo(cUnit);
- bool *canBeRef = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * cUnit->numDalvikRegisters,
+ SetMethodInfo(cUnit);
+ bool *canBeRef = static_cast<bool*>(NewMem(cUnit, sizeof(bool) * cUnit->numDalvikRegisters,
true, kAllocMisc));
for (int i = 0; i < cUnit->numSSARegs; i++) {
int vReg = SRegToVReg(cUnit, i);
@@ -1842,7 +1842,7 @@
}
}
if (cUnit->numShadowFrameEntries > 0) {
- cUnit->shadowMap = static_cast<int*>(oatNew(cUnit, sizeof(int) * cUnit->numShadowFrameEntries,
+ cUnit->shadowMap = static_cast<int*>(NewMem(cUnit, sizeof(int) * cUnit->numShadowFrameEntries,
true, kAllocMisc));
for (int i = 0, j = 0; i < cUnit->numDalvikRegisters; i++) {
if (canBeRef[i]) {
@@ -1875,7 +1875,7 @@
for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) {
- setDexOffset(cUnit, mir->offset);
+ SetDexOffset(cUnit, mir->offset);
int opcode = mir->dalvikInsn.opcode;
Instruction::Format dalvikFormat =
@@ -1896,7 +1896,7 @@
llvm::Value* switchKey =
cUnit->irb->CreateCall(intr, cUnit->irb->getInt32(mir->offset));
GrowableListIterator iter;
- oatGrowableListIteratorInit(&bb->successorBlockList.blocks, &iter);
+ GrowableListIteratorInit(&bb->successorBlockList.blocks, &iter);
// New basic block to use for work half
llvm::BasicBlock* workBB =
llvm::BasicBlock::Create(*cUnit->context, "", cUnit->func);
@@ -1905,10 +1905,10 @@
bb->successorBlockList.blocks.numUsed);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iter));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iter));
if (successorBlockInfo == NULL) break;
llvm::BasicBlock *target =
- getLLVMBlock(cUnit, successorBlockInfo->block->id);
+ GetLLVMBlock(cUnit, successorBlockInfo->block->id);
int typeIndex = successorBlockInfo->key;
sw->addCase(cUnit->irb->getInt32(typeIndex), target);
}
@@ -1918,11 +1918,11 @@
}
if (opcode >= kMirOpFirst) {
- convertExtendedMIR(cUnit, bb, mir, llvmBB);
+ ConvertExtendedMIR(cUnit, bb, mir, llvmBB);
continue;
}
- bool notHandled = convertMIRNode(cUnit, mir, bb, llvmBB,
+ bool notHandled = ConvertMIRNode(cUnit, mir, bb, llvmBB,
NULL /* labelList */);
if (notHandled) {
Instruction::Code dalvikOpcode = static_cast<Instruction::Code>(opcode);
@@ -1934,15 +1934,15 @@
}
if (bb->blockType == kEntryBlock) {
- cUnit->entryTargetBB = getLLVMBlock(cUnit, bb->fallThrough->id);
+ cUnit->entryTargetBB = GetLLVMBlock(cUnit, bb->fallThrough->id);
} else if ((bb->fallThrough != NULL) && !bb->hasReturn) {
- cUnit->irb->CreateBr(getLLVMBlock(cUnit, bb->fallThrough->id));
+ cUnit->irb->CreateBr(GetLLVMBlock(cUnit, bb->fallThrough->id));
}
return false;
}
-char remapShorty(char shortyType) {
+char RemapShorty(char shortyType) {
/*
* TODO: might want to revisit this. Dalvik registers are 32-bits wide,
* and longs/doubles are represented as a pair of registers. When sub-word
@@ -1964,10 +1964,10 @@
return shortyType;
}
-llvm::FunctionType* getFunctionType(CompilationUnit* cUnit) {
+llvm::FunctionType* GetFunctionType(CompilationUnit* cUnit) {
// Get return type
- llvm::Type* ret_type = cUnit->irb->GetJType(remapShorty(cUnit->shorty[0]),
+ llvm::Type* ret_type = cUnit->irb->GetJType(RemapShorty(cUnit->shorty[0]),
greenland::kAccurate);
// Get argument type
@@ -1982,17 +1982,17 @@
}
for (uint32_t i = 1; i < strlen(cUnit->shorty); ++i) {
- args_type.push_back(cUnit->irb->GetJType(remapShorty(cUnit->shorty[i]),
+ args_type.push_back(cUnit->irb->GetJType(RemapShorty(cUnit->shorty[i]),
greenland::kAccurate));
}
return llvm::FunctionType::get(ret_type, args_type, false);
}
-bool createFunction(CompilationUnit* cUnit) {
+bool CreateFunction(CompilationUnit* cUnit) {
std::string func_name(PrettyMethod(cUnit->method_idx, *cUnit->dex_file,
/* with_signature */ false));
- llvm::FunctionType* func_type = getFunctionType(cUnit);
+ llvm::FunctionType* func_type = GetFunctionType(cUnit);
if (func_type == NULL) {
return false;
@@ -2018,7 +2018,7 @@
return true;
}
-bool createLLVMBasicBlock(CompilationUnit* cUnit, BasicBlock* bb)
+bool CreateLLVMBasicBlock(CompilationUnit* cUnit, BasicBlock* bb)
{
// Skip the exit block
if ((bb->blockType == kDead) ||(bb->blockType == kExitBlock)) {
@@ -2050,16 +2050,16 @@
* o Iterate through the MIR a basic block at a time, setting arguments
* to recovered ssa name.
*/
-void oatMethodMIR2Bitcode(CompilationUnit* cUnit)
+void MethodMIR2Bitcode(CompilationUnit* cUnit)
{
- initIR(cUnit);
- oatInitGrowableList(cUnit, &cUnit->llvmValues, cUnit->numSSARegs);
+ InitIR(cUnit);
+ CompilerInitGrowableList(cUnit, &cUnit->llvmValues, cUnit->numSSARegs);
// Create the function
- createFunction(cUnit);
+ CreateFunction(cUnit);
// Create an LLVM basic block for each MIR block in dfs preorder
- oatDataFlowAnalysisDispatcher(cUnit, createLLVMBasicBlock,
+ DataFlowAnalysisDispatcher(cUnit, CreateLLVMBasicBlock,
kPreOrderDFSTraversal, false /* isIterative */);
/*
* Create an llvm named value for each MIR SSA name. Note: we'll use
@@ -2073,22 +2073,22 @@
llvm::Value* val;
RegLocation rlTemp = cUnit->regLocation[i];
if ((SRegToVReg(cUnit, i) < 0) || rlTemp.highWord) {
- oatInsertGrowableList(cUnit, &cUnit->llvmValues, 0);
+ InsertGrowableList(cUnit, &cUnit->llvmValues, 0);
} else if ((i < cUnit->numRegs) ||
(i >= (cUnit->numRegs + cUnit->numIns))) {
llvm::Constant* immValue = cUnit->regLocation[i].wide ?
cUnit->irb->GetJLong(0) : cUnit->irb->GetJInt(0);
- val = emitConst(cUnit, immValue, cUnit->regLocation[i]);
- val->setName(llvmSSAName(cUnit, i));
- oatInsertGrowableList(cUnit, &cUnit->llvmValues, reinterpret_cast<uintptr_t>(val));
+ val = EmitConst(cUnit, immValue, cUnit->regLocation[i]);
+ val->setName(LlvmSSAName(cUnit, i));
+ InsertGrowableList(cUnit, &cUnit->llvmValues, reinterpret_cast<uintptr_t>(val));
} else {
// Recover previously-created argument values
llvm::Value* argVal = arg_iter++;
- oatInsertGrowableList(cUnit, &cUnit->llvmValues, reinterpret_cast<uintptr_t>(argVal));
+ InsertGrowableList(cUnit, &cUnit->llvmValues, reinterpret_cast<uintptr_t>(argVal));
}
}
- oatDataFlowAnalysisDispatcher(cUnit, methodBlockBitcodeConversion,
+ DataFlowAnalysisDispatcher(cUnit, MethodBlockBitcodeConversion,
kPreOrderDFSTraversal, false /* Iterative */);
/*
@@ -2114,7 +2114,7 @@
inst->eraseFromParent();
}
}
- setDexOffset(cUnit, 0);
+ SetDexOffset(cUnit, 0);
if (cUnit->placeholderBB->empty()) {
cUnit->placeholderBB->eraseFromParent();
} else {
@@ -2138,7 +2138,7 @@
// Write bitcode to file
std::string errmsg;
std::string fname(PrettyMethod(cUnit->method_idx, *cUnit->dex_file));
- oatReplaceSpecialChars(fname);
+ ReplaceSpecialChars(fname);
// TODO: make configurable change naming mechanism to avoid fname length issues.
fname = StringPrintf("/sdcard/Bitcode/%s.bc", fname.c_str());
@@ -2160,7 +2160,7 @@
}
}
-RegLocation getLoc(CompilationUnit* cUnit, llvm::Value* val) {
+RegLocation GetLoc(CompilationUnit* cUnit, llvm::Value* val) {
RegLocation res;
DCHECK(val != NULL);
SafeMap<llvm::Value*, RegLocation>::iterator it = cUnit->locMap.find(val);
@@ -2172,7 +2172,7 @@
UNIMPLEMENTED(WARNING) << "Need to handle unnamed llvm temps";
memset(&res, 0, sizeof(res));
res.location = kLocPhysReg;
- res.lowReg = oatAllocTemp(cUnit);
+ res.lowReg = AllocTemp(cUnit);
res.home = true;
res.sRegLow = INVALID_SREG;
res.origSReg = INVALID_SREG;
@@ -2180,7 +2180,7 @@
res.wide = ((ty == cUnit->irb->getInt64Ty()) ||
(ty == cUnit->irb->getDoubleTy()));
if (res.wide) {
- res.highReg = oatAllocTemp(cUnit);
+ res.highReg = AllocTemp(cUnit);
}
cUnit->locMap.Put(val, res);
} else {
@@ -2196,7 +2196,7 @@
return res;
}
-Instruction::Code getDalvikOpcode(OpKind op, bool isConst, bool isWide)
+Instruction::Code GetDalvikOpcode(OpKind op, bool isConst, bool isWide)
{
Instruction::Code res = Instruction::NOP;
if (isWide) {
@@ -2248,7 +2248,7 @@
return res;
}
-Instruction::Code getDalvikFPOpcode(OpKind op, bool isConst, bool isWide)
+Instruction::Code GetDalvikFPOpcode(OpKind op, bool isConst, bool isWide)
{
Instruction::Code res = Instruction::NOP;
if (isWide) {
@@ -2273,9 +2273,9 @@
return res;
}
-void cvtBinFPOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
+void CvtBinFPOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
{
- RegLocation rlDest = getLoc(cUnit, inst);
+ RegLocation rlDest = GetLoc(cUnit, inst);
/*
* Normally, we won't ever generate an FP operation with an immediate
* operand (not supported in Dex instruction set). However, the IR builder
@@ -2286,37 +2286,37 @@
llvm::ConstantFP* op2C = llvm::dyn_cast<llvm::ConstantFP>(inst->getOperand(1));
DCHECK(op2C == NULL);
if ((op1C != NULL) && (op == kOpSub)) {
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(1));
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(1));
if (rlDest.wide) {
- genArithOpDouble(cUnit, Instruction::NEG_DOUBLE, rlDest, rlSrc, rlSrc);
+ GenArithOpDouble(cUnit, Instruction::NEG_DOUBLE, rlDest, rlSrc, rlSrc);
} else {
- genArithOpFloat(cUnit, Instruction::NEG_FLOAT, rlDest, rlSrc, rlSrc);
+ GenArithOpFloat(cUnit, Instruction::NEG_FLOAT, rlDest, rlSrc, rlSrc);
}
} else {
DCHECK(op1C == NULL);
- RegLocation rlSrc1 = getLoc(cUnit, inst->getOperand(0));
- RegLocation rlSrc2 = getLoc(cUnit, inst->getOperand(1));
- Instruction::Code dalvikOp = getDalvikFPOpcode(op, false, rlDest.wide);
+ RegLocation rlSrc1 = GetLoc(cUnit, inst->getOperand(0));
+ RegLocation rlSrc2 = GetLoc(cUnit, inst->getOperand(1));
+ Instruction::Code dalvikOp = GetDalvikFPOpcode(op, false, rlDest.wide);
if (rlDest.wide) {
- genArithOpDouble(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
+ GenArithOpDouble(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
} else {
- genArithOpFloat(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
+ GenArithOpFloat(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
}
}
}
-void cvtIntNarrowing(CompilationUnit* cUnit, llvm::Instruction* inst,
+void CvtIntNarrowing(CompilationUnit* cUnit, llvm::Instruction* inst,
Instruction::Code opcode)
{
- RegLocation rlDest = getLoc(cUnit, inst);
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(0));
- genIntNarrowing(cUnit, opcode, rlDest, rlSrc);
+ RegLocation rlDest = GetLoc(cUnit, inst);
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
+ GenIntNarrowing(cUnit, opcode, rlDest, rlSrc);
}
-void cvtIntToFP(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtIntToFP(CompilationUnit* cUnit, llvm::Instruction* inst)
{
- RegLocation rlDest = getLoc(cUnit, inst);
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(0));
+ RegLocation rlDest = GetLoc(cUnit, inst);
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
Instruction::Code opcode;
if (rlDest.wide) {
if (rlSrc.wide) {
@@ -2331,13 +2331,13 @@
opcode = Instruction::INT_TO_FLOAT;
}
}
- genConversion(cUnit, opcode, rlDest, rlSrc);
+ GenConversion(cUnit, opcode, rlDest, rlSrc);
}
-void cvtFPToInt(CompilationUnit* cUnit, llvm::CallInst* call_inst)
+void CvtFPToInt(CompilationUnit* cUnit, llvm::CallInst* call_inst)
{
- RegLocation rlDest = getLoc(cUnit, call_inst);
- RegLocation rlSrc = getLoc(cUnit, call_inst->getOperand(0));
+ RegLocation rlDest = GetLoc(cUnit, call_inst);
+ RegLocation rlSrc = GetLoc(cUnit, call_inst->getOperand(0));
Instruction::Code opcode;
if (rlDest.wide) {
if (rlSrc.wide) {
@@ -2352,82 +2352,82 @@
opcode = Instruction::FLOAT_TO_INT;
}
}
- genConversion(cUnit, opcode, rlDest, rlSrc);
+ GenConversion(cUnit, opcode, rlDest, rlSrc);
}
-void cvtFloatToDouble(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtFloatToDouble(CompilationUnit* cUnit, llvm::Instruction* inst)
{
- RegLocation rlDest = getLoc(cUnit, inst);
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(0));
- genConversion(cUnit, Instruction::FLOAT_TO_DOUBLE, rlDest, rlSrc);
+ RegLocation rlDest = GetLoc(cUnit, inst);
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
+ GenConversion(cUnit, Instruction::FLOAT_TO_DOUBLE, rlDest, rlSrc);
}
-void cvtTrunc(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtTrunc(CompilationUnit* cUnit, llvm::Instruction* inst)
{
- RegLocation rlDest = getLoc(cUnit, inst);
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(0));
- rlSrc = oatUpdateLocWide(cUnit, rlSrc);
- rlSrc = oatWideToNarrow(cUnit, rlSrc);
- storeValue(cUnit, rlDest, rlSrc);
+ RegLocation rlDest = GetLoc(cUnit, inst);
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
+ rlSrc = UpdateLocWide(cUnit, rlSrc);
+ rlSrc = WideToNarrow(cUnit, rlSrc);
+ StoreValue(cUnit, rlDest, rlSrc);
}
-void cvtDoubleToFloat(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtDoubleToFloat(CompilationUnit* cUnit, llvm::Instruction* inst)
{
- RegLocation rlDest = getLoc(cUnit, inst);
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(0));
- genConversion(cUnit, Instruction::DOUBLE_TO_FLOAT, rlDest, rlSrc);
+ RegLocation rlDest = GetLoc(cUnit, inst);
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
+ GenConversion(cUnit, Instruction::DOUBLE_TO_FLOAT, rlDest, rlSrc);
}
-void cvtIntExt(CompilationUnit* cUnit, llvm::Instruction* inst, bool isSigned)
+void CvtIntExt(CompilationUnit* cUnit, llvm::Instruction* inst, bool isSigned)
{
// TODO: evaluate src/tgt types and add general support for more than int to long
- RegLocation rlDest = getLoc(cUnit, inst);
- RegLocation rlSrc = getLoc(cUnit, inst->getOperand(0));
+ RegLocation rlDest = GetLoc(cUnit, inst);
+ RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
DCHECK(rlDest.wide);
DCHECK(!rlSrc.wide);
DCHECK(!rlDest.fp);
DCHECK(!rlSrc.fp);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (rlSrc.location == kLocPhysReg) {
- opRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
+ OpRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
} else {
- loadValueDirect(cUnit, rlSrc, rlResult.lowReg);
+ LoadValueDirect(cUnit, rlSrc, rlResult.lowReg);
}
if (isSigned) {
- opRegRegImm(cUnit, kOpAsr, rlResult.highReg, rlResult.lowReg, 31);
+ OpRegRegImm(cUnit, kOpAsr, rlResult.highReg, rlResult.lowReg, 31);
} else {
- loadConstant(cUnit, rlResult.highReg, 0);
+ LoadConstant(cUnit, rlResult.highReg, 0);
}
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
}
-void cvtBinOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
+void CvtBinOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
{
- RegLocation rlDest = getLoc(cUnit, inst);
+ RegLocation rlDest = GetLoc(cUnit, inst);
llvm::Value* lhs = inst->getOperand(0);
// Special-case RSUB/NEG
llvm::ConstantInt* lhsImm = llvm::dyn_cast<llvm::ConstantInt>(lhs);
if ((op == kOpSub) && (lhsImm != NULL)) {
- RegLocation rlSrc1 = getLoc(cUnit, inst->getOperand(1));
+ RegLocation rlSrc1 = GetLoc(cUnit, inst->getOperand(1));
if (rlSrc1.wide) {
DCHECK_EQ(lhsImm->getSExtValue(), 0);
- genArithOpLong(cUnit, Instruction::NEG_LONG, rlDest, rlSrc1, rlSrc1);
+ GenArithOpLong(cUnit, Instruction::NEG_LONG, rlDest, rlSrc1, rlSrc1);
} else {
- genArithOpIntLit(cUnit, Instruction::RSUB_INT, rlDest, rlSrc1,
+ GenArithOpIntLit(cUnit, Instruction::RSUB_INT, rlDest, rlSrc1,
lhsImm->getSExtValue());
}
return;
}
DCHECK(lhsImm == NULL);
- RegLocation rlSrc1 = getLoc(cUnit, inst->getOperand(0));
+ RegLocation rlSrc1 = GetLoc(cUnit, inst->getOperand(0));
llvm::Value* rhs = inst->getOperand(1);
llvm::ConstantInt* constRhs = llvm::dyn_cast<llvm::ConstantInt>(rhs);
if (!rlDest.wide && (constRhs != NULL)) {
- Instruction::Code dalvikOp = getDalvikOpcode(op, true, false);
- genArithOpIntLit(cUnit, dalvikOp, rlDest, rlSrc1, constRhs->getSExtValue());
+ Instruction::Code dalvikOp = GetDalvikOpcode(op, true, false);
+ GenArithOpIntLit(cUnit, dalvikOp, rlDest, rlSrc1, constRhs->getSExtValue());
} else {
- Instruction::Code dalvikOp = getDalvikOpcode(op, false, rlDest.wide);
+ Instruction::Code dalvikOp = GetDalvikOpcode(op, false, rlDest.wide);
RegLocation rlSrc2;
if (constRhs != NULL) {
// ir_builder converts NOT_LONG to xor src, -1. Restore
@@ -2436,66 +2436,66 @@
dalvikOp = Instruction::NOT_LONG;
rlSrc2 = rlSrc1;
} else {
- rlSrc2 = getLoc(cUnit, rhs);
+ rlSrc2 = GetLoc(cUnit, rhs);
}
if (rlDest.wide) {
- genArithOpLong(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
+ GenArithOpLong(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
} else {
- genArithOpInt(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
+ GenArithOpInt(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2);
}
}
}
-void cvtShiftOp(CompilationUnit* cUnit, Instruction::Code opcode,
+void CvtShiftOp(CompilationUnit* cUnit, Instruction::Code opcode,
llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
- RegLocation rlDest = getLoc(cUnit, callInst);
- RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(0));
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(0));
llvm::Value* rhs = callInst->getArgOperand(1);
if (llvm::ConstantInt* src2 = llvm::dyn_cast<llvm::ConstantInt>(rhs)) {
DCHECK(!rlDest.wide);
- genArithOpIntLit(cUnit, opcode, rlDest, rlSrc, src2->getSExtValue());
+ GenArithOpIntLit(cUnit, opcode, rlDest, rlSrc, src2->getSExtValue());
} else {
- RegLocation rlShift = getLoc(cUnit, rhs);
+ RegLocation rlShift = GetLoc(cUnit, rhs);
if (callInst->getType() == cUnit->irb->getInt64Ty()) {
- genShiftOpLong(cUnit, opcode, rlDest, rlSrc, rlShift);
+ GenShiftOpLong(cUnit, opcode, rlDest, rlSrc, rlShift);
} else {
- genArithOpInt(cUnit, opcode, rlDest, rlSrc, rlShift);
+ GenArithOpInt(cUnit, opcode, rlDest, rlSrc, rlShift);
}
}
}
-void cvtBr(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtBr(CompilationUnit* cUnit, llvm::Instruction* inst)
{
llvm::BranchInst* brInst = llvm::dyn_cast<llvm::BranchInst>(inst);
DCHECK(brInst != NULL);
DCHECK(brInst->isUnconditional()); // May change - but this is all we use now
llvm::BasicBlock* targetBB = brInst->getSuccessor(0);
- opUnconditionalBranch(cUnit, cUnit->blockToLabelMap.Get(targetBB));
+ OpUnconditionalBranch(cUnit, cUnit->blockToLabelMap.Get(targetBB));
}
-void cvtPhi(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtPhi(CompilationUnit* cUnit, llvm::Instruction* inst)
{
// Nop - these have already been processed
}
-void cvtRet(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtRet(CompilationUnit* cUnit, llvm::Instruction* inst)
{
llvm::ReturnInst* retInst = llvm::dyn_cast<llvm::ReturnInst>(inst);
llvm::Value* retVal = retInst->getReturnValue();
if (retVal != NULL) {
- RegLocation rlSrc = getLoc(cUnit, retVal);
+ RegLocation rlSrc = GetLoc(cUnit, retVal);
if (rlSrc.wide) {
- storeValueWide(cUnit, oatGetReturnWide(cUnit, rlSrc.fp), rlSrc);
+ StoreValueWide(cUnit, GetReturnWide(cUnit, rlSrc.fp), rlSrc);
} else {
- storeValue(cUnit, oatGetReturn(cUnit, rlSrc.fp), rlSrc);
+ StoreValue(cUnit, GetReturn(cUnit, rlSrc.fp), rlSrc);
}
}
- genExitSequence(cUnit);
+ GenExitSequence(cUnit);
}
-ConditionCode getCond(llvm::ICmpInst::Predicate llvmCond)
+ConditionCode GetCond(llvm::ICmpInst::Predicate llvmCond)
{
ConditionCode res = kCondAl;
switch(llvmCond) {
@@ -2510,13 +2510,13 @@
return res;
}
-void cvtICmp(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtICmp(CompilationUnit* cUnit, llvm::Instruction* inst)
{
- // genCmpLong(cUnit, rlDest, rlSrc1, rlSrc2)
+ // GenCmpLong(cUnit, rlDest, rlSrc1, rlSrc2)
UNIMPLEMENTED(FATAL);
}
-void cvtICmpBr(CompilationUnit* cUnit, llvm::Instruction* inst,
+void CvtICmpBr(CompilationUnit* cUnit, llvm::Instruction* inst,
llvm::BranchInst* brInst)
{
// Get targets
@@ -2526,12 +2526,12 @@
LIR* fallThrough = cUnit->blockToLabelMap.Get(fallThroughBB);
// Get comparison operands
llvm::ICmpInst* iCmpInst = llvm::dyn_cast<llvm::ICmpInst>(inst);
- ConditionCode cond = getCond(iCmpInst->getPredicate());
+ ConditionCode cond = GetCond(iCmpInst->getPredicate());
llvm::Value* lhs = iCmpInst->getOperand(0);
// Not expecting a constant as 1st operand
DCHECK(llvm::dyn_cast<llvm::ConstantInt>(lhs) == NULL);
- RegLocation rlSrc1 = getLoc(cUnit, inst->getOperand(0));
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
+ RegLocation rlSrc1 = GetLoc(cUnit, inst->getOperand(0));
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
llvm::Value* rhs = inst->getOperand(1);
if (cUnit->instructionSet == kMips) {
// Compare and branch in one shot
@@ -2540,173 +2540,173 @@
//Compare, then branch
// TODO: handle fused CMP_LONG/IF_xxZ case
if (llvm::ConstantInt* src2 = llvm::dyn_cast<llvm::ConstantInt>(rhs)) {
- opRegImm(cUnit, kOpCmp, rlSrc1.lowReg, src2->getSExtValue());
+ OpRegImm(cUnit, kOpCmp, rlSrc1.lowReg, src2->getSExtValue());
} else if (llvm::dyn_cast<llvm::ConstantPointerNull>(rhs) != NULL) {
- opRegImm(cUnit, kOpCmp, rlSrc1.lowReg, 0);
+ OpRegImm(cUnit, kOpCmp, rlSrc1.lowReg, 0);
} else {
- RegLocation rlSrc2 = getLoc(cUnit, rhs);
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
- opRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
+ RegLocation rlSrc2 = GetLoc(cUnit, rhs);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
+ OpRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
}
- opCondBranch(cUnit, cond, taken);
+ OpCondBranch(cUnit, cond, taken);
// Fallthrough
- opUnconditionalBranch(cUnit, fallThrough);
+ OpUnconditionalBranch(cUnit, fallThrough);
}
-void cvtCall(CompilationUnit* cUnit, llvm::CallInst* callInst,
+void CvtCall(CompilationUnit* cUnit, llvm::CallInst* callInst,
llvm::Function* callee)
{
UNIMPLEMENTED(FATAL);
}
-void cvtCopy(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtCopy(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
- RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(0));
- RegLocation rlDest = getLoc(cUnit, callInst);
+ RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(0));
+ RegLocation rlDest = GetLoc(cUnit, callInst);
DCHECK_EQ(rlSrc.wide, rlDest.wide);
DCHECK_EQ(rlSrc.fp, rlDest.fp);
if (rlSrc.wide) {
- storeValueWide(cUnit, rlDest, rlSrc);
+ StoreValueWide(cUnit, rlDest, rlSrc);
} else {
- storeValue(cUnit, rlDest, rlSrc);
+ StoreValue(cUnit, rlDest, rlSrc);
}
}
// Note: Immediate arg is a ConstantInt regardless of result type
-void cvtConst(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtConst(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* src =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint64_t immval = src->getZExtValue();
- RegLocation rlDest = getLoc(cUnit, callInst);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
if (rlDest.wide) {
- loadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg,
+ LoadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg,
(immval) & 0xffffffff, (immval >> 32) & 0xffffffff);
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- loadConstantNoClobber(cUnit, rlResult.lowReg, immval & 0xffffffff);
- storeValue(cUnit, rlDest, rlResult);
+ LoadConstantNoClobber(cUnit, rlResult.lowReg, immval & 0xffffffff);
+ StoreValue(cUnit, rlDest, rlResult);
}
}
-void cvtConstObject(CompilationUnit* cUnit, llvm::CallInst* callInst,
+void CvtConstObject(CompilationUnit* cUnit, llvm::CallInst* callInst,
bool isString)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* idxVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint32_t index = idxVal->getZExtValue();
- RegLocation rlDest = getLoc(cUnit, callInst);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
if (isString) {
- genConstString(cUnit, index, rlDest);
+ GenConstString(cUnit, index, rlDest);
} else {
- genConstClass(cUnit, index, rlDest);
+ GenConstClass(cUnit, index, rlDest);
}
}
-void cvtFillArrayData(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtFillArrayData(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* offsetVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
- RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(1));
- genFillArrayData(cUnit, offsetVal->getSExtValue(), rlSrc);
+ RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(1));
+ GenFillArrayData(cUnit, offsetVal->getSExtValue(), rlSrc);
}
-void cvtNewInstance(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtNewInstance(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* typeIdxVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint32_t typeIdx = typeIdxVal->getZExtValue();
- RegLocation rlDest = getLoc(cUnit, callInst);
- genNewInstance(cUnit, typeIdx, rlDest);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenNewInstance(cUnit, typeIdx, rlDest);
}
-void cvtNewArray(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtNewArray(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdxVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint32_t typeIdx = typeIdxVal->getZExtValue();
llvm::Value* len = callInst->getArgOperand(1);
- RegLocation rlLen = getLoc(cUnit, len);
- RegLocation rlDest = getLoc(cUnit, callInst);
- genNewArray(cUnit, typeIdx, rlDest, rlLen);
+ RegLocation rlLen = GetLoc(cUnit, len);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenNewArray(cUnit, typeIdx, rlDest, rlLen);
}
-void cvtInstanceOf(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtInstanceOf(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdxVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint32_t typeIdx = typeIdxVal->getZExtValue();
llvm::Value* src = callInst->getArgOperand(1);
- RegLocation rlSrc = getLoc(cUnit, src);
- RegLocation rlDest = getLoc(cUnit, callInst);
- genInstanceof(cUnit, typeIdx, rlDest, rlSrc);
+ RegLocation rlSrc = GetLoc(cUnit, src);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenInstanceof(cUnit, typeIdx, rlDest, rlSrc);
}
-void cvtThrow(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtThrow(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::Value* src = callInst->getArgOperand(0);
- RegLocation rlSrc = getLoc(cUnit, src);
- genThrow(cUnit, rlSrc);
+ RegLocation rlSrc = GetLoc(cUnit, src);
+ GenThrow(cUnit, rlSrc);
}
-void cvtMonitorEnterExit(CompilationUnit* cUnit, bool isEnter,
+void CvtMonitorEnterExit(CompilationUnit* cUnit, bool isEnter,
llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* optFlags =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
llvm::Value* src = callInst->getArgOperand(1);
- RegLocation rlSrc = getLoc(cUnit, src);
+ RegLocation rlSrc = GetLoc(cUnit, src);
if (isEnter) {
- genMonitorEnter(cUnit, optFlags->getZExtValue(), rlSrc);
+ GenMonitorEnter(cUnit, optFlags->getZExtValue(), rlSrc);
} else {
- genMonitorExit(cUnit, optFlags->getZExtValue(), rlSrc);
+ GenMonitorExit(cUnit, optFlags->getZExtValue(), rlSrc);
}
}
-void cvtArrayLength(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtArrayLength(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* optFlags =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
llvm::Value* src = callInst->getArgOperand(1);
- RegLocation rlSrc = getLoc(cUnit, src);
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- genNullCheck(cUnit, rlSrc.sRegLow, rlSrc.lowReg, optFlags->getZExtValue());
- RegLocation rlDest = getLoc(cUnit, callInst);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ RegLocation rlSrc = GetLoc(cUnit, src);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ GenNullCheck(cUnit, rlSrc.sRegLow, rlSrc.lowReg, optFlags->getZExtValue());
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
int lenOffset = Array::LengthOffset().Int32Value();
- loadWordDisp(cUnit, rlSrc.lowReg, lenOffset, rlResult.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ LoadWordDisp(cUnit, rlSrc.lowReg, lenOffset, rlResult.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
-void cvtMoveException(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtMoveException(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
- RegLocation rlDest = getLoc(cUnit, callInst);
- genMoveException(cUnit, rlDest);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenMoveException(cUnit, rlDest);
}
-void cvtSget(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide,
+void CvtSget(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide,
bool isObject)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* typeIdxVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint32_t typeIdx = typeIdxVal->getZExtValue();
- RegLocation rlDest = getLoc(cUnit, callInst);
- genSget(cUnit, typeIdx, rlDest, isWide, isObject);
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenSget(cUnit, typeIdx, rlDest, isWide, isObject);
}
-void cvtSput(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide,
+void CvtSput(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide,
bool isObject)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
@@ -2714,107 +2714,107 @@
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
uint32_t typeIdx = typeIdxVal->getZExtValue();
llvm::Value* src = callInst->getArgOperand(1);
- RegLocation rlSrc = getLoc(cUnit, src);
- genSput(cUnit, typeIdx, rlSrc, isWide, isObject);
+ RegLocation rlSrc = GetLoc(cUnit, src);
+ GenSput(cUnit, typeIdx, rlSrc, isWide, isObject);
}
-void cvtAget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+void CvtAget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
int scale)
{
DCHECK_EQ(callInst->getNumArgOperands(), 3U);
llvm::ConstantInt* optFlags =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
- RegLocation rlArray = getLoc(cUnit, callInst->getArgOperand(1));
- RegLocation rlIndex = getLoc(cUnit, callInst->getArgOperand(2));
- RegLocation rlDest = getLoc(cUnit, callInst);
- genArrayGet(cUnit, optFlags->getZExtValue(), size, rlArray, rlIndex,
+ RegLocation rlArray = GetLoc(cUnit, callInst->getArgOperand(1));
+ RegLocation rlIndex = GetLoc(cUnit, callInst->getArgOperand(2));
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenArrayGet(cUnit, optFlags->getZExtValue(), size, rlArray, rlIndex,
rlDest, scale);
}
-void cvtAput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+void CvtAput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
int scale, bool isObject)
{
DCHECK_EQ(callInst->getNumArgOperands(), 4U);
llvm::ConstantInt* optFlags =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
- RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(1));
- RegLocation rlArray = getLoc(cUnit, callInst->getArgOperand(2));
- RegLocation rlIndex = getLoc(cUnit, callInst->getArgOperand(3));
+ RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(1));
+ RegLocation rlArray = GetLoc(cUnit, callInst->getArgOperand(2));
+ RegLocation rlIndex = GetLoc(cUnit, callInst->getArgOperand(3));
if (isObject) {
- genArrayObjPut(cUnit, optFlags->getZExtValue(), rlArray, rlIndex,
+ GenArrayObjPut(cUnit, optFlags->getZExtValue(), rlArray, rlIndex,
rlSrc, scale);
} else {
- genArrayPut(cUnit, optFlags->getZExtValue(), size, rlArray, rlIndex,
+ GenArrayPut(cUnit, optFlags->getZExtValue(), size, rlArray, rlIndex,
rlSrc, scale);
}
}
-void cvtAputObj(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtAputObj(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
- cvtAput(cUnit, callInst, kWord, 2, true /* isObject */);
+ CvtAput(cUnit, callInst, kWord, 2, true /* isObject */);
}
-void cvtAputPrimitive(CompilationUnit* cUnit, llvm::CallInst* callInst,
+void CvtAputPrimitive(CompilationUnit* cUnit, llvm::CallInst* callInst,
OpSize size, int scale)
{
- cvtAput(cUnit, callInst, size, scale, false /* isObject */);
+ CvtAput(cUnit, callInst, size, scale, false /* isObject */);
}
-void cvtIget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+void CvtIget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
bool isWide, bool isObj)
{
DCHECK_EQ(callInst->getNumArgOperands(), 3U);
llvm::ConstantInt* optFlags =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
- RegLocation rlObj = getLoc(cUnit, callInst->getArgOperand(1));
+ RegLocation rlObj = GetLoc(cUnit, callInst->getArgOperand(1));
llvm::ConstantInt* fieldIdx =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(2));
- RegLocation rlDest = getLoc(cUnit, callInst);
- genIGet(cUnit, fieldIdx->getZExtValue(), optFlags->getZExtValue(),
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenIGet(cUnit, fieldIdx->getZExtValue(), optFlags->getZExtValue(),
size, rlDest, rlObj, isWide, isObj);
}
-void cvtIput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+void CvtIput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
bool isWide, bool isObj)
{
DCHECK_EQ(callInst->getNumArgOperands(), 4U);
llvm::ConstantInt* optFlags =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
- RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(1));
- RegLocation rlObj = getLoc(cUnit, callInst->getArgOperand(2));
+ RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(1));
+ RegLocation rlObj = GetLoc(cUnit, callInst->getArgOperand(2));
llvm::ConstantInt* fieldIdx =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(3));
- genIPut(cUnit, fieldIdx->getZExtValue(), optFlags->getZExtValue(),
+ GenIPut(cUnit, fieldIdx->getZExtValue(), optFlags->getZExtValue(),
size, rlSrc, rlObj, isWide, isObj);
}
-void cvtCheckCast(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtCheckCast(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdx =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
- RegLocation rlSrc = getLoc(cUnit, callInst->getArgOperand(1));
- genCheckCast(cUnit, typeIdx->getZExtValue(), rlSrc);
+ RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(1));
+ GenCheckCast(cUnit, typeIdx->getZExtValue(), rlSrc);
}
-void cvtFPCompare(CompilationUnit* cUnit, llvm::CallInst* callInst,
+void CvtFPCompare(CompilationUnit* cUnit, llvm::CallInst* callInst,
Instruction::Code opcode)
{
- RegLocation rlSrc1 = getLoc(cUnit, callInst->getArgOperand(0));
- RegLocation rlSrc2 = getLoc(cUnit, callInst->getArgOperand(1));
- RegLocation rlDest = getLoc(cUnit, callInst);
- genCmpFP(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ RegLocation rlSrc1 = GetLoc(cUnit, callInst->getArgOperand(0));
+ RegLocation rlSrc2 = GetLoc(cUnit, callInst->getArgOperand(1));
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenCmpFP(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
}
-void cvtLongCompare(CompilationUnit* cUnit, llvm::CallInst* callInst)
+void CvtLongCompare(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
- RegLocation rlSrc1 = getLoc(cUnit, callInst->getArgOperand(0));
- RegLocation rlSrc2 = getLoc(cUnit, callInst->getArgOperand(1));
- RegLocation rlDest = getLoc(cUnit, callInst);
- genCmpLong(cUnit, rlDest, rlSrc1, rlSrc2);
+ RegLocation rlSrc1 = GetLoc(cUnit, callInst->getArgOperand(0));
+ RegLocation rlSrc2 = GetLoc(cUnit, callInst->getArgOperand(1));
+ RegLocation rlDest = GetLoc(cUnit, callInst);
+ GenCmpLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
-void cvtSwitch(CompilationUnit* cUnit, llvm::Instruction* inst)
+void CvtSwitch(CompilationUnit* cUnit, llvm::Instruction* inst)
{
llvm::SwitchInst* swInst = llvm::dyn_cast<llvm::SwitchInst>(inst);
DCHECK(swInst != NULL);
@@ -2824,25 +2824,25 @@
llvm::ConstantInt* tableOffsetValue =
static_cast<llvm::ConstantInt*>(tableOffsetNode->getOperand(0));
int32_t tableOffset = tableOffsetValue->getSExtValue();
- RegLocation rlSrc = getLoc(cUnit, testVal);
+ RegLocation rlSrc = GetLoc(cUnit, testVal);
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
uint16_t tableMagic = *table;
if (tableMagic == 0x100) {
- genPackedSwitch(cUnit, tableOffset, rlSrc);
+ GenPackedSwitch(cUnit, tableOffset, rlSrc);
} else {
DCHECK_EQ(tableMagic, 0x200);
- genSparseSwitch(cUnit, tableOffset, rlSrc);
+ GenSparseSwitch(cUnit, tableOffset, rlSrc);
}
}
-void cvtInvoke(CompilationUnit* cUnit, llvm::CallInst* callInst,
+void CvtInvoke(CompilationUnit* cUnit, llvm::CallInst* callInst,
bool isVoid, bool isFilledNewArray)
{
- CallInfo* info = static_cast<CallInfo*>(oatNew(cUnit, sizeof(CallInfo), true, kAllocMisc));
+ CallInfo* info = static_cast<CallInfo*>(NewMem(cUnit, sizeof(CallInfo), true, kAllocMisc));
if (isVoid) {
info->result.location = kLocInvalid;
} else {
- info->result = getLoc(cUnit, callInst);
+ info->result = GetLoc(cUnit, callInst);
}
llvm::ConstantInt* invokeTypeVal =
llvm::dyn_cast<llvm::ConstantInt>(callInst->getArgOperand(0));
@@ -2858,14 +2858,14 @@
// Count the argument words, and then build argument array.
info->numArgWords = 0;
for (unsigned int i = 3; i < callInst->getNumArgOperands(); i++) {
- RegLocation tLoc = getLoc(cUnit, callInst->getArgOperand(i));
+ RegLocation tLoc = GetLoc(cUnit, callInst->getArgOperand(i));
info->numArgWords += tLoc.wide ? 2 : 1;
}
info->args = (info->numArgWords == 0) ? NULL : static_cast<RegLocation*>
- (oatNew(cUnit, sizeof(RegLocation) * info->numArgWords, false, kAllocMisc));
+ (NewMem(cUnit, sizeof(RegLocation) * info->numArgWords, false, kAllocMisc));
// Now, fill in the location records, synthesizing high loc of wide vals
for (int i = 3, next = 0; next < info->numArgWords;) {
- info->args[next] = getLoc(cUnit, callInst->getArgOperand(i++));
+ info->args[next] = GetLoc(cUnit, callInst->getArgOperand(i++));
if (info->args[next].wide) {
next++;
// TODO: Might make sense to mark this as an invalid loc
@@ -2878,21 +2878,21 @@
info->isRange = (info->numArgWords > 5);
if (isFilledNewArray) {
- genFilledNewArray(cUnit, info);
+ GenFilledNewArray(cUnit, info);
} else {
- genInvoke(cUnit, info);
+ GenInvoke(cUnit, info);
}
}
/* Look up the RegLocation associated with a Value. Must already be defined */
-RegLocation valToLoc(CompilationUnit* cUnit, llvm::Value* val)
+RegLocation ValToLoc(CompilationUnit* cUnit, llvm::Value* val)
{
SafeMap<llvm::Value*, RegLocation>::iterator it = cUnit->locMap.find(val);
DCHECK(it != cUnit->locMap.end()) << "Missing definition";
return it->second;
}
-bool methodBitcodeBlockCodeGen(CompilationUnit* cUnit, llvm::BasicBlock* bb)
+bool MethodBitcodeBlockCodeGen(CompilationUnit* cUnit, llvm::BasicBlock* bb)
{
while (cUnit->llvmBlocks.find(bb) == cUnit->llvmBlocks.end()) {
llvm::BasicBlock* nextBB = NULL;
@@ -2919,42 +2919,42 @@
// Set the label kind
blockLabel->opcode = kPseudoNormalBlockLabel;
// Insert the label
- oatAppendLIR(cUnit, blockLabel);
+ AppendLIR(cUnit, blockLabel);
LIR* headLIR = NULL;
if (blockType == kCatchBlock) {
- headLIR = newLIR0(cUnit, kPseudoExportedPC);
+ headLIR = NewLIR0(cUnit, kPseudoExportedPC);
}
// Free temp registers and reset redundant store tracking */
- oatResetRegPool(cUnit);
- oatResetDefTracking(cUnit);
+ ResetRegPool(cUnit);
+ ResetDefTracking(cUnit);
//TODO: restore oat incoming liveness optimization
- oatClobberAllRegs(cUnit);
+ ClobberAllRegs(cUnit);
if (isEntry) {
- RegLocation* argLocs = static_cast<RegLocation*>
- (oatNew(cUnit, sizeof(RegLocation) * cUnit->numIns, true, kAllocMisc));
+ RegLocation* ArgLocs = static_cast<RegLocation*>
+ (NewMem(cUnit, sizeof(RegLocation) * cUnit->numIns, true, kAllocMisc));
llvm::Function::arg_iterator it(cUnit->func->arg_begin());
llvm::Function::arg_iterator it_end(cUnit->func->arg_end());
// Skip past Method*
it++;
for (unsigned i = 0; it != it_end; ++it) {
llvm::Value* val = it;
- argLocs[i++] = valToLoc(cUnit, val);
+ ArgLocs[i++] = ValToLoc(cUnit, val);
llvm::Type* ty = val->getType();
if ((ty == cUnit->irb->getInt64Ty()) || (ty == cUnit->irb->getDoubleTy())) {
- argLocs[i] = argLocs[i-1];
- argLocs[i].lowReg = argLocs[i].highReg;
- argLocs[i].origSReg++;
- argLocs[i].sRegLow = INVALID_SREG;
- argLocs[i].highWord = true;
+ ArgLocs[i] = ArgLocs[i-1];
+ ArgLocs[i].lowReg = ArgLocs[i].highReg;
+ ArgLocs[i].origSReg++;
+ ArgLocs[i].sRegLow = INVALID_SREG;
+ ArgLocs[i].highWord = true;
i++;
}
}
- genEntrySequence(cUnit, argLocs, cUnit->methodLoc);
+ GenEntrySequence(cUnit, ArgLocs, cUnit->methodLoc);
}
// Visit all of the instructions in the block
@@ -2970,13 +2970,13 @@
cUnit->currentDalvikOffset = dexOffsetValue->getZExtValue();
}
- oatResetRegPool(cUnit);
+ ResetRegPool(cUnit);
if (cUnit->disableOpt & (1 << kTrackLiveTemps)) {
- oatClobberAllRegs(cUnit);
+ ClobberAllRegs(cUnit);
}
if (cUnit->disableOpt & (1 << kSuppressLoads)) {
- oatResetDefTracking(cUnit);
+ ResetDefTracking(cUnit);
}
#ifndef NDEBUG
@@ -2985,7 +2985,7 @@
#endif
// TODO: use llvm opcode name here instead of "boundary" if verbose
- LIR* boundaryLIR = markBoundary(cUnit, cUnit->currentDalvikOffset, "boundary");
+ LIR* boundaryLIR = MarkBoundary(cUnit, cUnit->currentDalvikOffset, "boundary");
/* Remember the first LIR for thisl block*/
if (headLIR == NULL) {
@@ -2999,10 +2999,10 @@
llvm::Instruction* nextInst = nextIt;
llvm::BranchInst* brInst = llvm::dyn_cast<llvm::BranchInst>(nextInst);
if (brInst != NULL /* and... */) {
- cvtICmpBr(cUnit, inst, brInst);
+ CvtICmpBr(cUnit, inst, brInst);
++it;
} else {
- cvtICmp(cUnit, inst);
+ CvtICmp(cUnit, inst);
}
}
break;
@@ -3024,59 +3024,59 @@
case greenland::IntrinsicHelper::CopyFloat:
case greenland::IntrinsicHelper::CopyLong:
case greenland::IntrinsicHelper::CopyDouble:
- cvtCopy(cUnit, callInst);
+ CvtCopy(cUnit, callInst);
break;
case greenland::IntrinsicHelper::ConstInt:
case greenland::IntrinsicHelper::ConstObj:
case greenland::IntrinsicHelper::ConstLong:
case greenland::IntrinsicHelper::ConstFloat:
case greenland::IntrinsicHelper::ConstDouble:
- cvtConst(cUnit, callInst);
+ CvtConst(cUnit, callInst);
break;
case greenland::IntrinsicHelper::DivInt:
case greenland::IntrinsicHelper::DivLong:
- cvtBinOp(cUnit, kOpDiv, inst);
+ CvtBinOp(cUnit, kOpDiv, inst);
break;
case greenland::IntrinsicHelper::RemInt:
case greenland::IntrinsicHelper::RemLong:
- cvtBinOp(cUnit, kOpRem, inst);
+ CvtBinOp(cUnit, kOpRem, inst);
break;
case greenland::IntrinsicHelper::MethodInfo:
// Already dealt with - just ignore it here.
break;
case greenland::IntrinsicHelper::CheckSuspend:
- genSuspendTest(cUnit, 0 /* optFlags already applied */);
+ GenSuspendTest(cUnit, 0 /* optFlags already applied */);
break;
case greenland::IntrinsicHelper::HLInvokeObj:
case greenland::IntrinsicHelper::HLInvokeFloat:
case greenland::IntrinsicHelper::HLInvokeDouble:
case greenland::IntrinsicHelper::HLInvokeLong:
case greenland::IntrinsicHelper::HLInvokeInt:
- cvtInvoke(cUnit, callInst, false /* isVoid */, false /* newArray */);
+ CvtInvoke(cUnit, callInst, false /* isVoid */, false /* newArray */);
break;
case greenland::IntrinsicHelper::HLInvokeVoid:
- cvtInvoke(cUnit, callInst, true /* isVoid */, false /* newArray */);
+ CvtInvoke(cUnit, callInst, true /* isVoid */, false /* newArray */);
break;
case greenland::IntrinsicHelper::HLFilledNewArray:
- cvtInvoke(cUnit, callInst, false /* isVoid */, true /* newArray */);
+ CvtInvoke(cUnit, callInst, false /* isVoid */, true /* newArray */);
break;
case greenland::IntrinsicHelper::HLFillArrayData:
- cvtFillArrayData(cUnit, callInst);
+ CvtFillArrayData(cUnit, callInst);
break;
case greenland::IntrinsicHelper::ConstString:
- cvtConstObject(cUnit, callInst, true /* isString */);
+ CvtConstObject(cUnit, callInst, true /* isString */);
break;
case greenland::IntrinsicHelper::ConstClass:
- cvtConstObject(cUnit, callInst, false /* isString */);
+ CvtConstObject(cUnit, callInst, false /* isString */);
break;
case greenland::IntrinsicHelper::HLCheckCast:
- cvtCheckCast(cUnit, callInst);
+ CvtCheckCast(cUnit, callInst);
break;
case greenland::IntrinsicHelper::NewInstance:
- cvtNewInstance(cUnit, callInst);
+ CvtNewInstance(cUnit, callInst);
break;
case greenland::IntrinsicHelper::HLSgetObject:
- cvtSget(cUnit, callInst, false /* wide */, true /* Object */);
+ CvtSget(cUnit, callInst, false /* wide */, true /* Object */);
break;
case greenland::IntrinsicHelper::HLSget:
case greenland::IntrinsicHelper::HLSgetFloat:
@@ -3084,11 +3084,11 @@
case greenland::IntrinsicHelper::HLSgetByte:
case greenland::IntrinsicHelper::HLSgetChar:
case greenland::IntrinsicHelper::HLSgetShort:
- cvtSget(cUnit, callInst, false /* wide */, false /* Object */);
+ CvtSget(cUnit, callInst, false /* wide */, false /* Object */);
break;
case greenland::IntrinsicHelper::HLSgetWide:
case greenland::IntrinsicHelper::HLSgetDouble:
- cvtSget(cUnit, callInst, true /* wide */, false /* Object */);
+ CvtSget(cUnit, callInst, true /* wide */, false /* Object */);
break;
case greenland::IntrinsicHelper::HLSput:
case greenland::IntrinsicHelper::HLSputFloat:
@@ -3096,190 +3096,190 @@
case greenland::IntrinsicHelper::HLSputByte:
case greenland::IntrinsicHelper::HLSputChar:
case greenland::IntrinsicHelper::HLSputShort:
- cvtSput(cUnit, callInst, false /* wide */, false /* Object */);
+ CvtSput(cUnit, callInst, false /* wide */, false /* Object */);
break;
case greenland::IntrinsicHelper::HLSputWide:
case greenland::IntrinsicHelper::HLSputDouble:
- cvtSput(cUnit, callInst, true /* wide */, false /* Object */);
+ CvtSput(cUnit, callInst, true /* wide */, false /* Object */);
break;
case greenland::IntrinsicHelper::HLSputObject:
- cvtSput(cUnit, callInst, false /* wide */, true /* Object */);
+ CvtSput(cUnit, callInst, false /* wide */, true /* Object */);
break;
case greenland::IntrinsicHelper::GetException:
- cvtMoveException(cUnit, callInst);
+ CvtMoveException(cUnit, callInst);
break;
case greenland::IntrinsicHelper::HLThrowException:
- cvtThrow(cUnit, callInst);
+ CvtThrow(cUnit, callInst);
break;
case greenland::IntrinsicHelper::MonitorEnter:
- cvtMonitorEnterExit(cUnit, true /* isEnter */, callInst);
+ CvtMonitorEnterExit(cUnit, true /* isEnter */, callInst);
break;
case greenland::IntrinsicHelper::MonitorExit:
- cvtMonitorEnterExit(cUnit, false /* isEnter */, callInst);
+ CvtMonitorEnterExit(cUnit, false /* isEnter */, callInst);
break;
case greenland::IntrinsicHelper::OptArrayLength:
- cvtArrayLength(cUnit, callInst);
+ CvtArrayLength(cUnit, callInst);
break;
case greenland::IntrinsicHelper::NewArray:
- cvtNewArray(cUnit, callInst);
+ CvtNewArray(cUnit, callInst);
break;
case greenland::IntrinsicHelper::InstanceOf:
- cvtInstanceOf(cUnit, callInst);
+ CvtInstanceOf(cUnit, callInst);
break;
case greenland::IntrinsicHelper::HLArrayGet:
case greenland::IntrinsicHelper::HLArrayGetObject:
case greenland::IntrinsicHelper::HLArrayGetFloat:
- cvtAget(cUnit, callInst, kWord, 2);
+ CvtAget(cUnit, callInst, kWord, 2);
break;
case greenland::IntrinsicHelper::HLArrayGetWide:
case greenland::IntrinsicHelper::HLArrayGetDouble:
- cvtAget(cUnit, callInst, kLong, 3);
+ CvtAget(cUnit, callInst, kLong, 3);
break;
case greenland::IntrinsicHelper::HLArrayGetBoolean:
- cvtAget(cUnit, callInst, kUnsignedByte, 0);
+ CvtAget(cUnit, callInst, kUnsignedByte, 0);
break;
case greenland::IntrinsicHelper::HLArrayGetByte:
- cvtAget(cUnit, callInst, kSignedByte, 0);
+ CvtAget(cUnit, callInst, kSignedByte, 0);
break;
case greenland::IntrinsicHelper::HLArrayGetChar:
- cvtAget(cUnit, callInst, kUnsignedHalf, 1);
+ CvtAget(cUnit, callInst, kUnsignedHalf, 1);
break;
case greenland::IntrinsicHelper::HLArrayGetShort:
- cvtAget(cUnit, callInst, kSignedHalf, 1);
+ CvtAget(cUnit, callInst, kSignedHalf, 1);
break;
case greenland::IntrinsicHelper::HLArrayPut:
case greenland::IntrinsicHelper::HLArrayPutFloat:
- cvtAputPrimitive(cUnit, callInst, kWord, 2);
+ CvtAputPrimitive(cUnit, callInst, kWord, 2);
break;
case greenland::IntrinsicHelper::HLArrayPutObject:
- cvtAputObj(cUnit, callInst);
+ CvtAputObj(cUnit, callInst);
break;
case greenland::IntrinsicHelper::HLArrayPutWide:
case greenland::IntrinsicHelper::HLArrayPutDouble:
- cvtAputPrimitive(cUnit, callInst, kLong, 3);
+ CvtAputPrimitive(cUnit, callInst, kLong, 3);
break;
case greenland::IntrinsicHelper::HLArrayPutBoolean:
- cvtAputPrimitive(cUnit, callInst, kUnsignedByte, 0);
+ CvtAputPrimitive(cUnit, callInst, kUnsignedByte, 0);
break;
case greenland::IntrinsicHelper::HLArrayPutByte:
- cvtAputPrimitive(cUnit, callInst, kSignedByte, 0);
+ CvtAputPrimitive(cUnit, callInst, kSignedByte, 0);
break;
case greenland::IntrinsicHelper::HLArrayPutChar:
- cvtAputPrimitive(cUnit, callInst, kUnsignedHalf, 1);
+ CvtAputPrimitive(cUnit, callInst, kUnsignedHalf, 1);
break;
case greenland::IntrinsicHelper::HLArrayPutShort:
- cvtAputPrimitive(cUnit, callInst, kSignedHalf, 1);
+ CvtAputPrimitive(cUnit, callInst, kSignedHalf, 1);
break;
case greenland::IntrinsicHelper::HLIGet:
case greenland::IntrinsicHelper::HLIGetFloat:
- cvtIget(cUnit, callInst, kWord, false /* isWide */, false /* obj */);
+ CvtIget(cUnit, callInst, kWord, false /* isWide */, false /* obj */);
break;
case greenland::IntrinsicHelper::HLIGetObject:
- cvtIget(cUnit, callInst, kWord, false /* isWide */, true /* obj */);
+ CvtIget(cUnit, callInst, kWord, false /* isWide */, true /* obj */);
break;
case greenland::IntrinsicHelper::HLIGetWide:
case greenland::IntrinsicHelper::HLIGetDouble:
- cvtIget(cUnit, callInst, kLong, true /* isWide */, false /* obj */);
+ CvtIget(cUnit, callInst, kLong, true /* isWide */, false /* obj */);
break;
case greenland::IntrinsicHelper::HLIGetBoolean:
- cvtIget(cUnit, callInst, kUnsignedByte, false /* isWide */,
+ CvtIget(cUnit, callInst, kUnsignedByte, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIGetByte:
- cvtIget(cUnit, callInst, kSignedByte, false /* isWide */,
+ CvtIget(cUnit, callInst, kSignedByte, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIGetChar:
- cvtIget(cUnit, callInst, kUnsignedHalf, false /* isWide */,
+ CvtIget(cUnit, callInst, kUnsignedHalf, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIGetShort:
- cvtIget(cUnit, callInst, kSignedHalf, false /* isWide */,
+ CvtIget(cUnit, callInst, kSignedHalf, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIPut:
case greenland::IntrinsicHelper::HLIPutFloat:
- cvtIput(cUnit, callInst, kWord, false /* isWide */, false /* obj */);
+ CvtIput(cUnit, callInst, kWord, false /* isWide */, false /* obj */);
break;
case greenland::IntrinsicHelper::HLIPutObject:
- cvtIput(cUnit, callInst, kWord, false /* isWide */, true /* obj */);
+ CvtIput(cUnit, callInst, kWord, false /* isWide */, true /* obj */);
break;
case greenland::IntrinsicHelper::HLIPutWide:
case greenland::IntrinsicHelper::HLIPutDouble:
- cvtIput(cUnit, callInst, kLong, true /* isWide */, false /* obj */);
+ CvtIput(cUnit, callInst, kLong, true /* isWide */, false /* obj */);
break;
case greenland::IntrinsicHelper::HLIPutBoolean:
- cvtIput(cUnit, callInst, kUnsignedByte, false /* isWide */,
+ CvtIput(cUnit, callInst, kUnsignedByte, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIPutByte:
- cvtIput(cUnit, callInst, kSignedByte, false /* isWide */,
+ CvtIput(cUnit, callInst, kSignedByte, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIPutChar:
- cvtIput(cUnit, callInst, kUnsignedHalf, false /* isWide */,
+ CvtIput(cUnit, callInst, kUnsignedHalf, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::HLIPutShort:
- cvtIput(cUnit, callInst, kSignedHalf, false /* isWide */,
+ CvtIput(cUnit, callInst, kSignedHalf, false /* isWide */,
false /* obj */);
break;
case greenland::IntrinsicHelper::IntToChar:
- cvtIntNarrowing(cUnit, callInst, Instruction::INT_TO_CHAR);
+ CvtIntNarrowing(cUnit, callInst, Instruction::INT_TO_CHAR);
break;
case greenland::IntrinsicHelper::IntToShort:
- cvtIntNarrowing(cUnit, callInst, Instruction::INT_TO_SHORT);
+ CvtIntNarrowing(cUnit, callInst, Instruction::INT_TO_SHORT);
break;
case greenland::IntrinsicHelper::IntToByte:
- cvtIntNarrowing(cUnit, callInst, Instruction::INT_TO_BYTE);
+ CvtIntNarrowing(cUnit, callInst, Instruction::INT_TO_BYTE);
break;
case greenland::IntrinsicHelper::F2I:
case greenland::IntrinsicHelper::D2I:
case greenland::IntrinsicHelper::F2L:
case greenland::IntrinsicHelper::D2L:
- cvtFPToInt(cUnit, callInst);
+ CvtFPToInt(cUnit, callInst);
break;
case greenland::IntrinsicHelper::CmplFloat:
- cvtFPCompare(cUnit, callInst, Instruction::CMPL_FLOAT);
+ CvtFPCompare(cUnit, callInst, Instruction::CMPL_FLOAT);
break;
case greenland::IntrinsicHelper::CmpgFloat:
- cvtFPCompare(cUnit, callInst, Instruction::CMPG_FLOAT);
+ CvtFPCompare(cUnit, callInst, Instruction::CMPG_FLOAT);
break;
case greenland::IntrinsicHelper::CmplDouble:
- cvtFPCompare(cUnit, callInst, Instruction::CMPL_DOUBLE);
+ CvtFPCompare(cUnit, callInst, Instruction::CMPL_DOUBLE);
break;
case greenland::IntrinsicHelper::CmpgDouble:
- cvtFPCompare(cUnit, callInst, Instruction::CMPG_DOUBLE);
+ CvtFPCompare(cUnit, callInst, Instruction::CMPG_DOUBLE);
break;
case greenland::IntrinsicHelper::CmpLong:
- cvtLongCompare(cUnit, callInst);
+ CvtLongCompare(cUnit, callInst);
break;
case greenland::IntrinsicHelper::SHLLong:
- cvtShiftOp(cUnit, Instruction::SHL_LONG, callInst);
+ CvtShiftOp(cUnit, Instruction::SHL_LONG, callInst);
break;
case greenland::IntrinsicHelper::SHRLong:
- cvtShiftOp(cUnit, Instruction::SHR_LONG, callInst);
+ CvtShiftOp(cUnit, Instruction::SHR_LONG, callInst);
break;
case greenland::IntrinsicHelper::USHRLong:
- cvtShiftOp(cUnit, Instruction::USHR_LONG, callInst);
+ CvtShiftOp(cUnit, Instruction::USHR_LONG, callInst);
break;
case greenland::IntrinsicHelper::SHLInt:
- cvtShiftOp(cUnit, Instruction::SHL_INT, callInst);
+ CvtShiftOp(cUnit, Instruction::SHL_INT, callInst);
break;
case greenland::IntrinsicHelper::SHRInt:
- cvtShiftOp(cUnit, Instruction::SHR_INT, callInst);
+ CvtShiftOp(cUnit, Instruction::SHR_INT, callInst);
break;
case greenland::IntrinsicHelper::USHRInt:
- cvtShiftOp(cUnit, Instruction::USHR_INT, callInst);
+ CvtShiftOp(cUnit, Instruction::USHR_INT, callInst);
break;
case greenland::IntrinsicHelper::CatchTargets: {
@@ -3294,7 +3294,7 @@
*/
llvm::BasicBlock* targetBB = swInst->getDefaultDest();
DCHECK(targetBB != NULL);
- opUnconditionalBranch(cUnit,
+ OpUnconditionalBranch(cUnit,
cUnit->blockToLabelMap.Get(targetBB));
++it;
// Set next bb to default target - improves code layout
@@ -3308,33 +3308,33 @@
}
break;
- case llvm::Instruction::Br: cvtBr(cUnit, inst); break;
- case llvm::Instruction::Add: cvtBinOp(cUnit, kOpAdd, inst); break;
- case llvm::Instruction::Sub: cvtBinOp(cUnit, kOpSub, inst); break;
- case llvm::Instruction::Mul: cvtBinOp(cUnit, kOpMul, inst); break;
- case llvm::Instruction::SDiv: cvtBinOp(cUnit, kOpDiv, inst); break;
- case llvm::Instruction::SRem: cvtBinOp(cUnit, kOpRem, inst); break;
- case llvm::Instruction::And: cvtBinOp(cUnit, kOpAnd, inst); break;
- case llvm::Instruction::Or: cvtBinOp(cUnit, kOpOr, inst); break;
- case llvm::Instruction::Xor: cvtBinOp(cUnit, kOpXor, inst); break;
- case llvm::Instruction::PHI: cvtPhi(cUnit, inst); break;
- case llvm::Instruction::Ret: cvtRet(cUnit, inst); break;
- case llvm::Instruction::FAdd: cvtBinFPOp(cUnit, kOpAdd, inst); break;
- case llvm::Instruction::FSub: cvtBinFPOp(cUnit, kOpSub, inst); break;
- case llvm::Instruction::FMul: cvtBinFPOp(cUnit, kOpMul, inst); break;
- case llvm::Instruction::FDiv: cvtBinFPOp(cUnit, kOpDiv, inst); break;
- case llvm::Instruction::FRem: cvtBinFPOp(cUnit, kOpRem, inst); break;
- case llvm::Instruction::SIToFP: cvtIntToFP(cUnit, inst); break;
- case llvm::Instruction::FPTrunc: cvtDoubleToFloat(cUnit, inst); break;
- case llvm::Instruction::FPExt: cvtFloatToDouble(cUnit, inst); break;
- case llvm::Instruction::Trunc: cvtTrunc(cUnit, inst); break;
+ case llvm::Instruction::Br: CvtBr(cUnit, inst); break;
+ case llvm::Instruction::Add: CvtBinOp(cUnit, kOpAdd, inst); break;
+ case llvm::Instruction::Sub: CvtBinOp(cUnit, kOpSub, inst); break;
+ case llvm::Instruction::Mul: CvtBinOp(cUnit, kOpMul, inst); break;
+ case llvm::Instruction::SDiv: CvtBinOp(cUnit, kOpDiv, inst); break;
+ case llvm::Instruction::SRem: CvtBinOp(cUnit, kOpRem, inst); break;
+ case llvm::Instruction::And: CvtBinOp(cUnit, kOpAnd, inst); break;
+ case llvm::Instruction::Or: CvtBinOp(cUnit, kOpOr, inst); break;
+ case llvm::Instruction::Xor: CvtBinOp(cUnit, kOpXor, inst); break;
+ case llvm::Instruction::PHI: CvtPhi(cUnit, inst); break;
+ case llvm::Instruction::Ret: CvtRet(cUnit, inst); break;
+ case llvm::Instruction::FAdd: CvtBinFPOp(cUnit, kOpAdd, inst); break;
+ case llvm::Instruction::FSub: CvtBinFPOp(cUnit, kOpSub, inst); break;
+ case llvm::Instruction::FMul: CvtBinFPOp(cUnit, kOpMul, inst); break;
+ case llvm::Instruction::FDiv: CvtBinFPOp(cUnit, kOpDiv, inst); break;
+ case llvm::Instruction::FRem: CvtBinFPOp(cUnit, kOpRem, inst); break;
+ case llvm::Instruction::SIToFP: CvtIntToFP(cUnit, inst); break;
+ case llvm::Instruction::FPTrunc: CvtDoubleToFloat(cUnit, inst); break;
+ case llvm::Instruction::FPExt: CvtFloatToDouble(cUnit, inst); break;
+ case llvm::Instruction::Trunc: CvtTrunc(cUnit, inst); break;
- case llvm::Instruction::ZExt: cvtIntExt(cUnit, inst, false /* signed */);
+ case llvm::Instruction::ZExt: CvtIntExt(cUnit, inst, false /* signed */);
break;
- case llvm::Instruction::SExt: cvtIntExt(cUnit, inst, true /* signed */);
+ case llvm::Instruction::SExt: CvtIntExt(cUnit, inst, true /* signed */);
break;
- case llvm::Instruction::Switch: cvtSwitch(cUnit, inst); break;
+ case llvm::Instruction::Switch: CvtSwitch(cUnit, inst); break;
case llvm::Instruction::Unreachable:
break; // FIXME: can we really ignore these?
@@ -3380,7 +3380,7 @@
}
if (headLIR != NULL) {
- oatApplyLocalOptimizations(cUnit, headLIR, cUnit->lastLIRInsn);
+ ApplyLocalOptimizations(cUnit, headLIR, cUnit->lastLIRInsn);
}
if (nextBB != NULL) {
bb = nextBB;
@@ -3404,13 +3404,13 @@
* o Assemble LIR as usual.
* o Profit.
*/
-void oatMethodBitcode2LIR(CompilationUnit* cUnit)
+void MethodBitcode2LIR(CompilationUnit* cUnit)
{
llvm::Function* func = cUnit->func;
int numBasicBlocks = func->getBasicBlockList().size();
// Allocate a list for LIR basic block labels
cUnit->blockLabelList =
- static_cast<LIR*>(oatNew(cUnit, sizeof(LIR) * numBasicBlocks, true, kAllocLIR));
+ static_cast<LIR*>(NewMem(cUnit, sizeof(LIR) * numBasicBlocks, true, kAllocLIR));
LIR* labelList = cUnit->blockLabelList;
int nextLabel = 0;
for (llvm::Function::iterator i = func->begin(),
@@ -3487,55 +3487,55 @@
uint32_t mapData = rawMapData->getZExtValue();
PromotionMap* p = &cUnit->promotionMap[i];
p->firstInPair = (mapData >> 24) & 0xff;
- p->fpReg = (mapData >> 16) & 0xff;
+ p->FpReg = (mapData >> 16) & 0xff;
p->coreReg = (mapData >> 8) & 0xff;
p->fpLocation = static_cast<RegLocationType>((mapData >> 4) & 0xf);
if (p->fpLocation == kLocPhysReg) {
- oatRecordFpPromotion(cUnit, p->fpReg, i);
+ RecordFpPromotion(cUnit, p->FpReg, i);
}
p->coreLocation = static_cast<RegLocationType>(mapData & 0xf);
if (p->coreLocation == kLocPhysReg) {
- oatRecordCorePromotion(cUnit, p->coreReg, i);
+ RecordCorePromotion(cUnit, p->coreReg, i);
}
}
if (cUnit->printMe) {
- oatDumpPromotionMap(cUnit);
+ DumpPromotionMap(cUnit);
}
}
break;
}
}
}
- oatAdjustSpillMask(cUnit);
- cUnit->frameSize = oatComputeFrameSize(cUnit);
+ AdjustSpillMask(cUnit);
+ cUnit->frameSize = ComputeFrameSize(cUnit);
// Create RegLocations for arguments
llvm::Function::arg_iterator it(cUnit->func->arg_begin());
llvm::Function::arg_iterator it_end(cUnit->func->arg_end());
for (; it != it_end; ++it) {
llvm::Value* val = it;
- createLocFromValue(cUnit, val);
+ CreateLocFromValue(cUnit, val);
}
// Create RegLocations for all non-argument defintions
for (llvm::inst_iterator i = llvm::inst_begin(func),
e = llvm::inst_end(func); i != e; ++i) {
llvm::Value* val = &*i;
if (val->hasName() && (val->getName().str().c_str()[0] == 'v')) {
- createLocFromValue(cUnit, val);
+ CreateLocFromValue(cUnit, val);
}
}
// Walk the blocks, generating code.
for (llvm::Function::iterator i = cUnit->func->begin(),
e = cUnit->func->end(); i != e; ++i) {
- methodBitcodeBlockCodeGen(cUnit, static_cast<llvm::BasicBlock*>(i));
+ MethodBitcodeBlockCodeGen(cUnit, static_cast<llvm::BasicBlock*>(i));
}
- handleSuspendLaunchpads(cUnit);
+ HandleSuspendLaunchPads(cUnit);
- handleThrowLaunchpads(cUnit);
+ HandleThrowLaunchPads(cUnit);
- handleIntrinsicLaunchpads(cUnit);
+ HandleIntrinsicLaunchPads(cUnit);
cUnit->func->eraseFromParent();
cUnit->func = NULL;
diff --git a/src/compiler/codegen/method_bitcode.h b/src/compiler/codegen/method_bitcode.h
index 8b14286..1d6a1c9 100644
--- a/src/compiler/codegen/method_bitcode.h
+++ b/src/compiler/codegen/method_bitcode.h
@@ -19,8 +19,8 @@
namespace art {
-void oatMethodMIR2Bitcode(CompilationUnit* cUnit);
-void oatMethodBitcode2LIR(CompilationUnit* cUnit);
+void MethodMIR2Bitcode(CompilationUnit* cUnit);
+void MethodBitcode2LIR(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/codegen/method_codegen_driver.cc b/src/compiler/codegen/method_codegen_driver.cc
index 4bf5a40..f7480b1 100644
--- a/src/compiler/codegen/method_codegen_driver.cc
+++ b/src/compiler/codegen/method_codegen_driver.cc
@@ -29,29 +29,29 @@
INVALID_SREG};
/* Mark register usage state and return long retloc */
-RegLocation oatGetReturnWide(CompilationUnit* cUnit, bool isDouble)
+RegLocation GetReturnWide(CompilationUnit* cUnit, bool isDouble)
{
- RegLocation gpr_res = locCReturnWide();
- RegLocation fpr_res = locCReturnDouble();
+ RegLocation gpr_res = LocCReturnWide();
+ RegLocation fpr_res = LocCReturnDouble();
RegLocation res = isDouble ? fpr_res : gpr_res;
- oatClobber(cUnit, res.lowReg);
- oatClobber(cUnit, res.highReg);
- oatLockTemp(cUnit, res.lowReg);
- oatLockTemp(cUnit, res.highReg);
- oatMarkPair(cUnit, res.lowReg, res.highReg);
+ Clobber(cUnit, res.lowReg);
+ Clobber(cUnit, res.highReg);
+ LockTemp(cUnit, res.lowReg);
+ LockTemp(cUnit, res.highReg);
+ MarkPair(cUnit, res.lowReg, res.highReg);
return res;
}
-RegLocation oatGetReturn(CompilationUnit* cUnit, bool isFloat)
+RegLocation GetReturn(CompilationUnit* cUnit, bool isFloat)
{
- RegLocation gpr_res = locCReturn();
- RegLocation fpr_res = locCReturnFloat();
+ RegLocation gpr_res = LocCReturn();
+ RegLocation fpr_res = LocCReturnFloat();
RegLocation res = isFloat ? fpr_res : gpr_res;
- oatClobber(cUnit, res.lowReg);
+ Clobber(cUnit, res.lowReg);
if (cUnit->instructionSet == kMips) {
- oatMarkInUse(cUnit, res.lowReg);
+ MarkInUse(cUnit, res.lowReg);
} else {
- oatLockTemp(cUnit, res.lowReg);
+ LockTemp(cUnit, res.lowReg);
}
return res;
}
@@ -61,7 +61,7 @@
* load/store utilities here, or target-dependent genXX() handlers
* when necessary.
*/
-bool compileDalvikInstruction(CompilationUnit* cUnit, MIR* mir,
+bool CompileDalvikInstruction(CompilationUnit* cUnit, MIR* mir,
BasicBlock* bb, LIR* labelList)
{
bool res = false; // Assume success
@@ -80,34 +80,34 @@
rlSrc[0] = rlSrc[1] = rlSrc[2] = badLoc;
if (attrs & DF_UA) {
if (attrs & DF_A_WIDE) {
- rlSrc[nextLoc++] = oatGetSrcWide(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrcWide(cUnit, mir, nextSreg);
nextSreg+= 2;
} else {
- rlSrc[nextLoc++] = oatGetSrc(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrc(cUnit, mir, nextSreg);
nextSreg++;
}
}
if (attrs & DF_UB) {
if (attrs & DF_B_WIDE) {
- rlSrc[nextLoc++] = oatGetSrcWide(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrcWide(cUnit, mir, nextSreg);
nextSreg+= 2;
} else {
- rlSrc[nextLoc++] = oatGetSrc(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrc(cUnit, mir, nextSreg);
nextSreg++;
}
}
if (attrs & DF_UC) {
if (attrs & DF_C_WIDE) {
- rlSrc[nextLoc++] = oatGetSrcWide(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrcWide(cUnit, mir, nextSreg);
} else {
- rlSrc[nextLoc++] = oatGetSrc(cUnit, mir, nextSreg);
+ rlSrc[nextLoc++] = GetSrc(cUnit, mir, nextSreg);
}
}
if (attrs & DF_DA) {
if (attrs & DF_A_WIDE) {
- rlDest = oatGetDestWide(cUnit, mir);
+ rlDest = GetDestWide(cUnit, mir);
} else {
- rlDest = oatGetDest(cUnit, mir);
+ rlDest = GetDest(cUnit, mir);
}
}
switch (opcode) {
@@ -115,41 +115,41 @@
break;
case Instruction::MOVE_EXCEPTION:
- genMoveException(cUnit, rlDest);
+ GenMoveException(cUnit, rlDest);
break;
case Instruction::RETURN_VOID:
if (!(cUnit->attrs & METHOD_IS_LEAF)) {
- genSuspendTest(cUnit, optFlags);
+ GenSuspendTest(cUnit, optFlags);
}
break;
case Instruction::RETURN:
case Instruction::RETURN_OBJECT:
if (!(cUnit->attrs & METHOD_IS_LEAF)) {
- genSuspendTest(cUnit, optFlags);
+ GenSuspendTest(cUnit, optFlags);
}
- storeValue(cUnit, oatGetReturn(cUnit, cUnit->shorty[0] == 'F'), rlSrc[0]);
+ StoreValue(cUnit, GetReturn(cUnit, cUnit->shorty[0] == 'F'), rlSrc[0]);
break;
case Instruction::RETURN_WIDE:
if (!(cUnit->attrs & METHOD_IS_LEAF)) {
- genSuspendTest(cUnit, optFlags);
+ GenSuspendTest(cUnit, optFlags);
}
- storeValueWide(cUnit, oatGetReturnWide(cUnit,
+ StoreValueWide(cUnit, GetReturnWide(cUnit,
cUnit->shorty[0] == 'D'), rlSrc[0]);
break;
case Instruction::MOVE_RESULT_WIDE:
if (optFlags & MIR_INLINED)
break; // Nop - combined w/ previous invoke
- storeValueWide(cUnit, rlDest, oatGetReturnWide(cUnit, rlDest.fp));
+ StoreValueWide(cUnit, rlDest, GetReturnWide(cUnit, rlDest.fp));
break;
case Instruction::MOVE_RESULT:
case Instruction::MOVE_RESULT_OBJECT:
if (optFlags & MIR_INLINED)
break; // Nop - combined w/ previous invoke
- storeValue(cUnit, rlDest, oatGetReturn(cUnit, rlDest.fp));
+ StoreValue(cUnit, rlDest, GetReturn(cUnit, rlDest.fp));
break;
case Instruction::MOVE:
@@ -158,140 +158,140 @@
case Instruction::MOVE_OBJECT_16:
case Instruction::MOVE_FROM16:
case Instruction::MOVE_OBJECT_FROM16:
- storeValue(cUnit, rlDest, rlSrc[0]);
+ StoreValue(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::MOVE_WIDE:
case Instruction::MOVE_WIDE_16:
case Instruction::MOVE_WIDE_FROM16:
- storeValueWide(cUnit, rlDest, rlSrc[0]);
+ StoreValueWide(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::CONST:
case Instruction::CONST_4:
case Instruction::CONST_16:
- rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
- loadConstantNoClobber(cUnit, rlResult.lowReg, vB);
- storeValue(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
+ LoadConstantNoClobber(cUnit, rlResult.lowReg, vB);
+ StoreValue(cUnit, rlDest, rlResult);
break;
case Instruction::CONST_HIGH16:
- rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
- loadConstantNoClobber(cUnit, rlResult.lowReg, vB << 16);
- storeValue(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
+ LoadConstantNoClobber(cUnit, rlResult.lowReg, vB << 16);
+ StoreValue(cUnit, rlDest, rlResult);
break;
case Instruction::CONST_WIDE_16:
case Instruction::CONST_WIDE_32:
- rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
- loadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg, vB,
+ rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
+ LoadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg, vB,
(vB & 0x80000000) ? -1 : 0);
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
break;
case Instruction::CONST_WIDE:
- rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
- loadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg,
+ rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
+ LoadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg,
mir->dalvikInsn.vB_wide & 0xffffffff,
(mir->dalvikInsn.vB_wide >> 32) & 0xffffffff);
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
break;
case Instruction::CONST_WIDE_HIGH16:
- rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true);
- loadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg,
+ rlResult = EvalLoc(cUnit, rlDest, kAnyReg, true);
+ LoadConstantValueWide(cUnit, rlResult.lowReg, rlResult.highReg,
0, vB << 16);
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
break;
case Instruction::MONITOR_ENTER:
- genMonitorEnter(cUnit, optFlags, rlSrc[0]);
+ GenMonitorEnter(cUnit, optFlags, rlSrc[0]);
break;
case Instruction::MONITOR_EXIT:
- genMonitorExit(cUnit, optFlags, rlSrc[0]);
+ GenMonitorExit(cUnit, optFlags, rlSrc[0]);
break;
case Instruction::CHECK_CAST:
- genCheckCast(cUnit, vB, rlSrc[0]);
+ GenCheckCast(cUnit, vB, rlSrc[0]);
break;
case Instruction::INSTANCE_OF:
- genInstanceof(cUnit, vC, rlDest, rlSrc[0]);
+ GenInstanceof(cUnit, vC, rlDest, rlSrc[0]);
break;
case Instruction::NEW_INSTANCE:
- genNewInstance(cUnit, vB, rlDest);
+ GenNewInstance(cUnit, vB, rlDest);
break;
case Instruction::THROW:
- genThrow(cUnit, rlSrc[0]);
+ GenThrow(cUnit, rlSrc[0]);
break;
case Instruction::ARRAY_LENGTH:
int lenOffset;
lenOffset = Array::LengthOffset().Int32Value();
- rlSrc[0] = loadValue(cUnit, rlSrc[0], kCoreReg);
- genNullCheck(cUnit, rlSrc[0].sRegLow, rlSrc[0].lowReg, optFlags);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- loadWordDisp(cUnit, rlSrc[0].lowReg, lenOffset, rlResult.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc[0] = LoadValue(cUnit, rlSrc[0], kCoreReg);
+ GenNullCheck(cUnit, rlSrc[0].sRegLow, rlSrc[0].lowReg, optFlags);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ LoadWordDisp(cUnit, rlSrc[0].lowReg, lenOffset, rlResult.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
break;
case Instruction::CONST_STRING:
case Instruction::CONST_STRING_JUMBO:
- genConstString(cUnit, vB, rlDest);
+ GenConstString(cUnit, vB, rlDest);
break;
case Instruction::CONST_CLASS:
- genConstClass(cUnit, vB, rlDest);
+ GenConstClass(cUnit, vB, rlDest);
break;
case Instruction::FILL_ARRAY_DATA:
- genFillArrayData(cUnit, vB, rlSrc[0]);
+ GenFillArrayData(cUnit, vB, rlSrc[0]);
break;
case Instruction::FILLED_NEW_ARRAY:
- genFilledNewArray(cUnit, oatNewCallInfo(cUnit, bb, mir, kStatic,
+ GenFilledNewArray(cUnit, NewMemCallInfo(cUnit, bb, mir, kStatic,
false /* not range */));
break;
case Instruction::FILLED_NEW_ARRAY_RANGE:
- genFilledNewArray(cUnit, oatNewCallInfo(cUnit, bb, mir, kStatic,
+ GenFilledNewArray(cUnit, NewMemCallInfo(cUnit, bb, mir, kStatic,
true /* range */));
break;
case Instruction::NEW_ARRAY:
- genNewArray(cUnit, vC, rlDest, rlSrc[0]);
+ GenNewArray(cUnit, vC, rlDest, rlSrc[0]);
break;
case Instruction::GOTO:
case Instruction::GOTO_16:
case Instruction::GOTO_32:
if (bb->taken->startOffset <= mir->offset) {
- genSuspendTestAndBranch(cUnit, optFlags, &labelList[bb->taken->id]);
+ GenSuspendTestAndBranch(cUnit, optFlags, &labelList[bb->taken->id]);
} else {
- opUnconditionalBranch(cUnit, &labelList[bb->taken->id]);
+ OpUnconditionalBranch(cUnit, &labelList[bb->taken->id]);
}
break;
case Instruction::PACKED_SWITCH:
- genPackedSwitch(cUnit, vB, rlSrc[0]);
+ GenPackedSwitch(cUnit, vB, rlSrc[0]);
break;
case Instruction::SPARSE_SWITCH:
- genSparseSwitch(cUnit, vB, rlSrc[0]);
+ GenSparseSwitch(cUnit, vB, rlSrc[0]);
break;
case Instruction::CMPL_FLOAT:
case Instruction::CMPG_FLOAT:
case Instruction::CMPL_DOUBLE:
case Instruction::CMPG_DOUBLE:
- res = genCmpFP(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
+ res = GenCmpFP(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::CMP_LONG:
- genCmpLong(cUnit, rlDest, rlSrc[0], rlSrc[1]);
+ GenCmpLong(cUnit, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::IF_EQ:
@@ -305,9 +305,9 @@
bool backwardBranch;
backwardBranch = (bb->taken->startOffset <= mir->offset);
if (backwardBranch) {
- genSuspendTest(cUnit, optFlags);
+ GenSuspendTest(cUnit, optFlags);
}
- genCompareAndBranch(cUnit, opcode, rlSrc[0], rlSrc[1], taken,
+ GenCompareAndBranch(cUnit, opcode, rlSrc[0], rlSrc[1], taken,
fallThrough);
break;
}
@@ -323,123 +323,123 @@
bool backwardBranch;
backwardBranch = (bb->taken->startOffset <= mir->offset);
if (backwardBranch) {
- genSuspendTest(cUnit, optFlags);
+ GenSuspendTest(cUnit, optFlags);
}
- genCompareZeroAndBranch(cUnit, opcode, rlSrc[0], taken, fallThrough);
+ GenCompareZeroAndBranch(cUnit, opcode, rlSrc[0], taken, fallThrough);
break;
}
case Instruction::AGET_WIDE:
- genArrayGet(cUnit, optFlags, kLong, rlSrc[0], rlSrc[1], rlDest, 3);
+ GenArrayGet(cUnit, optFlags, kLong, rlSrc[0], rlSrc[1], rlDest, 3);
break;
case Instruction::AGET:
case Instruction::AGET_OBJECT:
- genArrayGet(cUnit, optFlags, kWord, rlSrc[0], rlSrc[1], rlDest, 2);
+ GenArrayGet(cUnit, optFlags, kWord, rlSrc[0], rlSrc[1], rlDest, 2);
break;
case Instruction::AGET_BOOLEAN:
- genArrayGet(cUnit, optFlags, kUnsignedByte, rlSrc[0], rlSrc[1], rlDest, 0);
+ GenArrayGet(cUnit, optFlags, kUnsignedByte, rlSrc[0], rlSrc[1], rlDest, 0);
break;
case Instruction::AGET_BYTE:
- genArrayGet(cUnit, optFlags, kSignedByte, rlSrc[0], rlSrc[1], rlDest, 0);
+ GenArrayGet(cUnit, optFlags, kSignedByte, rlSrc[0], rlSrc[1], rlDest, 0);
break;
case Instruction::AGET_CHAR:
- genArrayGet(cUnit, optFlags, kUnsignedHalf, rlSrc[0], rlSrc[1], rlDest, 1);
+ GenArrayGet(cUnit, optFlags, kUnsignedHalf, rlSrc[0], rlSrc[1], rlDest, 1);
break;
case Instruction::AGET_SHORT:
- genArrayGet(cUnit, optFlags, kSignedHalf, rlSrc[0], rlSrc[1], rlDest, 1);
+ GenArrayGet(cUnit, optFlags, kSignedHalf, rlSrc[0], rlSrc[1], rlDest, 1);
break;
case Instruction::APUT_WIDE:
- genArrayPut(cUnit, optFlags, kLong, rlSrc[1], rlSrc[2], rlSrc[0], 3);
+ GenArrayPut(cUnit, optFlags, kLong, rlSrc[1], rlSrc[2], rlSrc[0], 3);
break;
case Instruction::APUT:
- genArrayPut(cUnit, optFlags, kWord, rlSrc[1], rlSrc[2], rlSrc[0], 2);
+ GenArrayPut(cUnit, optFlags, kWord, rlSrc[1], rlSrc[2], rlSrc[0], 2);
break;
case Instruction::APUT_OBJECT:
- genArrayObjPut(cUnit, optFlags, rlSrc[1], rlSrc[2], rlSrc[0], 2);
+ GenArrayObjPut(cUnit, optFlags, rlSrc[1], rlSrc[2], rlSrc[0], 2);
break;
case Instruction::APUT_SHORT:
case Instruction::APUT_CHAR:
- genArrayPut(cUnit, optFlags, kUnsignedHalf, rlSrc[1], rlSrc[2], rlSrc[0], 1);
+ GenArrayPut(cUnit, optFlags, kUnsignedHalf, rlSrc[1], rlSrc[2], rlSrc[0], 1);
break;
case Instruction::APUT_BYTE:
case Instruction::APUT_BOOLEAN:
- genArrayPut(cUnit, optFlags, kUnsignedByte, rlSrc[1], rlSrc[2],
+ GenArrayPut(cUnit, optFlags, kUnsignedByte, rlSrc[1], rlSrc[2],
rlSrc[0], 0);
break;
case Instruction::IGET_OBJECT:
//case Instruction::IGET_OBJECT_VOLATILE:
- genIGet(cUnit, vC, optFlags, kWord, rlDest, rlSrc[0], false, true);
+ GenIGet(cUnit, vC, optFlags, kWord, rlDest, rlSrc[0], false, true);
break;
case Instruction::IGET_WIDE:
//case Instruction::IGET_WIDE_VOLATILE:
- genIGet(cUnit, vC, optFlags, kLong, rlDest, rlSrc[0], true, false);
+ GenIGet(cUnit, vC, optFlags, kLong, rlDest, rlSrc[0], true, false);
break;
case Instruction::IGET:
//case Instruction::IGET_VOLATILE:
- genIGet(cUnit, vC, optFlags, kWord, rlDest, rlSrc[0], false, false);
+ GenIGet(cUnit, vC, optFlags, kWord, rlDest, rlSrc[0], false, false);
break;
case Instruction::IGET_CHAR:
- genIGet(cUnit, vC, optFlags, kUnsignedHalf, rlDest, rlSrc[0], false, false);
+ GenIGet(cUnit, vC, optFlags, kUnsignedHalf, rlDest, rlSrc[0], false, false);
break;
case Instruction::IGET_SHORT:
- genIGet(cUnit, vC, optFlags, kSignedHalf, rlDest, rlSrc[0], false, false);
+ GenIGet(cUnit, vC, optFlags, kSignedHalf, rlDest, rlSrc[0], false, false);
break;
case Instruction::IGET_BOOLEAN:
case Instruction::IGET_BYTE:
- genIGet(cUnit, vC, optFlags, kUnsignedByte, rlDest, rlSrc[0], false, false);
+ GenIGet(cUnit, vC, optFlags, kUnsignedByte, rlDest, rlSrc[0], false, false);
break;
case Instruction::IPUT_WIDE:
//case Instruction::IPUT_WIDE_VOLATILE:
- genIPut(cUnit, vC, optFlags, kLong, rlSrc[0], rlSrc[1], true, false);
+ GenIPut(cUnit, vC, optFlags, kLong, rlSrc[0], rlSrc[1], true, false);
break;
case Instruction::IPUT_OBJECT:
//case Instruction::IPUT_OBJECT_VOLATILE:
- genIPut(cUnit, vC, optFlags, kWord, rlSrc[0], rlSrc[1], false, true);
+ GenIPut(cUnit, vC, optFlags, kWord, rlSrc[0], rlSrc[1], false, true);
break;
case Instruction::IPUT:
//case Instruction::IPUT_VOLATILE:
- genIPut(cUnit, vC, optFlags, kWord, rlSrc[0], rlSrc[1], false, false);
+ GenIPut(cUnit, vC, optFlags, kWord, rlSrc[0], rlSrc[1], false, false);
break;
case Instruction::IPUT_BOOLEAN:
case Instruction::IPUT_BYTE:
- genIPut(cUnit, vC, optFlags, kUnsignedByte, rlSrc[0], rlSrc[1], false, false);
+ GenIPut(cUnit, vC, optFlags, kUnsignedByte, rlSrc[0], rlSrc[1], false, false);
break;
case Instruction::IPUT_CHAR:
- genIPut(cUnit, vC, optFlags, kUnsignedHalf, rlSrc[0], rlSrc[1], false, false);
+ GenIPut(cUnit, vC, optFlags, kUnsignedHalf, rlSrc[0], rlSrc[1], false, false);
break;
case Instruction::IPUT_SHORT:
- genIPut(cUnit, vC, optFlags, kSignedHalf, rlSrc[0], rlSrc[1], false, false);
+ GenIPut(cUnit, vC, optFlags, kSignedHalf, rlSrc[0], rlSrc[1], false, false);
break;
case Instruction::SGET_OBJECT:
- genSget(cUnit, vB, rlDest, false, true);
+ GenSget(cUnit, vB, rlDest, false, true);
break;
case Instruction::SGET:
case Instruction::SGET_BOOLEAN:
case Instruction::SGET_BYTE:
case Instruction::SGET_CHAR:
case Instruction::SGET_SHORT:
- genSget(cUnit, vB, rlDest, false, false);
+ GenSget(cUnit, vB, rlDest, false, false);
break;
case Instruction::SGET_WIDE:
- genSget(cUnit, vB, rlDest, true, false);
+ GenSget(cUnit, vB, rlDest, true, false);
break;
case Instruction::SPUT_OBJECT:
- genSput(cUnit, vB, rlSrc[0], false, true);
+ GenSput(cUnit, vB, rlSrc[0], false, true);
break;
case Instruction::SPUT:
@@ -447,80 +447,80 @@
case Instruction::SPUT_BYTE:
case Instruction::SPUT_CHAR:
case Instruction::SPUT_SHORT:
- genSput(cUnit, vB, rlSrc[0], false, false);
+ GenSput(cUnit, vB, rlSrc[0], false, false);
break;
case Instruction::SPUT_WIDE:
- genSput(cUnit, vB, rlSrc[0], true, false);
+ GenSput(cUnit, vB, rlSrc[0], true, false);
break;
case Instruction::INVOKE_STATIC_RANGE:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kStatic, true));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kStatic, true));
break;
case Instruction::INVOKE_STATIC:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kStatic, false));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kStatic, false));
break;
case Instruction::INVOKE_DIRECT:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kDirect, false));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kDirect, false));
break;
case Instruction::INVOKE_DIRECT_RANGE:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kDirect, true));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kDirect, true));
break;
case Instruction::INVOKE_VIRTUAL:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kVirtual, false));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kVirtual, false));
break;
case Instruction::INVOKE_VIRTUAL_RANGE:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kVirtual, true));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kVirtual, true));
break;
case Instruction::INVOKE_SUPER:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kSuper, false));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kSuper, false));
break;
case Instruction::INVOKE_SUPER_RANGE:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kSuper, true));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kSuper, true));
break;
case Instruction::INVOKE_INTERFACE:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kInterface, false));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kInterface, false));
break;
case Instruction::INVOKE_INTERFACE_RANGE:
- genInvoke(cUnit, oatNewCallInfo(cUnit, bb, mir, kInterface, true));
+ GenInvoke(cUnit, NewMemCallInfo(cUnit, bb, mir, kInterface, true));
break;
case Instruction::NEG_INT:
case Instruction::NOT_INT:
- res = genArithOpInt(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
+ res = GenArithOpInt(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
break;
case Instruction::NEG_LONG:
case Instruction::NOT_LONG:
- res = genArithOpLong(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
+ res = GenArithOpLong(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
break;
case Instruction::NEG_FLOAT:
- res = genArithOpFloat(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
+ res = GenArithOpFloat(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
break;
case Instruction::NEG_DOUBLE:
- res = genArithOpDouble(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
+ res = GenArithOpDouble(cUnit, opcode, rlDest, rlSrc[0], rlSrc[0]);
break;
case Instruction::INT_TO_LONG:
- genIntToLong(cUnit, rlDest, rlSrc[0]);
+ GenIntToLong(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::LONG_TO_INT:
- rlSrc[0] = oatUpdateLocWide(cUnit, rlSrc[0]);
- rlSrc[0] = oatWideToNarrow(cUnit, rlSrc[0]);
- storeValue(cUnit, rlDest, rlSrc[0]);
+ rlSrc[0] = UpdateLocWide(cUnit, rlSrc[0]);
+ rlSrc[0] = WideToNarrow(cUnit, rlSrc[0]);
+ StoreValue(cUnit, rlDest, rlSrc[0]);
break;
case Instruction::INT_TO_BYTE:
case Instruction::INT_TO_SHORT:
case Instruction::INT_TO_CHAR:
- genIntNarrowing(cUnit, opcode, rlDest, rlSrc[0]);
+ GenIntNarrowing(cUnit, opcode, rlDest, rlSrc[0]);
break;
case Instruction::INT_TO_FLOAT:
@@ -533,7 +533,7 @@
case Instruction::DOUBLE_TO_INT:
case Instruction::DOUBLE_TO_LONG:
case Instruction::DOUBLE_TO_FLOAT:
- genConversion(cUnit, opcode, rlDest, rlSrc[0]);
+ GenConversion(cUnit, opcode, rlDest, rlSrc[0]);
break;
case Instruction::ADD_INT:
@@ -558,7 +558,7 @@
case Instruction::SHL_INT_2ADDR:
case Instruction::SHR_INT_2ADDR:
case Instruction::USHR_INT_2ADDR:
- genArithOpInt(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
+ GenArithOpInt(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::ADD_LONG:
@@ -577,7 +577,7 @@
case Instruction::AND_LONG_2ADDR:
case Instruction::OR_LONG_2ADDR:
case Instruction::XOR_LONG_2ADDR:
- genArithOpLong(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
+ GenArithOpLong(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::SHL_LONG:
@@ -586,7 +586,7 @@
case Instruction::SHL_LONG_2ADDR:
case Instruction::SHR_LONG_2ADDR:
case Instruction::USHR_LONG_2ADDR:
- genShiftOpLong(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
+ GenShiftOpLong(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::ADD_FLOAT:
@@ -599,7 +599,7 @@
case Instruction::MUL_FLOAT_2ADDR:
case Instruction::DIV_FLOAT_2ADDR:
case Instruction::REM_FLOAT_2ADDR:
- genArithOpFloat(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
+ GenArithOpFloat(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::ADD_DOUBLE:
@@ -612,7 +612,7 @@
case Instruction::MUL_DOUBLE_2ADDR:
case Instruction::DIV_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE_2ADDR:
- genArithOpDouble(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
+ GenArithOpDouble(cUnit, opcode, rlDest, rlSrc[0], rlSrc[1]);
break;
case Instruction::RSUB_INT:
@@ -634,7 +634,7 @@
case Instruction::SHL_INT_LIT8:
case Instruction::SHR_INT_LIT8:
case Instruction::USHR_INT_LIT8:
- genArithOpIntLit(cUnit, opcode, rlDest, rlSrc[0], vC);
+ GenArithOpIntLit(cUnit, opcode, rlDest, rlSrc[0], vC);
break;
default:
@@ -644,47 +644,47 @@
}
/* Extended MIR instructions like PHI */
-void handleExtendedMethodMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
+void HandleExtendedMethodMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
{
int opOffset = mir->dalvikInsn.opcode - kMirOpFirst;
char* msg = NULL;
if (cUnit->printMe) {
- msg = static_cast<char*>(oatNew(cUnit, strlen(extendedMIROpNames[opOffset]) + 1,
+ msg = static_cast<char*>(NewMem(cUnit, strlen(extendedMIROpNames[opOffset]) + 1,
false, kAllocDebugInfo));
strcpy(msg, extendedMIROpNames[opOffset]);
}
- LIR* op = newLIR1(cUnit, kPseudoExtended, reinterpret_cast<uintptr_t>(msg));
+ LIR* op = NewLIR1(cUnit, kPseudoExtended, reinterpret_cast<uintptr_t>(msg));
switch (static_cast<ExtendedMIROpcode>(mir->dalvikInsn.opcode)) {
case kMirOpPhi: {
char* ssaString = NULL;
if (cUnit->printMe) {
- ssaString = oatGetSSAString(cUnit, mir->ssaRep);
+ ssaString = GetSSAString(cUnit, mir->ssaRep);
}
op->flags.isNop = true;
- newLIR1(cUnit, kPseudoSSARep, reinterpret_cast<uintptr_t>(ssaString));
+ NewLIR1(cUnit, kPseudoSSARep, reinterpret_cast<uintptr_t>(ssaString));
break;
}
case kMirOpCopy: {
- RegLocation rlSrc = oatGetSrc(cUnit, mir, 0);
- RegLocation rlDest = oatGetDest(cUnit, mir);
- storeValue(cUnit, rlDest, rlSrc);
+ RegLocation rlSrc = GetSrc(cUnit, mir, 0);
+ RegLocation rlDest = GetDest(cUnit, mir);
+ StoreValue(cUnit, rlDest, rlSrc);
break;
}
case kMirOpFusedCmplFloat:
- genFusedFPCmpBranch(cUnit, bb, mir, false /*gt bias*/, false /*double*/);
+ GenFusedFPCmpBranch(cUnit, bb, mir, false /*gt bias*/, false /*double*/);
break;
case kMirOpFusedCmpgFloat:
- genFusedFPCmpBranch(cUnit, bb, mir, true /*gt bias*/, false /*double*/);
+ GenFusedFPCmpBranch(cUnit, bb, mir, true /*gt bias*/, false /*double*/);
break;
case kMirOpFusedCmplDouble:
- genFusedFPCmpBranch(cUnit, bb, mir, false /*gt bias*/, true /*double*/);
+ GenFusedFPCmpBranch(cUnit, bb, mir, false /*gt bias*/, true /*double*/);
break;
case kMirOpFusedCmpgDouble:
- genFusedFPCmpBranch(cUnit, bb, mir, true /*gt bias*/, true /*double*/);
+ GenFusedFPCmpBranch(cUnit, bb, mir, true /*gt bias*/, true /*double*/);
break;
case kMirOpFusedCmpLong:
- genFusedLongCmpBranch(cUnit, bb, mir);
+ GenFusedLongCmpBranch(cUnit, bb, mir);
break;
default:
break;
@@ -692,7 +692,7 @@
}
/* Handle the content in each basic block */
-bool methodBlockCodeGen(CompilationUnit* cUnit, BasicBlock* bb)
+bool MethodBlockCodeGen(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb->blockType == kDead) return false;
cUnit->currentDalvikOffset = bb->startOffset;
@@ -705,38 +705,38 @@
/* Insert the block label */
labelList[blockId].opcode = kPseudoNormalBlockLabel;
- oatAppendLIR(cUnit, &labelList[blockId]);
+ AppendLIR(cUnit, &labelList[blockId]);
LIR* headLIR = NULL;
/* If this is a catch block, export the start address */
if (bb->catchEntry) {
- headLIR = newLIR0(cUnit, kPseudoExportedPC);
+ headLIR = NewLIR0(cUnit, kPseudoExportedPC);
}
/* Free temp registers and reset redundant store tracking */
- oatResetRegPool(cUnit);
- oatResetDefTracking(cUnit);
+ ResetRegPool(cUnit);
+ ResetDefTracking(cUnit);
- oatClobberAllRegs(cUnit);
+ ClobberAllRegs(cUnit);
if (bb->blockType == kEntryBlock) {
int startVReg = cUnit->numDalvikRegisters - cUnit->numIns;
- genEntrySequence(cUnit, &cUnit->regLocation[startVReg],
+ GenEntrySequence(cUnit, &cUnit->regLocation[startVReg],
cUnit->regLocation[cUnit->methodSReg]);
} else if (bb->blockType == kExitBlock) {
- genExitSequence(cUnit);
+ GenExitSequence(cUnit);
}
for (mir = bb->firstMIRInsn; mir; mir = mir->next) {
- oatResetRegPool(cUnit);
+ ResetRegPool(cUnit);
if (cUnit->disableOpt & (1 << kTrackLiveTemps)) {
- oatClobberAllRegs(cUnit);
+ ClobberAllRegs(cUnit);
}
if (cUnit->disableOpt & (1 << kSuppressLoads)) {
- oatResetDefTracking(cUnit);
+ ResetDefTracking(cUnit);
}
#ifndef NDEBUG
@@ -750,8 +750,8 @@
/* Mark the beginning of a Dalvik instruction for line tracking */
char* instStr = cUnit->printMe ?
- oatGetDalvikDisassembly(cUnit, mir->dalvikInsn, "") : NULL;
- boundaryLIR = markBoundary(cUnit, mir->offset, instStr);
+ GetDalvikDisassembly(cUnit, mir->dalvikInsn, "") : NULL;
+ boundaryLIR = MarkBoundary(cUnit, mir->offset, instStr);
/* Remember the first LIR for this block */
if (headLIR == NULL) {
headLIR = boundaryLIR;
@@ -761,8 +761,8 @@
/* Don't generate the SSA annotation unless verbose mode is on */
if (cUnit->printMe && mir->ssaRep) {
- char* ssaString = oatGetSSAString(cUnit, mir->ssaRep);
- newLIR1(cUnit, kPseudoSSARep, reinterpret_cast<uintptr_t>(ssaString));
+ char* ssaString = GetSSAString(cUnit, mir->ssaRep);
+ NewLIR1(cUnit, kPseudoSSARep, reinterpret_cast<uintptr_t>(ssaString));
}
if (opcode == kMirOpCheck) {
@@ -777,11 +777,11 @@
}
if (opcode >= kMirOpFirst) {
- handleExtendedMethodMIR(cUnit, bb, mir);
+ HandleExtendedMethodMIR(cUnit, bb, mir);
continue;
}
- bool notHandled = compileDalvikInstruction(cUnit, mir, bb, labelList);
+ bool notHandled = CompileDalvikInstruction(cUnit, mir, bb, labelList);
if (notHandled) {
LOG(FATAL) << StringPrintf("%#06x: Opcode %#x (%s)",
mir->offset, opcode,
@@ -794,20 +794,20 @@
* Eliminate redundant loads/stores and delay stores into later
* slots
*/
- oatApplyLocalOptimizations(cUnit, headLIR, cUnit->lastLIRInsn);
+ ApplyLocalOptimizations(cUnit, headLIR, cUnit->lastLIRInsn);
/*
* Generate an unconditional branch to the fallthrough block.
*/
if (bb->fallThrough) {
- opUnconditionalBranch(cUnit, &labelList[bb->fallThrough->id]);
+ OpUnconditionalBranch(cUnit, &labelList[bb->fallThrough->id]);
}
}
return false;
}
/* Set basic block labels */
-bool labelBlocks(CompilationUnit* cUnit, BasicBlock* bb)
+bool LabelBlocks(CompilationUnit* cUnit, BasicBlock* bb)
{
LIR* labelList = cUnit->blockLabelList;
int blockId = bb->id;
@@ -820,7 +820,7 @@
return false;
}
-void oatSpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase)
+void SpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase)
{
/* Find the first DalvikByteCode block */
int numReachableBlocks = cUnit->numReachableBlocks;
@@ -828,7 +828,7 @@
BasicBlock*bb = NULL;
for (int idx = 0; idx < numReachableBlocks; idx++) {
int dfsIndex = cUnit->dfsOrder.elemList[idx];
- bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, dfsIndex));
+ bb = reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, dfsIndex));
if (bb->blockType == kDalvikByteCode) {
break;
}
@@ -843,30 +843,30 @@
MIR* mir = bb->firstMIRInsn;
/* Free temp registers and reset redundant store tracking */
- oatResetRegPool(cUnit);
- oatResetDefTracking(cUnit);
- oatClobberAllRegs(cUnit);
+ ResetRegPool(cUnit);
+ ResetDefTracking(cUnit);
+ ClobberAllRegs(cUnit);
- genSpecialCase(cUnit, bb, mir, specialCase);
+ GenSpecialCase(cUnit, bb, mir, specialCase);
}
-void oatMethodMIR2LIR(CompilationUnit* cUnit)
+void MethodMIR2LIR(CompilationUnit* cUnit)
{
/* Used to hold the labels of each block */
cUnit->blockLabelList =
- static_cast<LIR*>(oatNew(cUnit, sizeof(LIR) * cUnit->numBlocks, true, kAllocLIR));
+ static_cast<LIR*>(NewMem(cUnit, sizeof(LIR) * cUnit->numBlocks, true, kAllocLIR));
- oatDataFlowAnalysisDispatcher(cUnit, methodBlockCodeGen,
+ DataFlowAnalysisDispatcher(cUnit, MethodBlockCodeGen,
kPreOrderDFSTraversal, false /* Iterative */);
- handleSuspendLaunchpads(cUnit);
+ HandleSuspendLaunchPads(cUnit);
- handleThrowLaunchpads(cUnit);
+ HandleThrowLaunchPads(cUnit);
- handleIntrinsicLaunchpads(cUnit);
+ HandleIntrinsicLaunchPads(cUnit);
if (!(cUnit->disableOpt & (1 << kSafeOptimizations))) {
- removeRedundantBranches(cUnit);
+ RemoveRedundantBranches(cUnit);
}
}
diff --git a/src/compiler/codegen/method_codegen_driver.h b/src/compiler/codegen/method_codegen_driver.h
index dbed049..5eb9b6e 100644
--- a/src/compiler/codegen/method_codegen_driver.h
+++ b/src/compiler/codegen/method_codegen_driver.h
@@ -18,12 +18,12 @@
#define ART_SRC_COMPILER_CODEGEN_METHODCODEGENDRIVER_H_
namespace art {
-// TODO: move genInvoke to gen_invoke.cc
-void genInvoke(CompilationUnit* cUnit, CallInfo* info);
-// TODO: move genInvoke to gen_invoke.cc or utils
-CallInfo* oatNewCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, InvokeType type, bool isRange);
-void oatSpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase);
-void oatMethodMIR2LIR(CompilationUnit* cUnit);
+// TODO: move GenInvoke to gen_invoke.cc
+void GenInvoke(CompilationUnit* cUnit, CallInfo* info);
+// TODO: move GenInvoke to gen_invoke.cc or utils
+CallInfo* NewMemCallInfo(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, InvokeType type, bool isRange);
+void SpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase);
+void MethodMIR2LIR(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/codegen/mips/assemble_mips.cc b/src/compiler/codegen/mips/assemble_mips.cc
index 79259fb..889541f 100644
--- a/src/compiler/codegen/mips/assemble_mips.cc
+++ b/src/compiler/codegen/mips/assemble_mips.cc
@@ -458,7 +458,7 @@
* NOTE: An out-of-range bal isn't supported because it should
* never happen with the current PIC model.
*/
-void convertShortToLongBranch(CompilationUnit* cUnit, LIR* lir)
+void ConvertShortToLongBranch(CompilationUnit* cUnit, LIR* lir)
{
// For conditional branches we'll need to reverse the sense
bool unconditional = false;
@@ -483,27 +483,27 @@
}
LIR* hopTarget = NULL;
if (!unconditional) {
- hopTarget = rawLIR(cUnit, dalvikOffset, kPseudoTargetLabel);
- LIR* hopBranch = rawLIR(cUnit, dalvikOffset, opcode, lir->operands[0],
+ hopTarget = RawLIR(cUnit, dalvikOffset, kPseudoTargetLabel);
+ LIR* hopBranch = RawLIR(cUnit, dalvikOffset, opcode, lir->operands[0],
lir->operands[1], 0, 0, 0, hopTarget);
- oatInsertLIRBefore(lir, hopBranch);
+ InsertLIRBefore(lir, hopBranch);
}
- LIR* currPC = rawLIR(cUnit, dalvikOffset, kMipsCurrPC);
- oatInsertLIRBefore(lir, currPC);
- LIR* anchor = rawLIR(cUnit, dalvikOffset, kPseudoTargetLabel);
- LIR* deltaHi = rawLIR(cUnit, dalvikOffset, kMipsDeltaHi, r_AT, 0,
+ LIR* currPC = RawLIR(cUnit, dalvikOffset, kMipsCurrPC);
+ InsertLIRBefore(lir, currPC);
+ LIR* anchor = RawLIR(cUnit, dalvikOffset, kPseudoTargetLabel);
+ LIR* deltaHi = RawLIR(cUnit, dalvikOffset, kMipsDeltaHi, r_AT, 0,
reinterpret_cast<uintptr_t>(anchor), 0, 0, lir->target);
- oatInsertLIRBefore(lir, deltaHi);
- oatInsertLIRBefore(lir, anchor);
- LIR* deltaLo = rawLIR(cUnit, dalvikOffset, kMipsDeltaLo, r_AT, 0,
+ InsertLIRBefore(lir, deltaHi);
+ InsertLIRBefore(lir, anchor);
+ LIR* deltaLo = RawLIR(cUnit, dalvikOffset, kMipsDeltaLo, r_AT, 0,
reinterpret_cast<uintptr_t>(anchor), 0, 0, lir->target);
- oatInsertLIRBefore(lir, deltaLo);
- LIR* addu = rawLIR(cUnit, dalvikOffset, kMipsAddu, r_AT, r_AT, r_RA);
- oatInsertLIRBefore(lir, addu);
- LIR* jr = rawLIR(cUnit, dalvikOffset, kMipsJr, r_AT);
- oatInsertLIRBefore(lir, jr);
+ InsertLIRBefore(lir, deltaLo);
+ LIR* addu = RawLIR(cUnit, dalvikOffset, kMipsAddu, r_AT, r_AT, r_RA);
+ InsertLIRBefore(lir, addu);
+ LIR* jr = RawLIR(cUnit, dalvikOffset, kMipsJr, r_AT);
+ InsertLIRBefore(lir, jr);
if (!unconditional) {
- oatInsertLIRBefore(lir, hopTarget);
+ InsertLIRBefore(lir, hopTarget);
}
lir->flags.isNop = true;
}
@@ -514,7 +514,7 @@
* instruction. In those cases we will try to substitute a new code
* sequence or request that the trace be shortened and retried.
*/
-AssemblerStatus oatAssembleInstructions(CompilationUnit *cUnit,
+AssemblerStatus AssembleInstructions(CompilationUnit *cUnit,
uintptr_t startAddr)
{
LIR *lir;
@@ -552,19 +552,19 @@
} else {
// Doesn't fit - must expand to kMipsDelta[Hi|Lo] pair
LIR *newDeltaHi =
- rawLIR(cUnit, lir->dalvikOffset, kMipsDeltaHi,
+ RawLIR(cUnit, lir->dalvikOffset, kMipsDeltaHi,
lir->operands[0], 0, lir->operands[2],
lir->operands[3], 0, lir->target);
- oatInsertLIRBefore(lir, newDeltaHi);
+ InsertLIRBefore(lir, newDeltaHi);
LIR *newDeltaLo =
- rawLIR(cUnit, lir->dalvikOffset, kMipsDeltaLo,
+ RawLIR(cUnit, lir->dalvikOffset, kMipsDeltaLo,
lir->operands[0], 0, lir->operands[2],
lir->operands[3], 0, lir->target);
- oatInsertLIRBefore(lir, newDeltaLo);
+ InsertLIRBefore(lir, newDeltaLo);
LIR *newAddu =
- rawLIR(cUnit, lir->dalvikOffset, kMipsAddu,
+ RawLIR(cUnit, lir->dalvikOffset, kMipsAddu,
lir->operands[0], lir->operands[0], r_RA);
- oatInsertLIRBefore(lir, newAddu);
+ InsertLIRBefore(lir, newAddu);
lir->flags.isNop = true;
res = kRetryAll;
}
@@ -590,7 +590,7 @@
}
if (delta > 131068 || delta < -131069) {
res = kRetryAll;
- convertShortToLongBranch(cUnit, lir);
+ ConvertShortToLongBranch(cUnit, lir);
} else {
lir->operands[0] = delta >> 2;
}
@@ -604,7 +604,7 @@
}
if (delta > 131068 || delta < -131069) {
res = kRetryAll;
- convertShortToLongBranch(cUnit, lir);
+ ConvertShortToLongBranch(cUnit, lir);
} else {
lir->operands[1] = delta >> 2;
}
@@ -618,7 +618,7 @@
}
if (delta > 131068 || delta < -131069) {
res = kRetryAll;
- convertShortToLongBranch(cUnit, lir);
+ ConvertShortToLongBranch(cUnit, lir);
} else {
lir->operands[2] = delta >> 2;
}
@@ -710,7 +710,7 @@
return res;
}
-int oatGetInsnSize(LIR* lir)
+int GetInsnSize(LIR* lir)
{
return EncodingMap[lir->opcode].size;
}
@@ -718,7 +718,7 @@
* Target-dependent offset assignment.
* independent.
*/
-int oatAssignInsnOffsets(CompilationUnit* cUnit)
+int AssignInsnOffsets(CompilationUnit* cUnit)
{
LIR* mipsLIR;
int offset = 0;
diff --git a/src/compiler/codegen/mips/call_mips.cc b/src/compiler/codegen/mips/call_mips.cc
index 5049eec..33a7aed 100644
--- a/src/compiler/codegen/mips/call_mips.cc
+++ b/src/compiler/codegen/mips/call_mips.cc
@@ -23,7 +23,7 @@
namespace art {
-void genSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
SpecialCaseHandler specialCase)
{
// TODO
@@ -60,22 +60,22 @@
* done:
*
*/
-void genSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpSparseSwitchTable(table);
+ DumpSparseSwitchTable(table);
}
// Add the table to the list - we'll process it later
SwitchTable *tabRec =
- static_cast<SwitchTable*>(oatNew(cUnit, sizeof(SwitchTable), true, kAllocData));
+ static_cast<SwitchTable*>(NewMem(cUnit, sizeof(SwitchTable), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
int elements = table[1];
tabRec->targets =
- static_cast<LIR**>(oatNew(cUnit, elements * sizeof(LIR*), true, kAllocLIR));
- oatInsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
+ static_cast<LIR**>(NewMem(cUnit, elements * sizeof(LIR*), true, kAllocLIR));
+ InsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
// The table is composed of 8-byte key/disp pairs
int byteSize = elements * 8;
@@ -83,47 +83,47 @@
int sizeHi = byteSize >> 16;
int sizeLo = byteSize & 0xffff;
- int rEnd = oatAllocTemp(cUnit);
+ int rEnd = AllocTemp(cUnit);
if (sizeHi) {
- newLIR2(cUnit, kMipsLui, rEnd, sizeHi);
+ NewLIR2(cUnit, kMipsLui, rEnd, sizeHi);
}
// Must prevent code motion for the curr pc pair
- genBarrier(cUnit); // Scheduling barrier
- newLIR0(cUnit, kMipsCurrPC); // Really a jal to .+8
+ GenBarrier(cUnit); // Scheduling barrier
+ NewLIR0(cUnit, kMipsCurrPC); // Really a jal to .+8
// Now, fill the branch delay slot
if (sizeHi) {
- newLIR3(cUnit, kMipsOri, rEnd, rEnd, sizeLo);
+ NewLIR3(cUnit, kMipsOri, rEnd, rEnd, sizeLo);
} else {
- newLIR3(cUnit, kMipsOri, rEnd, r_ZERO, sizeLo);
+ NewLIR3(cUnit, kMipsOri, rEnd, r_ZERO, sizeLo);
}
- genBarrier(cUnit); // Scheduling barrier
+ GenBarrier(cUnit); // Scheduling barrier
// Construct BaseLabel and set up table base register
- LIR* baseLabel = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* baseLabel = NewLIR0(cUnit, kPseudoTargetLabel);
// Remember base label so offsets can be computed later
tabRec->anchor = baseLabel;
- int rBase = oatAllocTemp(cUnit);
- newLIR4(cUnit, kMipsDelta, rBase, 0, reinterpret_cast<uintptr_t>(baseLabel),
+ int rBase = AllocTemp(cUnit);
+ NewLIR4(cUnit, kMipsDelta, rBase, 0, reinterpret_cast<uintptr_t>(baseLabel),
reinterpret_cast<uintptr_t>(tabRec));
- opRegRegReg(cUnit, kOpAdd, rEnd, rEnd, rBase);
+ OpRegRegReg(cUnit, kOpAdd, rEnd, rEnd, rBase);
// Grab switch test value
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
// Test loop
- int rKey = oatAllocTemp(cUnit);
- LIR* loopLabel = newLIR0(cUnit, kPseudoTargetLabel);
- LIR* exitBranch = opCmpBranch(cUnit , kCondEq, rBase, rEnd, NULL);
- loadWordDisp(cUnit, rBase, 0, rKey);
- opRegImm(cUnit, kOpAdd, rBase, 8);
- opCmpBranch(cUnit, kCondNe, rlSrc.lowReg, rKey, loopLabel);
- int rDisp = oatAllocTemp(cUnit);
- loadWordDisp(cUnit, rBase, -4, rDisp);
- opRegRegReg(cUnit, kOpAdd, r_RA, r_RA, rDisp);
- opReg(cUnit, kOpBx, r_RA);
+ int rKey = AllocTemp(cUnit);
+ LIR* loopLabel = NewLIR0(cUnit, kPseudoTargetLabel);
+ LIR* exitBranch = OpCmpBranch(cUnit , kCondEq, rBase, rEnd, NULL);
+ LoadWordDisp(cUnit, rBase, 0, rKey);
+ OpRegImm(cUnit, kOpAdd, rBase, 8);
+ OpCmpBranch(cUnit, kCondNe, rlSrc.lowReg, rKey, loopLabel);
+ int rDisp = AllocTemp(cUnit);
+ LoadWordDisp(cUnit, rBase, -4, rDisp);
+ OpRegRegReg(cUnit, kOpAdd, r_RA, r_RA, rDisp);
+ OpReg(cUnit, kOpBx, r_RA);
// Loop exit
- LIR* exitLabel = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* exitLabel = NewLIR0(cUnit, kPseudoTargetLabel);
exitBranch->target = exitLabel;
}
@@ -140,24 +140,24 @@
* jr r_RA
* done:
*/
-void genPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpPackedSwitchTable(table);
+ DumpPackedSwitchTable(table);
}
// Add the table to the list - we'll process it later
SwitchTable *tabRec =
- static_cast<SwitchTable*>(oatNew(cUnit, sizeof(SwitchTable), true, kAllocData));
+ static_cast<SwitchTable*>(NewMem(cUnit, sizeof(SwitchTable), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
int size = table[1];
- tabRec->targets = static_cast<LIR**>(oatNew(cUnit, size * sizeof(LIR*), true, kAllocLIR));
- oatInsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
+ tabRec->targets = static_cast<LIR**>(NewMem(cUnit, size * sizeof(LIR*), true, kAllocLIR));
+ InsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
// Get the switch value
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
// Prepare the bias. If too big, handle 1st stage here
int lowKey = s4FromSwitchData(&table[2]);
@@ -166,51 +166,51 @@
if (lowKey == 0) {
rKey = rlSrc.lowReg;
} else if ((lowKey & 0xffff) != lowKey) {
- rKey = oatAllocTemp(cUnit);
- loadConstant(cUnit, rKey, lowKey);
+ rKey = AllocTemp(cUnit);
+ LoadConstant(cUnit, rKey, lowKey);
largeBias = true;
} else {
- rKey = oatAllocTemp(cUnit);
+ rKey = AllocTemp(cUnit);
}
// Must prevent code motion for the curr pc pair
- genBarrier(cUnit);
- newLIR0(cUnit, kMipsCurrPC); // Really a jal to .+8
+ GenBarrier(cUnit);
+ NewLIR0(cUnit, kMipsCurrPC); // Really a jal to .+8
// Now, fill the branch delay slot with bias strip
if (lowKey == 0) {
- newLIR0(cUnit, kMipsNop);
+ NewLIR0(cUnit, kMipsNop);
} else {
if (largeBias) {
- opRegRegReg(cUnit, kOpSub, rKey, rlSrc.lowReg, rKey);
+ OpRegRegReg(cUnit, kOpSub, rKey, rlSrc.lowReg, rKey);
} else {
- opRegRegImm(cUnit, kOpSub, rKey, rlSrc.lowReg, lowKey);
+ OpRegRegImm(cUnit, kOpSub, rKey, rlSrc.lowReg, lowKey);
}
}
- genBarrier(cUnit); // Scheduling barrier
+ GenBarrier(cUnit); // Scheduling barrier
// Construct BaseLabel and set up table base register
- LIR* baseLabel = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* baseLabel = NewLIR0(cUnit, kPseudoTargetLabel);
// Remember base label so offsets can be computed later
tabRec->anchor = baseLabel;
// Bounds check - if < 0 or >= size continue following switch
- LIR* branchOver = opCmpImmBranch(cUnit, kCondHi, rKey, size-1, NULL);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondHi, rKey, size-1, NULL);
// Materialize the table base pointer
- int rBase = oatAllocTemp(cUnit);
- newLIR4(cUnit, kMipsDelta, rBase, 0, reinterpret_cast<uintptr_t>(baseLabel),
+ int rBase = AllocTemp(cUnit);
+ NewLIR4(cUnit, kMipsDelta, rBase, 0, reinterpret_cast<uintptr_t>(baseLabel),
reinterpret_cast<uintptr_t>(tabRec));
// Load the displacement from the switch table
- int rDisp = oatAllocTemp(cUnit);
- loadBaseIndexed(cUnit, rBase, rKey, rDisp, 2, kWord);
+ int rDisp = AllocTemp(cUnit);
+ LoadBaseIndexed(cUnit, rBase, rKey, rDisp, 2, kWord);
// Add to r_AP and go
- opRegRegReg(cUnit, kOpAdd, r_RA, r_RA, rDisp);
- opReg(cUnit, kOpBx, r_RA);
+ OpRegRegReg(cUnit, kOpAdd, r_RA, r_RA, rDisp);
+ OpReg(cUnit, kOpBx, r_RA);
/* branchOver target here */
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
}
@@ -224,96 +224,96 @@
*
* Total size is 4+(width * size + 1)/2 16-bit code units.
*/
-void genFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
// Add the table to the list - we'll process it later
FillArrayData *tabRec =
- reinterpret_cast<FillArrayData*>(oatNew(cUnit, sizeof(FillArrayData), true, kAllocData));
+ reinterpret_cast<FillArrayData*>(NewMem(cUnit, sizeof(FillArrayData), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
uint16_t width = tabRec->table[1];
uint32_t size = tabRec->table[2] | ((static_cast<uint32_t>(tabRec->table[3])) << 16);
tabRec->size = (size * width) + 8;
- oatInsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
+ InsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
// Making a call - use explicit registers
- oatFlushAllRegs(cUnit); /* Everything to home location */
- oatLockCallTemps(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rMIPS_ARG0);
+ FlushAllRegs(cUnit); /* Everything to home location */
+ LockCallTemps(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rMIPS_ARG0);
// Must prevent code motion for the curr pc pair
- genBarrier(cUnit);
- newLIR0(cUnit, kMipsCurrPC); // Really a jal to .+8
+ GenBarrier(cUnit);
+ NewLIR0(cUnit, kMipsCurrPC); // Really a jal to .+8
// Now, fill the branch delay slot with the helper load
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode));
- genBarrier(cUnit); // Scheduling barrier
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode));
+ GenBarrier(cUnit); // Scheduling barrier
// Construct BaseLabel and set up table base register
- LIR* baseLabel = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* baseLabel = NewLIR0(cUnit, kPseudoTargetLabel);
// Materialize a pointer to the fill data image
- newLIR4(cUnit, kMipsDelta, rMIPS_ARG1, 0, reinterpret_cast<uintptr_t>(baseLabel),
+ NewLIR4(cUnit, kMipsDelta, rMIPS_ARG1, 0, reinterpret_cast<uintptr_t>(baseLabel),
reinterpret_cast<uintptr_t>(tabRec));
// And go...
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rTgt); // ( array*, fill_data* )
- markSafepointPC(cUnit, callInst);
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rTgt); // ( array*, fill_data* )
+ MarkSafepointPC(cUnit, callInst);
}
/*
* TODO: implement fast path to short-circuit thin-lock case
*/
-void genMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rMIPS_ARG0); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, rMIPS_ARG0, optFlags);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rMIPS_ARG0); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, rMIPS_ARG0, optFlags);
// Go expensive route - artLockObjectFromCode(self, obj);
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pLockObjectFromCode));
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rTgt);
- markSafepointPC(cUnit, callInst);
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pLockObjectFromCode));
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rTgt);
+ MarkSafepointPC(cUnit, callInst);
}
/*
* TODO: implement fast path to short-circuit thin-lock case
*/
-void genMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rMIPS_ARG0); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, rMIPS_ARG0, optFlags);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rMIPS_ARG0); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, rMIPS_ARG0, optFlags);
// Go expensive route - UnlockObjectFromCode(obj);
- int rTgt = loadHelper(cUnit, ENTRYPOINT_OFFSET(pUnlockObjectFromCode));
- oatClobberCalleeSave(cUnit);
- LIR* callInst = opReg(cUnit, kOpBlx, rTgt);
- markSafepointPC(cUnit, callInst);
+ int rTgt = LoadHelper(cUnit, ENTRYPOINT_OFFSET(pUnlockObjectFromCode));
+ ClobberCalleeSave(cUnit);
+ LIR* callInst = OpReg(cUnit, kOpBlx, rTgt);
+ MarkSafepointPC(cUnit, callInst);
}
/*
* Mark garbage collection card. Skip if the value we're storing is null.
*/
-void markGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
+void MarkGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
{
- int regCardBase = oatAllocTemp(cUnit);
- int regCardNo = oatAllocTemp(cUnit);
- LIR* branchOver = opCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
- loadWordDisp(cUnit, rMIPS_SELF, Thread::CardTableOffset().Int32Value(), regCardBase);
- opRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
- storeBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
+ int regCardBase = AllocTemp(cUnit);
+ int regCardNo = AllocTemp(cUnit);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
+ LoadWordDisp(cUnit, rMIPS_SELF, Thread::CardTableOffset().Int32Value(), regCardBase);
+ OpRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
+ StoreBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
kUnsignedByte);
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
- oatFreeTemp(cUnit, regCardBase);
- oatFreeTemp(cUnit, regCardNo);
+ FreeTemp(cUnit, regCardBase);
+ FreeTemp(cUnit, regCardNo);
}
-void genEntrySequence(CompilationUnit* cUnit, RegLocation* argLocs,
+void GenEntrySequence(CompilationUnit* cUnit, RegLocation* ArgLocs,
RegLocation rlMethod)
{
int spillCount = cUnit->numCoreSpills + cUnit->numFPSpills;
@@ -323,10 +323,10 @@
* expanding the frame or flushing. This leaves the utility
* code with a single temp: r12. This should be enough.
*/
- oatLockTemp(cUnit, rMIPS_ARG0);
- oatLockTemp(cUnit, rMIPS_ARG1);
- oatLockTemp(cUnit, rMIPS_ARG2);
- oatLockTemp(cUnit, rMIPS_ARG3);
+ LockTemp(cUnit, rMIPS_ARG0);
+ LockTemp(cUnit, rMIPS_ARG1);
+ LockTemp(cUnit, rMIPS_ARG2);
+ LockTemp(cUnit, rMIPS_ARG3);
/*
* We can safely skip the stack overflow check if we're
@@ -334,45 +334,45 @@
*/
bool skipOverflowCheck = ((cUnit->attrs & METHOD_IS_LEAF) &&
(static_cast<size_t>(cUnit->frameSize) < Thread::kStackOverflowReservedBytes));
- newLIR0(cUnit, kPseudoMethodEntry);
- int checkReg = oatAllocTemp(cUnit);
- int newSP = oatAllocTemp(cUnit);
+ NewLIR0(cUnit, kPseudoMethodEntry);
+ int checkReg = AllocTemp(cUnit);
+ int newSP = AllocTemp(cUnit);
if (!skipOverflowCheck) {
/* Load stack limit */
- loadWordDisp(cUnit, rMIPS_SELF, Thread::StackEndOffset().Int32Value(), checkReg);
+ LoadWordDisp(cUnit, rMIPS_SELF, Thread::StackEndOffset().Int32Value(), checkReg);
}
/* Spill core callee saves */
- spillCoreRegs(cUnit);
+ SpillCoreRegs(cUnit);
/* NOTE: promotion of FP regs currently unsupported, thus no FP spill */
DCHECK_EQ(cUnit->numFPSpills, 0);
if (!skipOverflowCheck) {
- opRegRegImm(cUnit, kOpSub, newSP, rMIPS_SP, cUnit->frameSize - (spillCount * 4));
- genRegRegCheck(cUnit, kCondCc, newSP, checkReg, kThrowStackOverflow);
- opRegCopy(cUnit, rMIPS_SP, newSP); // Establish stack
+ OpRegRegImm(cUnit, kOpSub, newSP, rMIPS_SP, cUnit->frameSize - (spillCount * 4));
+ GenRegRegCheck(cUnit, kCondCc, newSP, checkReg, kThrowStackOverflow);
+ OpRegCopy(cUnit, rMIPS_SP, newSP); // Establish stack
} else {
- opRegImm(cUnit, kOpSub, rMIPS_SP, cUnit->frameSize - (spillCount * 4));
+ OpRegImm(cUnit, kOpSub, rMIPS_SP, cUnit->frameSize - (spillCount * 4));
}
- flushIns(cUnit, argLocs, rlMethod);
+ FlushIns(cUnit, ArgLocs, rlMethod);
- oatFreeTemp(cUnit, rMIPS_ARG0);
- oatFreeTemp(cUnit, rMIPS_ARG1);
- oatFreeTemp(cUnit, rMIPS_ARG2);
- oatFreeTemp(cUnit, rMIPS_ARG3);
+ FreeTemp(cUnit, rMIPS_ARG0);
+ FreeTemp(cUnit, rMIPS_ARG1);
+ FreeTemp(cUnit, rMIPS_ARG2);
+ FreeTemp(cUnit, rMIPS_ARG3);
}
-void genExitSequence(CompilationUnit* cUnit)
+void GenExitSequence(CompilationUnit* cUnit)
{
/*
* In the exit path, rMIPS_RET0/rMIPS_RET1 are live - make sure they aren't
* allocated by the register utilities as temps.
*/
- oatLockTemp(cUnit, rMIPS_RET0);
- oatLockTemp(cUnit, rMIPS_RET1);
+ LockTemp(cUnit, rMIPS_RET0);
+ LockTemp(cUnit, rMIPS_RET1);
- newLIR0(cUnit, kPseudoMethodExit);
- unSpillCoreRegs(cUnit);
- opReg(cUnit, kOpBx, r_RA);
+ NewLIR0(cUnit, kPseudoMethodExit);
+ UnSpillCoreRegs(cUnit);
+ OpReg(cUnit, kOpBx, r_RA);
}
} // namespace art
diff --git a/src/compiler/codegen/mips/fp_mips.cc b/src/compiler/codegen/mips/fp_mips.cc
index 268a88d..942259d 100644
--- a/src/compiler/codegen/mips/fp_mips.cc
+++ b/src/compiler/codegen/mips/fp_mips.cc
@@ -21,7 +21,7 @@
namespace art {
-bool genArithOpFloat(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenArithOpFloat(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
#ifdef __mips_hard_float
@@ -52,24 +52,24 @@
case Instruction::REM_FLOAT_2ADDR:
case Instruction::REM_FLOAT:
case Instruction::NEG_FLOAT: {
- return genArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
}
default:
return true;
}
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR3(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR3(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
#else
- return genArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
#endif
}
-bool genArithOpDouble(CompilationUnit *cUnit, Instruction::Code opcode,
+bool GenArithOpDouble(CompilationUnit *cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2)
{
#ifdef __mips_hard_float
@@ -96,28 +96,28 @@
case Instruction::REM_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE:
case Instruction::NEG_DOUBLE: {
- return genArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
}
default:
return true;
}
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
DCHECK(rlSrc1.wide);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
DCHECK(rlSrc2.wide);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
DCHECK(rlDest.wide);
DCHECK(rlResult.wide);
- newLIR3(cUnit, op, s2d(rlResult.lowReg, rlResult.highReg), s2d(rlSrc1.lowReg, rlSrc1.highReg),
- s2d(rlSrc2.lowReg, rlSrc2.highReg));
- storeValueWide(cUnit, rlDest, rlResult);
+ NewLIR3(cUnit, op, S2d(rlResult.lowReg, rlResult.highReg), S2d(rlSrc1.lowReg, rlSrc1.highReg),
+ S2d(rlSrc2.lowReg, rlSrc2.highReg));
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
#else
- return genArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
#endif
}
-bool genConversion(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenConversion(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc)
{
#ifdef __mips_hard_float
@@ -143,33 +143,33 @@
case Instruction::FLOAT_TO_LONG:
case Instruction::LONG_TO_FLOAT:
case Instruction::DOUBLE_TO_LONG:
- return genConversionPortable(cUnit, opcode, rlDest, rlSrc);
+ return GenConversionPortable(cUnit, opcode, rlDest, rlSrc);
default:
return true;
}
if (rlSrc.wide) {
- rlSrc = loadValueWide(cUnit, rlSrc, kFPReg);
- srcReg = s2d(rlSrc.lowReg, rlSrc.highReg);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kFPReg);
+ srcReg = S2d(rlSrc.lowReg, rlSrc.highReg);
} else {
- rlSrc = loadValue(cUnit, rlSrc, kFPReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kFPReg);
srcReg = rlSrc.lowReg;
}
if (rlDest.wide) {
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, op, s2d(rlResult.lowReg, rlResult.highReg), srcReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, op, S2d(rlResult.lowReg, rlResult.highReg), srcReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, op, rlResult.lowReg, srcReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, op, rlResult.lowReg, srcReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
return false;
#else
- return genConversionPortable(cUnit, opcode, rlDest, rlSrc);
+ return GenConversionPortable(cUnit, opcode, rlDest, rlSrc);
#endif
}
-bool genCmpFP(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest,
+bool GenCmpFP(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
bool wide = true;
@@ -193,49 +193,49 @@
default:
return true;
}
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit);
if (wide) {
- loadValueDirectWideFixed(cUnit, rlSrc1, rMIPS_FARG0, rMIPS_FARG1);
- loadValueDirectWideFixed(cUnit, rlSrc2, rMIPS_FARG2, rMIPS_FARG3);
+ LoadValueDirectWideFixed(cUnit, rlSrc1, rMIPS_FARG0, rMIPS_FARG1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, rMIPS_FARG2, rMIPS_FARG3);
} else {
- loadValueDirectFixed(cUnit, rlSrc1, rMIPS_FARG0);
- loadValueDirectFixed(cUnit, rlSrc2, rMIPS_FARG2);
+ LoadValueDirectFixed(cUnit, rlSrc1, rMIPS_FARG0);
+ LoadValueDirectFixed(cUnit, rlSrc2, rMIPS_FARG2);
}
- int rTgt = loadHelper(cUnit, offset);
+ int rTgt = LoadHelper(cUnit, offset);
// NOTE: not a safepoint
- opReg(cUnit, kOpBlx, rTgt);
- RegLocation rlResult = oatGetReturn(cUnit, false);
- storeValue(cUnit, rlDest, rlResult);
+ OpReg(cUnit, kOpBlx, rTgt);
+ RegLocation rlResult = GetReturn(cUnit, false);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-void genFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
bool gtBias, bool isDouble)
{
UNIMPLEMENTED(FATAL) << "Need codegen for fused fp cmp branch";
}
-void genNegFloat(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
+void GenNegFloat(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
{
RegLocation rlResult;
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegImm(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, 0x80000000);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegImm(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, 0x80000000);
+ StoreValue(cUnit, rlDest, rlResult);
}
-void genNegDouble(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
+void GenNegDouble(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
{
RegLocation rlResult;
- rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegImm(cUnit, kOpAdd, rlResult.highReg, rlSrc.highReg, 0x80000000);
- opRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegImm(cUnit, kOpAdd, rlResult.highReg, rlSrc.highReg, 0x80000000);
+ OpRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
}
-bool genInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin)
+bool GenInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin)
{
// TODO: need Mips implementation
return false;
diff --git a/src/compiler/codegen/mips/int_mips.cc b/src/compiler/codegen/mips/int_mips.cc
index 297a5d92..29b08ed 100644
--- a/src/compiler/codegen/mips/int_mips.cc
+++ b/src/compiler/codegen/mips/int_mips.cc
@@ -39,29 +39,29 @@
* finish:
*
*/
-void genCmpLong(CompilationUnit* cUnit, RegLocation rlDest,
+void GenCmpLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
- int t0 = oatAllocTemp(cUnit);
- int t1 = oatAllocTemp(cUnit);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- newLIR3(cUnit, kMipsSlt, t0, rlSrc1.highReg, rlSrc2.highReg);
- newLIR3(cUnit, kMipsSlt, t1, rlSrc2.highReg, rlSrc1.highReg);
- newLIR3(cUnit, kMipsSubu, rlResult.lowReg, t1, t0);
- LIR* branch = opCmpImmBranch(cUnit, kCondNe, rlResult.lowReg, 0, NULL);
- newLIR3(cUnit, kMipsSltu, t0, rlSrc1.lowReg, rlSrc2.lowReg);
- newLIR3(cUnit, kMipsSltu, t1, rlSrc2.lowReg, rlSrc1.lowReg);
- newLIR3(cUnit, kMipsSubu, rlResult.lowReg, t1, t0);
- oatFreeTemp(cUnit, t0);
- oatFreeTemp(cUnit, t1);
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
+ int t0 = AllocTemp(cUnit);
+ int t1 = AllocTemp(cUnit);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ NewLIR3(cUnit, kMipsSlt, t0, rlSrc1.highReg, rlSrc2.highReg);
+ NewLIR3(cUnit, kMipsSlt, t1, rlSrc2.highReg, rlSrc1.highReg);
+ NewLIR3(cUnit, kMipsSubu, rlResult.lowReg, t1, t0);
+ LIR* branch = OpCmpImmBranch(cUnit, kCondNe, rlResult.lowReg, 0, NULL);
+ NewLIR3(cUnit, kMipsSltu, t0, rlSrc1.lowReg, rlSrc2.lowReg);
+ NewLIR3(cUnit, kMipsSltu, t1, rlSrc2.lowReg, rlSrc1.lowReg);
+ NewLIR3(cUnit, kMipsSubu, rlResult.lowReg, t1, t0);
+ FreeTemp(cUnit, t0);
+ FreeTemp(cUnit, t1);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branch->target = target;
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
}
-LIR* opCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1,
+LIR* OpCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1,
int src2, LIR* target)
{
LIR* branch;
@@ -114,31 +114,31 @@
return NULL;
}
if (cmpZero) {
- branch = newLIR2(cUnit, brOp, src1, src2);
+ branch = NewLIR2(cUnit, brOp, src1, src2);
} else {
- int tReg = oatAllocTemp(cUnit);
+ int tReg = AllocTemp(cUnit);
if (swapped) {
- newLIR3(cUnit, sltOp, tReg, src2, src1);
+ NewLIR3(cUnit, sltOp, tReg, src2, src1);
} else {
- newLIR3(cUnit, sltOp, tReg, src1, src2);
+ NewLIR3(cUnit, sltOp, tReg, src1, src2);
}
- branch = newLIR1(cUnit, brOp, tReg);
- oatFreeTemp(cUnit, tReg);
+ branch = NewLIR1(cUnit, brOp, tReg);
+ FreeTemp(cUnit, tReg);
}
branch->target = target;
return branch;
}
-LIR* opCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg,
+LIR* OpCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg,
int checkValue, LIR* target)
{
LIR* branch;
if (checkValue != 0) {
// TUNING: handle s16 & kCondLt/Mi case using slti
- int tReg = oatAllocTemp(cUnit);
- loadConstant(cUnit, tReg, checkValue);
- branch = opCmpBranch(cUnit, cond, reg, tReg, target);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ LoadConstant(cUnit, tReg, checkValue);
+ branch = OpCmpBranch(cUnit, cond, reg, tReg, target);
+ FreeTemp(cUnit, tReg);
return branch;
}
MipsOpCode opc;
@@ -152,24 +152,24 @@
case kCondNe: opc = kMipsBnez; break;
default:
// Tuning: use slti when applicable
- int tReg = oatAllocTemp(cUnit);
- loadConstant(cUnit, tReg, checkValue);
- branch = opCmpBranch(cUnit, cond, reg, tReg, target);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ LoadConstant(cUnit, tReg, checkValue);
+ branch = OpCmpBranch(cUnit, cond, reg, tReg, target);
+ FreeTemp(cUnit, tReg);
return branch;
}
- branch = newLIR1(cUnit, opc, reg);
+ branch = NewLIR1(cUnit, opc, reg);
branch->target = target;
return branch;
}
-LIR* opRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
+LIR* OpRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
{
#ifdef __mips_hard_float
if (MIPS_FPREG(rDest) || MIPS_FPREG(rSrc))
- return fpRegCopy(cUnit, rDest, rSrc);
+ return FpRegCopy(cUnit, rDest, rSrc);
#endif
- LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, kMipsMove,
+ LIR* res = RawLIR(cUnit, cUnit->currentDalvikOffset, kMipsMove,
rDest, rSrc);
if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) && rDest == rSrc) {
res->flags.isNop = true;
@@ -177,14 +177,14 @@
return res;
}
-LIR* opRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
+LIR* OpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
{
- LIR *res = opRegCopyNoInsert(cUnit, rDest, rSrc);
- oatAppendLIR(cUnit, res);
+ LIR *res = OpRegCopyNoInsert(cUnit, rDest, rSrc);
+ AppendLIR(cUnit, res);
return res;
}
-void opRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
+void OpRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
int srcLo, int srcHi)
{
#ifdef __mips_hard_float
@@ -194,169 +194,169 @@
assert(MIPS_FPREG(destLo) == MIPS_FPREG(destHi));
if (destFP) {
if (srcFP) {
- opRegCopy(cUnit, s2d(destLo, destHi), s2d(srcLo, srcHi));
+ OpRegCopy(cUnit, S2d(destLo, destHi), S2d(srcLo, srcHi));
} else {
/* note the operands are swapped for the mtc1 instr */
- newLIR2(cUnit, kMipsMtc1, srcLo, destLo);
- newLIR2(cUnit, kMipsMtc1, srcHi, destHi);
+ NewLIR2(cUnit, kMipsMtc1, srcLo, destLo);
+ NewLIR2(cUnit, kMipsMtc1, srcHi, destHi);
}
} else {
if (srcFP) {
- newLIR2(cUnit, kMipsMfc1, destLo, srcLo);
- newLIR2(cUnit, kMipsMfc1, destHi, srcHi);
+ NewLIR2(cUnit, kMipsMfc1, destLo, srcLo);
+ NewLIR2(cUnit, kMipsMfc1, destHi, srcHi);
} else {
// Handle overlap
if (srcHi == destLo) {
- opRegCopy(cUnit, destHi, srcHi);
- opRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
} else {
- opRegCopy(cUnit, destLo, srcLo);
- opRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
}
}
}
#else
// Handle overlap
if (srcHi == destLo) {
- opRegCopy(cUnit, destHi, srcHi);
- opRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
} else {
- opRegCopy(cUnit, destLo, srcLo);
- opRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
}
#endif
}
-void genFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
+void GenFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
{
UNIMPLEMENTED(FATAL) << "Need codegen for fused long cmp branch";
}
-LIR* genRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode,
+LIR* GenRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode,
int reg1, int base, int offset, ThrowKind kind)
{
- LOG(FATAL) << "Unexpected use of genRegMemCheck for Arm";
+ LOG(FATAL) << "Unexpected use of GenRegMemCheck for Arm";
return NULL;
}
-RegLocation genDivRem(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int reg2, bool isDiv)
+RegLocation GenDivRem(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int reg2, bool isDiv)
{
- newLIR4(cUnit, kMipsDiv, r_HI, r_LO, reg1, reg2);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ NewLIR4(cUnit, kMipsDiv, r_HI, r_LO, reg1, reg2);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (isDiv) {
- newLIR2(cUnit, kMipsMflo, rlResult.lowReg, r_LO);
+ NewLIR2(cUnit, kMipsMflo, rlResult.lowReg, r_LO);
} else {
- newLIR2(cUnit, kMipsMfhi, rlResult.lowReg, r_HI);
+ NewLIR2(cUnit, kMipsMfhi, rlResult.lowReg, r_HI);
}
return rlResult;
}
-RegLocation genDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int lit, bool isDiv)
+RegLocation GenDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int reg1, int lit, bool isDiv)
{
- int tReg = oatAllocTemp(cUnit);
- newLIR3(cUnit, kMipsAddiu, tReg, r_ZERO, lit);
- newLIR4(cUnit, kMipsDiv, r_HI, r_LO, reg1, tReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ int tReg = AllocTemp(cUnit);
+ NewLIR3(cUnit, kMipsAddiu, tReg, r_ZERO, lit);
+ NewLIR4(cUnit, kMipsDiv, r_HI, r_LO, reg1, tReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
if (isDiv) {
- newLIR2(cUnit, kMipsMflo, rlResult.lowReg, r_LO);
+ NewLIR2(cUnit, kMipsMflo, rlResult.lowReg, r_LO);
} else {
- newLIR2(cUnit, kMipsMfhi, rlResult.lowReg, r_HI);
+ NewLIR2(cUnit, kMipsMfhi, rlResult.lowReg, r_HI);
}
- oatFreeTemp(cUnit, tReg);
+ FreeTemp(cUnit, tReg);
return rlResult;
}
-void opLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset)
+void OpLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset)
{
- LOG(FATAL) << "Unexpected use of opLea for Arm";
+ LOG(FATAL) << "Unexpected use of OpLea for Arm";
}
-void opTlsCmp(CompilationUnit* cUnit, int offset, int val)
+void OpTlsCmp(CompilationUnit* cUnit, int offset, int val)
{
- LOG(FATAL) << "Unexpected use of opTlsCmp for Arm";
+ LOG(FATAL) << "Unexpected use of OpTlsCmp for Arm";
}
-bool genInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier) {
+bool GenInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier) {
DCHECK_NE(cUnit->instructionSet, kThumb2);
return false;
}
-bool genInlinedSqrt(CompilationUnit* cUnit, CallInfo* info) {
+bool GenInlinedSqrt(CompilationUnit* cUnit, CallInfo* info) {
DCHECK_NE(cUnit->instructionSet, kThumb2);
return false;
}
-LIR* opPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target) {
- LOG(FATAL) << "Unexpected use of opPcRelLoad for Mips";
+LIR* OpPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target) {
+ LOG(FATAL) << "Unexpected use of OpPcRelLoad for Mips";
return NULL;
}
-LIR* opVldm(CompilationUnit* cUnit, int rBase, int count)
+LIR* OpVldm(CompilationUnit* cUnit, int rBase, int count)
{
- LOG(FATAL) << "Unexpected use of opVldm for Mips";
+ LOG(FATAL) << "Unexpected use of OpVldm for Mips";
return NULL;
}
-LIR* opVstm(CompilationUnit* cUnit, int rBase, int count)
+LIR* OpVstm(CompilationUnit* cUnit, int rBase, int count)
{
- LOG(FATAL) << "Unexpected use of opVstm for Mips";
+ LOG(FATAL) << "Unexpected use of OpVstm for Mips";
return NULL;
}
-void genMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc,
+void GenMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc,
RegLocation rlResult, int lit,
int firstBit, int secondBit)
{
- int tReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpLsl, tReg, rlSrc.lowReg, secondBit - firstBit);
- opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, tReg);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpLsl, tReg, rlSrc.lowReg, secondBit - firstBit);
+ OpRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, tReg);
+ FreeTemp(cUnit, tReg);
if (firstBit != 0) {
- opRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlResult.lowReg, firstBit);
+ OpRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlResult.lowReg, firstBit);
}
}
-void genDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi)
+void GenDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi)
{
- int tReg = oatAllocTemp(cUnit);
- opRegRegReg(cUnit, kOpOr, tReg, regLo, regHi);
- genImmedCheck(cUnit, kCondEq, tReg, 0, kThrowDivZero);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegReg(cUnit, kOpOr, tReg, regLo, regHi);
+ GenImmedCheck(cUnit, kCondEq, tReg, 0, kThrowDivZero);
+ FreeTemp(cUnit, tReg);
}
// Test suspend flag, return target of taken suspend branch
-LIR* opTestSuspend(CompilationUnit* cUnit, LIR* target)
+LIR* OpTestSuspend(CompilationUnit* cUnit, LIR* target)
{
- opRegImm(cUnit, kOpSub, rMIPS_SUSPEND, 1);
- return opCmpImmBranch(cUnit, (target == NULL) ? kCondEq : kCondNe, rMIPS_SUSPEND, 0, target);
+ OpRegImm(cUnit, kOpSub, rMIPS_SUSPEND, 1);
+ return OpCmpImmBranch(cUnit, (target == NULL) ? kCondEq : kCondNe, rMIPS_SUSPEND, 0, target);
}
// Decrement register and branch on condition
-LIR* opDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target)
+LIR* OpDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target)
{
- opRegImm(cUnit, kOpSub, reg, 1);
- return opCmpImmBranch(cUnit, cCode, reg, 0, target);
+ OpRegImm(cUnit, kOpSub, reg, 1);
+ return OpCmpImmBranch(cUnit, cCode, reg, 0, target);
}
-bool smallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
+bool SmallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
RegLocation rlSrc, RegLocation rlDest, int lit)
{
LOG(FATAL) << "Unexpected use of smallLiteralDive in Mips";
return false;
}
-LIR* opIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide)
+LIR* OpIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide)
{
- LOG(FATAL) << "Unexpected use of opIT in Mips";
+ LOG(FATAL) << "Unexpected use of OpIT in Mips";
return NULL;
}
-bool genAddLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenAddLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
/*
* [v1 v0] = [a1 a0] + [a3 a2];
* addu v0,a2,a0
@@ -365,22 +365,22 @@
* addu v1,v1,t1
*/
- opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc2.lowReg, rlSrc1.lowReg);
- int tReg = oatAllocTemp(cUnit);
- opRegRegReg(cUnit, kOpAdd, tReg, rlSrc2.highReg, rlSrc1.highReg);
- newLIR3(cUnit, kMipsSltu, rlResult.highReg, rlResult.lowReg, rlSrc2.lowReg);
- opRegRegReg(cUnit, kOpAdd, rlResult.highReg, rlResult.highReg, tReg);
- oatFreeTemp(cUnit, tReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ OpRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc2.lowReg, rlSrc1.lowReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegReg(cUnit, kOpAdd, tReg, rlSrc2.highReg, rlSrc1.highReg);
+ NewLIR3(cUnit, kMipsSltu, rlResult.highReg, rlResult.lowReg, rlSrc2.lowReg);
+ OpRegRegReg(cUnit, kOpAdd, rlResult.highReg, rlResult.highReg, tReg);
+ FreeTemp(cUnit, tReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genSubLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenSubLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
/*
* [v1 v0] = [a1 a0] - [a3 a2];
* sltu t1,a0,a2
@@ -389,21 +389,21 @@
* subu v1,v1,t1
*/
- int tReg = oatAllocTemp(cUnit);
- newLIR3(cUnit, kMipsSltu, tReg, rlSrc1.lowReg, rlSrc2.lowReg);
- opRegRegReg(cUnit, kOpSub, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
- opRegRegReg(cUnit, kOpSub, rlResult.highReg, rlSrc1.highReg, rlSrc2.highReg);
- opRegRegReg(cUnit, kOpSub, rlResult.highReg, rlResult.highReg, tReg);
- oatFreeTemp(cUnit, tReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ int tReg = AllocTemp(cUnit);
+ NewLIR3(cUnit, kMipsSltu, tReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ OpRegRegReg(cUnit, kOpSub, rlResult.lowReg, rlSrc1.lowReg, rlSrc2.lowReg);
+ OpRegRegReg(cUnit, kOpSub, rlResult.highReg, rlSrc1.highReg, rlSrc2.highReg);
+ OpRegRegReg(cUnit, kOpSub, rlResult.highReg, rlResult.highReg, tReg);
+ FreeTemp(cUnit, tReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genNegLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenNegLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kCoreReg);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
/*
* [v1 v0] = -[a1 a0]
* negu v0,a0
@@ -412,34 +412,34 @@
* subu v1,v1,t1
*/
- opRegReg(cUnit, kOpNeg, rlResult.lowReg, rlSrc.lowReg);
- opRegReg(cUnit, kOpNeg, rlResult.highReg, rlSrc.highReg);
- int tReg = oatAllocTemp(cUnit);
- newLIR3(cUnit, kMipsSltu, tReg, r_ZERO, rlResult.lowReg);
- opRegRegReg(cUnit, kOpSub, rlResult.highReg, rlResult.highReg, tReg);
- oatFreeTemp(cUnit, tReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ OpRegReg(cUnit, kOpNeg, rlResult.lowReg, rlSrc.lowReg);
+ OpRegReg(cUnit, kOpNeg, rlResult.highReg, rlSrc.highReg);
+ int tReg = AllocTemp(cUnit);
+ NewLIR3(cUnit, kMipsSltu, tReg, r_ZERO, rlResult.lowReg);
+ OpRegRegReg(cUnit, kOpSub, rlResult.highReg, rlResult.highReg, tReg);
+ FreeTemp(cUnit, tReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genAndLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenAndLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genAndLong for Mips";
+ LOG(FATAL) << "Unexpected use of GenAndLong for Mips";
return false;
}
-bool genOrLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenOrLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genOrLong for Mips";
+ LOG(FATAL) << "Unexpected use of GenOrLong for Mips";
return false;
}
-bool genXorLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenXorLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- LOG(FATAL) << "Unexpected use of genXorLong for Mips";
+ LOG(FATAL) << "Unexpected use of GenXorLong for Mips";
return false;
}
diff --git a/src/compiler/codegen/mips/target_mips.cc b/src/compiler/codegen/mips/target_mips.cc
index a3621f5..3623800 100644
--- a/src/compiler/codegen/mips/target_mips.cc
+++ b/src/compiler/codegen/mips/target_mips.cc
@@ -27,43 +27,43 @@
r_T0, r_T1, r_T2, r_T3, r_T4, r_T5, r_T6, r_T7,
r_S0, r_S1, r_S2, r_S3, r_S4, r_S5, r_S6, r_S7, r_T8,
r_T9, r_K0, r_K1, r_GP, r_SP, r_FP, r_RA};
-static int reservedRegs[] = {r_ZERO, r_AT, r_S0, r_S1, r_K0, r_K1, r_GP, r_SP,
+static int ReservedRegs[] = {r_ZERO, r_AT, r_S0, r_S1, r_K0, r_K1, r_GP, r_SP,
r_RA};
static int coreTemps[] = {r_V0, r_V1, r_A0, r_A1, r_A2, r_A3, r_T0, r_T1, r_T2,
r_T3, r_T4, r_T5, r_T6, r_T7, r_T8};
#ifdef __mips_hard_float
-static int fpRegs[] = {r_F0, r_F1, r_F2, r_F3, r_F4, r_F5, r_F6, r_F7,
+static int FpRegs[] = {r_F0, r_F1, r_F2, r_F3, r_F4, r_F5, r_F6, r_F7,
r_F8, r_F9, r_F10, r_F11, r_F12, r_F13, r_F14, r_F15};
static int fpTemps[] = {r_F0, r_F1, r_F2, r_F3, r_F4, r_F5, r_F6, r_F7,
r_F8, r_F9, r_F10, r_F11, r_F12, r_F13, r_F14, r_F15};
#endif
-RegLocation locCReturn()
+RegLocation LocCReturn()
{
RegLocation res = MIPS_LOC_C_RETURN;
return res;
}
-RegLocation locCReturnWide()
+RegLocation LocCReturnWide()
{
RegLocation res = MIPS_LOC_C_RETURN_WIDE;
return res;
}
-RegLocation locCReturnFloat()
+RegLocation LocCReturnFloat()
{
RegLocation res = MIPS_LOC_C_RETURN_FLOAT;
return res;
}
-RegLocation locCReturnDouble()
+RegLocation LocCReturnDouble()
{
RegLocation res = MIPS_LOC_C_RETURN_DOUBLE;
return res;
}
// Return a target-dependent special register.
-int targetReg(SpecialTargetRegister reg) {
+int TargetReg(SpecialTargetRegister reg) {
int res = INVALID_REG;
switch (reg) {
case kSelf: res = rMIPS_SELF; break;
@@ -88,37 +88,37 @@
}
// Create a double from a pair of singles.
-int s2d(int lowReg, int highReg)
+int S2d(int lowReg, int highReg)
{
return MIPS_S2D(lowReg, highReg);
}
// Is reg a single or double?
-bool fpReg(int reg)
+bool FpReg(int reg)
{
return MIPS_FPREG(reg);
}
// Is reg a single?
-bool singleReg(int reg)
+bool SingleReg(int reg)
{
return MIPS_SINGLEREG(reg);
}
// Is reg a double?
-bool doubleReg(int reg)
+bool DoubleReg(int reg)
{
return MIPS_DOUBLEREG(reg);
}
// Return mask to strip off fp reg flags and bias.
-uint32_t fpRegMask()
+uint32_t FpRegMask()
{
return MIPS_FP_REG_MASK;
}
// True if both regs single, both core or both double.
-bool sameRegType(int reg1, int reg2)
+bool SameRegType(int reg1, int reg2)
{
return (MIPS_REGTYPE(reg1) == MIPS_REGTYPE(reg2));
}
@@ -126,7 +126,7 @@
/*
* Decode the register id.
*/
-uint64_t getRegMaskCommon(CompilationUnit* cUnit, int reg)
+uint64_t GetRegMaskCommon(CompilationUnit* cUnit, int reg)
{
uint64_t seed;
int shift;
@@ -143,13 +143,13 @@
return (seed << shift);
}
-uint64_t getPCUseDefEncoding()
+uint64_t GetPCUseDefEncoding()
{
return ENCODE_MIPS_REG_PC;
}
-void setupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir)
+void SetupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir)
{
DCHECK_EQ(cUnit->instructionSet, kMips);
@@ -182,7 +182,7 @@
* Interpret a format string and build a string no longer than size
* See format key in Assemble.c.
*/
-std::string buildInsnString(const char *fmt, LIR *lir, unsigned char* baseAddr)
+std::string BuildInsnString(const char *fmt, LIR *lir, unsigned char* baseAddr)
{
std::string buf;
int i;
@@ -275,7 +275,7 @@
}
// FIXME: need to redo resource maps for MIPS - fix this at that time
-void oatDumpResourceMask(LIR *mipsLIR, uint64_t mask, const char *prefix)
+void DumpResourceMask(LIR *mipsLIR, uint64_t mask, const char *prefix)
{
char buf[256];
buf[0] = 0;
@@ -326,7 +326,7 @@
* machinery is in place, always spill lr.
*/
-void oatAdjustSpillMask(CompilationUnit* cUnit)
+void AdjustSpillMask(CompilationUnit* cUnit)
{
cUnit->coreSpillMask |= (1 << r_RA);
cUnit->numCoreSpills++;
@@ -338,15 +338,15 @@
* include any holes in the mask. Associate holes with
* Dalvik register INVALID_VREG (0xFFFFU).
*/
-void oatMarkPreservedSingle(CompilationUnit* cUnit, int sReg, int reg)
+void MarkPreservedSingle(CompilationUnit* cUnit, int sReg, int reg)
{
LOG(FATAL) << "No support yet for promoted FP regs";
}
-void oatFlushRegWide(CompilationUnit* cUnit, int reg1, int reg2)
+void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2)
{
- RegisterInfo* info1 = oatGetRegInfo(cUnit, reg1);
- RegisterInfo* info2 = oatGetRegInfo(cUnit, reg2);
+ RegisterInfo* info1 = GetRegInfo(cUnit, reg1);
+ RegisterInfo* info2 = GetRegInfo(cUnit, reg2);
DCHECK(info1 && info2 && info1->pair && info2->pair &&
(info1->partner == info2->reg) &&
(info2->partner == info1->reg));
@@ -361,130 +361,117 @@
if (SRegToVReg(cUnit, info2->sReg) < SRegToVReg(cUnit, info1->sReg))
info1 = info2;
int vReg = SRegToVReg(cUnit, info1->sReg);
- storeBaseDispWide(cUnit, rMIPS_SP, oatVRegOffset(cUnit, vReg), info1->reg, info1->partner);
+ StoreBaseDispWide(cUnit, rMIPS_SP, VRegOffset(cUnit, vReg), info1->reg, info1->partner);
}
}
-void oatFlushReg(CompilationUnit* cUnit, int reg)
+void FlushReg(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
if (info->live && info->dirty) {
info->dirty = false;
int vReg = SRegToVReg(cUnit, info->sReg);
- storeBaseDisp(cUnit, rMIPS_SP, oatVRegOffset(cUnit, vReg), reg, kWord);
+ StoreBaseDisp(cUnit, rMIPS_SP, VRegOffset(cUnit, vReg), reg, kWord);
}
}
/* Give access to the target-dependent FP register encoding to common code */
-bool oatIsFpReg(int reg) {
+bool IsFpReg(int reg) {
return MIPS_FPREG(reg);
}
-uint32_t oatFpRegMask() {
- return MIPS_FP_REG_MASK;
-}
-
/* Clobber all regs that might be used by an external C call */
-extern void oatClobberCalleeSave(CompilationUnit *cUnit)
+extern void ClobberCalleeSave(CompilationUnit *cUnit)
{
- oatClobber(cUnit, r_ZERO);
- oatClobber(cUnit, r_AT);
- oatClobber(cUnit, r_V0);
- oatClobber(cUnit, r_V1);
- oatClobber(cUnit, r_A0);
- oatClobber(cUnit, r_A1);
- oatClobber(cUnit, r_A2);
- oatClobber(cUnit, r_A3);
- oatClobber(cUnit, r_T0);
- oatClobber(cUnit, r_T1);
- oatClobber(cUnit, r_T2);
- oatClobber(cUnit, r_T3);
- oatClobber(cUnit, r_T4);
- oatClobber(cUnit, r_T5);
- oatClobber(cUnit, r_T6);
- oatClobber(cUnit, r_T7);
- oatClobber(cUnit, r_T8);
- oatClobber(cUnit, r_T9);
- oatClobber(cUnit, r_K0);
- oatClobber(cUnit, r_K1);
- oatClobber(cUnit, r_GP);
- oatClobber(cUnit, r_FP);
- oatClobber(cUnit, r_RA);
- oatClobber(cUnit, r_F0);
- oatClobber(cUnit, r_F1);
- oatClobber(cUnit, r_F2);
- oatClobber(cUnit, r_F3);
- oatClobber(cUnit, r_F4);
- oatClobber(cUnit, r_F5);
- oatClobber(cUnit, r_F6);
- oatClobber(cUnit, r_F7);
- oatClobber(cUnit, r_F8);
- oatClobber(cUnit, r_F9);
- oatClobber(cUnit, r_F10);
- oatClobber(cUnit, r_F11);
- oatClobber(cUnit, r_F12);
- oatClobber(cUnit, r_F13);
- oatClobber(cUnit, r_F14);
- oatClobber(cUnit, r_F15);
+ Clobber(cUnit, r_ZERO);
+ Clobber(cUnit, r_AT);
+ Clobber(cUnit, r_V0);
+ Clobber(cUnit, r_V1);
+ Clobber(cUnit, r_A0);
+ Clobber(cUnit, r_A1);
+ Clobber(cUnit, r_A2);
+ Clobber(cUnit, r_A3);
+ Clobber(cUnit, r_T0);
+ Clobber(cUnit, r_T1);
+ Clobber(cUnit, r_T2);
+ Clobber(cUnit, r_T3);
+ Clobber(cUnit, r_T4);
+ Clobber(cUnit, r_T5);
+ Clobber(cUnit, r_T6);
+ Clobber(cUnit, r_T7);
+ Clobber(cUnit, r_T8);
+ Clobber(cUnit, r_T9);
+ Clobber(cUnit, r_K0);
+ Clobber(cUnit, r_K1);
+ Clobber(cUnit, r_GP);
+ Clobber(cUnit, r_FP);
+ Clobber(cUnit, r_RA);
+ Clobber(cUnit, r_F0);
+ Clobber(cUnit, r_F1);
+ Clobber(cUnit, r_F2);
+ Clobber(cUnit, r_F3);
+ Clobber(cUnit, r_F4);
+ Clobber(cUnit, r_F5);
+ Clobber(cUnit, r_F6);
+ Clobber(cUnit, r_F7);
+ Clobber(cUnit, r_F8);
+ Clobber(cUnit, r_F9);
+ Clobber(cUnit, r_F10);
+ Clobber(cUnit, r_F11);
+ Clobber(cUnit, r_F12);
+ Clobber(cUnit, r_F13);
+ Clobber(cUnit, r_F14);
+ Clobber(cUnit, r_F15);
}
-extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit)
+extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit)
{
- UNIMPLEMENTED(FATAL) << "No oatGetReturnWideAlt for MIPS";
- RegLocation res = locCReturnWide();
+ UNIMPLEMENTED(FATAL) << "No GetReturnWideAlt for MIPS";
+ RegLocation res = LocCReturnWide();
return res;
}
-extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit)
+extern RegLocation GetReturnAlt(CompilationUnit* cUnit)
{
- UNIMPLEMENTED(FATAL) << "No oatGetReturnAlt for MIPS";
- RegLocation res = locCReturn();
+ UNIMPLEMENTED(FATAL) << "No GetReturnAlt for MIPS";
+ RegLocation res = LocCReturn();
return res;
}
-extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg)
+extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg)
{
return MIPS_FPREG(reg) ? &cUnit->regPool->FPRegs[reg & MIPS_FP_REG_MASK]
: &cUnit->regPool->coreRegs[reg];
}
/* To be used when explicitly managing register use */
-extern void oatLockCallTemps(CompilationUnit* cUnit)
+extern void LockCallTemps(CompilationUnit* cUnit)
{
- oatLockTemp(cUnit, rMIPS_ARG0);
- oatLockTemp(cUnit, rMIPS_ARG1);
- oatLockTemp(cUnit, rMIPS_ARG2);
- oatLockTemp(cUnit, rMIPS_ARG3);
+ LockTemp(cUnit, rMIPS_ARG0);
+ LockTemp(cUnit, rMIPS_ARG1);
+ LockTemp(cUnit, rMIPS_ARG2);
+ LockTemp(cUnit, rMIPS_ARG3);
}
/* To be used when explicitly managing register use */
-extern void oatFreeCallTemps(CompilationUnit* cUnit)
+extern void FreeCallTemps(CompilationUnit* cUnit)
{
- oatFreeTemp(cUnit, rMIPS_ARG0);
- oatFreeTemp(cUnit, rMIPS_ARG1);
- oatFreeTemp(cUnit, rMIPS_ARG2);
- oatFreeTemp(cUnit, rMIPS_ARG3);
-}
-
-/*
- * Determine the initial instruction set to be used for this trace.
- * Later components may decide to change this.
- */
-InstructionSet oatInstructionSet()
-{
- return kMips;
+ FreeTemp(cUnit, rMIPS_ARG0);
+ FreeTemp(cUnit, rMIPS_ARG1);
+ FreeTemp(cUnit, rMIPS_ARG2);
+ FreeTemp(cUnit, rMIPS_ARG3);
}
/* Architecture-specific initializations and checks go here */
-bool oatArchVariantInit(void)
+bool ArchVariantInit(void)
{
return true;
}
-void oatGenMemBarrier(CompilationUnit *cUnit, MemBarrierKind barrierKind)
+void GenMemBarrier(CompilationUnit *cUnit, MemBarrierKind barrierKind)
{
#if ANDROID_SMP != 0
- newLIR1(cUnit, kMipsSync, 0 /* Only stype currently supported */);
+ NewLIR1(cUnit, kMipsSync, 0 /* Only stype currently supported */);
#endif
}
@@ -492,7 +479,7 @@
* Alloc a pair of core registers, or a double. Low reg in low byte,
* high reg in next byte.
*/
-int oatAllocTypedTempPair(CompilationUnit *cUnit, bool fpHint,
+int AllocTypedTempPair(CompilationUnit *cUnit, bool fpHint,
int regClass)
{
int highReg;
@@ -501,71 +488,71 @@
#ifdef __mips_hard_float
if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg)) {
- lowReg = oatAllocTempDouble(cUnit);
+ lowReg = AllocTempDouble(cUnit);
highReg = lowReg + 1;
res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
return res;
}
#endif
- lowReg = oatAllocTemp(cUnit);
- highReg = oatAllocTemp(cUnit);
+ lowReg = AllocTemp(cUnit);
+ highReg = AllocTemp(cUnit);
res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
return res;
}
-int oatAllocTypedTemp(CompilationUnit *cUnit, bool fpHint, int regClass)
+int AllocTypedTemp(CompilationUnit *cUnit, bool fpHint, int regClass)
{
#ifdef __mips_hard_float
if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg))
{
- return oatAllocTempFloat(cUnit);
+ return AllocTempFloat(cUnit);
}
#endif
- return oatAllocTemp(cUnit);
+ return AllocTemp(cUnit);
}
-void oatInitializeRegAlloc(CompilationUnit* cUnit)
+void CompilerInitializeRegAlloc(CompilationUnit* cUnit)
{
int numRegs = sizeof(coreRegs)/sizeof(*coreRegs);
- int numReserved = sizeof(reservedRegs)/sizeof(*reservedRegs);
+ int numReserved = sizeof(ReservedRegs)/sizeof(*ReservedRegs);
int numTemps = sizeof(coreTemps)/sizeof(*coreTemps);
#ifdef __mips_hard_float
- int numFPRegs = sizeof(fpRegs)/sizeof(*fpRegs);
+ int numFPRegs = sizeof(FpRegs)/sizeof(*FpRegs);
int numFPTemps = sizeof(fpTemps)/sizeof(*fpTemps);
#else
int numFPRegs = 0;
int numFPTemps = 0;
#endif
RegisterPool *pool =
- static_cast<RegisterPool*>(oatNew(cUnit, sizeof(*pool), true, kAllocRegAlloc));
+ static_cast<RegisterPool*>(NewMem(cUnit, sizeof(*pool), true, kAllocRegAlloc));
cUnit->regPool = pool;
pool->numCoreRegs = numRegs;
pool->coreRegs = static_cast<RegisterInfo*>
- (oatNew(cUnit, numRegs * sizeof(*cUnit->regPool->coreRegs), true, kAllocRegAlloc));
+ (NewMem(cUnit, numRegs * sizeof(*cUnit->regPool->coreRegs), true, kAllocRegAlloc));
pool->numFPRegs = numFPRegs;
pool->FPRegs = static_cast<RegisterInfo*>
- (oatNew(cUnit, numFPRegs * sizeof(*cUnit->regPool->FPRegs), true, kAllocRegAlloc));
- oatInitPool(pool->coreRegs, coreRegs, pool->numCoreRegs);
- oatInitPool(pool->FPRegs, fpRegs, pool->numFPRegs);
+ (NewMem(cUnit, numFPRegs * sizeof(*cUnit->regPool->FPRegs), true, kAllocRegAlloc));
+ CompilerInitPool(pool->coreRegs, coreRegs, pool->numCoreRegs);
+ CompilerInitPool(pool->FPRegs, FpRegs, pool->numFPRegs);
// Keep special registers from being allocated
for (int i = 0; i < numReserved; i++) {
- if (NO_SUSPEND && (reservedRegs[i] == rMIPS_SUSPEND)) {
+ if (NO_SUSPEND && (ReservedRegs[i] == rMIPS_SUSPEND)) {
//To measure cost of suspend check
continue;
}
- oatMarkInUse(cUnit, reservedRegs[i]);
+ MarkInUse(cUnit, ReservedRegs[i]);
}
// Mark temp regs - all others not in use can be used for promotion
for (int i = 0; i < numTemps; i++) {
- oatMarkTemp(cUnit, coreTemps[i]);
+ MarkTemp(cUnit, coreTemps[i]);
}
for (int i = 0; i < numFPTemps; i++) {
- oatMarkTemp(cUnit, fpTemps[i]);
+ MarkTemp(cUnit, fpTemps[i]);
}
// Construct the alias map.
cUnit->phiAliasMap = static_cast<int*>
- (oatNew(cUnit, cUnit->numSSARegs * sizeof(cUnit->phiAliasMap[0]), false, kAllocDFInfo));
+ (NewMem(cUnit, cUnit->numSSARegs * sizeof(cUnit->phiAliasMap[0]), false, kAllocDFInfo));
for (int i = 0; i < cUnit->numSSARegs; i++) {
cUnit->phiAliasMap[i] = i;
}
@@ -581,14 +568,14 @@
}
}
-void freeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep,
+void FreeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep,
RegLocation rlFree)
{
if ((rlFree.lowReg != rlKeep.lowReg) && (rlFree.lowReg != rlKeep.highReg) &&
(rlFree.highReg != rlKeep.lowReg) && (rlFree.highReg != rlKeep.highReg)) {
// No overlap, free both
- oatFreeTemp(cUnit, rlFree.lowReg);
- oatFreeTemp(cUnit, rlFree.highReg);
+ FreeTemp(cUnit, rlFree.lowReg);
+ FreeTemp(cUnit, rlFree.highReg);
}
}
/*
@@ -597,29 +584,29 @@
* ensure that all branch instructions can be restarted if
* there is a trap in the shadow. Allocate a temp register.
*/
-int loadHelper(CompilationUnit* cUnit, int offset)
+int LoadHelper(CompilationUnit* cUnit, int offset)
{
- loadWordDisp(cUnit, rMIPS_SELF, offset, r_T9);
+ LoadWordDisp(cUnit, rMIPS_SELF, offset, r_T9);
return r_T9;
}
-void spillCoreRegs(CompilationUnit* cUnit)
+void SpillCoreRegs(CompilationUnit* cUnit)
{
if (cUnit->numCoreSpills == 0) {
return;
}
uint32_t mask = cUnit->coreSpillMask;
int offset = cUnit->numCoreSpills * 4;
- opRegImm(cUnit, kOpSub, rMIPS_SP, offset);
+ OpRegImm(cUnit, kOpSub, rMIPS_SP, offset);
for (int reg = 0; mask; mask >>= 1, reg++) {
if (mask & 0x1) {
offset -= 4;
- storeWordDisp(cUnit, rMIPS_SP, offset, reg);
+ StoreWordDisp(cUnit, rMIPS_SP, offset, reg);
}
}
}
-void unSpillCoreRegs(CompilationUnit* cUnit)
+void UnSpillCoreRegs(CompilationUnit* cUnit)
{
if (cUnit->numCoreSpills == 0) {
return;
@@ -629,19 +616,19 @@
for (int reg = 0; mask; mask >>= 1, reg++) {
if (mask & 0x1) {
offset -= 4;
- loadWordDisp(cUnit, rMIPS_SP, offset, reg);
+ LoadWordDisp(cUnit, rMIPS_SP, offset, reg);
}
}
- opRegImm(cUnit, kOpAdd, rMIPS_SP, cUnit->frameSize);
+ OpRegImm(cUnit, kOpAdd, rMIPS_SP, cUnit->frameSize);
}
-bool branchUnconditional(LIR* lir)
+bool BranchUnconditional(LIR* lir)
{
return (lir->opcode == kMipsB);
}
/* Common initialization routine for an architecture family */
-bool oatArchInit()
+bool ArchInit()
{
int i;
@@ -652,20 +639,20 @@
}
}
- return oatArchVariantInit();
+ return ArchVariantInit();
}
-uint64_t getTargetInstFlags(int opcode)
+uint64_t GetTargetInstFlags(int opcode)
{
return EncodingMap[opcode].flags;
}
-const char* getTargetInstName(int opcode)
+const char* GetTargetInstName(int opcode)
{
return EncodingMap[opcode].name;
}
-const char* getTargetInstFmt(int opcode)
+const char* GetTargetInstFmt(int opcode)
{
return EncodingMap[opcode].fmt;
}
diff --git a/src/compiler/codegen/mips/utility_mips.cc b/src/compiler/codegen/mips/utility_mips.cc
index 7a018c5..011fc34 100644
--- a/src/compiler/codegen/mips/utility_mips.cc
+++ b/src/compiler/codegen/mips/utility_mips.cc
@@ -22,16 +22,16 @@
/* This file contains codegen for the MIPS32 ISA. */
-void genBarrier(CompilationUnit *cUnit);
-void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg);
-LIR *loadWordDisp(CompilationUnit *cUnit, int rBase, int displacement,
+void GenBarrier(CompilationUnit *cUnit);
+void LoadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg);
+LIR *LoadWordDisp(CompilationUnit *cUnit, int rBase, int displacement,
int rDest);
-LIR *storeWordDisp(CompilationUnit *cUnit, int rBase,
+LIR *StoreWordDisp(CompilationUnit *cUnit, int rBase,
int displacement, int rSrc);
-LIR *loadConstant(CompilationUnit *cUnit, int rDest, int value);
+LIR *LoadConstant(CompilationUnit *cUnit, int rDest, int value);
#ifdef __mips_hard_float
-LIR *fpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
+LIR *FpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
{
int opcode;
/* must be both DOUBLE or both not DOUBLE */
@@ -54,7 +54,7 @@
opcode = kMipsMfc1;
}
}
- LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rSrc, rDest);
+ LIR* res = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rSrc, rDest);
if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) && rDest == rSrc) {
res->flags.isNop = true;
}
@@ -68,10 +68,10 @@
* a high register, build constant into a low register and copy.
*
* No additional register clobbering operation performed. Use this version when
- * 1) rDest is freshly returned from oatAllocTemp or
+ * 1) rDest is freshly returned from AllocTemp or
* 2) The codegen is under fixed register usage
*/
-LIR *loadConstantNoClobber(CompilationUnit *cUnit, int rDest, int value)
+LIR *LoadConstantNoClobber(CompilationUnit *cUnit, int rDest, int value)
{
LIR *res;
@@ -80,42 +80,42 @@
int isFpReg = MIPS_FPREG(rDest);
if (isFpReg) {
DCHECK(MIPS_SINGLEREG(rDest));
- rDest = oatAllocTemp(cUnit);
+ rDest = AllocTemp(cUnit);
}
#endif
/* See if the value can be constructed cheaply */
if (value == 0) {
- res = newLIR2(cUnit, kMipsMove, rDest, r_ZERO);
+ res = NewLIR2(cUnit, kMipsMove, rDest, r_ZERO);
} else if ((value > 0) && (value <= 65535)) {
- res = newLIR3(cUnit, kMipsOri, rDest, r_ZERO, value);
+ res = NewLIR3(cUnit, kMipsOri, rDest, r_ZERO, value);
} else if ((value < 0) && (value >= -32768)) {
- res = newLIR3(cUnit, kMipsAddiu, rDest, r_ZERO, value);
+ res = NewLIR3(cUnit, kMipsAddiu, rDest, r_ZERO, value);
} else {
- res = newLIR2(cUnit, kMipsLui, rDest, value>>16);
+ res = NewLIR2(cUnit, kMipsLui, rDest, value>>16);
if (value & 0xffff)
- newLIR3(cUnit, kMipsOri, rDest, rDest, value);
+ NewLIR3(cUnit, kMipsOri, rDest, rDest, value);
}
#ifdef __mips_hard_float
if (isFpReg) {
- newLIR2(cUnit, kMipsMtc1, rDest, rDestSave);
- oatFreeTemp(cUnit, rDest);
+ NewLIR2(cUnit, kMipsMtc1, rDest, rDestSave);
+ FreeTemp(cUnit, rDest);
}
#endif
return res;
}
-LIR *opBranchUnconditional(CompilationUnit *cUnit, OpKind op)
+LIR *OpBranchUnconditional(CompilationUnit *cUnit, OpKind op)
{
DCHECK_EQ(op, kOpUncondBr);
- return newLIR1(cUnit, kMipsB, 0 /* offset to be patched */ );
+ return NewLIR1(cUnit, kMipsB, 0 /* offset to be patched */ );
}
-LIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
+LIR *LoadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
-LIR *opReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
+LIR *OpReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
{
MipsOpCode opcode = kMipsNop;
switch (op) {
@@ -123,17 +123,17 @@
opcode = kMipsJalr;
break;
case kOpBx:
- return newLIR1(cUnit, kMipsJr, rDestSrc);
+ return NewLIR1(cUnit, kMipsJr, rDestSrc);
break;
default:
- LOG(FATAL) << "Bad case in opReg";
+ LOG(FATAL) << "Bad case in OpReg";
}
- return newLIR2(cUnit, opcode, r_RA, rDestSrc);
+ return NewLIR2(cUnit, opcode, r_RA, rDestSrc);
}
-LIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
+LIR *OpRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
int rSrc1, int value);
-LIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
+LIR *OpRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
int value)
{
LIR *res;
@@ -143,29 +143,29 @@
MipsOpCode opcode = kMipsNop;
switch (op) {
case kOpAdd:
- return opRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
+ return OpRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
break;
case kOpSub:
- return opRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
+ return OpRegRegImm(cUnit, op, rDestSrc1, rDestSrc1, value);
break;
default:
- LOG(FATAL) << "Bad case in opRegImm";
+ LOG(FATAL) << "Bad case in OpRegImm";
break;
}
if (shortForm)
- res = newLIR2(cUnit, opcode, rDestSrc1, absValue);
+ res = NewLIR2(cUnit, opcode, rDestSrc1, absValue);
else {
- int rScratch = oatAllocTemp(cUnit);
- res = loadConstant(cUnit, rScratch, value);
+ int rScratch = AllocTemp(cUnit);
+ res = LoadConstant(cUnit, rScratch, value);
if (op == kOpCmp)
- newLIR2(cUnit, opcode, rDestSrc1, rScratch);
+ NewLIR2(cUnit, opcode, rDestSrc1, rScratch);
else
- newLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rScratch);
+ NewLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, rScratch);
}
return res;
}
-LIR *opRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest,
+LIR *OpRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest,
int rSrc1, int rSrc2)
{
MipsOpCode opcode = kMipsNop;
@@ -202,13 +202,13 @@
LOG(FATAL) << "No carry bit on MIPS";
break;
default:
- LOG(FATAL) << "bad case in opRegRegReg";
+ LOG(FATAL) << "bad case in OpRegRegReg";
break;
}
- return newLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
+ return NewLIR3(cUnit, opcode, rDest, rSrc1, rSrc2);
}
-LIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
+LIR *OpRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
int rSrc1, int value)
{
LIR *res;
@@ -279,26 +279,26 @@
opcode = kMipsMul;
break;
default:
- LOG(FATAL) << "Bad case in opRegRegImm";
+ LOG(FATAL) << "Bad case in OpRegRegImm";
break;
}
if (shortForm)
- res = newLIR3(cUnit, opcode, rDest, rSrc1, value);
+ res = NewLIR3(cUnit, opcode, rDest, rSrc1, value);
else {
if (rDest != rSrc1) {
- res = loadConstant(cUnit, rDest, value);
- newLIR3(cUnit, opcode, rDest, rSrc1, rDest);
+ res = LoadConstant(cUnit, rDest, value);
+ NewLIR3(cUnit, opcode, rDest, rSrc1, rDest);
} else {
- int rScratch = oatAllocTemp(cUnit);
- res = loadConstant(cUnit, rScratch, value);
- newLIR3(cUnit, opcode, rDest, rSrc1, rScratch);
+ int rScratch = AllocTemp(cUnit);
+ res = LoadConstant(cUnit, rScratch, value);
+ NewLIR3(cUnit, opcode, rDest, rSrc1, rScratch);
}
}
return res;
}
-LIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int rSrc2)
+LIR *OpRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int rSrc2)
{
MipsOpCode opcode = kMipsNop;
LIR *res;
@@ -307,58 +307,58 @@
opcode = kMipsMove;
break;
case kOpMvn:
- return newLIR3(cUnit, kMipsNor, rDestSrc1, rSrc2, r_ZERO);
+ return NewLIR3(cUnit, kMipsNor, rDestSrc1, rSrc2, r_ZERO);
case kOpNeg:
- return newLIR3(cUnit, kMipsSubu, rDestSrc1, r_ZERO, rSrc2);
+ return NewLIR3(cUnit, kMipsSubu, rDestSrc1, r_ZERO, rSrc2);
case kOpAdd:
case kOpAnd:
case kOpMul:
case kOpOr:
case kOpSub:
case kOpXor:
- return opRegRegReg(cUnit, op, rDestSrc1, rDestSrc1, rSrc2);
+ return OpRegRegReg(cUnit, op, rDestSrc1, rDestSrc1, rSrc2);
case kOp2Byte:
#if __mips_isa_rev>=2
- res = newLIR2(cUnit, kMipsSeb, rDestSrc1, rSrc2);
+ res = NewLIR2(cUnit, kMipsSeb, rDestSrc1, rSrc2);
#else
- res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 24);
- opRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 24);
+ res = OpRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 24);
+ OpRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 24);
#endif
return res;
case kOp2Short:
#if __mips_isa_rev>=2
- res = newLIR2(cUnit, kMipsSeh, rDestSrc1, rSrc2);
+ res = NewLIR2(cUnit, kMipsSeh, rDestSrc1, rSrc2);
#else
- res = opRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 16);
- opRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 16);
+ res = OpRegRegImm(cUnit, kOpLsl, rDestSrc1, rSrc2, 16);
+ OpRegRegImm(cUnit, kOpAsr, rDestSrc1, rDestSrc1, 16);
#endif
return res;
case kOp2Char:
- return newLIR3(cUnit, kMipsAndi, rDestSrc1, rSrc2, 0xFFFF);
+ return NewLIR3(cUnit, kMipsAndi, rDestSrc1, rSrc2, 0xFFFF);
default:
- LOG(FATAL) << "Bad case in opRegReg";
+ LOG(FATAL) << "Bad case in OpRegReg";
break;
}
- return newLIR2(cUnit, opcode, rDestSrc1, rSrc2);
+ return NewLIR2(cUnit, opcode, rDestSrc1, rSrc2);
}
-LIR *loadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
+LIR *LoadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
int rDestHi, int valLo, int valHi)
{
LIR *res;
- res = loadConstantNoClobber(cUnit, rDestLo, valLo);
- loadConstantNoClobber(cUnit, rDestHi, valHi);
+ res = LoadConstantNoClobber(cUnit, rDestLo, valLo);
+ LoadConstantNoClobber(cUnit, rDestHi, valHi);
return res;
}
/* Load value from base + scaled index. */
-LIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase,
+LIR *LoadBaseIndexed(CompilationUnit *cUnit, int rBase,
int rIndex, int rDest, int scale, OpSize size)
{
LIR *first = NULL;
LIR *res;
MipsOpCode opcode = kMipsNop;
- int tReg = oatAllocTemp(cUnit);
+ int tReg = AllocTemp(cUnit);
#ifdef __mips_hard_float
if (MIPS_FPREG(rDest)) {
@@ -372,10 +372,10 @@
#endif
if (!scale) {
- first = newLIR3(cUnit, kMipsAddu, tReg , rBase, rIndex);
+ first = NewLIR3(cUnit, kMipsAddu, tReg , rBase, rIndex);
} else {
- first = opRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale);
- newLIR3(cUnit, kMipsAddu, tReg , rBase, tReg);
+ first = OpRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale);
+ NewLIR3(cUnit, kMipsAddu, tReg , rBase, tReg);
}
switch (size) {
@@ -400,22 +400,22 @@
opcode = kMipsLb;
break;
default:
- LOG(FATAL) << "Bad case in loadBaseIndexed";
+ LOG(FATAL) << "Bad case in LoadBaseIndexed";
}
- res = newLIR3(cUnit, opcode, rDest, 0, tReg);
- oatFreeTemp(cUnit, tReg);
+ res = NewLIR3(cUnit, opcode, rDest, 0, tReg);
+ FreeTemp(cUnit, tReg);
return (first) ? first : res;
}
/* store value base base + scaled index. */
-LIR *storeBaseIndexed(CompilationUnit *cUnit, int rBase,
+LIR *StoreBaseIndexed(CompilationUnit *cUnit, int rBase,
int rIndex, int rSrc, int scale, OpSize size)
{
LIR *first = NULL;
MipsOpCode opcode = kMipsNop;
int rNewIndex = rIndex;
- int tReg = oatAllocTemp(cUnit);
+ int tReg = AllocTemp(cUnit);
#ifdef __mips_hard_float
if (MIPS_FPREG(rSrc)) {
@@ -429,10 +429,10 @@
#endif
if (!scale) {
- first = newLIR3(cUnit, kMipsAddu, tReg , rBase, rIndex);
+ first = NewLIR3(cUnit, kMipsAddu, tReg , rBase, rIndex);
} else {
- first = opRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale);
- newLIR3(cUnit, kMipsAddu, tReg , rBase, tReg);
+ first = OpRegRegImm(cUnit, kOpLsl, tReg, rIndex, scale);
+ NewLIR3(cUnit, kMipsAddu, tReg , rBase, tReg);
}
switch (size) {
@@ -453,58 +453,58 @@
opcode = kMipsSb;
break;
default:
- LOG(FATAL) << "Bad case in storeBaseIndexed";
+ LOG(FATAL) << "Bad case in StoreBaseIndexed";
}
- newLIR3(cUnit, opcode, rSrc, 0, tReg);
- oatFreeTemp(cUnit, rNewIndex);
+ NewLIR3(cUnit, opcode, rSrc, 0, tReg);
+ FreeTemp(cUnit, rNewIndex);
return first;
}
-LIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
+LIR *LoadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
{
int i;
int loadCnt = 0;
LIR *res = NULL ;
- genBarrier(cUnit);
+ GenBarrier(cUnit);
for (i = 0; i < 8; i++, rMask >>= 1) {
if (rMask & 0x1) { /* map r0 to MIPS r_A0 */
- newLIR3(cUnit, kMipsLw, i+r_A0, loadCnt*4, rBase);
+ NewLIR3(cUnit, kMipsLw, i+r_A0, loadCnt*4, rBase);
loadCnt++;
}
}
if (loadCnt) {/* increment after */
- newLIR3(cUnit, kMipsAddiu, rBase, rBase, loadCnt*4);
+ NewLIR3(cUnit, kMipsAddiu, rBase, rBase, loadCnt*4);
}
- genBarrier(cUnit);
+ GenBarrier(cUnit);
return res; /* NULL always returned which should be ok since no callers use it */
}
-LIR *storeMultiple(CompilationUnit *cUnit, int rBase, int rMask)
+LIR *StoreMultiple(CompilationUnit *cUnit, int rBase, int rMask)
{
int i;
int storeCnt = 0;
LIR *res = NULL ;
- genBarrier(cUnit);
+ GenBarrier(cUnit);
for (i = 0; i < 8; i++, rMask >>= 1) {
if (rMask & 0x1) { /* map r0 to MIPS r_A0 */
- newLIR3(cUnit, kMipsSw, i+r_A0, storeCnt*4, rBase);
+ NewLIR3(cUnit, kMipsSw, i+r_A0, storeCnt*4, rBase);
storeCnt++;
}
}
if (storeCnt) { /* increment after */
- newLIR3(cUnit, kMipsAddiu, rBase, rBase, storeCnt*4);
+ NewLIR3(cUnit, kMipsAddiu, rBase, rBase, storeCnt*4);
}
- genBarrier(cUnit);
+ GenBarrier(cUnit);
return res; /* NULL always returned which should be ok since no callers use it */
}
-LIR *loadBaseDispBody(CompilationUnit *cUnit, int rBase,
+LIR *LoadBaseDispBody(CompilationUnit *cUnit, int rBase,
int displacement, int rDest, int rDestHi,
OpSize size, int sReg)
/*
@@ -569,61 +569,61 @@
opcode = kMipsLb;
break;
default:
- LOG(FATAL) << "Bad case in loadBaseIndexedBody";
+ LOG(FATAL) << "Bad case in LoadBaseIndexedBody";
}
if (shortForm) {
if (!pair) {
- load = res = newLIR3(cUnit, opcode, rDest, displacement, rBase);
+ load = res = NewLIR3(cUnit, opcode, rDest, displacement, rBase);
} else {
- load = res = newLIR3(cUnit, opcode, rDest,
+ load = res = NewLIR3(cUnit, opcode, rDest,
displacement + LOWORD_OFFSET, rBase);
- load2 = newLIR3(cUnit, opcode, rDestHi,
+ load2 = NewLIR3(cUnit, opcode, rDestHi,
displacement + HIWORD_OFFSET, rBase);
}
} else {
if (pair) {
- int rTmp = oatAllocFreeTemp(cUnit);
- res = opRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
- load = newLIR3(cUnit, opcode, rDest, LOWORD_OFFSET, rTmp);
- load2 = newLIR3(cUnit, opcode, rDestHi, HIWORD_OFFSET, rTmp);
- oatFreeTemp(cUnit, rTmp);
+ int rTmp = AllocFreeTemp(cUnit);
+ res = OpRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
+ load = NewLIR3(cUnit, opcode, rDest, LOWORD_OFFSET, rTmp);
+ load2 = NewLIR3(cUnit, opcode, rDestHi, HIWORD_OFFSET, rTmp);
+ FreeTemp(cUnit, rTmp);
} else {
- int rTmp = (rBase == rDest) ? oatAllocFreeTemp(cUnit) : rDest;
- res = opRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
- load = newLIR3(cUnit, opcode, rDest, 0, rTmp);
+ int rTmp = (rBase == rDest) ? AllocFreeTemp(cUnit) : rDest;
+ res = OpRegRegImm(cUnit, kOpAdd, rTmp, rBase, displacement);
+ load = NewLIR3(cUnit, opcode, rDest, 0, rTmp);
if (rTmp != rDest)
- oatFreeTemp(cUnit, rTmp);
+ FreeTemp(cUnit, rTmp);
}
}
if (rBase == rMIPS_SP) {
- annotateDalvikRegAccess(load,
+ AnnotateDalvikRegAccess(load,
(displacement + (pair ? LOWORD_OFFSET : 0)) >> 2,
true /* isLoad */, pair /* is64bit */);
if (pair) {
- annotateDalvikRegAccess(load2, (displacement + HIWORD_OFFSET) >> 2,
+ AnnotateDalvikRegAccess(load2, (displacement + HIWORD_OFFSET) >> 2,
true /* isLoad */, pair /* is64bit */);
}
}
return load;
}
-LIR *loadBaseDisp(CompilationUnit *cUnit, int rBase,
+LIR *LoadBaseDisp(CompilationUnit *cUnit, int rBase,
int displacement, int rDest, OpSize size, int sReg)
{
- return loadBaseDispBody(cUnit, rBase, displacement, rDest, -1,
+ return LoadBaseDispBody(cUnit, rBase, displacement, rDest, -1,
size, sReg);
}
-LIR *loadBaseDispWide(CompilationUnit *cUnit, int rBase,
+LIR *LoadBaseDispWide(CompilationUnit *cUnit, int rBase,
int displacement, int rDestLo, int rDestHi, int sReg)
{
- return loadBaseDispBody(cUnit, rBase, displacement, rDestLo, rDestHi,
+ return LoadBaseDispBody(cUnit, rBase, displacement, rDestLo, rDestHi,
kLong, sReg);
}
-LIR *storeBaseDispBody(CompilationUnit *cUnit, int rBase,
+LIR *StoreBaseDispBody(CompilationUnit *cUnit, int rBase,
int displacement, int rSrc, int rSrcHi, OpSize size)
{
LIR *res;
@@ -674,35 +674,35 @@
opcode = kMipsSb;
break;
default:
- LOG(FATAL) << "Bad case in storeBaseIndexedBody";
+ LOG(FATAL) << "Bad case in StoreBaseIndexedBody";
}
if (shortForm) {
if (!pair) {
- store = res = newLIR3(cUnit, opcode, rSrc, displacement, rBase);
+ store = res = NewLIR3(cUnit, opcode, rSrc, displacement, rBase);
} else {
- store = res = newLIR3(cUnit, opcode, rSrc, displacement + LOWORD_OFFSET,
+ store = res = NewLIR3(cUnit, opcode, rSrc, displacement + LOWORD_OFFSET,
rBase);
- store2 = newLIR3(cUnit, opcode, rSrcHi, displacement + HIWORD_OFFSET,
+ store2 = NewLIR3(cUnit, opcode, rSrcHi, displacement + HIWORD_OFFSET,
rBase);
}
} else {
- int rScratch = oatAllocTemp(cUnit);
- res = opRegRegImm(cUnit, kOpAdd, rScratch, rBase, displacement);
+ int rScratch = AllocTemp(cUnit);
+ res = OpRegRegImm(cUnit, kOpAdd, rScratch, rBase, displacement);
if (!pair) {
- store = newLIR3(cUnit, opcode, rSrc, 0, rScratch);
+ store = NewLIR3(cUnit, opcode, rSrc, 0, rScratch);
} else {
- store = newLIR3(cUnit, opcode, rSrc, LOWORD_OFFSET, rScratch);
- store2 = newLIR3(cUnit, opcode, rSrcHi, HIWORD_OFFSET, rScratch);
+ store = NewLIR3(cUnit, opcode, rSrc, LOWORD_OFFSET, rScratch);
+ store2 = NewLIR3(cUnit, opcode, rSrcHi, HIWORD_OFFSET, rScratch);
}
- oatFreeTemp(cUnit, rScratch);
+ FreeTemp(cUnit, rScratch);
}
if (rBase == rMIPS_SP) {
- annotateDalvikRegAccess(store, (displacement + (pair ? LOWORD_OFFSET : 0))
+ AnnotateDalvikRegAccess(store, (displacement + (pair ? LOWORD_OFFSET : 0))
>> 2, false /* isLoad */, pair /* is64bit */);
if (pair) {
- annotateDalvikRegAccess(store2, (displacement + HIWORD_OFFSET) >> 2,
+ AnnotateDalvikRegAccess(store2, (displacement + HIWORD_OFFSET) >> 2,
false /* isLoad */, pair /* is64bit */);
}
}
@@ -710,64 +710,64 @@
return res;
}
-LIR *storeBaseDisp(CompilationUnit *cUnit, int rBase,
+LIR *StoreBaseDisp(CompilationUnit *cUnit, int rBase,
int displacement, int rSrc, OpSize size)
{
- return storeBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
+ return StoreBaseDispBody(cUnit, rBase, displacement, rSrc, -1, size);
}
-LIR *storeBaseDispWide(CompilationUnit *cUnit, int rBase,
+LIR *StoreBaseDispWide(CompilationUnit *cUnit, int rBase,
int displacement, int rSrcLo, int rSrcHi)
{
- return storeBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
+ return StoreBaseDispBody(cUnit, rBase, displacement, rSrcLo, rSrcHi, kLong);
}
-void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
+void LoadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
{
- loadWordDisp(cUnit, base, LOWORD_OFFSET , lowReg);
- loadWordDisp(cUnit, base, HIWORD_OFFSET , highReg);
+ LoadWordDisp(cUnit, base, LOWORD_OFFSET , lowReg);
+ LoadWordDisp(cUnit, base, HIWORD_OFFSET , highReg);
}
-LIR* opThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset)
+LIR* OpThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset)
{
- LOG(FATAL) << "Unexpected use of opThreadMem for MIPS";
+ LOG(FATAL) << "Unexpected use of OpThreadMem for MIPS";
return NULL;
}
-LIR* opMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp)
+LIR* OpMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp)
{
- LOG(FATAL) << "Unexpected use of opMem for MIPS";
+ LOG(FATAL) << "Unexpected use of OpMem for MIPS";
return NULL;
}
-LIR* storeBaseIndexedDisp(CompilationUnit *cUnit,
+LIR* StoreBaseIndexedDisp(CompilationUnit *cUnit,
int rBase, int rIndex, int scale, int displacement,
int rSrc, int rSrcHi,
OpSize size, int sReg)
{
- LOG(FATAL) << "Unexpected use of storeBaseIndexedDisp for MIPS";
+ LOG(FATAL) << "Unexpected use of StoreBaseIndexedDisp for MIPS";
return NULL;
}
-LIR* opRegMem(CompilationUnit *cUnit, OpKind op, int rDest, int rBase,
+LIR* OpRegMem(CompilationUnit *cUnit, OpKind op, int rDest, int rBase,
int offset)
{
- LOG(FATAL) << "Unexpected use of opRegMem for MIPS";
+ LOG(FATAL) << "Unexpected use of OpRegMem for MIPS";
return NULL;
}
-LIR* loadBaseIndexedDisp(CompilationUnit *cUnit,
+LIR* LoadBaseIndexedDisp(CompilationUnit *cUnit,
int rBase, int rIndex, int scale, int displacement,
int rDest, int rDestHi,
OpSize size, int sReg)
{
- LOG(FATAL) << "Unexpected use of loadBaseIndexedDisp for MIPS";
+ LOG(FATAL) << "Unexpected use of LoadBaseIndexedDisp for MIPS";
return NULL;
}
-LIR* opCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target)
+LIR* OpCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target)
{
- LOG(FATAL) << "Unexpected use of opCondBranch for MIPS";
+ LOG(FATAL) << "Unexpected use of OpCondBranch for MIPS";
return NULL;
}
diff --git a/src/compiler/codegen/ralloc_util.cc b/src/compiler/codegen/ralloc_util.cc
index efdbd32..2a4880a 100644
--- a/src/compiler/codegen/ralloc_util.cc
+++ b/src/compiler/codegen/ralloc_util.cc
@@ -29,7 +29,7 @@
* not affect the "liveness" of a temp register, which will stay
* live until it is either explicitly killed or reallocated.
*/
-extern void oatResetRegPool(CompilationUnit* cUnit)
+extern void ResetRegPool(CompilationUnit* cUnit)
{
int i;
for (i=0; i < cUnit->regPool->numCoreRegs; i++) {
@@ -46,7 +46,7 @@
* Set up temp & preserved register pools specialized by target.
* Note: numRegs may be zero.
*/
-extern void oatInitPool(RegisterInfo* regs, int* regNums, int num)
+extern void CompilerInitPool(RegisterInfo* regs, int* regNums, int num)
{
int i;
for (i=0; i < num; i++) {
@@ -60,7 +60,7 @@
}
}
-void dumpRegPool(RegisterInfo* p, int numRegs)
+void DumpRegPool(RegisterInfo* p, int numRegs)
{
LOG(INFO) << "================================================";
for (int i = 0; i < numRegs; i++) {
@@ -73,18 +73,18 @@
LOG(INFO) << "================================================";
}
-void oatDumpCoreRegPool(CompilationUnit* cUnit)
+void DumpCoreRegPool(CompilationUnit* cUnit)
{
- dumpRegPool(cUnit->regPool->coreRegs, cUnit->regPool->numCoreRegs);
+ DumpRegPool(cUnit->regPool->coreRegs, cUnit->regPool->numCoreRegs);
}
-void oatDumpFpRegPool(CompilationUnit* cUnit)
+void DumpFpRegPool(CompilationUnit* cUnit)
{
- dumpRegPool(cUnit->regPool->FPRegs, cUnit->regPool->numFPRegs);
+ DumpRegPool(cUnit->regPool->FPRegs, cUnit->regPool->numFPRegs);
}
/* Mark a temp register as dead. Does not affect allocation state. */
-static inline void clobberBody(CompilationUnit *cUnit, RegisterInfo* p)
+static inline void ClobberBody(CompilationUnit *cUnit, RegisterInfo* p)
{
if (p->isTemp) {
DCHECK(!(p->live && p->dirty)) << "Live & dirty temp in clobber";
@@ -94,18 +94,18 @@
p->defEnd = NULL;
if (p->pair) {
p->pair = false;
- oatClobber(cUnit, p->partner);
+ Clobber(cUnit, p->partner);
}
}
}
/* Mark a temp register as dead. Does not affect allocation state. */
-void oatClobber(CompilationUnit* cUnit, int reg)
+void Clobber(CompilationUnit* cUnit, int reg)
{
- clobberBody(cUnit, oatGetRegInfo(cUnit, reg));
+ ClobberBody(cUnit, GetRegInfo(cUnit, reg));
}
-void clobberSRegBody(RegisterInfo* p, int numRegs, int sReg)
+void ClobberSRegBody(RegisterInfo* p, int numRegs, int sReg)
{
int i;
for (i=0; i< numRegs; i++) {
@@ -120,7 +120,7 @@
}
/* Clobber any temp associated with an sReg. Could be in either class */
-extern void oatClobberSReg(CompilationUnit* cUnit, int sReg)
+extern void ClobberSReg(CompilationUnit* cUnit, int sReg)
{
#ifndef NDEBUG
/* Reset live temp tracking sanity checker */
@@ -128,8 +128,8 @@
cUnit->liveSReg = INVALID_SREG;
}
#endif
- clobberSRegBody(cUnit->regPool->coreRegs, cUnit->regPool->numCoreRegs, sReg);
- clobberSRegBody(cUnit->regPool->FPRegs, cUnit->regPool->numFPRegs, sReg);
+ ClobberSRegBody(cUnit->regPool->coreRegs, cUnit->regPool->numCoreRegs, sReg);
+ ClobberSRegBody(cUnit->regPool->FPRegs, cUnit->regPool->numFPRegs, sReg);
}
/*
@@ -156,11 +156,11 @@
}
}
-void oatRecordCorePromotion(CompilationUnit* cUnit, int reg, int sReg)
+void RecordCorePromotion(CompilationUnit* cUnit, int reg, int sReg)
{
int pMapIdx = SRegToPMap(cUnit, sReg);
int vReg = SRegToVReg(cUnit, sReg);
- oatGetRegInfo(cUnit, reg)->inUse = true;
+ GetRegInfo(cUnit, reg)->inUse = true;
cUnit->coreSpillMask |= (1 << reg);
// Include reg for later sort
cUnit->coreVmapTable.push_back(reg << VREG_NUM_WIDTH |
@@ -171,28 +171,28 @@
}
/* Reserve a callee-save register. Return -1 if none available */
-extern int oatAllocPreservedCoreReg(CompilationUnit* cUnit, int sReg)
+extern int AllocPreservedCoreReg(CompilationUnit* cUnit, int sReg)
{
int res = -1;
RegisterInfo* coreRegs = cUnit->regPool->coreRegs;
for (int i = 0; i < cUnit->regPool->numCoreRegs; i++) {
if (!coreRegs[i].isTemp && !coreRegs[i].inUse) {
res = coreRegs[i].reg;
- oatRecordCorePromotion(cUnit, res, sReg);
+ RecordCorePromotion(cUnit, res, sReg);
break;
}
}
return res;
}
-void oatRecordFpPromotion(CompilationUnit* cUnit, int reg, int sReg)
+void RecordFpPromotion(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);
+ GetRegInfo(cUnit, reg)->inUse = true;
+ MarkPreservedSingle(cUnit, vReg, reg);
cUnit->promotionMap[pMapIdx].fpLocation = kLocPhysReg;
- cUnit->promotionMap[pMapIdx].fpReg = reg;
+ cUnit->promotionMap[pMapIdx].FpReg = reg;
}
/*
@@ -200,7 +200,7 @@
* even/odd allocation, but go ahead and allocate anything if not
* available. If nothing's available, return -1.
*/
-int allocPreservedSingle(CompilationUnit* cUnit, int sReg, bool even)
+int AllocPreservedSingle(CompilationUnit* cUnit, int sReg, bool even)
{
int res = -1;
RegisterInfo* FPRegs = cUnit->regPool->FPRegs;
@@ -208,7 +208,7 @@
if (!FPRegs[i].isTemp && !FPRegs[i].inUse &&
((FPRegs[i].reg & 0x1) == 0) == even) {
res = FPRegs[i].reg;
- oatRecordFpPromotion(cUnit, res, sReg);
+ RecordFpPromotion(cUnit, res, sReg);
break;
}
}
@@ -223,20 +223,20 @@
* allocate if we can't meet the requirements for the pair of
* sReg<=sX[even] & (sReg+1)<= sX+1.
*/
-int allocPreservedDouble(CompilationUnit* cUnit, int sReg)
+int AllocPreservedDouble(CompilationUnit* cUnit, int sReg)
{
int res = -1; // Assume failure
int vReg = SRegToVReg(cUnit, sReg);
int pMapIdx = SRegToPMap(cUnit, sReg);
if (cUnit->promotionMap[pMapIdx+1].fpLocation == kLocPhysReg) {
// Upper reg is already allocated. Can we fit?
- int highReg = cUnit->promotionMap[pMapIdx+1].fpReg;
+ int highReg = cUnit->promotionMap[pMapIdx+1].FpReg;
if ((highReg & 1) == 0) {
// High reg is even - fail.
return res;
}
// Is the low reg of the pair free?
- RegisterInfo* p = oatGetRegInfo(cUnit, highReg-1);
+ RegisterInfo* p = GetRegInfo(cUnit, highReg-1);
if (p->inUse || p->isTemp) {
// Already allocated or not preserved - fail.
return res;
@@ -245,7 +245,7 @@
res = p->reg;
p->inUse = true;
DCHECK_EQ((res & 1), 0);
- oatMarkPreservedSingle(cUnit, vReg, res);
+ MarkPreservedSingle(cUnit, vReg, res);
} else {
RegisterInfo* FPRegs = cUnit->regPool->FPRegs;
for (int i = 0; i < cUnit->regPool->numFPRegs; i++) {
@@ -256,19 +256,19 @@
(FPRegs[i].reg + 1) == FPRegs[i+1].reg) {
res = FPRegs[i].reg;
FPRegs[i].inUse = true;
- oatMarkPreservedSingle(cUnit, vReg, res);
+ MarkPreservedSingle(cUnit, vReg, res);
FPRegs[i+1].inUse = true;
DCHECK_EQ(res + 1, FPRegs[i+1].reg);
- oatMarkPreservedSingle(cUnit, vReg+1, res+1);
+ MarkPreservedSingle(cUnit, vReg+1, res+1);
break;
}
}
}
if (res != -1) {
cUnit->promotionMap[pMapIdx].fpLocation = kLocPhysReg;
- cUnit->promotionMap[pMapIdx].fpReg = res;
+ cUnit->promotionMap[pMapIdx].FpReg = res;
cUnit->promotionMap[pMapIdx+1].fpLocation = kLocPhysReg;
- cUnit->promotionMap[pMapIdx+1].fpReg = res + 1;
+ cUnit->promotionMap[pMapIdx+1].FpReg = res + 1;
}
return res;
}
@@ -280,22 +280,22 @@
* single regs (but if can't still attempt to allocate a single, preferring
* first to allocate an odd register.
*/
-extern int oatAllocPreservedFPReg(CompilationUnit* cUnit, int sReg,
+extern int AllocPreservedFPReg(CompilationUnit* cUnit, int sReg,
bool doubleStart)
{
int res = -1;
if (doubleStart) {
- res = allocPreservedDouble(cUnit, sReg);
+ res = AllocPreservedDouble(cUnit, sReg);
}
if (res == -1) {
- res = allocPreservedSingle(cUnit, sReg, false /* try odd # */);
+ res = AllocPreservedSingle(cUnit, sReg, false /* try odd # */);
}
if (res == -1)
- res = allocPreservedSingle(cUnit, sReg, true /* try even # */);
+ res = AllocPreservedSingle(cUnit, sReg, true /* try even # */);
return res;
}
-int allocTempBody(CompilationUnit* cUnit, RegisterInfo* p, int numRegs,
+int AllocTempBody(CompilationUnit* cUnit, RegisterInfo* p, int numRegs,
int* nextTemp, bool required)
{
int i;
@@ -304,7 +304,7 @@
if (next >= numRegs)
next = 0;
if (p[next].isTemp && !p[next].inUse && !p[next].live) {
- oatClobber(cUnit, p[next].reg);
+ Clobber(cUnit, p[next].reg);
p[next].inUse = true;
p[next].pair = false;
*nextTemp = next + 1;
@@ -317,7 +317,7 @@
if (next >= numRegs)
next = 0;
if (p[next].isTemp && !p[next].inUse) {
- oatClobber(cUnit, p[next].reg);
+ Clobber(cUnit, p[next].reg);
p[next].inUse = true;
p[next].pair = false;
*nextTemp = next + 1;
@@ -326,8 +326,8 @@
next++;
}
if (required) {
- oatCodegenDump(cUnit);
- dumpRegPool(cUnit->regPool->coreRegs,
+ CodegenDump(cUnit);
+ DumpRegPool(cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs);
LOG(FATAL) << "No free temp registers";
}
@@ -335,7 +335,7 @@
}
//REDO: too many assumptions.
-extern int oatAllocTempDouble(CompilationUnit* cUnit)
+extern int AllocTempDouble(CompilationUnit* cUnit)
{
RegisterInfo* p = cUnit->regPool->FPRegs;
int numRegs = cUnit->regPool->numFPRegs;
@@ -348,8 +348,8 @@
next = 0;
if ((p[next].isTemp && !p[next].inUse && !p[next].live) &&
(p[next+1].isTemp && !p[next+1].inUse && !p[next+1].live)) {
- oatClobber(cUnit, p[next].reg);
- oatClobber(cUnit, p[next+1].reg);
+ Clobber(cUnit, p[next].reg);
+ Clobber(cUnit, p[next+1].reg);
p[next].inUse = true;
p[next+1].inUse = true;
DCHECK_EQ((p[next].reg+1), p[next+1].reg);
@@ -370,8 +370,8 @@
next = 0;
if (p[next].isTemp && !p[next].inUse && p[next+1].isTemp &&
!p[next+1].inUse) {
- oatClobber(cUnit, p[next].reg);
- oatClobber(cUnit, p[next+1].reg);
+ Clobber(cUnit, p[next].reg);
+ Clobber(cUnit, p[next+1].reg);
p[next].inUse = true;
p[next+1].inUse = true;
DCHECK_EQ((p[next].reg+1), p[next+1].reg);
@@ -389,28 +389,28 @@
}
/* Return a temp if one is available, -1 otherwise */
-extern int oatAllocFreeTemp(CompilationUnit* cUnit)
+extern int AllocFreeTemp(CompilationUnit* cUnit)
{
- return allocTempBody(cUnit, cUnit->regPool->coreRegs,
+ return AllocTempBody(cUnit, cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs,
&cUnit->regPool->nextCoreReg, true);
}
-extern int oatAllocTemp(CompilationUnit* cUnit)
+extern int AllocTemp(CompilationUnit* cUnit)
{
- return allocTempBody(cUnit, cUnit->regPool->coreRegs,
+ return AllocTempBody(cUnit, cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs,
&cUnit->regPool->nextCoreReg, true);
}
-extern int oatAllocTempFloat(CompilationUnit* cUnit)
+extern int AllocTempFloat(CompilationUnit* cUnit)
{
- return allocTempBody(cUnit, cUnit->regPool->FPRegs,
+ return AllocTempBody(cUnit, cUnit->regPool->FPRegs,
cUnit->regPool->numFPRegs,
&cUnit->regPool->nextFPReg, true);
}
-RegisterInfo* allocLiveBody(RegisterInfo* p, int numRegs, int sReg)
+RegisterInfo* AllocLiveBody(RegisterInfo* p, int numRegs, int sReg)
{
int i;
if (sReg == -1)
@@ -425,22 +425,22 @@
return NULL;
}
-RegisterInfo* allocLive(CompilationUnit* cUnit, int sReg, int regClass)
+RegisterInfo* AllocLive(CompilationUnit* cUnit, int sReg, int regClass)
{
RegisterInfo* res = NULL;
switch (regClass) {
case kAnyReg:
- res = allocLiveBody(cUnit->regPool->FPRegs,
+ res = AllocLiveBody(cUnit->regPool->FPRegs,
cUnit->regPool->numFPRegs, sReg);
if (res)
break;
/* Intentional fallthrough */
case kCoreReg:
- res = allocLiveBody(cUnit->regPool->coreRegs,
+ res = AllocLiveBody(cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs, sReg);
break;
case kFPReg:
- res = allocLiveBody(cUnit->regPool->FPRegs,
+ res = AllocLiveBody(cUnit->regPool->FPRegs,
cUnit->regPool->numFPRegs, sReg);
break;
default:
@@ -449,7 +449,7 @@
return res;
}
-extern void oatFreeTemp(CompilationUnit* cUnit, int reg)
+extern void FreeTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = cUnit->regPool->coreRegs;
int numRegs = cUnit->regPool->numCoreRegs;
@@ -477,7 +477,7 @@
LOG(FATAL) << "Tried to free a non-existant temp: r" << reg;
}
-extern RegisterInfo* oatIsLive(CompilationUnit* cUnit, int reg)
+extern RegisterInfo* IsLive(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = cUnit->regPool->coreRegs;
int numRegs = cUnit->regPool->numCoreRegs;
@@ -497,30 +497,30 @@
return NULL;
}
-extern RegisterInfo* oatIsTemp(CompilationUnit* cUnit, int reg)
+extern RegisterInfo* IsTemp(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* p = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* p = GetRegInfo(cUnit, reg);
return (p->isTemp) ? p : NULL;
}
-extern RegisterInfo* oatIsPromoted(CompilationUnit* cUnit, int reg)
+extern RegisterInfo* IsPromoted(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* p = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* p = GetRegInfo(cUnit, reg);
return (p->isTemp) ? NULL : p;
}
-extern bool oatIsDirty(CompilationUnit* cUnit, int reg)
+extern bool IsDirty(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* p = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* p = GetRegInfo(cUnit, reg);
return p->dirty;
}
/*
- * Similar to oatAllocTemp(), but forces the allocation of a specific
+ * Similar to AllocTemp(), but forces the allocation of a specific
* register. No check is made to see if the register was previously
* allocated. Use with caution.
*/
-extern void oatLockTemp(CompilationUnit* cUnit, int reg)
+extern void LockTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = cUnit->regPool->coreRegs;
int numRegs = cUnit->regPool->numCoreRegs;
@@ -546,25 +546,25 @@
LOG(FATAL) << "Tried to lock a non-existant temp: r" << reg;
}
-static inline void resetDefBody(RegisterInfo* p)
+static inline void ResetDefBody(RegisterInfo* p)
{
p->defStart = NULL;
p->defEnd = NULL;
}
-extern void oatResetDef(CompilationUnit* cUnit, int reg)
+extern void ResetDef(CompilationUnit* cUnit, int reg)
{
- resetDefBody(oatGetRegInfo(cUnit, reg));
+ ResetDefBody(GetRegInfo(cUnit, reg));
}
-void nullifyRange(CompilationUnit* cUnit, LIR *start, LIR *finish,
+void NullifyRange(CompilationUnit* cUnit, LIR *start, LIR *finish,
int sReg1, int sReg2)
{
if (start && finish) {
LIR *p;
DCHECK_EQ(sReg1, sReg2);
for (p = start; ;p = p->next) {
- oatNopLIR(p);
+ NopLIR(p);
if (p == finish)
break;
}
@@ -576,13 +576,13 @@
* on entry start points to the LIR prior to the beginning of the
* sequence.
*/
-extern void oatMarkDef(CompilationUnit* cUnit, RegLocation rl,
+extern void MarkDef(CompilationUnit* cUnit, RegLocation rl,
LIR *start, LIR *finish)
{
DCHECK(!rl.wide);
DCHECK(start && start->next);
DCHECK(finish);
- RegisterInfo* p = oatGetRegInfo(cUnit, rl.lowReg);
+ RegisterInfo* p = GetRegInfo(cUnit, rl.lowReg);
p->defStart = start->next;
p->defEnd = finish;
}
@@ -592,24 +592,24 @@
* on entry start points to the LIR prior to the beginning of the
* sequence.
*/
-extern void oatMarkDefWide(CompilationUnit* cUnit, RegLocation rl,
+extern void MarkDefWide(CompilationUnit* cUnit, RegLocation rl,
LIR *start, LIR *finish)
{
DCHECK(rl.wide);
DCHECK(start && start->next);
DCHECK(finish);
- RegisterInfo* p = oatGetRegInfo(cUnit, rl.lowReg);
- oatResetDef(cUnit, rl.highReg); // Only track low of pair
+ RegisterInfo* p = GetRegInfo(cUnit, rl.lowReg);
+ ResetDef(cUnit, rl.highReg); // Only track low of pair
p->defStart = start->next;
p->defEnd = finish;
}
-extern RegLocation oatWideToNarrow(CompilationUnit* cUnit, RegLocation rl)
+extern RegLocation WideToNarrow(CompilationUnit* cUnit, RegLocation rl)
{
DCHECK(rl.wide);
if (rl.location == kLocPhysReg) {
- RegisterInfo* infoLo = oatGetRegInfo(cUnit, rl.lowReg);
- RegisterInfo* infoHi = oatGetRegInfo(cUnit, rl.highReg);
+ RegisterInfo* infoLo = GetRegInfo(cUnit, rl.lowReg);
+ RegisterInfo* infoHi = GetRegInfo(cUnit, rl.highReg);
if (infoLo->isTemp) {
infoLo->pair = false;
infoLo->defStart = NULL;
@@ -625,100 +625,100 @@
return rl;
}
-extern void oatResetDefLoc(CompilationUnit* cUnit, RegLocation rl)
+extern void ResetDefLoc(CompilationUnit* cUnit, RegLocation rl)
{
DCHECK(!rl.wide);
- RegisterInfo* p = oatIsTemp(cUnit, rl.lowReg);
+ RegisterInfo* p = IsTemp(cUnit, rl.lowReg);
if (p && !(cUnit->disableOpt & (1 << kSuppressLoads))) {
DCHECK(!p->pair);
- nullifyRange(cUnit, p->defStart, p->defEnd, p->sReg, rl.sRegLow);
+ NullifyRange(cUnit, p->defStart, p->defEnd, p->sReg, rl.sRegLow);
}
- oatResetDef(cUnit, rl.lowReg);
+ ResetDef(cUnit, rl.lowReg);
}
-extern void oatResetDefLocWide(CompilationUnit* cUnit, RegLocation rl)
+extern void ResetDefLocWide(CompilationUnit* cUnit, RegLocation rl)
{
DCHECK(rl.wide);
- RegisterInfo* pLow = oatIsTemp(cUnit, rl.lowReg);
- RegisterInfo* pHigh = oatIsTemp(cUnit, rl.highReg);
+ RegisterInfo* pLow = IsTemp(cUnit, rl.lowReg);
+ RegisterInfo* pHigh = IsTemp(cUnit, rl.highReg);
if (pLow && !(cUnit->disableOpt & (1 << kSuppressLoads))) {
DCHECK(pLow->pair);
- nullifyRange(cUnit, pLow->defStart, pLow->defEnd, pLow->sReg, rl.sRegLow);
+ NullifyRange(cUnit, pLow->defStart, pLow->defEnd, pLow->sReg, rl.sRegLow);
}
if (pHigh && !(cUnit->disableOpt & (1 << kSuppressLoads))) {
DCHECK(pHigh->pair);
}
- oatResetDef(cUnit, rl.lowReg);
- oatResetDef(cUnit, rl.highReg);
+ ResetDef(cUnit, rl.lowReg);
+ ResetDef(cUnit, rl.highReg);
}
-extern void oatResetDefTracking(CompilationUnit* cUnit)
+extern void ResetDefTracking(CompilationUnit* cUnit)
{
int i;
for (i=0; i< cUnit->regPool->numCoreRegs; i++) {
- resetDefBody(&cUnit->regPool->coreRegs[i]);
+ ResetDefBody(&cUnit->regPool->coreRegs[i]);
}
for (i=0; i< cUnit->regPool->numFPRegs; i++) {
- resetDefBody(&cUnit->regPool->FPRegs[i]);
+ ResetDefBody(&cUnit->regPool->FPRegs[i]);
}
}
-extern void oatClobberAllRegs(CompilationUnit* cUnit)
+extern void ClobberAllRegs(CompilationUnit* cUnit)
{
int i;
for (i=0; i< cUnit->regPool->numCoreRegs; i++) {
- clobberBody(cUnit, &cUnit->regPool->coreRegs[i]);
+ ClobberBody(cUnit, &cUnit->regPool->coreRegs[i]);
}
for (i=0; i< cUnit->regPool->numFPRegs; i++) {
- clobberBody(cUnit, &cUnit->regPool->FPRegs[i]);
+ ClobberBody(cUnit, &cUnit->regPool->FPRegs[i]);
}
}
// Make sure nothing is live and dirty
-void flushAllRegsBody(CompilationUnit* cUnit, RegisterInfo* info,
+void FlushAllRegsBody(CompilationUnit* cUnit, RegisterInfo* info,
int numRegs)
{
int i;
for (i=0; i < numRegs; i++) {
if (info[i].live && info[i].dirty) {
if (info[i].pair) {
- oatFlushRegWide(cUnit, info[i].reg, info[i].partner);
+ FlushRegWide(cUnit, info[i].reg, info[i].partner);
} else {
- oatFlushReg(cUnit, info[i].reg);
+ FlushReg(cUnit, info[i].reg);
}
}
}
}
-extern void oatFlushAllRegs(CompilationUnit* cUnit)
+extern void FlushAllRegs(CompilationUnit* cUnit)
{
- flushAllRegsBody(cUnit, cUnit->regPool->coreRegs,
+ FlushAllRegsBody(cUnit, cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs);
- flushAllRegsBody(cUnit, cUnit->regPool->FPRegs,
+ FlushAllRegsBody(cUnit, cUnit->regPool->FPRegs,
cUnit->regPool->numFPRegs);
- oatClobberAllRegs(cUnit);
+ ClobberAllRegs(cUnit);
}
//TUNING: rewrite all of this reg stuff. Probably use an attribute table
-bool regClassMatches(int regClass, int reg)
+bool RegClassMatches(int regClass, int reg)
{
if (regClass == kAnyReg) {
return true;
} else if (regClass == kCoreReg) {
- return !oatIsFpReg(reg);
+ return !IsFpReg(reg);
} else {
- return oatIsFpReg(reg);
+ return IsFpReg(reg);
}
}
-extern void oatMarkLive(CompilationUnit* cUnit, int reg, int sReg)
+extern void MarkLive(CompilationUnit* cUnit, int reg, int sReg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
if ((info->reg == reg) && (info->sReg == sReg) && info->live) {
return; /* already live */
} else if (sReg != INVALID_SREG) {
- oatClobberSReg(cUnit, sReg);
+ ClobberSReg(cUnit, sReg);
if (info->isTemp) {
info->live = true;
}
@@ -730,61 +730,61 @@
info->sReg = sReg;
}
-extern void oatMarkTemp(CompilationUnit* cUnit, int reg)
+extern void MarkTemp(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
info->isTemp = true;
}
-extern void oatUnmarkTemp(CompilationUnit* cUnit, int reg)
+extern void UnmarkTemp(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
info->isTemp = false;
}
-extern void oatMarkPair(CompilationUnit* cUnit, int lowReg, int highReg)
+extern void MarkPair(CompilationUnit* cUnit, int lowReg, int highReg)
{
- RegisterInfo* infoLo = oatGetRegInfo(cUnit, lowReg);
- RegisterInfo* infoHi = oatGetRegInfo(cUnit, highReg);
+ RegisterInfo* infoLo = GetRegInfo(cUnit, lowReg);
+ RegisterInfo* infoHi = GetRegInfo(cUnit, highReg);
infoLo->pair = infoHi->pair = true;
infoLo->partner = highReg;
infoHi->partner = lowReg;
}
-extern void oatMarkClean(CompilationUnit* cUnit, RegLocation loc)
+extern void MarkClean(CompilationUnit* cUnit, RegLocation loc)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, loc.lowReg);
+ RegisterInfo* info = GetRegInfo(cUnit, loc.lowReg);
info->dirty = false;
if (loc.wide) {
- info = oatGetRegInfo(cUnit, loc.highReg);
+ info = GetRegInfo(cUnit, loc.highReg);
info->dirty = false;
}
}
-extern void oatMarkDirty(CompilationUnit* cUnit, RegLocation loc)
+extern void MarkDirty(CompilationUnit* cUnit, RegLocation loc)
{
if (loc.home) {
// If already home, can't be dirty
return;
}
- RegisterInfo* info = oatGetRegInfo(cUnit, loc.lowReg);
+ RegisterInfo* info = GetRegInfo(cUnit, loc.lowReg);
info->dirty = true;
if (loc.wide) {
- info = oatGetRegInfo(cUnit, loc.highReg);
+ info = GetRegInfo(cUnit, loc.highReg);
info->dirty = true;
}
}
-extern void oatMarkInUse(CompilationUnit* cUnit, int reg)
+extern void MarkInUse(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
info->inUse = true;
}
-void copyRegInfo(CompilationUnit* cUnit, int newReg, int oldReg)
+void CopyRegInfo(CompilationUnit* cUnit, int newReg, int oldReg)
{
- RegisterInfo* newInfo = oatGetRegInfo(cUnit, newReg);
- RegisterInfo* oldInfo = oatGetRegInfo(cUnit, oldReg);
+ RegisterInfo* newInfo = GetRegInfo(cUnit, newReg);
+ RegisterInfo* oldInfo = GetRegInfo(cUnit, oldReg);
// Target temp status must not change
bool isTemp = newInfo->isTemp;
*newInfo = *oldInfo;
@@ -803,19 +803,19 @@
* if it's worthwhile trying to be more clever here.
*/
-extern RegLocation oatUpdateLoc(CompilationUnit* cUnit, RegLocation loc)
+extern RegLocation UpdateLoc(CompilationUnit* cUnit, RegLocation loc)
{
DCHECK(!loc.wide);
- DCHECK(oatCheckCorePoolSanity(cUnit));
+ DCHECK(CheckCorePoolSanity(cUnit));
if (loc.location != kLocPhysReg) {
DCHECK((loc.location == kLocDalvikFrame) ||
(loc.location == kLocCompilerTemp));
- RegisterInfo* infoLo = allocLive(cUnit, loc.sRegLow, kAnyReg);
+ RegisterInfo* infoLo = AllocLive(cUnit, loc.sRegLow, kAnyReg);
if (infoLo) {
if (infoLo->pair) {
- oatClobber(cUnit, infoLo->reg);
- oatClobber(cUnit, infoLo->partner);
- oatFreeTemp(cUnit, infoLo->reg);
+ Clobber(cUnit, infoLo->reg);
+ Clobber(cUnit, infoLo->partner);
+ FreeTemp(cUnit, infoLo->reg);
} else {
loc.lowReg = infoLo->reg;
loc.location = kLocPhysReg;
@@ -826,14 +826,14 @@
return loc;
}
-bool oatCheckCorePoolSanity(CompilationUnit* cUnit)
+bool CheckCorePoolSanity(CompilationUnit* cUnit)
{
for (static int i = 0; i < cUnit->regPool->numCoreRegs; i++) {
if (cUnit->regPool->coreRegs[i].pair) {
static int myReg = cUnit->regPool->coreRegs[i].reg;
static int mySreg = cUnit->regPool->coreRegs[i].sReg;
static int partnerReg = cUnit->regPool->coreRegs[i].partner;
- static RegisterInfo* partner = oatGetRegInfo(cUnit, partnerReg);
+ static RegisterInfo* partner = GetRegInfo(cUnit, partnerReg);
DCHECK(partner != NULL);
DCHECK(partner->pair);
DCHECK_EQ(myReg, partner->partner);
@@ -854,24 +854,24 @@
}
/* see comments for updateLoc */
-extern RegLocation oatUpdateLocWide(CompilationUnit* cUnit, RegLocation loc)
+extern RegLocation UpdateLocWide(CompilationUnit* cUnit, RegLocation loc)
{
DCHECK(loc.wide);
- DCHECK(oatCheckCorePoolSanity(cUnit));
+ DCHECK(CheckCorePoolSanity(cUnit));
if (loc.location != kLocPhysReg) {
DCHECK((loc.location == kLocDalvikFrame) ||
(loc.location == kLocCompilerTemp));
// Are the dalvik regs already live in physical registers?
- RegisterInfo* infoLo = allocLive(cUnit, loc.sRegLow, kAnyReg);
- RegisterInfo* infoHi = allocLive(cUnit,
+ RegisterInfo* infoLo = AllocLive(cUnit, loc.sRegLow, kAnyReg);
+ RegisterInfo* infoHi = AllocLive(cUnit,
oatSRegHi(loc.sRegLow), kAnyReg);
bool match = true;
match = match && (infoLo != NULL);
match = match && (infoHi != NULL);
// Are they both core or both FP?
- match = match && (oatIsFpReg(infoLo->reg) == oatIsFpReg(infoHi->reg));
+ match = match && (IsFpReg(infoLo->reg) == IsFpReg(infoHi->reg));
// If a pair of floating point singles, are they properly aligned?
- if (match && oatIsFpReg(infoLo->reg)) {
+ if (match && IsFpReg(infoLo->reg)) {
match &= ((infoLo->reg & 0x1) == 0);
match &= ((infoHi->reg - infoLo->reg) == 1);
}
@@ -886,22 +886,22 @@
loc.lowReg = infoLo->reg;
loc.highReg = infoHi->reg;
loc.location = kLocPhysReg;
- oatMarkPair(cUnit, loc.lowReg, loc.highReg);
- DCHECK(!oatIsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
+ MarkPair(cUnit, loc.lowReg, loc.highReg);
+ DCHECK(!IsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
return loc;
}
// Can't easily reuse - clobber and free any overlaps
if (infoLo) {
- oatClobber(cUnit, infoLo->reg);
- oatFreeTemp(cUnit, infoLo->reg);
+ Clobber(cUnit, infoLo->reg);
+ FreeTemp(cUnit, infoLo->reg);
if (infoLo->pair)
- oatClobber(cUnit, infoLo->partner);
+ Clobber(cUnit, infoLo->partner);
}
if (infoHi) {
- oatClobber(cUnit, infoHi->reg);
- oatFreeTemp(cUnit, infoHi->reg);
+ Clobber(cUnit, infoHi->reg);
+ FreeTemp(cUnit, infoHi->reg);
if (infoHi->pair)
- oatClobber(cUnit, infoHi->partner);
+ Clobber(cUnit, infoHi->partner);
}
}
return loc;
@@ -909,15 +909,15 @@
/* For use in cases we don't know (or care) width */
-extern RegLocation oatUpdateRawLoc(CompilationUnit* cUnit, RegLocation loc)
+extern RegLocation UpdateRawLoc(CompilationUnit* cUnit, RegLocation loc)
{
if (loc.wide)
- return oatUpdateLocWide(cUnit, loc);
+ return UpdateLocWide(cUnit, loc);
else
- return oatUpdateLoc(cUnit, loc);
+ return UpdateLoc(cUnit, loc);
}
-RegLocation evalLocWide(CompilationUnit* cUnit, RegLocation loc,
+RegLocation EvalLocWide(CompilationUnit* cUnit, RegLocation loc,
int regClass, bool update)
{
DCHECK(loc.wide);
@@ -925,27 +925,27 @@
int lowReg;
int highReg;
- loc = oatUpdateLocWide(cUnit, loc);
+ loc = UpdateLocWide(cUnit, loc);
/* If already in registers, we can assume proper form. Right reg class? */
if (loc.location == kLocPhysReg) {
- DCHECK_EQ(oatIsFpReg(loc.lowReg), oatIsFpReg(loc.highReg));
- DCHECK(!oatIsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
- if (!regClassMatches(regClass, loc.lowReg)) {
+ DCHECK_EQ(IsFpReg(loc.lowReg), IsFpReg(loc.highReg));
+ DCHECK(!IsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
+ if (!RegClassMatches(regClass, loc.lowReg)) {
/* Wrong register class. Reallocate and copy */
- newRegs = oatAllocTypedTempPair(cUnit, loc.fp, regClass);
+ newRegs = AllocTypedTempPair(cUnit, loc.fp, regClass);
lowReg = newRegs & 0xff;
highReg = (newRegs >> 8) & 0xff;
- opRegCopyWide(cUnit, lowReg, highReg, loc.lowReg,
+ OpRegCopyWide(cUnit, lowReg, highReg, loc.lowReg,
loc.highReg);
- copyRegInfo(cUnit, lowReg, loc.lowReg);
- copyRegInfo(cUnit, highReg, loc.highReg);
- oatClobber(cUnit, loc.lowReg);
- oatClobber(cUnit, loc.highReg);
+ CopyRegInfo(cUnit, lowReg, loc.lowReg);
+ CopyRegInfo(cUnit, highReg, loc.highReg);
+ Clobber(cUnit, loc.lowReg);
+ Clobber(cUnit, loc.highReg);
loc.lowReg = lowReg;
loc.highReg = highReg;
- oatMarkPair(cUnit, loc.lowReg, loc.highReg);
- DCHECK(!oatIsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
+ MarkPair(cUnit, loc.lowReg, loc.highReg);
+ DCHECK(!IsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
}
return loc;
}
@@ -953,37 +953,37 @@
DCHECK_NE(loc.sRegLow, INVALID_SREG);
DCHECK_NE(oatSRegHi(loc.sRegLow), INVALID_SREG);
- newRegs = oatAllocTypedTempPair(cUnit, loc.fp, regClass);
+ newRegs = AllocTypedTempPair(cUnit, loc.fp, regClass);
loc.lowReg = newRegs & 0xff;
loc.highReg = (newRegs >> 8) & 0xff;
- oatMarkPair(cUnit, loc.lowReg, loc.highReg);
+ MarkPair(cUnit, loc.lowReg, loc.highReg);
if (update) {
loc.location = kLocPhysReg;
- oatMarkLive(cUnit, loc.lowReg, loc.sRegLow);
- oatMarkLive(cUnit, loc.highReg, oatSRegHi(loc.sRegLow));
+ MarkLive(cUnit, loc.lowReg, loc.sRegLow);
+ MarkLive(cUnit, loc.highReg, oatSRegHi(loc.sRegLow));
}
- DCHECK(!oatIsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
+ DCHECK(!IsFpReg(loc.lowReg) || ((loc.lowReg & 0x1) == 0));
return loc;
}
-extern RegLocation oatEvalLoc(CompilationUnit* cUnit, RegLocation loc,
+extern RegLocation EvalLoc(CompilationUnit* cUnit, RegLocation loc,
int regClass, bool update)
{
int newReg;
if (loc.wide)
- return evalLocWide(cUnit, loc, regClass, update);
+ return EvalLocWide(cUnit, loc, regClass, update);
- loc = oatUpdateLoc(cUnit, loc);
+ loc = UpdateLoc(cUnit, loc);
if (loc.location == kLocPhysReg) {
- if (!regClassMatches(regClass, loc.lowReg)) {
+ if (!RegClassMatches(regClass, loc.lowReg)) {
/* Wrong register class. Realloc, copy and transfer ownership */
- newReg = oatAllocTypedTemp(cUnit, loc.fp, regClass);
- opRegCopy(cUnit, newReg, loc.lowReg);
- copyRegInfo(cUnit, newReg, loc.lowReg);
- oatClobber(cUnit, loc.lowReg);
+ newReg = AllocTypedTemp(cUnit, loc.fp, regClass);
+ OpRegCopy(cUnit, newReg, loc.lowReg);
+ CopyRegInfo(cUnit, newReg, loc.lowReg);
+ Clobber(cUnit, loc.lowReg);
loc.lowReg = newReg;
}
return loc;
@@ -991,61 +991,61 @@
DCHECK_NE(loc.sRegLow, INVALID_SREG);
- newReg = oatAllocTypedTemp(cUnit, loc.fp, regClass);
+ newReg = AllocTypedTemp(cUnit, loc.fp, regClass);
loc.lowReg = newReg;
if (update) {
loc.location = kLocPhysReg;
- oatMarkLive(cUnit, loc.lowReg, loc.sRegLow);
+ MarkLive(cUnit, loc.lowReg, loc.sRegLow);
}
return loc;
}
-extern RegLocation oatGetRawSrc(CompilationUnit* cUnit, MIR* mir, int num)
+extern RegLocation GetRawSrc(CompilationUnit* cUnit, MIR* mir, int num)
{
DCHECK(num < mir->ssaRep->numUses);
RegLocation res = cUnit->regLocation[mir->ssaRep->uses[num]];
return res;
}
-extern RegLocation oatGetRawDest(CompilationUnit* cUnit, MIR* mir)
+extern RegLocation GetRawDest(CompilationUnit* cUnit, MIR* mir)
{
DCHECK_GT(mir->ssaRep->numDefs, 0);
RegLocation res = cUnit->regLocation[mir->ssaRep->defs[0]];
return res;
}
-extern RegLocation oatGetDest(CompilationUnit* cUnit, MIR* mir)
+extern RegLocation GetDest(CompilationUnit* cUnit, MIR* mir)
{
- RegLocation res = oatGetRawDest(cUnit, mir);
+ RegLocation res = GetRawDest(cUnit, mir);
DCHECK(!res.wide);
return res;
}
-extern RegLocation oatGetSrc(CompilationUnit* cUnit, MIR* mir, int num)
+extern RegLocation GetSrc(CompilationUnit* cUnit, MIR* mir, int num)
{
- RegLocation res = oatGetRawSrc(cUnit, mir, num);
+ RegLocation res = GetRawSrc(cUnit, mir, num);
DCHECK(!res.wide);
return res;
}
-extern RegLocation oatGetDestWide(CompilationUnit* cUnit, MIR* mir)
+extern RegLocation GetDestWide(CompilationUnit* cUnit, MIR* mir)
{
- RegLocation res = oatGetRawDest(cUnit, mir);
+ RegLocation res = GetRawDest(cUnit, mir);
DCHECK(res.wide);
return res;
}
-extern RegLocation oatGetSrcWide(CompilationUnit* cUnit, MIR* mir,
+extern RegLocation GetSrcWide(CompilationUnit* cUnit, MIR* mir,
int low)
{
- RegLocation res = oatGetRawSrc(cUnit, mir, low);
+ RegLocation res = GetRawSrc(cUnit, mir, low);
DCHECK(res.wide);
return res;
}
/* USE SSA names to count references of base Dalvik vRegs. */
-void oatCountRefs(CompilationUnit *cUnit, BasicBlock* bb,
+void CountRefs(CompilationUnit *cUnit, BasicBlock* bb,
RefCounts* coreCounts, RefCounts* fpCounts)
{
if ((cUnit->disableOpt & (1 << kPromoteRegs)) ||
@@ -1075,14 +1075,14 @@
}
/* qsort callback function, sort descending */
-int oatSortCounts(const void *val1, const void *val2)
+int SortCounts(const void *val1, const void *val2)
{
const RefCounts* op1 = reinterpret_cast<const RefCounts*>(val1);
const RefCounts* op2 = reinterpret_cast<const RefCounts*>(val2);
return (op1->count == op2->count) ? 0 : (op1->count < op2->count ? 1 : -1);
}
-void oatDumpCounts(const RefCounts* arr, int size, const char* msg)
+void DumpCounts(const RefCounts* arr, int size, const char* msg)
{
LOG(INFO) << msg;
for (int i = 0; i < size; i++) {
@@ -1094,7 +1094,7 @@
* Note: some portions of this code required even if the kPromoteRegs
* optimization is disabled.
*/
-extern void oatDoPromotion(CompilationUnit* cUnit)
+extern void DoPromotion(CompilationUnit* cUnit)
{
int regBias = cUnit->numCompilerTemps + 1;
int dalvikRegs = cUnit->numDalvikRegisters;
@@ -1102,7 +1102,7 @@
const int promotionThreshold = 2;
// Allow target code to add any special registers
- oatAdjustSpillMask(cUnit);
+ AdjustSpillMask(cUnit);
/*
* Simple register promotion. Just do a static count of the uses
@@ -1115,31 +1115,31 @@
* TUNING: replace with linear scan once we have the ability
* to describe register live ranges for GC.
*/
- RefCounts *coreRegs = static_cast<RefCounts*>(oatNew(cUnit, sizeof(RefCounts) * numRegs,
+ RefCounts *coreRegs = static_cast<RefCounts*>(NewMem(cUnit, sizeof(RefCounts) * numRegs,
true, kAllocRegAlloc));
- RefCounts *fpRegs = static_cast<RefCounts *>(oatNew(cUnit, sizeof(RefCounts) * numRegs,
+ RefCounts *FpRegs = static_cast<RefCounts *>(NewMem(cUnit, sizeof(RefCounts) * numRegs,
true, kAllocRegAlloc));
// Set ssa names for original Dalvik registers
for (int i = 0; i < dalvikRegs; i++) {
- coreRegs[i].sReg = fpRegs[i].sReg = i;
+ coreRegs[i].sReg = FpRegs[i].sReg = i;
}
// Set ssa name for Method*
coreRegs[dalvikRegs].sReg = cUnit->methodSReg;
- fpRegs[dalvikRegs].sReg = cUnit->methodSReg; // For consistecy
+ FpRegs[dalvikRegs].sReg = cUnit->methodSReg; // For consistecy
// Set ssa names for compilerTemps
for (int i = 1; i <= cUnit->numCompilerTemps; i++) {
CompilerTemp* ct = reinterpret_cast<CompilerTemp*>(cUnit->compilerTemps.elemList[i]);
coreRegs[dalvikRegs + i].sReg = ct->sReg;
- fpRegs[dalvikRegs + i].sReg = ct->sReg;
+ FpRegs[dalvikRegs + i].sReg = ct->sReg;
}
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->blockList, &iterator);
+ GrowableListIteratorInit(&cUnit->blockList, &iterator);
while (true) {
BasicBlock* bb;
- bb = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iterator));
+ bb = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iterator));
if (bb == NULL) break;
- oatCountRefs(cUnit, bb, coreRegs, fpRegs);
+ CountRefs(cUnit, bb, coreRegs, FpRegs);
}
/*
@@ -1148,28 +1148,28 @@
* used as the start of a pair first.
*/
for (int i = 0; i < numRegs; i++) {
- if (fpRegs[i].doubleStart) {
- fpRegs[i].count *= 2;
+ if (FpRegs[i].doubleStart) {
+ FpRegs[i].count *= 2;
}
}
// Sort the count arrays
- qsort(coreRegs, numRegs, sizeof(RefCounts), oatSortCounts);
- qsort(fpRegs, numRegs, sizeof(RefCounts), oatSortCounts);
+ qsort(coreRegs, numRegs, sizeof(RefCounts), SortCounts);
+ qsort(FpRegs, numRegs, sizeof(RefCounts), SortCounts);
if (cUnit->printMe) {
- oatDumpCounts(coreRegs, numRegs, "Core regs after sort");
- oatDumpCounts(fpRegs, numRegs, "Fp regs after sort");
+ DumpCounts(coreRegs, numRegs, "Core regs after sort");
+ DumpCounts(FpRegs, numRegs, "Fp regs after sort");
}
if (!(cUnit->disableOpt & (1 << kPromoteRegs))) {
- // Promote fpRegs
+ // Promote FpRegs
for (int i = 0; (i < numRegs) &&
- (fpRegs[i].count >= promotionThreshold ); i++) {
- int pMapIdx = SRegToPMap(cUnit, fpRegs[i].sReg);
+ (FpRegs[i].count >= promotionThreshold ); i++) {
+ int pMapIdx = SRegToPMap(cUnit, FpRegs[i].sReg);
if (cUnit->promotionMap[pMapIdx].fpLocation != kLocPhysReg) {
- int reg = oatAllocPreservedFPReg(cUnit, fpRegs[i].sReg,
- fpRegs[i].doubleStart);
+ int reg = AllocPreservedFPReg(cUnit, FpRegs[i].sReg,
+ FpRegs[i].doubleStart);
if (reg < 0) {
break; // No more left
}
@@ -1182,16 +1182,16 @@
int pMapIdx = SRegToPMap(cUnit, coreRegs[i].sReg);
if (cUnit->promotionMap[pMapIdx].coreLocation !=
kLocPhysReg) {
- int reg = oatAllocPreservedCoreReg(cUnit, coreRegs[i].sReg);
+ int reg = AllocPreservedCoreReg(cUnit, coreRegs[i].sReg);
if (reg < 0) {
break; // No more left
}
}
}
} else if (cUnit->qdMode) {
- oatAllocPreservedCoreReg(cUnit, cUnit->methodSReg);
+ AllocPreservedCoreReg(cUnit, cUnit->methodSReg);
for (int i = 0; i < numRegs; i++) {
- int reg = oatAllocPreservedCoreReg(cUnit, i);
+ int reg = AllocPreservedCoreReg(cUnit, i);
if (reg < 0) {
break; // No more left
}
@@ -1207,7 +1207,7 @@
if (curr->fp) {
if (cUnit->promotionMap[pMapIdx].fpLocation == kLocPhysReg) {
curr->location = kLocPhysReg;
- curr->lowReg = cUnit->promotionMap[pMapIdx].fpReg;
+ curr->lowReg = cUnit->promotionMap[pMapIdx].FpReg;
curr->home = true;
}
} else {
@@ -1226,8 +1226,8 @@
if ((cUnit->promotionMap[pMapIdx].fpLocation == kLocPhysReg) &&
(cUnit->promotionMap[pMapIdx+1].fpLocation ==
kLocPhysReg)) {
- int lowReg = cUnit->promotionMap[pMapIdx].fpReg;
- int highReg = cUnit->promotionMap[pMapIdx+1].fpReg;
+ int lowReg = cUnit->promotionMap[pMapIdx].FpReg;
+ int highReg = cUnit->promotionMap[pMapIdx+1].FpReg;
// Doubles require pair of singles starting at even reg
if (((lowReg & 0x1) == 0) && ((lowReg + 1) == highReg)) {
curr->location = kLocPhysReg;
@@ -1249,21 +1249,21 @@
}
}
if (cUnit->printMe) {
- oatDumpPromotionMap(cUnit);
+ DumpPromotionMap(cUnit);
}
}
/* Returns sp-relative offset in bytes for a VReg */
-extern int oatVRegOffset(CompilationUnit* cUnit, int vReg)
+extern int VRegOffset(CompilationUnit* cUnit, int vReg)
{
return StackVisitor::GetVRegOffset(cUnit->code_item, cUnit->coreSpillMask,
cUnit->fpSpillMask, cUnit->frameSize, vReg);
}
/* Returns sp-relative offset in bytes for a SReg */
-extern int oatSRegOffset(CompilationUnit* cUnit, int sReg)
+extern int SRegOffset(CompilationUnit* cUnit, int sReg)
{
- return oatVRegOffset(cUnit, SRegToVReg(cUnit, sReg));
+ return VRegOffset(cUnit, SRegToVReg(cUnit, sReg));
}
} // namespace art
diff --git a/src/compiler/codegen/ralloc_util.h b/src/compiler/codegen/ralloc_util.h
index 56b1e22..6947656 100644
--- a/src/compiler/codegen/ralloc_util.h
+++ b/src/compiler/codegen/ralloc_util.h
@@ -60,164 +60,164 @@
return mir->ssaRep->uses[num];
}
-extern RegLocation oatEvalLoc(CompilationUnit* cUnit, RegLocation loc,
+extern RegLocation EvalLoc(CompilationUnit* cUnit, RegLocation loc,
int regClass, bool update);
/* Mark a temp register as dead. Does not affect allocation state. */
-extern void oatClobber(CompilationUnit* cUnit, int reg);
-extern RegLocation oatUpdateLoc(CompilationUnit* cUnit, RegLocation loc);
+extern void Clobber(CompilationUnit* cUnit, int reg);
+extern RegLocation UpdateLoc(CompilationUnit* cUnit, RegLocation loc);
/* see comments for updateLoc */
-extern RegLocation oatUpdateLocWide(CompilationUnit* cUnit, RegLocation loc);
+extern RegLocation UpdateLocWide(CompilationUnit* cUnit, RegLocation loc);
-extern RegLocation oatUpdateRawLoc(CompilationUnit* cUnit, RegLocation loc);
+extern RegLocation UpdateRawLoc(CompilationUnit* cUnit, RegLocation loc);
-extern void oatMarkLive(CompilationUnit* cUnit, int reg, int sReg);
+extern void MarkLive(CompilationUnit* cUnit, int reg, int sReg);
-extern void oatMarkTemp(CompilationUnit* cUnit, int reg);
+extern void MarkTemp(CompilationUnit* cUnit, int reg);
-extern void oatUnmarkTemp(CompilationUnit* cUnit, int reg);
+extern void UnmarkTemp(CompilationUnit* cUnit, int reg);
-extern void oatMarkDirty(CompilationUnit* cUnit, RegLocation loc);
+extern void MarkDirty(CompilationUnit* cUnit, RegLocation loc);
-extern void oatMarkPair(CompilationUnit* cUnit, int lowReg, int highReg);
+extern void MarkPair(CompilationUnit* cUnit, int lowReg, int highReg);
-extern void oatMarkClean(CompilationUnit* cUnit, RegLocation loc);
+extern void MarkClean(CompilationUnit* cUnit, RegLocation loc);
-extern void oatResetDef(CompilationUnit* cUnit, int reg);
+extern void ResetDef(CompilationUnit* cUnit, int reg);
-extern void oatResetDefLoc(CompilationUnit* cUnit, RegLocation rl);
+extern void ResetDefLoc(CompilationUnit* cUnit, RegLocation rl);
/* Set up temp & preserved register pools specialized by target */
-extern void oatInitPool(RegisterInfo* regs, int* regNums, int num);
+extern void CompilerInitPool(RegisterInfo* regs, int* regNums, int num);
/*
* Mark the beginning and end LIR of a def sequence. Note that
* on entry start points to the LIR prior to the beginning of the
* sequence.
*/
-extern void oatMarkDef(CompilationUnit* cUnit, RegLocation rl, LIR* start,
+extern void MarkDef(CompilationUnit* cUnit, RegLocation rl, LIR* start,
LIR* finish);
/*
* Mark the beginning and end LIR of a def sequence. Note that
* on entry start points to the LIR prior to the beginning of the
* sequence.
*/
-extern void oatMarkDefWide(CompilationUnit* cUnit, RegLocation rl,
+extern void MarkDefWide(CompilationUnit* cUnit, RegLocation rl,
LIR* start, LIR* finish);
// Get the LocRecord associated with an SSA name use.
-extern RegLocation oatGetSrc(CompilationUnit* cUnit, MIR* mir, int num);
-extern RegLocation oatGetSrcWide(CompilationUnit* cUnit, MIR* mir, int low);
+extern RegLocation GetSrc(CompilationUnit* cUnit, MIR* mir, int num);
+extern RegLocation GetSrcWide(CompilationUnit* cUnit, MIR* mir, int low);
// Non-width checking version
-extern RegLocation oatGetRawSrc(CompilationUnit* cUnit, MIR* mir, int num);
+extern RegLocation GetRawSrc(CompilationUnit* cUnit, MIR* mir, int num);
// Get the LocRecord associated with an SSA name def.
-extern RegLocation oatGetDest(CompilationUnit* cUnit, MIR* mir);
-extern RegLocation oatGetDestWide(CompilationUnit* cUnit, MIR* mir);
+extern RegLocation GetDest(CompilationUnit* cUnit, MIR* mir);
+extern RegLocation GetDestWide(CompilationUnit* cUnit, MIR* mir);
// Non-width checking version
-extern RegLocation oatGetRawDest(CompilationUnit* cUnit, MIR* mir);
+extern RegLocation GetRawDest(CompilationUnit* cUnit, MIR* mir);
-extern RegLocation oatGetReturnWide(CompilationUnit* cUnit, bool isDouble);
+extern RegLocation GetReturnWide(CompilationUnit* cUnit, bool isDouble);
/* Clobber all regs that might be used by an external C call */
-extern void oatClobberCalleeSave(CompilationUnit* cUnit);
+extern void ClobberCalleeSave(CompilationUnit* cUnit);
-extern RegisterInfo *oatIsTemp(CompilationUnit* cUnit, int reg);
+extern RegisterInfo *IsTemp(CompilationUnit* cUnit, int reg);
-extern RegisterInfo *oatIsPromoted(CompilationUnit* cUnit, int reg);
+extern RegisterInfo *IsPromoted(CompilationUnit* cUnit, int reg);
-extern bool oatIsDirty(CompilationUnit* cUnit, int reg);
+extern bool IsDirty(CompilationUnit* cUnit, int reg);
-extern void oatMarkInUse(CompilationUnit* cUnit, int reg);
+extern void MarkInUse(CompilationUnit* cUnit, int reg);
-extern int oatAllocTemp(CompilationUnit* cUnit);
+extern int AllocTemp(CompilationUnit* cUnit);
-extern int oatAllocTempFloat(CompilationUnit* cUnit);
+extern int AllocTempFloat(CompilationUnit* cUnit);
//REDO: too many assumptions.
-extern int oatAllocTempDouble(CompilationUnit* cUnit);
+extern int AllocTempDouble(CompilationUnit* cUnit);
-extern void oatFreeTemp(CompilationUnit* cUnit, int reg);
+extern void FreeTemp(CompilationUnit* cUnit, int reg);
-extern void oatResetDefLocWide(CompilationUnit* cUnit, RegLocation rl);
+extern void ResetDefLocWide(CompilationUnit* cUnit, RegLocation rl);
-extern void oatResetDefTracking(CompilationUnit* cUnit);
+extern void ResetDefTracking(CompilationUnit* cUnit);
-extern RegisterInfo *oatIsLive(CompilationUnit* cUnit, int reg);
+extern RegisterInfo *IsLive(CompilationUnit* cUnit, int reg);
/* To be used when explicitly managing register use */
-extern void oatLockCallTemps(CompilationUnit* cUnit);
+extern void LockCallTemps(CompilationUnit* cUnit);
-extern void oatFreeCallTemps(CompilationUnit* cUnit);
+extern void FreeCallTemps(CompilationUnit* cUnit);
-extern void oatFlushAllRegs(CompilationUnit* cUnit);
+extern void FlushAllRegs(CompilationUnit* cUnit);
-extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit);
+extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit);
-extern RegLocation oatGetReturn(CompilationUnit* cUnit, bool isFloat);
+extern RegLocation GetReturn(CompilationUnit* cUnit, bool isFloat);
-extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit);
+extern RegLocation GetReturnAlt(CompilationUnit* cUnit);
/* Clobber any temp associated with an sReg. Could be in either class */
-extern void oatClobberSReg(CompilationUnit* cUnit, int sReg);
+extern void ClobberSReg(CompilationUnit* cUnit, int sReg);
/* Return a temp if one is available, -1 otherwise */
-extern int oatAllocFreeTemp(CompilationUnit* cUnit);
+extern int AllocFreeTemp(CompilationUnit* cUnit);
/* Attempt to allocate a callee-save register */
-extern int oatAllocPreservedCoreReg(CompilationUnit* cUnit, int sreg);
-extern int oatAllocPreservedFPReg(CompilationUnit* cUnit, int sReg,
+extern int AllocPreservedCoreReg(CompilationUnit* cUnit, int sreg);
+extern int AllocPreservedFPReg(CompilationUnit* cUnit, int sReg,
bool doubleStart);
/*
- * Similar to oatAllocTemp(), but forces the allocation of a specific
+ * Similar to AllocTemp(), but forces the allocation of a specific
* register. No check is made to see if the register was previously
* allocated. Use with caution.
*/
-extern void oatLockTemp(CompilationUnit* cUnit, int reg);
+extern void LockTemp(CompilationUnit* cUnit, int reg);
-extern RegLocation oatWideToNarrow(CompilationUnit* cUnit, RegLocation rl);
+extern RegLocation WideToNarrow(CompilationUnit* cUnit, RegLocation rl);
/*
* Free all allocated temps in the temp pools. Note that this does
* not affect the "liveness" of a temp register, which will stay
* live until it is either explicitly killed or reallocated.
*/
-extern void oatResetRegPool(CompilationUnit* cUnit);
+extern void ResetRegPool(CompilationUnit* cUnit);
-extern void oatClobberAllRegs(CompilationUnit* cUnit);
+extern void ClobberAllRegs(CompilationUnit* cUnit);
-extern void oatFlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
+extern void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
-extern void oatFlushReg(CompilationUnit* cUnit, int reg);
+extern void FlushReg(CompilationUnit* cUnit, int reg);
-extern void oatDoPromotion(CompilationUnit* cUnit);
-extern int oatVRegOffset(CompilationUnit* cUnit, int reg);
-extern int oatSRegOffset(CompilationUnit* cUnit, int reg);
-extern void oatCountRefs(CompilationUnit*, BasicBlock*, RefCounts*, RefCounts*);
-extern int oatSortCounts(const void *val1, const void *val2);
-extern void oatDumpCounts(const RefCounts* arr, int size, const char* msg);
-extern void oatRecordCorePromotion(CompilationUnit* cUnit, int reg, int sReg);
-extern void oatRecordFpPromotion(CompilationUnit* cUnit, int reg, int sReg);
+extern void DoPromotion(CompilationUnit* cUnit);
+extern int VRegOffset(CompilationUnit* cUnit, int reg);
+extern int SRegOffset(CompilationUnit* cUnit, int reg);
+extern void CountRefs(CompilationUnit*, BasicBlock*, RefCounts*, RefCounts*);
+extern int SortCounts(const void *val1, const void *val2);
+extern void DumpCounts(const RefCounts* arr, int size, const char* msg);
+extern void RecordCorePromotion(CompilationUnit* cUnit, int reg, int sReg);
+extern void RecordFpPromotion(CompilationUnit* cUnit, int reg, int sReg);
/* Architecture-dependent register allocation routines. */
-extern int oatAllocTypedTempPair(CompilationUnit* cUnit,
+extern int AllocTypedTempPair(CompilationUnit* cUnit,
bool fpHint, int regClass);
-extern int oatAllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass);
+extern int AllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass);
-extern void oatDumpCoreRegPool(CompilationUnit* cUint);
+extern void DumpCoreRegPool(CompilationUnit* cUint);
extern void oatDumpFPRegPool(CompilationUnit* cUint);
-extern bool oatCheckCorePoolSanity(CompilationUnit* cUnit);
-extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg);
-extern void oatNopLIR(LIR* lir);
+extern bool CheckCorePoolSanity(CompilationUnit* cUnit);
+extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg);
+extern void NopLIR(LIR* lir);
extern bool oatIsFPReg(int reg);
extern uint32_t oatFPRegMask(void);
-extern void oatAdjustSpillMask(CompilationUnit* cUnit);
-void oatMarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg);
-int oatComputeFrameSize(CompilationUnit* cUnit);
+extern void AdjustSpillMask(CompilationUnit* cUnit);
+void MarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg);
+int ComputeFrameSize(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/codegen/target_list.h b/src/compiler/codegen/target_list.h
index 5fc3891..970be2d 100644
--- a/src/compiler/codegen/target_list.h
+++ b/src/compiler/codegen/target_list.h
@@ -1,146 +1,146 @@
-ArmConditionCode oatArmConditionEncoding(ConditionCode code);
-AssemblerStatus oatAssembleInstructions(CompilationUnit* cUnit, uintptr_t startAddr);
-bool doubleReg(int reg);
-bool fpReg(int reg);
-bool genAddLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genAndLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genArithOpDouble(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genArithOpFloat(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genArithOpFloat(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genCmpFP(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genConversion(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc);
-bool genInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier);
-bool genInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin);
-bool genInlinedSqrt(CompilationUnit* cUnit, CallInfo* info);
-bool genNegLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
-bool genOrLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genSubLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool genXorLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-bool oatArchInit();
-bool oatArchVariantInit(void);
-bool oatIsFpReg(int reg);
-bool sameRegType(int reg1, int reg2);
-bool singleReg(int reg);
-bool smallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode, RegLocation rlSrc, RegLocation rlDest, int lit);
-char* decodeFPCSRegList(int count, int base, char* buf);
-char* decodeRegList(int opcode, int vector, char* buf);
-RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg);
-RegLocation oatGetReturnAlt(CompilationUnit* cUnit);
-RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit);
-void oatClobberCalleeSave(CompilationUnit *cUnit);
-void oatFreeCallTemps(CompilationUnit* cUnit);
-void oatLockCallTemps(CompilationUnit* cUnit);
-InstructionSet oatInstructionSet();
-int encodeImmDoubleHigh(int value);
-int encodeImmDouble(int valLo, int valHi);
-int encodeImmSingle(int value);
-int encodeShift(int code, int amount);
-int expandImmediate(int value);
-int inPosition(CompilationUnit* cUnit, int sReg);
-int leadingZeros(uint32_t val);
-int loadHelper(CompilationUnit* cUnit, int offset);
-int modifiedImmediate(uint32_t value);
-int oatAllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass);
-int oatAllocTypedTempPair(CompilationUnit* cUnit, bool fpHint, int regClass);
-int oatAssignInsnOffsets(CompilationUnit* cUnit);
-int oatGetInsnSize(LIR* lir);
-int s2d(int lowReg, int highReg);
-int targetReg(SpecialTargetRegister reg);
-LIR* fpRegCopy(CompilationUnit* cUnit, int rDest, int rSrc);
-LIR* genRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode, int reg1, int base, int offset, ThrowKind kind);
-LIR* loadBaseDispBody(CompilationUnit* cUnit, int rBase, int displacement, int rDest, int rDestHi, OpSize size, int sReg);
-LIR* loadBaseDisp(CompilationUnit* cUnit, int rBase, int displacement, int rDest, OpSize size, int sReg);
-LIR* loadBaseDispWide(CompilationUnit* cUnit, int rBase, int displacement, int rDestLo, int rDestHi, int sReg);
-LIR* loadBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rDest, int scale, OpSize size);
-LIR* loadBaseIndexedDisp(CompilationUnit *cUnit, int rBase, int rIndex, int scale, int displacement, int rDest, int rDestHi, OpSize size, int sReg);
-LIR* loadConstantNoClobber(CompilationUnit* cUnit, int rDest, int value);
-LIR* loadConstantValueWide(CompilationUnit* cUnit, int rDestLo, int rDestHi, int valLo, int valHi);
-LIR* loadFPConstantValue(CompilationUnit* cUnit, int rDest, int value);
-LIR* loadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
-LIR* opBranchUnconditional(CompilationUnit* cUnit, OpKind op);
-LIR* opCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1, int src2, LIR* target);
-LIR* opCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg, int checkValue, LIR* target);
-LIR* opCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target);
-LIR* opDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target);
-LIR* opIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide);
-LIR* opMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp);
-LIR* opPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target);
-LIR* opReg(CompilationUnit* cUnit, OpKind op, int rDestSrc);
-LIR* opRegCopy(CompilationUnit* cUnit, int rDest, int rSrc);
-LIR* opRegCopyNoInsert(CompilationUnit* cUnit, int rDest, int rSrc);
-LIR* opRegImm(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int value);
-LIR* opRegMem(CompilationUnit* cUnit, OpKind op, int rDest, int rBase, int offset);
-LIR* opRegReg(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int rSrc2);
-LIR* opRegRegImm(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1, int value);
-LIR* opRegRegReg(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1, int rSrc2);
-LIR* opRegRegRegShift(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1, int rSrc2, int shift);
-LIR* opRegRegShift(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int rSrc2, int shift);
-LIR* opTestSuspend(CompilationUnit* cUnit, LIR* target);
-LIR* opThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset);
-LIR* opVldm(CompilationUnit* cUnit, int rBase, int count);
-LIR* opVstm(CompilationUnit* cUnit, int rBase, int count);
-LIR* storeBaseDispBody(CompilationUnit* cUnit, int rBase, int displacement, int rSrc, int rSrcHi, OpSize size);
-LIR* storeBaseDisp(CompilationUnit* cUnit, int rBase, int displacement, int rSrc, OpSize size);
-LIR* storeBaseDispWide(CompilationUnit* cUnit, int rBase, int displacement, int rSrcLo, int rSrcHi);
-LIR* storeBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rSrc, int scale, OpSize size);
-LIR* storeBaseIndexedDisp(CompilationUnit *cUnit, int rBase, int rIndex, int scale, int displacement, int rSrc, int rSrcHi, OpSize size, int sReg);
-LIR* storeMultiple(CompilationUnit *cUnit, int rBase, int rMask);
-MIR* getNextMir(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir);
-MIR* specialIdentity(CompilationUnit* cUnit, MIR* mir);
-MIR* specialIGet(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir, OpSize size, bool longOrDouble, bool isObject);
-MIR* specialIPut(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir, OpSize size, bool longOrDouble, bool isObject);
-RegLocation argLoc(CompilationUnit* cUnit, RegLocation loc);
-RegLocation genDivRem(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int regHi, bool isDiv);
-RegLocation genDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int lit, bool isDiv);
-RegLocation loadArg(CompilationUnit* cUnit, RegLocation loc);
-RegLocation locCReturn();
-RegLocation locCReturnDouble();
-RegLocation locCReturnFloat();
-RegLocation locCReturnWide();
-std::string buildInsnString(const char* fmt, LIR* lir, unsigned char* baseAddr);
-uint64_t getRegMaskCommon(CompilationUnit* cUnit, int reg);
-uint32_t fpRegMask();
-uint32_t oatFpRegMask();
-uint64_t getPCUseDefEncoding();
-void convertShortToLongBranch(CompilationUnit* cUnit, LIR* lir);
-void freeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep, RegLocation rlFree);
-void genCmpLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
-void genDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi);
-void genEntrySequence(CompilationUnit* cUnit, RegLocation* argLocs, RegLocation rlMethod);
-void genExitSequence(CompilationUnit* cUnit);
-void genFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc);
-void genFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, bool gtBias, bool isDouble);
-void genFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
-void genMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc);
-void genMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc);
-void genMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc, RegLocation rlResult, int lit, int firstBit, int secondBit);
-void genNegDouble(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
-void genNegFloat(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
-void genPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc);
-void genPrintLabel(CompilationUnit *cUnit, MIR* mir);
-void genSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc);
-void genSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, SpecialCaseHandler specialCase);
-void loadPair(CompilationUnit* cUnit, int base, int lowReg, int highReg);
-void lockLiveArgs(CompilationUnit* cUnit, MIR* mir);
-void markGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg);
-void oatAdjustSpillMask(CompilationUnit* cUnit);
-void oatClobberCalleeSave(CompilationUnit *cUnit);
-void oatDumpResourceMask(LIR* lir, uint64_t mask, const char* prefix);
-void oatFlushReg(CompilationUnit* cUnit, int reg);
-void oatFlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
-void oatGenMemBarrier(CompilationUnit* cUnit, MemBarrierKind barrierKind);
-void oatInitializeRegAlloc(CompilationUnit* cUnit);
-void oatMarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg);
-void oatNopLIR( LIR* lir);
-void opLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset);
-void opRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi, int srcLo, int srcHi);
-void opRegThreadMem(CompilationUnit* cUnit, OpKind op, int rDest, int threadOffset);
-void opTlsCmp(CompilationUnit* cUnit, int offset, int val);
-bool branchUnconditional(LIR* lir);
-void setupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir);
-void spillCoreRegs(CompilationUnit* cUnit);
-void unSpillCoreRegs(CompilationUnit* cUnit);
-X86ConditionCode oatX86ConditionEncoding(ConditionCode cond);
-uint64_t getTargetInstFlags(int opcode);
-const char* getTargetInstName(int opcode);
-const char* getTargetInstFmt(int opcode);
+ArmConditionCode ArmConditionEncoding(ConditionCode code);
+AssemblerStatus AssembleInstructions(CompilationUnit* cUnit, uintptr_t startAddr);
+bool DoubleReg(int reg);
+bool FpReg(int reg);
+bool GenAddLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenAndLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenArithOpDouble(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenArithOpFloat(CompilationUnit *cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenArithOpFloat(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenCmpFP(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenConversion(CompilationUnit* cUnit, Instruction::Code opcode, RegLocation rlDest, RegLocation rlSrc);
+bool GenInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier);
+bool GenInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin);
+bool GenInlinedSqrt(CompilationUnit* cUnit, CallInfo* info);
+bool GenNegLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
+bool GenOrLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenSubLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool GenXorLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+bool ArchInit();
+bool ArchVariantInit(void);
+bool IsFpReg(int reg);
+bool SameRegType(int reg1, int reg2);
+bool SingleReg(int reg);
+bool SmallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode, RegLocation rlSrc, RegLocation rlDest, int lit);
+char* DecodeFPCSRegList(int count, int base, char* buf);
+char* DecodeRegList(int opcode, int vector, char* buf);
+RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg);
+RegLocation GetReturnAlt(CompilationUnit* cUnit);
+RegLocation GetReturnWideAlt(CompilationUnit* cUnit);
+void ClobberCalleeSave(CompilationUnit *cUnit);
+void FreeCallTemps(CompilationUnit* cUnit);
+void LockCallTemps(CompilationUnit* cUnit);
+InstructionSet InstructionSet();
+int EncodeImmDoubleHigh(int value);
+int EncodeImmDouble(int valLo, int valHi);
+int EncodeImmSingle(int value);
+int EncodeShift(int code, int amount);
+int ExpandImmediate(int value);
+int InPosition(CompilationUnit* cUnit, int sReg);
+int LeadingZeros(uint32_t val);
+int LoadHelper(CompilationUnit* cUnit, int offset);
+int ModifiedImmediate(uint32_t value);
+int AllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass);
+int AllocTypedTempPair(CompilationUnit* cUnit, bool fpHint, int regClass);
+int AssignInsnOffsets(CompilationUnit* cUnit);
+int GetInsnSize(LIR* lir);
+int S2d(int lowReg, int highReg);
+int TargetReg(SpecialTargetRegister reg);
+LIR* FpRegCopy(CompilationUnit* cUnit, int rDest, int rSrc);
+LIR* GenRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode, int reg1, int base, int offset, ThrowKind kind);
+LIR* LoadBaseDispBody(CompilationUnit* cUnit, int rBase, int displacement, int rDest, int rDestHi, OpSize size, int sReg);
+LIR* LoadBaseDisp(CompilationUnit* cUnit, int rBase, int displacement, int rDest, OpSize size, int sReg);
+LIR* LoadBaseDispWide(CompilationUnit* cUnit, int rBase, int displacement, int rDestLo, int rDestHi, int sReg);
+LIR* LoadBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rDest, int scale, OpSize size);
+LIR* LoadBaseIndexedDisp(CompilationUnit *cUnit, int rBase, int rIndex, int scale, int displacement, int rDest, int rDestHi, OpSize size, int sReg);
+LIR* LoadConstantNoClobber(CompilationUnit* cUnit, int rDest, int value);
+LIR* LoadConstantValueWide(CompilationUnit* cUnit, int rDestLo, int rDestHi, int valLo, int valHi);
+LIR* LoadFPConstantValue(CompilationUnit* cUnit, int rDest, int value);
+LIR* LoadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
+LIR* OpBranchUnconditional(CompilationUnit* cUnit, OpKind op);
+LIR* OpCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1, int src2, LIR* target);
+LIR* OpCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg, int checkValue, LIR* target);
+LIR* OpCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target);
+LIR* OpDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target);
+LIR* OpIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide);
+LIR* OpMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp);
+LIR* OpPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target);
+LIR* OpReg(CompilationUnit* cUnit, OpKind op, int rDestSrc);
+LIR* OpRegCopy(CompilationUnit* cUnit, int rDest, int rSrc);
+LIR* OpRegCopyNoInsert(CompilationUnit* cUnit, int rDest, int rSrc);
+LIR* OpRegImm(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int value);
+LIR* OpRegMem(CompilationUnit* cUnit, OpKind op, int rDest, int rBase, int offset);
+LIR* OpRegReg(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int rSrc2);
+LIR* OpRegRegImm(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1, int value);
+LIR* OpRegRegReg(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1, int rSrc2);
+LIR* OpRegRegRegShift(CompilationUnit* cUnit, OpKind op, int rDest, int rSrc1, int rSrc2, int shift);
+LIR* OpRegRegShift(CompilationUnit* cUnit, OpKind op, int rDestSrc1, int rSrc2, int shift);
+LIR* OpTestSuspend(CompilationUnit* cUnit, LIR* target);
+LIR* OpThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset);
+LIR* OpVldm(CompilationUnit* cUnit, int rBase, int count);
+LIR* OpVstm(CompilationUnit* cUnit, int rBase, int count);
+LIR* StoreBaseDispBody(CompilationUnit* cUnit, int rBase, int displacement, int rSrc, int rSrcHi, OpSize size);
+LIR* StoreBaseDisp(CompilationUnit* cUnit, int rBase, int displacement, int rSrc, OpSize size);
+LIR* StoreBaseDispWide(CompilationUnit* cUnit, int rBase, int displacement, int rSrcLo, int rSrcHi);
+LIR* StoreBaseIndexed(CompilationUnit* cUnit, int rBase, int rIndex, int rSrc, int scale, OpSize size);
+LIR* StoreBaseIndexedDisp(CompilationUnit *cUnit, int rBase, int rIndex, int scale, int displacement, int rSrc, int rSrcHi, OpSize size, int sReg);
+LIR* StoreMultiple(CompilationUnit *cUnit, int rBase, int rMask);
+MIR* GetNextMir(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir);
+MIR* SpecialIdentity(CompilationUnit* cUnit, MIR* mir);
+MIR* SpecialIGet(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir, OpSize size, bool longOrDouble, bool isObject);
+MIR* SpecialIPut(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir, OpSize size, bool longOrDouble, bool isObject);
+RegLocation ArgLoc(CompilationUnit* cUnit, RegLocation loc);
+RegLocation GenDivRem(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int regHi, bool isDiv);
+RegLocation GenDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int lit, bool isDiv);
+RegLocation LoadArg(CompilationUnit* cUnit, RegLocation loc);
+RegLocation LocCReturn();
+RegLocation LocCReturnDouble();
+RegLocation LocCReturnFloat();
+RegLocation LocCReturnWide();
+std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* baseAddr);
+uint64_t GetRegMaskCommon(CompilationUnit* cUnit, int reg);
+uint32_t FpRegMask();
+uint32_t FpRegMask();
+uint64_t GetPCUseDefEncoding();
+void ConvertShortToLongBranch(CompilationUnit* cUnit, LIR* lir);
+void FreeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep, RegLocation rlFree);
+void GenCmpLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2);
+void GenDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi);
+void GenEntrySequence(CompilationUnit* cUnit, RegLocation* ArgLocs, RegLocation rlMethod);
+void GenExitSequence(CompilationUnit* cUnit);
+void GenFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc);
+void GenFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, bool gtBias, bool isDouble);
+void GenFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
+void GenMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc);
+void GenMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc);
+void GenMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc, RegLocation rlResult, int lit, int firstBit, int secondBit);
+void GenNegDouble(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
+void GenNegFloat(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc);
+void GenPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc);
+void GenPrintLabel(CompilationUnit *cUnit, MIR* mir);
+void GenSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset, RegLocation rlSrc);
+void GenSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir, SpecialCaseHandler specialCase);
+void LoadPair(CompilationUnit* cUnit, int base, int lowReg, int highReg);
+void LockLiveArgs(CompilationUnit* cUnit, MIR* mir);
+void MarkGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg);
+void AdjustSpillMask(CompilationUnit* cUnit);
+void ClobberCalleeSave(CompilationUnit *cUnit);
+void DumpResourceMask(LIR* lir, uint64_t mask, const char* prefix);
+void FlushReg(CompilationUnit* cUnit, int reg);
+void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
+void GenMemBarrier(CompilationUnit* cUnit, MemBarrierKind barrierKind);
+void CompilerInitializeRegAlloc(CompilationUnit* cUnit);
+void MarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg);
+void NopLIR( LIR* lir);
+void OpLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset);
+void OpRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi, int srcLo, int srcHi);
+void OpRegThreadMem(CompilationUnit* cUnit, OpKind op, int rDest, int threadOffset);
+void OpTlsCmp(CompilationUnit* cUnit, int offset, int val);
+bool BranchUnconditional(LIR* lir);
+void SetupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir);
+void SpillCoreRegs(CompilationUnit* cUnit);
+void UnSpillCoreRegs(CompilationUnit* cUnit);
+X86ConditionCode X86ConditionEncoding(ConditionCode cond);
+uint64_t GetTargetInstFlags(int opcode);
+const char* GetTargetInstName(int opcode);
+const char* GetTargetInstFmt(int opcode);
diff --git a/src/compiler/codegen/x86/assemble_x86.cc b/src/compiler/codegen/x86/assemble_x86.cc
index 0c2ff0d..50300a5 100644
--- a/src/compiler/codegen/x86/assemble_x86.cc
+++ b/src/compiler/codegen/x86/assemble_x86.cc
@@ -329,7 +329,7 @@
{ kX86PcRelAdr, kPcRel, IS_LOAD | IS_BINARY_OP | REG_DEF0, { 0, 0, 0xB8, 0, 0, 0, 0, 4 }, "PcRelAdr", "!0r,!1d" },
};
-static size_t computeSize(X86EncodingMap* entry, int displacement, bool has_sib) {
+static size_t ComputeSize(X86EncodingMap* entry, int displacement, bool has_sib) {
size_t size = 0;
if (entry->skeleton.prefix1 > 0) {
++size;
@@ -358,7 +358,7 @@
return size;
}
-int oatGetInsnSize(LIR* lir) {
+int GetInsnSize(LIR* lir) {
X86EncodingMap* entry = &EncodingMap[lir->opcode];
switch (entry->kind) {
case kData:
@@ -368,48 +368,48 @@
case kNullary:
return 1; // 1 byte of opcode
case kReg: // lir operands - 0: reg
- return computeSize(entry, 0, false);
+ return ComputeSize(entry, 0, false);
case kMem: { // lir operands - 0: base, 1: disp
int base = lir->operands[0];
int disp = lir->operands[1];
// SP requires a special extra SIB byte. BP requires explicit disp,
// so add a byte for disp 0 which would normally be omitted.
- return computeSize(entry, disp, false) + ((base == rX86_SP) || (base == rBP && disp == 0) ? 1 : 0);
+ return ComputeSize(entry, disp, false) + ((base == rX86_SP) || (base == rBP && disp == 0) ? 1 : 0);
}
case kArray: // lir operands - 0: base, 1: index, 2: scale, 3: disp
- return computeSize(entry, lir->operands[3], true);
+ return ComputeSize(entry, lir->operands[3], true);
case kMemReg: { // lir operands - 0: base, 1: disp, 2: reg
int base = lir->operands[0];
int disp = lir->operands[1];
// SP requires a special extra SIB byte. BP requires explicit disp,
// so add a byte for disp 0 which would normally be omitted.
- return computeSize(entry, disp, false) + ((base == rX86_SP) || (base == rBP && disp == 0) ? 1 : 0);
+ return ComputeSize(entry, disp, false) + ((base == rX86_SP) || (base == rBP && disp == 0) ? 1 : 0);
}
case kArrayReg: // lir operands - 0: base, 1: index, 2: scale, 3: disp, 4: reg
- return computeSize(entry, lir->operands[3], true);
+ return ComputeSize(entry, lir->operands[3], true);
case kThreadReg: // lir operands - 0: disp, 1: reg
- return computeSize(entry, lir->operands[0], false);
+ return ComputeSize(entry, lir->operands[0], false);
case kRegReg:
- return computeSize(entry, 0, false);
+ return ComputeSize(entry, 0, false);
case kRegRegStore:
- return computeSize(entry, 0, false);
+ return ComputeSize(entry, 0, false);
case kRegMem: { // lir operands - 0: reg, 1: base, 2: disp
int base = lir->operands[1];
int disp = lir->operands[2];
// SP requires a special extra SIB byte. BP requires explicit disp,
// so add a byte for disp 0 which would normally be omitted.
- return computeSize(entry, disp, false) + ((base == rX86_SP) || (base == rBP && disp == 0) ? 1 : 0);
+ return ComputeSize(entry, disp, false) + ((base == rX86_SP) || (base == rBP && disp == 0) ? 1 : 0);
}
case kRegArray: { // lir operands - 0: reg, 1: base, 2: index, 3: scale, 4: disp
int base = lir->operands[1];
int disp = lir->operands[4];
// BP requires explicit disp, so add a byte for disp 0 which would normally be omitted.
- return computeSize(entry, disp, true) + ((base == rBP && disp == 0) ? 1 : 0);
+ return ComputeSize(entry, disp, true) + ((base == rBP && disp == 0) ? 1 : 0);
}
case kRegThread: // lir operands - 0: reg, 1: disp
- return computeSize(entry, 0x12345678, false); // displacement size is always 32bit
+ return ComputeSize(entry, 0x12345678, false); // displacement size is always 32bit
case kRegImm: { // lir operands - 0: reg, 1: immediate
- size_t size = computeSize(entry, 0, false);
+ size_t size = ComputeSize(entry, 0, false);
if (entry->skeleton.ax_opcode == 0) {
return size;
} else {
@@ -420,44 +420,44 @@
}
case kMemImm: // lir operands - 0: base, 1: disp, 2: immediate
CHECK_NE(lir->operands[0], static_cast<int>(rX86_SP)); // TODO: add extra SIB byte
- return computeSize(entry, lir->operands[1], false);
+ return ComputeSize(entry, lir->operands[1], false);
case kArrayImm: // lir operands - 0: base, 1: index, 2: scale, 3: disp 4: immediate
- return computeSize(entry, lir->operands[3], true);
+ return ComputeSize(entry, lir->operands[3], true);
case kThreadImm: // lir operands - 0: disp, 1: imm
- return computeSize(entry, 0x12345678, false); // displacement size is always 32bit
+ return ComputeSize(entry, 0x12345678, false); // displacement size is always 32bit
case kRegRegImm: // lir operands - 0: reg, 1: reg, 2: imm
- return computeSize(entry, 0, false);
+ return ComputeSize(entry, 0, false);
case kRegMemImm: // lir operands - 0: reg, 1: base, 2: disp, 3: imm
CHECK_NE(lir->operands[1], static_cast<int>(rX86_SP)); // TODO: add extra SIB byte
- return computeSize(entry, lir->operands[2], false);
+ return ComputeSize(entry, lir->operands[2], false);
case kRegArrayImm: // lir operands - 0: reg, 1: base, 2: index, 3: scale, 4: disp, 5: imm
- return computeSize(entry, lir->operands[4], true);
+ return ComputeSize(entry, lir->operands[4], true);
case kMovRegImm: // lir operands - 0: reg, 1: immediate
return 1 + entry->skeleton.immediate_bytes;
case kShiftRegImm: // lir operands - 0: reg, 1: immediate
// Shift by immediate one has a shorter opcode.
- return computeSize(entry, 0, false) - (lir->operands[1] == 1 ? 1 : 0);
+ return ComputeSize(entry, 0, false) - (lir->operands[1] == 1 ? 1 : 0);
case kShiftMemImm: // lir operands - 0: base, 1: disp, 2: immediate
CHECK_NE(lir->operands[0], static_cast<int>(rX86_SP)); // TODO: add extra SIB byte
// Shift by immediate one has a shorter opcode.
- return computeSize(entry, lir->operands[1], false) - (lir->operands[2] == 1 ? 1 : 0);
+ return ComputeSize(entry, lir->operands[1], false) - (lir->operands[2] == 1 ? 1 : 0);
case kShiftArrayImm: // lir operands - 0: base, 1: index, 2: scale, 3: disp 4: immediate
// Shift by immediate one has a shorter opcode.
- return computeSize(entry, lir->operands[3], true) - (lir->operands[4] == 1 ? 1 : 0);
+ return ComputeSize(entry, lir->operands[3], true) - (lir->operands[4] == 1 ? 1 : 0);
case kShiftRegCl:
- return computeSize(entry, 0, false);
+ return ComputeSize(entry, 0, false);
case kShiftMemCl: // lir operands - 0: base, 1: disp, 2: cl
CHECK_NE(lir->operands[0], static_cast<int>(rX86_SP)); // TODO: add extra SIB byte
- return computeSize(entry, lir->operands[1], false);
+ return ComputeSize(entry, lir->operands[1], false);
case kShiftArrayCl: // lir operands - 0: base, 1: index, 2: scale, 3: disp, 4: reg
- return computeSize(entry, lir->operands[3], true);
+ return ComputeSize(entry, lir->operands[3], true);
case kRegCond: // lir operands - 0: reg, 1: cond
- return computeSize(entry, 0, false);
+ return ComputeSize(entry, 0, false);
case kMemCond: // lir operands - 0: base, 1: disp, 2: cond
CHECK_NE(lir->operands[0], static_cast<int>(rX86_SP)); // TODO: add extra SIB byte
- return computeSize(entry, lir->operands[1], false);
+ return ComputeSize(entry, lir->operands[1], false);
case kArrayCond: // lir operands - 0: base, 1: index, 2: scale, 3: disp, 4: cond
- return computeSize(entry, lir->operands[3], true);
+ return ComputeSize(entry, lir->operands[3], true);
case kJcc:
if (lir->opcode == kX86Jcc8) {
return 2; // opcode + rel8
@@ -478,11 +478,11 @@
switch (lir->opcode) {
case kX86CallR: return 2; // opcode modrm
case kX86CallM: // lir operands - 0: base, 1: disp
- return computeSize(entry, lir->operands[1], false);
+ return ComputeSize(entry, lir->operands[1], false);
case kX86CallA: // lir operands - 0: base, 1: index, 2: scale, 3: disp
- return computeSize(entry, lir->operands[3], true);
+ return ComputeSize(entry, lir->operands[3], true);
case kX86CallT: // lir operands - 0: disp
- return computeSize(entry, 0x12345678, false); // displacement size is always 32bit
+ return ComputeSize(entry, 0x12345678, false); // displacement size is always 32bit
default:
break;
}
@@ -490,7 +490,7 @@
case kPcRel:
if (entry->opcode == kX86PcRelLoadRA) {
// lir operands - 0: reg, 1: base, 2: index, 3: scale, 4: table
- return computeSize(entry, 0x12345678, true);
+ return ComputeSize(entry, 0x12345678, true);
} else {
DCHECK(entry->opcode == kX86PcRelAdr);
return 5; // opcode with reg + 4 byte immediate
@@ -498,7 +498,7 @@
case kMacro:
DCHECK_EQ(lir->opcode, static_cast<int>(kX86StartOfMethod));
return 5 /* call opcode + 4 byte displacement */ + 1 /* pop reg */ +
- computeSize(&EncodingMap[kX86Sub32RI], 0, false) -
+ ComputeSize(&EncodingMap[kX86Sub32RI], 0, false) -
(lir->operands[0] == rAX ? 1 : 0); // shorter ax encoding
default:
break;
@@ -507,7 +507,7 @@
return 0;
}
-static uint8_t modrmForDisp(int base, int disp) {
+static uint8_t ModrmForDisp(int base, int disp) {
// BP requires an explicit disp, so do not omit it in the 0 case
if (disp == 0 && base != rBP) {
return 0;
@@ -518,7 +518,7 @@
}
}
-static void emitDisp(CompilationUnit* cUnit, int base, int disp) {
+static void EmitDisp(CompilationUnit* cUnit, int base, int disp) {
// BP requires an explicit disp, so do not omit it in the 0 case
if (disp == 0 && base != rBP) {
return;
@@ -532,7 +532,7 @@
}
}
-static void emitOpReg(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t reg) {
+static void EmitOpReg(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t reg) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
if (entry->skeleton.prefix2 != 0) {
@@ -567,7 +567,7 @@
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitOpMem(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t base, int disp) {
+static void EmitOpMem(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t base, int disp) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
if (entry->skeleton.prefix2 != 0) {
@@ -581,14 +581,14 @@
DCHECK_EQ(0, entry->skeleton.extra_opcode2);
DCHECK_LT(entry->skeleton.modrm_opcode, 8);
DCHECK_LT(base, 8);
- uint8_t modrm = (modrmForDisp(base, disp) << 6) | (entry->skeleton.modrm_opcode << 3) | base;
+ uint8_t modrm = (ModrmForDisp(base, disp) << 6) | (entry->skeleton.modrm_opcode << 3) | base;
cUnit->codeBuffer.push_back(modrm);
- emitDisp(cUnit, base, disp);
+ EmitDisp(cUnit, base, disp);
DCHECK_EQ(0, entry->skeleton.ax_opcode);
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitMemReg(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitMemReg(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t base, int disp, uint8_t reg) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -619,25 +619,25 @@
}
DCHECK_LT(reg, 8);
DCHECK_LT(base, 8);
- uint8_t modrm = (modrmForDisp(base, disp) << 6) | (reg << 3) | base;
+ uint8_t modrm = (ModrmForDisp(base, disp) << 6) | (reg << 3) | base;
cUnit->codeBuffer.push_back(modrm);
if (base == rX86_SP) {
// Special SIB for SP base
cUnit->codeBuffer.push_back(0 << 6 | (rX86_SP << 3) | rX86_SP);
}
- emitDisp(cUnit, base, disp);
+ EmitDisp(cUnit, base, disp);
DCHECK_EQ(0, entry->skeleton.modrm_opcode);
DCHECK_EQ(0, entry->skeleton.ax_opcode);
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitRegMem(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitRegMem(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, uint8_t base, int disp) {
// Opcode will flip operands.
- emitMemReg(cUnit, entry, base, disp, reg);
+ EmitMemReg(cUnit, entry, base, disp, reg);
}
-static void emitRegArray(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t reg,
+static void EmitRegArray(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t reg,
uint8_t base, uint8_t index, int scale, int disp) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -663,26 +663,26 @@
reg = reg & X86_FP_REG_MASK;
}
DCHECK_LT(reg, 8);
- uint8_t modrm = (modrmForDisp(base, disp) << 6) | (reg << 3) | rX86_SP;
+ uint8_t modrm = (ModrmForDisp(base, disp) << 6) | (reg << 3) | rX86_SP;
cUnit->codeBuffer.push_back(modrm);
DCHECK_LT(scale, 4);
DCHECK_LT(index, 8);
DCHECK_LT(base, 8);
uint8_t sib = (scale << 6) | (index << 3) | base;
cUnit->codeBuffer.push_back(sib);
- emitDisp(cUnit, base, disp);
+ EmitDisp(cUnit, base, disp);
DCHECK_EQ(0, entry->skeleton.modrm_opcode);
DCHECK_EQ(0, entry->skeleton.ax_opcode);
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitArrayReg(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitArrayReg(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t base, uint8_t index, int scale, int disp, uint8_t reg) {
// Opcode will flip operands.
- emitRegArray(cUnit, entry, reg, base, index, scale, disp);
+ EmitRegArray(cUnit, entry, reg, base, index, scale, disp);
}
-static void emitRegThread(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitRegThread(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, int disp) {
DCHECK_NE(entry->skeleton.prefix1, 0);
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -720,7 +720,7 @@
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitRegReg(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitRegReg(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg1, uint8_t reg2) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -757,7 +757,7 @@
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitRegRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitRegRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg1, uint8_t reg2, int32_t imm) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -814,7 +814,7 @@
}
}
-static void emitRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, int imm) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -868,7 +868,7 @@
}
}
-static void emitThreadImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitThreadImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
int disp, int imm) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -920,7 +920,7 @@
DCHECK_EQ(entry->skeleton.ax_opcode, 0);
}
-static void emitMovRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitMovRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, int imm) {
DCHECK_LT(reg, 8);
cUnit->codeBuffer.push_back(0xB8 + reg);
@@ -930,7 +930,7 @@
cUnit->codeBuffer.push_back((imm >> 24) & 0xFF);
}
-static void emitShiftRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitShiftRegImm(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, int imm) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -971,7 +971,7 @@
}
}
-static void emitShiftRegCl(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitShiftRegCl(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, uint8_t cl) {
DCHECK_EQ(cl, static_cast<uint8_t>(rCX));
if (entry->skeleton.prefix1 != 0) {
@@ -992,7 +992,7 @@
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitRegCond(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitRegCond(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, uint8_t condition) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -1014,7 +1014,7 @@
DCHECK_EQ(entry->skeleton.immediate_bytes, 0);
}
-static void emitJmp(CompilationUnit* cUnit, const X86EncodingMap* entry, int rel) {
+static void EmitJmp(CompilationUnit* cUnit, const X86EncodingMap* entry, int rel) {
if (entry->opcode == kX86Jmp8) {
DCHECK(IS_SIMM8(rel));
cUnit->codeBuffer.push_back(0xEB);
@@ -1035,7 +1035,7 @@
}
}
-static void emitJcc(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitJcc(CompilationUnit* cUnit, const X86EncodingMap* entry,
int rel, uint8_t cc) {
DCHECK_LT(cc, 16);
if (entry->opcode == kX86Jcc8) {
@@ -1053,7 +1053,7 @@
}
}
-static void emitCallMem(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitCallMem(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t base, int disp) {
if (entry->skeleton.prefix1 != 0) {
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
@@ -1075,18 +1075,18 @@
DCHECK_EQ(0, entry->skeleton.extra_opcode1);
DCHECK_EQ(0, entry->skeleton.extra_opcode2);
}
- uint8_t modrm = (modrmForDisp(base, disp) << 6) | (entry->skeleton.modrm_opcode << 3) | base;
+ uint8_t modrm = (ModrmForDisp(base, disp) << 6) | (entry->skeleton.modrm_opcode << 3) | base;
cUnit->codeBuffer.push_back(modrm);
if (base == rX86_SP) {
// Special SIB for SP base
cUnit->codeBuffer.push_back(0 << 6 | (rX86_SP << 3) | rX86_SP);
}
- emitDisp(cUnit, base, disp);
+ EmitDisp(cUnit, base, disp);
DCHECK_EQ(0, entry->skeleton.ax_opcode);
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitCallThread(CompilationUnit* cUnit, const X86EncodingMap* entry, int disp) {
+static void EmitCallThread(CompilationUnit* cUnit, const X86EncodingMap* entry, int disp) {
DCHECK_NE(entry->skeleton.prefix1, 0);
cUnit->codeBuffer.push_back(entry->skeleton.prefix1);
if (entry->skeleton.prefix2 != 0) {
@@ -1114,7 +1114,7 @@
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
}
-static void emitPcRel(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t reg,
+static void EmitPcRel(CompilationUnit* cUnit, const X86EncodingMap* entry, uint8_t reg,
int base_or_table, uint8_t index, int scale, int table_or_disp) {
int disp;
if (entry->opcode == kX86PcRelLoadRA) {
@@ -1161,7 +1161,7 @@
DCHECK_EQ(0, entry->skeleton.ax_opcode);
}
-static void emitMacro(CompilationUnit* cUnit, const X86EncodingMap* entry,
+static void EmitMacro(CompilationUnit* cUnit, const X86EncodingMap* entry,
uint8_t reg, int offset) {
DCHECK(entry->opcode == kX86StartOfMethod) << entry->name;
cUnit->codeBuffer.push_back(0xE8); // call +0
@@ -1173,12 +1173,12 @@
DCHECK_LT(reg, 8);
cUnit->codeBuffer.push_back(0x58 + reg); // pop reg
- emitRegImm(cUnit, &EncodingMap[kX86Sub32RI], reg, offset + 5 /* size of call +0 */);
+ EmitRegImm(cUnit, &EncodingMap[kX86Sub32RI], reg, offset + 5 /* size of call +0 */);
}
-void emitUnimplemented(CompilationUnit* cUnit, const X86EncodingMap* entry, LIR* lir) {
- UNIMPLEMENTED(WARNING) << "encoding kind for " << entry->name << " " << buildInsnString(entry->fmt, lir, 0);
- for (int i = 0; i < oatGetInsnSize(lir); ++i) {
+void EmitUnimplemented(CompilationUnit* cUnit, const X86EncodingMap* entry, LIR* lir) {
+ UNIMPLEMENTED(WARNING) << "encoding kind for " << entry->name << " " << BuildInsnString(entry->fmt, lir, 0);
+ for (int i = 0; i < GetInsnSize(lir); ++i) {
cUnit->codeBuffer.push_back(0xCC); // push breakpoint instruction - int 3
}
}
@@ -1189,7 +1189,7 @@
* instruction. In those cases we will try to substitute a new code
* sequence or request that the trace be shortened and retried.
*/
-AssemblerStatus oatAssembleInstructions(CompilationUnit *cUnit, uintptr_t startAddr) {
+AssemblerStatus AssembleInstructions(CompilationUnit *cUnit, uintptr_t startAddr) {
LIR *lir;
AssemblerStatus res = kSuccess; // Assume success
@@ -1223,14 +1223,14 @@
<< " delta: " << delta << " old delta: " << lir->operands[0];
}
lir->opcode = kX86Jcc32;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
}
if (kVerbosePcFixup) {
LOG(INFO) << "Source:";
- oatDumpLIRInsn(cUnit, lir, 0);
+ DumpLIRInsn(cUnit, lir, 0);
LOG(INFO) << "Target:";
- oatDumpLIRInsn(cUnit, targetLIR, 0);
+ DumpLIRInsn(cUnit, targetLIR, 0);
LOG(INFO) << "Delta " << delta;
}
lir->operands[0] = delta;
@@ -1244,9 +1244,9 @@
int delta = target - pc;
if (kVerbosePcFixup) {
LOG(INFO) << "Source:";
- oatDumpLIRInsn(cUnit, lir, 0);
+ DumpLIRInsn(cUnit, lir, 0);
LOG(INFO) << "Target:";
- oatDumpLIRInsn(cUnit, targetLIR, 0);
+ DumpLIRInsn(cUnit, targetLIR, 0);
LOG(INFO) << "Delta " << delta;
}
lir->operands[0] = delta;
@@ -1276,7 +1276,7 @@
LOG(INFO) << "Retry for JMP growth at " << lir->offset;
}
lir->opcode = kX86Jmp32;
- oatSetupResourceMasks(cUnit, lir);
+ SetupResourceMasks(cUnit, lir);
res = kRetryAll;
}
lir->operands[0] = delta;
@@ -1328,86 +1328,86 @@
DCHECK_EQ(0, entry->skeleton.immediate_bytes);
break;
case kReg: // lir operands - 0: reg
- emitOpReg(cUnit, entry, lir->operands[0]);
+ EmitOpReg(cUnit, entry, lir->operands[0]);
break;
case kMem: // lir operands - 0: base, 1: disp
- emitOpMem(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitOpMem(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kMemReg: // lir operands - 0: base, 1: disp, 2: reg
- emitMemReg(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2]);
+ EmitMemReg(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2]);
break;
case kArrayReg: // lir operands - 0: base, 1: index, 2: scale, 3: disp, 4: reg
- emitArrayReg(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2],
+ EmitArrayReg(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2],
lir->operands[3], lir->operands[4]);
break;
case kRegMem: // lir operands - 0: reg, 1: base, 2: disp
- emitRegMem(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2]);
+ EmitRegMem(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2]);
break;
case kRegArray: // lir operands - 0: reg, 1: base, 2: index, 3: scale, 4: disp
- emitRegArray(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2],
+ EmitRegArray(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2],
lir->operands[3], lir->operands[4]);
break;
case kRegThread: // lir operands - 0: reg, 1: disp
- emitRegThread(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitRegThread(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kRegReg: // lir operands - 0: reg1, 1: reg2
- emitRegReg(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitRegReg(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kRegRegStore: // lir operands - 0: reg2, 1: reg1
- emitRegReg(cUnit, entry, lir->operands[1], lir->operands[0]);
+ EmitRegReg(cUnit, entry, lir->operands[1], lir->operands[0]);
break;
case kRegRegImm:
- emitRegRegImm(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2]);
+ EmitRegRegImm(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2]);
break;
case kRegImm: // lir operands - 0: reg, 1: immediate
- emitRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kThreadImm: // lir operands - 0: disp, 1: immediate
- emitThreadImm(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitThreadImm(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kMovRegImm: // lir operands - 0: reg, 1: immediate
- emitMovRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitMovRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kShiftRegImm: // lir operands - 0: reg, 1: immediate
- emitShiftRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitShiftRegImm(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kShiftRegCl: // lir operands - 0: reg, 1: cl
- emitShiftRegCl(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitShiftRegCl(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kRegCond: // lir operands - 0: reg, 1: condition
- emitRegCond(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitRegCond(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kJmp: // lir operands - 0: rel
- emitJmp(cUnit, entry, lir->operands[0]);
+ EmitJmp(cUnit, entry, lir->operands[0]);
break;
case kJcc: // lir operands - 0: rel, 1: CC, target assigned
- emitJcc(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitJcc(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kCall:
switch (entry->opcode) {
case kX86CallM: // lir operands - 0: base, 1: disp
- emitCallMem(cUnit, entry, lir->operands[0], lir->operands[1]);
+ EmitCallMem(cUnit, entry, lir->operands[0], lir->operands[1]);
break;
case kX86CallT: // lir operands - 0: disp
- emitCallThread(cUnit, entry, lir->operands[0]);
+ EmitCallThread(cUnit, entry, lir->operands[0]);
break;
default:
- emitUnimplemented(cUnit, entry, lir);
+ EmitUnimplemented(cUnit, entry, lir);
break;
}
break;
case kPcRel: // lir operands - 0: reg, 1: base, 2: index, 3: scale, 4: table
- emitPcRel(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2],
+ EmitPcRel(cUnit, entry, lir->operands[0], lir->operands[1], lir->operands[2],
lir->operands[3], lir->operands[4]);
break;
case kMacro:
- emitMacro(cUnit, entry, lir->operands[0], lir->offset);
+ EmitMacro(cUnit, entry, lir->operands[0], lir->offset);
break;
default:
- emitUnimplemented(cUnit, entry, lir);
+ EmitUnimplemented(cUnit, entry, lir);
break;
}
- CHECK_EQ(static_cast<size_t>(oatGetInsnSize(lir)),
+ CHECK_EQ(static_cast<size_t>(GetInsnSize(lir)),
cUnit->codeBuffer.size() - starting_cbuf_size)
<< "Instruction size mismatch for entry: " << EncodingMap[lir->opcode].name;
}
@@ -1418,7 +1418,7 @@
* Target-dependent offset assignment.
* independent.
*/
-int oatAssignInsnOffsets(CompilationUnit* cUnit)
+int AssignInsnOffsets(CompilationUnit* cUnit)
{
LIR* x86LIR;
int offset = 0;
diff --git a/src/compiler/codegen/x86/call_x86.cc b/src/compiler/codegen/x86/call_x86.cc
index 51dda66..7ada136 100644
--- a/src/compiler/codegen/x86/call_x86.cc
+++ b/src/compiler/codegen/x86/call_x86.cc
@@ -22,7 +22,7 @@
namespace art {
-void genSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenSpecialCase(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
SpecialCaseHandler specialCase)
{
// TODO
@@ -32,26 +32,26 @@
* The sparse table in the literal pool is an array of <key,displacement>
* pairs.
*/
-BasicBlock *findBlock(CompilationUnit* cUnit, unsigned int codeOffset,
+BasicBlock *FindBlock(CompilationUnit* cUnit, unsigned int codeOffset,
bool split, bool create, BasicBlock** immedPredBlockP);
-void genSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenSparseSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpSparseSwitchTable(table);
+ DumpSparseSwitchTable(table);
}
int entries = table[1];
const int* keys = reinterpret_cast<const int*>(&table[2]);
const int* targets = &keys[entries];
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
for (int i = 0; i < entries; i++) {
int key = keys[i];
- BasicBlock* case_block = findBlock(cUnit,
+ BasicBlock* case_block = FindBlock(cUnit,
cUnit->currentDalvikOffset + targets[i],
false, false, NULL);
LIR* labelList = cUnit->blockLabelList;
- opCmpImmBranch(cUnit, kCondEq, rlSrc.lowReg, key,
+ OpCmpImmBranch(cUnit, kCondEq, rlSrc.lowReg, key,
&labelList[case_block->id]);
}
}
@@ -72,57 +72,57 @@
* jmp rStartOfMethod
* done:
*/
-void genPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenPackedSwitch(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
if (cUnit->printMe) {
- dumpPackedSwitchTable(table);
+ DumpPackedSwitchTable(table);
}
// Add the table to the list - we'll process it later
SwitchTable *tabRec =
- static_cast<SwitchTable *>(oatNew(cUnit, sizeof(SwitchTable), true, kAllocData));
+ static_cast<SwitchTable *>(NewMem(cUnit, sizeof(SwitchTable), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
int size = table[1];
- tabRec->targets = static_cast<LIR**>(oatNew(cUnit, size * sizeof(LIR*), true, kAllocLIR));
- oatInsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
+ tabRec->targets = static_cast<LIR**>(NewMem(cUnit, size * sizeof(LIR*), true, kAllocLIR));
+ InsertGrowableList(cUnit, &cUnit->switchTables, reinterpret_cast<uintptr_t>(tabRec));
// Get the switch value
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- int startOfMethodReg = oatAllocTemp(cUnit);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ int startOfMethodReg = AllocTemp(cUnit);
// Materialize a pointer to the switch table
- //newLIR0(cUnit, kX86Bkpt);
- newLIR1(cUnit, kX86StartOfMethod, startOfMethodReg);
+ //NewLIR0(cUnit, kX86Bkpt);
+ NewLIR1(cUnit, kX86StartOfMethod, startOfMethodReg);
int lowKey = s4FromSwitchData(&table[2]);
int keyReg;
// Remove the bias, if necessary
if (lowKey == 0) {
keyReg = rlSrc.lowReg;
} else {
- keyReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpSub, keyReg, rlSrc.lowReg, lowKey);
+ keyReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpSub, keyReg, rlSrc.lowReg, lowKey);
}
// Bounds check - if < 0 or >= size continue following switch
- opRegImm(cUnit, kOpCmp, keyReg, size-1);
- LIR* branchOver = opCondBranch(cUnit, kCondHi, NULL);
+ OpRegImm(cUnit, kOpCmp, keyReg, size-1);
+ LIR* branchOver = OpCondBranch(cUnit, kCondHi, NULL);
// Load the displacement from the switch table
- int dispReg = oatAllocTemp(cUnit);
- newLIR5(cUnit, kX86PcRelLoadRA, dispReg, startOfMethodReg, keyReg, 2,
+ int dispReg = AllocTemp(cUnit);
+ NewLIR5(cUnit, kX86PcRelLoadRA, dispReg, startOfMethodReg, keyReg, 2,
reinterpret_cast<uintptr_t>(tabRec));
// Add displacement to start of method
- opRegReg(cUnit, kOpAdd, startOfMethodReg, dispReg);
+ OpRegReg(cUnit, kOpAdd, startOfMethodReg, dispReg);
// ..and go!
- LIR* switchBranch = newLIR1(cUnit, kX86JmpR, startOfMethodReg);
+ LIR* switchBranch = NewLIR1(cUnit, kX86JmpR, startOfMethodReg);
tabRec->anchor = switchBranch;
/* branchOver target here */
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
}
-void callRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset,
+void CallRuntimeHelperRegReg(CompilationUnit* cUnit, int helperOffset,
int arg0, int arg1, bool safepointPC);
/*
* Array data table format:
@@ -134,90 +134,90 @@
*
* Total size is 4+(width * size + 1)/2 16-bit code units.
*/
-void genFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset,
+void GenFillArrayData(CompilationUnit* cUnit, uint32_t tableOffset,
RegLocation rlSrc)
{
const uint16_t* table = cUnit->insns + cUnit->currentDalvikOffset + tableOffset;
// Add the table to the list - we'll process it later
FillArrayData *tabRec =
- static_cast<FillArrayData*>(oatNew(cUnit, sizeof(FillArrayData), true, kAllocData));
+ static_cast<FillArrayData*>(NewMem(cUnit, sizeof(FillArrayData), true, kAllocData));
tabRec->table = table;
tabRec->vaddr = cUnit->currentDalvikOffset;
uint16_t width = tabRec->table[1];
uint32_t size = tabRec->table[2] | ((static_cast<uint32_t>(tabRec->table[3])) << 16);
tabRec->size = (size * width) + 8;
- oatInsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
+ InsertGrowableList(cUnit, &cUnit->fillArrayData, reinterpret_cast<uintptr_t>(tabRec));
// Making a call - use explicit registers
- oatFlushAllRegs(cUnit); /* Everything to home location */
- loadValueDirectFixed(cUnit, rlSrc, rX86_ARG0);
+ FlushAllRegs(cUnit); /* Everything to home location */
+ LoadValueDirectFixed(cUnit, rlSrc, rX86_ARG0);
// Materialize a pointer to the fill data image
- newLIR1(cUnit, kX86StartOfMethod, rX86_ARG2);
- newLIR2(cUnit, kX86PcRelAdr, rX86_ARG1, reinterpret_cast<uintptr_t>(tabRec));
- newLIR2(cUnit, kX86Add32RR, rX86_ARG1, rX86_ARG2);
- callRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode), rX86_ARG0,
+ NewLIR1(cUnit, kX86StartOfMethod, rX86_ARG2);
+ NewLIR2(cUnit, kX86PcRelAdr, rX86_ARG1, reinterpret_cast<uintptr_t>(tabRec));
+ NewLIR2(cUnit, kX86Add32RR, rX86_ARG1, rX86_ARG2);
+ CallRuntimeHelperRegReg(cUnit, ENTRYPOINT_OFFSET(pHandleFillArrayDataFromCode), rX86_ARG0,
rX86_ARG1, true);
}
-void genMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorEnter(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rCX); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, rCX, optFlags);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rCX); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, rCX, optFlags);
// If lock is unheld, try to grab it quickly with compare and exchange
// TODO: copy and clear hash state?
- newLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
- newLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
- newLIR2(cUnit, kX86Xor32RR, rAX, rAX);
- newLIR3(cUnit, kX86LockCmpxchgMR, rCX, Object::MonitorOffset().Int32Value(), rDX);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondEq);
+ NewLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
+ NewLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
+ NewLIR2(cUnit, kX86Xor32RR, rAX, rAX);
+ NewLIR3(cUnit, kX86LockCmpxchgMR, rCX, Object::MonitorOffset().Int32Value(), rDX);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondEq);
// If lock is held, go the expensive route - artLockObjectFromCode(self, obj);
- callRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pLockObjectFromCode), rCX, true);
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
+ CallRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pLockObjectFromCode), rCX, true);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
}
-void genMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
+void GenMonitorExit(CompilationUnit* cUnit, int optFlags, RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- loadValueDirectFixed(cUnit, rlSrc, rAX); // Get obj
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- genNullCheck(cUnit, rlSrc.sRegLow, rAX, optFlags);
+ FlushAllRegs(cUnit);
+ LoadValueDirectFixed(cUnit, rlSrc, rAX); // Get obj
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ GenNullCheck(cUnit, rlSrc.sRegLow, rAX, optFlags);
// If lock is held by the current thread, clear it to quickly release it
// TODO: clear hash state?
- newLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
- newLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
- newLIR3(cUnit, kX86Mov32RM, rCX, rAX, Object::MonitorOffset().Int32Value());
- opRegReg(cUnit, kOpSub, rCX, rDX);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondNe);
- newLIR3(cUnit, kX86Mov32MR, rAX, Object::MonitorOffset().Int32Value(), rCX);
- LIR* branch2 = newLIR1(cUnit, kX86Jmp8, 0);
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
+ NewLIR2(cUnit, kX86Mov32RT, rDX, Thread::ThinLockIdOffset().Int32Value());
+ NewLIR2(cUnit, kX86Sal32RI, rDX, LW_LOCK_OWNER_SHIFT);
+ NewLIR3(cUnit, kX86Mov32RM, rCX, rAX, Object::MonitorOffset().Int32Value());
+ OpRegReg(cUnit, kOpSub, rCX, rDX);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondNe);
+ NewLIR3(cUnit, kX86Mov32MR, rAX, Object::MonitorOffset().Int32Value(), rCX);
+ LIR* branch2 = NewLIR1(cUnit, kX86Jmp8, 0);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
// Otherwise, go the expensive route - UnlockObjectFromCode(obj);
- callRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pUnlockObjectFromCode), rAX, true);
- branch2->target = newLIR0(cUnit, kPseudoTargetLabel);
+ CallRuntimeHelperReg(cUnit, ENTRYPOINT_OFFSET(pUnlockObjectFromCode), rAX, true);
+ branch2->target = NewLIR0(cUnit, kPseudoTargetLabel);
}
/*
* Mark garbage collection card. Skip if the value we're storing is null.
*/
-void markGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
+void MarkGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg)
{
- int regCardBase = oatAllocTemp(cUnit);
- int regCardNo = oatAllocTemp(cUnit);
- LIR* branchOver = opCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
- newLIR2(cUnit, kX86Mov32RT, regCardBase, Thread::CardTableOffset().Int32Value());
- opRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
- storeBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
+ int regCardBase = AllocTemp(cUnit);
+ int regCardNo = AllocTemp(cUnit);
+ LIR* branchOver = OpCmpImmBranch(cUnit, kCondEq, valReg, 0, NULL);
+ NewLIR2(cUnit, kX86Mov32RT, regCardBase, Thread::CardTableOffset().Int32Value());
+ OpRegRegImm(cUnit, kOpLsr, regCardNo, tgtAddrReg, CardTable::kCardShift);
+ StoreBaseIndexed(cUnit, regCardBase, regCardNo, regCardBase, 0,
kUnsignedByte);
- LIR* target = newLIR0(cUnit, kPseudoTargetLabel);
+ LIR* target = NewLIR0(cUnit, kPseudoTargetLabel);
branchOver->target = target;
- oatFreeTemp(cUnit, regCardBase);
- oatFreeTemp(cUnit, regCardNo);
+ FreeTemp(cUnit, regCardBase);
+ FreeTemp(cUnit, regCardNo);
}
-void genEntrySequence(CompilationUnit* cUnit, RegLocation* argLocs,
+void GenEntrySequence(CompilationUnit* cUnit, RegLocation* ArgLocs,
RegLocation rlMethod)
{
/*
@@ -226,12 +226,12 @@
* expanding the frame or flushing. This leaves the utility
* code with no spare temps.
*/
- oatLockTemp(cUnit, rX86_ARG0);
- oatLockTemp(cUnit, rX86_ARG1);
- oatLockTemp(cUnit, rX86_ARG2);
+ LockTemp(cUnit, rX86_ARG0);
+ LockTemp(cUnit, rX86_ARG1);
+ LockTemp(cUnit, rX86_ARG2);
/* Build frame, return address already on stack */
- opRegImm(cUnit, kOpSub, rX86_SP, cUnit->frameSize - 4);
+ OpRegImm(cUnit, kOpSub, rX86_SP, cUnit->frameSize - 4);
/*
* We can safely skip the stack overflow check if we're
@@ -240,40 +240,40 @@
bool skipOverflowCheck = ((cUnit->attrs & METHOD_IS_LEAF) &&
(static_cast<size_t>(cUnit->frameSize) <
Thread::kStackOverflowReservedBytes));
- newLIR0(cUnit, kPseudoMethodEntry);
+ NewLIR0(cUnit, kPseudoMethodEntry);
/* Spill core callee saves */
- spillCoreRegs(cUnit);
+ SpillCoreRegs(cUnit);
/* NOTE: promotion of FP regs currently unsupported, thus no FP spill */
DCHECK_EQ(cUnit->numFPSpills, 0);
if (!skipOverflowCheck) {
// cmp rX86_SP, fs:[stack_end_]; jcc throw_launchpad
- LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kThrowStackOverflow, 0, 0, 0, 0);
- opRegThreadMem(cUnit, kOpCmp, rX86_SP, Thread::StackEndOffset().Int32Value());
- opCondBranch(cUnit, kCondUlt, tgt);
+ LIR* tgt = RawLIR(cUnit, 0, kPseudoThrowTarget, kThrowStackOverflow, 0, 0, 0, 0);
+ OpRegThreadMem(cUnit, kOpCmp, rX86_SP, Thread::StackEndOffset().Int32Value());
+ OpCondBranch(cUnit, kCondUlt, tgt);
// Remember branch target - will process later
- oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
+ InsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
}
- flushIns(cUnit, argLocs, rlMethod);
+ FlushIns(cUnit, ArgLocs, rlMethod);
- oatFreeTemp(cUnit, rX86_ARG0);
- oatFreeTemp(cUnit, rX86_ARG1);
- oatFreeTemp(cUnit, rX86_ARG2);
+ FreeTemp(cUnit, rX86_ARG0);
+ FreeTemp(cUnit, rX86_ARG1);
+ FreeTemp(cUnit, rX86_ARG2);
}
-void genExitSequence(CompilationUnit* cUnit) {
+void GenExitSequence(CompilationUnit* cUnit) {
/*
* In the exit path, rX86_RET0/rX86_RET1 are live - make sure they aren't
* allocated by the register utilities as temps.
*/
- oatLockTemp(cUnit, rX86_RET0);
- oatLockTemp(cUnit, rX86_RET1);
+ LockTemp(cUnit, rX86_RET0);
+ LockTemp(cUnit, rX86_RET1);
- newLIR0(cUnit, kPseudoMethodExit);
- unSpillCoreRegs(cUnit);
+ NewLIR0(cUnit, kPseudoMethodExit);
+ UnSpillCoreRegs(cUnit);
/* Remove frame except for return address */
- opRegImm(cUnit, kOpAdd, rX86_SP, cUnit->frameSize - 4);
- newLIR0(cUnit, kX86Ret);
+ OpRegImm(cUnit, kOpAdd, rX86_SP, cUnit->frameSize - 4);
+ NewLIR0(cUnit, kX86Ret);
}
} // namespace art
diff --git a/src/compiler/codegen/x86/fp_x86.cc b/src/compiler/codegen/x86/fp_x86.cc
index 92190cc..9ab80f4 100644
--- a/src/compiler/codegen/x86/fp_x86.cc
+++ b/src/compiler/codegen/x86/fp_x86.cc
@@ -20,7 +20,7 @@
namespace art {
-bool genArithOpFloat(CompilationUnit *cUnit, Instruction::Code opcode,
+bool GenArithOpFloat(CompilationUnit *cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2) {
X86OpCode op = kX86Nop;
RegLocation rlResult;
@@ -49,28 +49,28 @@
case Instruction::NEG_FLOAT:
case Instruction::REM_FLOAT_2ADDR:
case Instruction::REM_FLOAT:
- return genArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpFloatPortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
default:
return true;
}
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
int rDest = rlResult.lowReg;
int rSrc1 = rlSrc1.lowReg;
int rSrc2 = rlSrc2.lowReg;
if (rDest == rSrc2) {
- rSrc2 = oatAllocTempFloat(cUnit);
- opRegCopy(cUnit, rSrc2, rDest);
+ rSrc2 = AllocTempFloat(cUnit);
+ OpRegCopy(cUnit, rSrc2, rDest);
}
- opRegCopy(cUnit, rDest, rSrc1);
- newLIR2(cUnit, op, rDest, rSrc2);
- storeValue(cUnit, rlDest, rlResult);
+ OpRegCopy(cUnit, rDest, rSrc1);
+ NewLIR2(cUnit, op, rDest, rSrc2);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-bool genArithOpDouble(CompilationUnit *cUnit, Instruction::Code opcode,
+bool GenArithOpDouble(CompilationUnit *cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2) {
X86OpCode op = kX86Nop;
RegLocation rlResult;
@@ -95,31 +95,31 @@
case Instruction::NEG_DOUBLE:
case Instruction::REM_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE:
- return genArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
+ return GenArithOpDoublePortable(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
default:
return true;
}
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
DCHECK(rlSrc1.wide);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
DCHECK(rlSrc2.wide);
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
DCHECK(rlDest.wide);
DCHECK(rlResult.wide);
- int rDest = s2d(rlResult.lowReg, rlResult.highReg);
- int rSrc1 = s2d(rlSrc1.lowReg, rlSrc1.highReg);
- int rSrc2 = s2d(rlSrc2.lowReg, rlSrc2.highReg);
+ int rDest = S2d(rlResult.lowReg, rlResult.highReg);
+ int rSrc1 = S2d(rlSrc1.lowReg, rlSrc1.highReg);
+ int rSrc2 = S2d(rlSrc2.lowReg, rlSrc2.highReg);
if (rDest == rSrc2) {
- rSrc2 = oatAllocTempDouble(cUnit) | X86_FP_DOUBLE;
- opRegCopy(cUnit, rSrc2, rDest);
+ rSrc2 = AllocTempDouble(cUnit) | X86_FP_DOUBLE;
+ OpRegCopy(cUnit, rSrc2, rDest);
}
- opRegCopy(cUnit, rDest, rSrc1);
- newLIR2(cUnit, op, rDest, rSrc2);
- storeValueWide(cUnit, rlDest, rlResult);
+ OpRegCopy(cUnit, rDest, rSrc1);
+ NewLIR2(cUnit, op, rDest, rSrc2);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genConversion(CompilationUnit *cUnit, Instruction::Code opcode,
+bool GenConversion(CompilationUnit *cUnit, Instruction::Code opcode,
RegLocation rlDest, RegLocation rlSrc) {
RegisterClass rcSrc = kFPReg;
X86OpCode op = kX86Nop;
@@ -143,45 +143,45 @@
op = kX86Cvtsi2sdRR;
break;
case Instruction::FLOAT_TO_INT: {
- rlSrc = loadValue(cUnit, rlSrc, kFPReg);
+ rlSrc = LoadValue(cUnit, rlSrc, kFPReg);
srcReg = rlSrc.lowReg;
- oatClobberSReg(cUnit, rlDest.sRegLow);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- int tempReg = oatAllocTempFloat(cUnit);
+ ClobberSReg(cUnit, rlDest.sRegLow);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ int tempReg = AllocTempFloat(cUnit);
- loadConstant(cUnit, rlResult.lowReg, 0x7fffffff);
- newLIR2(cUnit, kX86Cvtsi2ssRR, tempReg, rlResult.lowReg);
- newLIR2(cUnit, kX86ComissRR, srcReg, tempReg);
- LIR* branchPosOverflow = newLIR2(cUnit, kX86Jcc8, 0, kX86CondA);
- LIR* branchNaN = newLIR2(cUnit, kX86Jcc8, 0, kX86CondP);
- newLIR2(cUnit, kX86Cvttss2siRR, rlResult.lowReg, srcReg);
- LIR* branchNormal = newLIR1(cUnit, kX86Jmp8, 0);
- branchNaN->target = newLIR0(cUnit, kPseudoTargetLabel);
- newLIR2(cUnit, kX86Xor32RR, rlResult.lowReg, rlResult.lowReg);
- branchPosOverflow->target = newLIR0(cUnit, kPseudoTargetLabel);
- branchNormal->target = newLIR0(cUnit, kPseudoTargetLabel);
- storeValue(cUnit, rlDest, rlResult);
+ LoadConstant(cUnit, rlResult.lowReg, 0x7fffffff);
+ NewLIR2(cUnit, kX86Cvtsi2ssRR, tempReg, rlResult.lowReg);
+ NewLIR2(cUnit, kX86ComissRR, srcReg, tempReg);
+ LIR* branchPosOverflow = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondA);
+ LIR* branchNaN = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondP);
+ NewLIR2(cUnit, kX86Cvttss2siRR, rlResult.lowReg, srcReg);
+ LIR* branchNormal = NewLIR1(cUnit, kX86Jmp8, 0);
+ branchNaN->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ NewLIR2(cUnit, kX86Xor32RR, rlResult.lowReg, rlResult.lowReg);
+ branchPosOverflow->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ branchNormal->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
case Instruction::DOUBLE_TO_INT: {
- rlSrc = loadValueWide(cUnit, rlSrc, kFPReg);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kFPReg);
srcReg = rlSrc.lowReg;
- oatClobberSReg(cUnit, rlDest.sRegLow);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- int tempReg = oatAllocTempDouble(cUnit) | X86_FP_DOUBLE;
+ ClobberSReg(cUnit, rlDest.sRegLow);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ int tempReg = AllocTempDouble(cUnit) | X86_FP_DOUBLE;
- loadConstant(cUnit, rlResult.lowReg, 0x7fffffff);
- newLIR2(cUnit, kX86Cvtsi2sdRR, tempReg, rlResult.lowReg);
- newLIR2(cUnit, kX86ComisdRR, srcReg, tempReg);
- LIR* branchPosOverflow = newLIR2(cUnit, kX86Jcc8, 0, kX86CondA);
- LIR* branchNaN = newLIR2(cUnit, kX86Jcc8, 0, kX86CondP);
- newLIR2(cUnit, kX86Cvttsd2siRR, rlResult.lowReg, srcReg);
- LIR* branchNormal = newLIR1(cUnit, kX86Jmp8, 0);
- branchNaN->target = newLIR0(cUnit, kPseudoTargetLabel);
- newLIR2(cUnit, kX86Xor32RR, rlResult.lowReg, rlResult.lowReg);
- branchPosOverflow->target = newLIR0(cUnit, kPseudoTargetLabel);
- branchNormal->target = newLIR0(cUnit, kPseudoTargetLabel);
- storeValue(cUnit, rlDest, rlResult);
+ LoadConstant(cUnit, rlResult.lowReg, 0x7fffffff);
+ NewLIR2(cUnit, kX86Cvtsi2sdRR, tempReg, rlResult.lowReg);
+ NewLIR2(cUnit, kX86ComisdRR, srcReg, tempReg);
+ LIR* branchPosOverflow = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondA);
+ LIR* branchNaN = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondP);
+ NewLIR2(cUnit, kX86Cvttsd2siRR, rlResult.lowReg, srcReg);
+ LIR* branchNormal = NewLIR1(cUnit, kX86Jmp8, 0);
+ branchNaN->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ NewLIR2(cUnit, kX86Xor32RR, rlResult.lowReg, rlResult.lowReg);
+ branchPosOverflow->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ branchNormal->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
case Instruction::LONG_TO_DOUBLE:
@@ -189,81 +189,81 @@
// TODO: inline by using memory as a 64-bit source. Be careful about promoted registers.
case Instruction::FLOAT_TO_LONG:
case Instruction::DOUBLE_TO_LONG:
- return genConversionPortable(cUnit, opcode, rlDest, rlSrc);
+ return GenConversionPortable(cUnit, opcode, rlDest, rlSrc);
default:
return true;
}
if (rlSrc.wide) {
- rlSrc = loadValueWide(cUnit, rlSrc, rcSrc);
- srcReg = s2d(rlSrc.lowReg, rlSrc.highReg);
+ rlSrc = LoadValueWide(cUnit, rlSrc, rcSrc);
+ srcReg = S2d(rlSrc.lowReg, rlSrc.highReg);
} else {
- rlSrc = loadValue(cUnit, rlSrc, rcSrc);
+ rlSrc = LoadValue(cUnit, rlSrc, rcSrc);
srcReg = rlSrc.lowReg;
}
if (rlDest.wide) {
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, op, s2d(rlResult.lowReg, rlResult.highReg), srcReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, op, S2d(rlResult.lowReg, rlResult.highReg), srcReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
} else {
- rlResult = oatEvalLoc(cUnit, rlDest, kFPReg, true);
- newLIR2(cUnit, op, rlResult.lowReg, srcReg);
- storeValue(cUnit, rlDest, rlResult);
+ rlResult = EvalLoc(cUnit, rlDest, kFPReg, true);
+ NewLIR2(cUnit, op, rlResult.lowReg, srcReg);
+ StoreValue(cUnit, rlDest, rlResult);
}
return false;
}
-bool genCmpFP(CompilationUnit *cUnit, Instruction::Code code, RegLocation rlDest,
+bool GenCmpFP(CompilationUnit *cUnit, Instruction::Code code, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2) {
bool single = (code == Instruction::CMPL_FLOAT) || (code == Instruction::CMPG_FLOAT);
bool unorderedGt = (code == Instruction::CMPG_DOUBLE) || (code == Instruction::CMPG_FLOAT);
int srcReg1;
int srcReg2;
if (single) {
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
srcReg1 = rlSrc1.lowReg;
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
srcReg2 = rlSrc2.lowReg;
} else {
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
- srcReg1 = s2d(rlSrc1.lowReg, rlSrc1.highReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
- srcReg2 = s2d(rlSrc2.lowReg, rlSrc2.highReg);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
+ srcReg1 = S2d(rlSrc1.lowReg, rlSrc1.highReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
+ srcReg2 = S2d(rlSrc2.lowReg, rlSrc2.highReg);
}
- oatClobberSReg(cUnit, rlDest.sRegLow);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- loadConstantNoClobber(cUnit, rlResult.lowReg, unorderedGt ? 1 : 0);
+ ClobberSReg(cUnit, rlDest.sRegLow);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ LoadConstantNoClobber(cUnit, rlResult.lowReg, unorderedGt ? 1 : 0);
if (single) {
- newLIR2(cUnit, kX86UcomissRR, srcReg1, srcReg2);
+ NewLIR2(cUnit, kX86UcomissRR, srcReg1, srcReg2);
} else {
- newLIR2(cUnit, kX86UcomisdRR, srcReg1, srcReg2);
+ NewLIR2(cUnit, kX86UcomisdRR, srcReg1, srcReg2);
}
LIR* branch = NULL;
if (unorderedGt) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
}
// If the result reg can't be byte accessed, use a jump and move instead of a set.
if (rlResult.lowReg >= 4) {
LIR* branch2 = NULL;
if (unorderedGt) {
- branch2 = newLIR2(cUnit, kX86Jcc8, 0, kX86CondA);
- newLIR2(cUnit, kX86Mov32RI, rlResult.lowReg, 0x0);
+ branch2 = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondA);
+ NewLIR2(cUnit, kX86Mov32RI, rlResult.lowReg, 0x0);
} else {
- branch2 = newLIR2(cUnit, kX86Jcc8, 0, kX86CondBe);
- newLIR2(cUnit, kX86Mov32RI, rlResult.lowReg, 0x1);
+ branch2 = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondBe);
+ NewLIR2(cUnit, kX86Mov32RI, rlResult.lowReg, 0x1);
}
- branch2->target = newLIR0(cUnit, kPseudoTargetLabel);
+ branch2->target = NewLIR0(cUnit, kPseudoTargetLabel);
} else {
- newLIR2(cUnit, kX86Set8R, rlResult.lowReg, kX86CondA /* above - unsigned > */);
+ NewLIR2(cUnit, kX86Set8R, rlResult.lowReg, kX86CondA /* above - unsigned > */);
}
- newLIR2(cUnit, kX86Sbb32RI, rlResult.lowReg, 0);
+ NewLIR2(cUnit, kX86Sbb32RI, rlResult.lowReg, 0);
if (unorderedGt) {
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
}
- storeValue(cUnit, rlDest, rlResult);
+ StoreValue(cUnit, rlDest, rlResult);
return false;
}
-void genFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+void GenFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
bool gtBias, bool isDouble) {
LIR* labelList = cUnit->blockLabelList;
LIR* taken = &labelList[bb->taken->id];
@@ -272,57 +272,57 @@
RegLocation rlSrc1;
RegLocation rlSrc2;
if (isDouble) {
- rlSrc1 = oatGetSrcWide(cUnit, mir, 0);
- rlSrc2 = oatGetSrcWide(cUnit, mir, 2);
- rlSrc1 = loadValueWide(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValueWide(cUnit, rlSrc2, kFPReg);
- newLIR2(cUnit, kX86UcomisdRR, s2d(rlSrc1.lowReg, rlSrc1.highReg),
- s2d(rlSrc2.lowReg, rlSrc2.highReg));
+ rlSrc1 = GetSrcWide(cUnit, mir, 0);
+ rlSrc2 = GetSrcWide(cUnit, mir, 2);
+ rlSrc1 = LoadValueWide(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValueWide(cUnit, rlSrc2, kFPReg);
+ NewLIR2(cUnit, kX86UcomisdRR, S2d(rlSrc1.lowReg, rlSrc1.highReg),
+ S2d(rlSrc2.lowReg, rlSrc2.highReg));
} else {
- rlSrc1 = oatGetSrc(cUnit, mir, 0);
- rlSrc2 = oatGetSrc(cUnit, mir, 1);
- rlSrc1 = loadValue(cUnit, rlSrc1, kFPReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kFPReg);
- newLIR2(cUnit, kX86UcomissRR, rlSrc1.lowReg, rlSrc2.lowReg);
+ rlSrc1 = GetSrc(cUnit, mir, 0);
+ rlSrc2 = GetSrc(cUnit, mir, 1);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kFPReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kFPReg);
+ NewLIR2(cUnit, kX86UcomissRR, rlSrc1.lowReg, rlSrc2.lowReg);
}
ConditionCode ccode = static_cast<ConditionCode>(mir->dalvikInsn.arg[0]);
switch (ccode) {
case kCondEq:
if (!gtBias) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
branch->target = notTaken;
}
break;
case kCondNe:
if (!gtBias) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
branch->target = taken;
}
break;
case kCondLt:
if (gtBias) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
branch->target = notTaken;
}
ccode = kCondCs;
break;
case kCondLe:
if (gtBias) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
branch->target = notTaken;
}
ccode = kCondLs;
break;
case kCondGt:
if (gtBias) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
branch->target = taken;
}
ccode = kCondHi;
break;
case kCondGe:
if (gtBias) {
- branch = newLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
+ branch = NewLIR2(cUnit, kX86Jcc8, 0, kX86CondPE);
branch->target = taken;
}
ccode = kCondCc;
@@ -330,29 +330,29 @@
default:
LOG(FATAL) << "Unexpected ccode: " << ccode;
}
- opCondBranch(cUnit, ccode, taken);
+ OpCondBranch(cUnit, ccode, taken);
}
-void genNegFloat(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
+void GenNegFloat(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
{
RegLocation rlResult;
- rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegImm(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, 0x80000000);
- storeValue(cUnit, rlDest, rlResult);
+ rlSrc = LoadValue(cUnit, rlSrc, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegImm(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, 0x80000000);
+ StoreValue(cUnit, rlDest, rlResult);
}
-void genNegDouble(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
+void GenNegDouble(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc)
{
RegLocation rlResult;
- rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
- rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegRegImm(cUnit, kOpAdd, rlResult.highReg, rlSrc.highReg, 0x80000000);
- opRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
- storeValueWide(cUnit, rlDest, rlResult);
+ rlSrc = LoadValueWide(cUnit, rlSrc, kCoreReg);
+ rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegRegImm(cUnit, kOpAdd, rlResult.highReg, rlSrc.highReg, 0x80000000);
+ OpRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg);
+ StoreValueWide(cUnit, rlDest, rlResult);
}
-bool genInlinedSqrt(CompilationUnit* cUnit, CallInfo* info) {
+bool GenInlinedSqrt(CompilationUnit* cUnit, CallInfo* info) {
DCHECK_NE(cUnit->instructionSet, kThumb2);
return false;
}
diff --git a/src/compiler/codegen/x86/int_x86.cc b/src/compiler/codegen/x86/int_x86.cc
index adde482..c501bc3 100644
--- a/src/compiler/codegen/x86/int_x86.cc
+++ b/src/compiler/codegen/x86/int_x86.cc
@@ -25,15 +25,15 @@
/*
* Perform register memory operation.
*/
-LIR* genRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode,
+LIR* GenRegMemCheck(CompilationUnit* cUnit, ConditionCode cCode,
int reg1, int base, int offset, ThrowKind kind)
{
- LIR* tgt = rawLIR(cUnit, 0, kPseudoThrowTarget, kind,
+ LIR* tgt = RawLIR(cUnit, 0, kPseudoThrowTarget, kind,
cUnit->currentDalvikOffset, reg1, base, offset);
- opRegMem(cUnit, kOpCmp, reg1, base, offset);
- LIR* branch = opCondBranch(cUnit, cCode, tgt);
+ OpRegMem(cUnit, kOpCmp, reg1, base, offset);
+ LIR* branch = OpCondBranch(cUnit, cCode, tgt);
// Remember branch target - will process later
- oatInsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
+ InsertGrowableList(cUnit, &cUnit->throwLaunchpads, reinterpret_cast<uintptr_t>(tgt));
return branch;
}
@@ -53,28 +53,28 @@
* finish:
*
*/
-void genCmpLong(CompilationUnit* cUnit, RegLocation rlDest,
+void GenCmpLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
// Compute (r1:r0) = (r1:r0) - (r3:r2)
- opRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2
- opRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF
- newLIR2(cUnit, kX86Set8R, r2, kX86CondL); // r2 = (r1:r0) < (r3:r2) ? 1 : 0
- newLIR2(cUnit, kX86Movzx8RR, r2, r2);
- opReg(cUnit, kOpNeg, r2); // r2 = -r2
- opRegReg(cUnit, kOpOr, r0, r1); // r0 = high | low - sets ZF
- newLIR2(cUnit, kX86Set8R, r0, kX86CondNz); // r0 = (r1:r0) != (r3:r2) ? 1 : 0
- newLIR2(cUnit, kX86Movzx8RR, r0, r0);
- opRegReg(cUnit, kOpOr, r0, r2); // r0 = r0 | r2
- RegLocation rlResult = locCReturn();
- storeValue(cUnit, rlDest, rlResult);
+ OpRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2
+ OpRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF
+ NewLIR2(cUnit, kX86Set8R, r2, kX86CondL); // r2 = (r1:r0) < (r3:r2) ? 1 : 0
+ NewLIR2(cUnit, kX86Movzx8RR, r2, r2);
+ OpReg(cUnit, kOpNeg, r2); // r2 = -r2
+ OpRegReg(cUnit, kOpOr, r0, r1); // r0 = high | low - sets ZF
+ NewLIR2(cUnit, kX86Set8R, r0, kX86CondNz); // r0 = (r1:r0) != (r3:r2) ? 1 : 0
+ NewLIR2(cUnit, kX86Movzx8RR, r0, r0);
+ OpRegReg(cUnit, kOpOr, r0, r2); // r0 = r0 | r2
+ RegLocation rlResult = LocCReturn();
+ StoreValue(cUnit, rlDest, rlResult);
}
-X86ConditionCode oatX86ConditionEncoding(ConditionCode cond) {
+X86ConditionCode X86ConditionEncoding(ConditionCode cond) {
switch (cond) {
case kCondEq: return kX86CondEq;
case kCondNe: return kX86CondNe;
@@ -96,37 +96,37 @@
return kX86CondO;
}
-LIR* opCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1,
+LIR* OpCmpBranch(CompilationUnit* cUnit, ConditionCode cond, int src1,
int src2, LIR* target)
{
- newLIR2(cUnit, kX86Cmp32RR, src1, src2);
- X86ConditionCode cc = oatX86ConditionEncoding(cond);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0 /* lir operand for Jcc offset */ ,
+ NewLIR2(cUnit, kX86Cmp32RR, src1, src2);
+ X86ConditionCode cc = X86ConditionEncoding(cond);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0 /* lir operand for Jcc offset */ ,
cc);
branch->target = target;
return branch;
}
-LIR* opCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg,
+LIR* OpCmpImmBranch(CompilationUnit* cUnit, ConditionCode cond, int reg,
int checkValue, LIR* target)
{
if ((checkValue == 0) && (cond == kCondEq || cond == kCondNe)) {
// TODO: when checkValue == 0 and reg is rCX, use the jcxz/nz opcode
- newLIR2(cUnit, kX86Test32RR, reg, reg);
+ NewLIR2(cUnit, kX86Test32RR, reg, reg);
} else {
- newLIR2(cUnit, IS_SIMM8(checkValue) ? kX86Cmp32RI8 : kX86Cmp32RI, reg, checkValue);
+ NewLIR2(cUnit, IS_SIMM8(checkValue) ? kX86Cmp32RI8 : kX86Cmp32RI, reg, checkValue);
}
- X86ConditionCode cc = oatX86ConditionEncoding(cond);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0 /* lir operand for Jcc offset */ , cc);
+ X86ConditionCode cc = X86ConditionEncoding(cond);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0 /* lir operand for Jcc offset */ , cc);
branch->target = target;
return branch;
}
-LIR* opRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
+LIR* OpRegCopyNoInsert(CompilationUnit *cUnit, int rDest, int rSrc)
{
if (X86_FPREG(rDest) || X86_FPREG(rSrc))
- return fpRegCopy(cUnit, rDest, rSrc);
- LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, kX86Mov32RR,
+ return FpRegCopy(cUnit, rDest, rSrc);
+ LIR* res = RawLIR(cUnit, cUnit->currentDalvikOffset, kX86Mov32RR,
rDest, rSrc);
if (rDest == rSrc) {
res->flags.isNop = true;
@@ -134,14 +134,14 @@
return res;
}
-LIR* opRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
+LIR* OpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
{
- LIR *res = opRegCopyNoInsert(cUnit, rDest, rSrc);
- oatAppendLIR(cUnit, res);
+ LIR *res = OpRegCopyNoInsert(cUnit, rDest, rSrc);
+ AppendLIR(cUnit, res);
return res;
}
-void opRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
+void OpRegCopyWide(CompilationUnit *cUnit, int destLo, int destHi,
int srcLo, int srcHi)
{
bool destFP = X86_FPREG(destLo) && X86_FPREG(destHi);
@@ -150,57 +150,57 @@
assert(X86_FPREG(destLo) == X86_FPREG(destHi));
if (destFP) {
if (srcFP) {
- opRegCopy(cUnit, s2d(destLo, destHi), s2d(srcLo, srcHi));
+ OpRegCopy(cUnit, S2d(destLo, destHi), S2d(srcLo, srcHi));
} else {
// TODO: Prevent this from happening in the code. The result is often
// unused or could have been loaded more easily from memory.
- newLIR2(cUnit, kX86MovdxrRR, destLo, srcLo);
- newLIR2(cUnit, kX86MovdxrRR, destHi, srcHi);
- newLIR2(cUnit, kX86PsllqRI, destHi, 32);
- newLIR2(cUnit, kX86OrpsRR, destLo, destHi);
+ NewLIR2(cUnit, kX86MovdxrRR, destLo, srcLo);
+ NewLIR2(cUnit, kX86MovdxrRR, destHi, srcHi);
+ NewLIR2(cUnit, kX86PsllqRI, destHi, 32);
+ NewLIR2(cUnit, kX86OrpsRR, destLo, destHi);
}
} else {
if (srcFP) {
- newLIR2(cUnit, kX86MovdrxRR, destLo, srcLo);
- newLIR2(cUnit, kX86PsrlqRI, srcLo, 32);
- newLIR2(cUnit, kX86MovdrxRR, destHi, srcLo);
+ NewLIR2(cUnit, kX86MovdrxRR, destLo, srcLo);
+ NewLIR2(cUnit, kX86PsrlqRI, srcLo, 32);
+ NewLIR2(cUnit, kX86MovdrxRR, destHi, srcLo);
} else {
// Handle overlap
if (srcHi == destLo) {
- opRegCopy(cUnit, destHi, srcHi);
- opRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
} else {
- opRegCopy(cUnit, destLo, srcLo);
- opRegCopy(cUnit, destHi, srcHi);
+ OpRegCopy(cUnit, destLo, srcLo);
+ OpRegCopy(cUnit, destHi, srcHi);
}
}
}
}
-void genFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir) {
+void GenFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir) {
LIR* labelList = cUnit->blockLabelList;
LIR* taken = &labelList[bb->taken->id];
- RegLocation rlSrc1 = oatGetSrcWide(cUnit, mir, 0);
- RegLocation rlSrc2 = oatGetSrcWide(cUnit, mir, 2);
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ RegLocation rlSrc1 = GetSrcWide(cUnit, mir, 0);
+ RegLocation rlSrc2 = GetSrcWide(cUnit, mir, 2);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
ConditionCode ccode = static_cast<ConditionCode>(mir->dalvikInsn.arg[0]);
// Swap operands and condition code to prevent use of zero flag.
if (ccode == kCondLe || ccode == kCondGt) {
// Compute (r3:r2) = (r3:r2) - (r1:r0)
- opRegReg(cUnit, kOpSub, r2, r0); // r2 = r2 - r0
- opRegReg(cUnit, kOpSbc, r3, r1); // r3 = r3 - r1 - CF
+ OpRegReg(cUnit, kOpSub, r2, r0); // r2 = r2 - r0
+ OpRegReg(cUnit, kOpSbc, r3, r1); // r3 = r3 - r1 - CF
} else {
// Compute (r1:r0) = (r1:r0) - (r3:r2)
- opRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2
- opRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF
+ OpRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2
+ OpRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF
}
switch (ccode) {
case kCondEq:
case kCondNe:
- opRegReg(cUnit, kOpOr, r0, r1); // r0 = r0 | r1
+ OpRegReg(cUnit, kOpOr, r0, r1); // r0 = r0 | r1
break;
case kCondLe:
ccode = kCondGe;
@@ -214,217 +214,217 @@
default:
LOG(FATAL) << "Unexpected ccode: " << ccode;
}
- opCondBranch(cUnit, ccode, taken);
+ OpCondBranch(cUnit, ccode, taken);
}
-RegLocation genDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int lit, bool isDiv)
+RegLocation GenDivRemLit(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int lit, bool isDiv)
{
- LOG(FATAL) << "Unexpected use of genDivRemLit for x86";
+ LOG(FATAL) << "Unexpected use of GenDivRemLit for x86";
return rlDest;
}
-RegLocation genDivRem(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int regHi, bool isDiv)
+RegLocation GenDivRem(CompilationUnit* cUnit, RegLocation rlDest, int regLo, int regHi, bool isDiv)
{
- LOG(FATAL) << "Unexpected use of genDivRem for x86";
+ LOG(FATAL) << "Unexpected use of GenDivRem for x86";
return rlDest;
}
-bool genInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin)
+bool GenInlinedMinMaxInt(CompilationUnit *cUnit, CallInfo* info, bool isMin)
{
DCHECK_EQ(cUnit->instructionSet, kX86);
RegLocation rlSrc1 = info->args[0];
RegLocation rlSrc2 = info->args[1];
- rlSrc1 = loadValue(cUnit, rlSrc1, kCoreReg);
- rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg);
- RegLocation rlDest = inlineTarget(cUnit, info);
- RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
- opRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
+ rlSrc1 = LoadValue(cUnit, rlSrc1, kCoreReg);
+ rlSrc2 = LoadValue(cUnit, rlSrc2, kCoreReg);
+ RegLocation rlDest = InlineTarget(cUnit, info);
+ RegLocation rlResult = EvalLoc(cUnit, rlDest, kCoreReg, true);
+ OpRegReg(cUnit, kOpCmp, rlSrc1.lowReg, rlSrc2.lowReg);
DCHECK_EQ(cUnit->instructionSet, kX86);
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0, isMin ? kX86CondG : kX86CondL);
- opRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc1.lowReg);
- LIR* branch2 = newLIR1(cUnit, kX86Jmp8, 0);
- branch->target = newLIR0(cUnit, kPseudoTargetLabel);
- opRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc2.lowReg);
- branch2->target = newLIR0(cUnit, kPseudoTargetLabel);
- storeValue(cUnit, rlDest, rlResult);
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0, isMin ? kX86CondG : kX86CondL);
+ OpRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc1.lowReg);
+ LIR* branch2 = NewLIR1(cUnit, kX86Jmp8, 0);
+ branch->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ OpRegReg(cUnit, kOpMov, rlResult.lowReg, rlSrc2.lowReg);
+ branch2->target = NewLIR0(cUnit, kPseudoTargetLabel);
+ StoreValue(cUnit, rlDest, rlResult);
return true;
}
-void opLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset)
+void OpLea(CompilationUnit* cUnit, int rBase, int reg1, int reg2, int scale, int offset)
{
- newLIR5(cUnit, kX86Lea32RA, rBase, reg1, reg2, scale, offset);
+ NewLIR5(cUnit, kX86Lea32RA, rBase, reg1, reg2, scale, offset);
}
-void opTlsCmp(CompilationUnit* cUnit, int offset, int val)
+void OpTlsCmp(CompilationUnit* cUnit, int offset, int val)
{
- newLIR2(cUnit, kX86Cmp16TI8, offset, val);
+ NewLIR2(cUnit, kX86Cmp16TI8, offset, val);
}
-bool genInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier) {
+bool GenInlinedCas32(CompilationUnit* cUnit, CallInfo* info, bool need_write_barrier) {
DCHECK_NE(cUnit->instructionSet, kThumb2);
return false;
}
-LIR* opPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target) {
- LOG(FATAL) << "Unexpected use of opPcRelLoad for x86";
+LIR* OpPcRelLoad(CompilationUnit* cUnit, int reg, LIR* target) {
+ LOG(FATAL) << "Unexpected use of OpPcRelLoad for x86";
return NULL;
}
-LIR* opVldm(CompilationUnit* cUnit, int rBase, int count)
+LIR* OpVldm(CompilationUnit* cUnit, int rBase, int count)
{
- LOG(FATAL) << "Unexpected use of opVldm for x86";
+ LOG(FATAL) << "Unexpected use of OpVldm for x86";
return NULL;
}
-LIR* opVstm(CompilationUnit* cUnit, int rBase, int count)
+LIR* OpVstm(CompilationUnit* cUnit, int rBase, int count)
{
- LOG(FATAL) << "Unexpected use of opVstm for x86";
+ LOG(FATAL) << "Unexpected use of OpVstm for x86";
return NULL;
}
-void genMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc,
+void GenMultiplyByTwoBitMultiplier(CompilationUnit* cUnit, RegLocation rlSrc,
RegLocation rlResult, int lit,
int firstBit, int secondBit)
{
- int tReg = oatAllocTemp(cUnit);
- opRegRegImm(cUnit, kOpLsl, tReg, rlSrc.lowReg, secondBit - firstBit);
- opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, tReg);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegImm(cUnit, kOpLsl, tReg, rlSrc.lowReg, secondBit - firstBit);
+ OpRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, tReg);
+ FreeTemp(cUnit, tReg);
if (firstBit != 0) {
- opRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlResult.lowReg, firstBit);
+ OpRegRegImm(cUnit, kOpLsl, rlResult.lowReg, rlResult.lowReg, firstBit);
}
}
-void genDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi)
+void GenDivZeroCheck(CompilationUnit* cUnit, int regLo, int regHi)
{
- int tReg = oatAllocTemp(cUnit);
- opRegRegReg(cUnit, kOpOr, tReg, regLo, regHi);
- genImmedCheck(cUnit, kCondEq, tReg, 0, kThrowDivZero);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegRegReg(cUnit, kOpOr, tReg, regLo, regHi);
+ GenImmedCheck(cUnit, kCondEq, tReg, 0, kThrowDivZero);
+ FreeTemp(cUnit, tReg);
}
// Test suspend flag, return target of taken suspend branch
-LIR* opTestSuspend(CompilationUnit* cUnit, LIR* target)
+LIR* OpTestSuspend(CompilationUnit* cUnit, LIR* target)
{
- opTlsCmp(cUnit, Thread::ThreadFlagsOffset().Int32Value(), 0);
- return opCondBranch(cUnit, (target == NULL) ? kCondNe : kCondEq, target);
+ OpTlsCmp(cUnit, Thread::ThreadFlagsOffset().Int32Value(), 0);
+ return OpCondBranch(cUnit, (target == NULL) ? kCondNe : kCondEq, target);
}
// Decrement register and branch on condition
-LIR* opDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target)
+LIR* OpDecAndBranch(CompilationUnit* cUnit, ConditionCode cCode, int reg, LIR* target)
{
- opRegImm(cUnit, kOpSub, reg, 1);
- return opCmpImmBranch(cUnit, cCode, reg, 0, target);
+ OpRegImm(cUnit, kOpSub, reg, 1);
+ return OpCmpImmBranch(cUnit, cCode, reg, 0, target);
}
-bool smallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
+bool SmallLiteralDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
RegLocation rlSrc, RegLocation rlDest, int lit)
{
LOG(FATAL) << "Unexpected use of smallLiteralDive in x86";
return false;
}
-LIR* opIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide)
+LIR* OpIT(CompilationUnit* cUnit, ArmConditionCode cond, const char* guide)
{
- LOG(FATAL) << "Unexpected use of opIT in x86";
+ LOG(FATAL) << "Unexpected use of OpIT in x86";
return NULL;
}
-bool genAddLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenAddLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
// Compute (r1:r0) = (r1:r0) + (r2:r3)
- opRegReg(cUnit, kOpAdd, r0, r2); // r0 = r0 + r2
- opRegReg(cUnit, kOpAdc, r1, r3); // r1 = r1 + r3 + CF
+ OpRegReg(cUnit, kOpAdd, r0, r2); // r0 = r0 + r2
+ OpRegReg(cUnit, kOpAdc, r1, r3); // r1 = r1 + r3 + CF
RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1,
INVALID_SREG, INVALID_SREG};
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genSubLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenSubLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
// Compute (r1:r0) = (r1:r0) + (r2:r3)
- opRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2
- opRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF
+ OpRegReg(cUnit, kOpSub, r0, r2); // r0 = r0 - r2
+ OpRegReg(cUnit, kOpSbc, r1, r3); // r1 = r1 - r3 - CF
RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1,
INVALID_SREG, INVALID_SREG};
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genAndLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenAndLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
// Compute (r1:r0) = (r1:r0) + (r2:r3)
- opRegReg(cUnit, kOpAnd, r0, r2); // r0 = r0 - r2
- opRegReg(cUnit, kOpAnd, r1, r3); // r1 = r1 - r3 - CF
+ OpRegReg(cUnit, kOpAnd, r0, r2); // r0 = r0 - r2
+ OpRegReg(cUnit, kOpAnd, r1, r3); // r1 = r1 - r3 - CF
RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1,
INVALID_SREG, INVALID_SREG};
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genOrLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenOrLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
// Compute (r1:r0) = (r1:r0) + (r2:r3)
- opRegReg(cUnit, kOpOr, r0, r2); // r0 = r0 - r2
- opRegReg(cUnit, kOpOr, r1, r3); // r1 = r1 - r3 - CF
+ OpRegReg(cUnit, kOpOr, r0, r2); // r0 = r0 - r2
+ OpRegReg(cUnit, kOpOr, r1, r3); // r1 = r1 - r3 - CF
RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1,
INVALID_SREG, INVALID_SREG};
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genXorLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenXorLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc1, RegLocation rlSrc2)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
- loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
+ LoadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
// Compute (r1:r0) = (r1:r0) + (r2:r3)
- opRegReg(cUnit, kOpXor, r0, r2); // r0 = r0 - r2
- opRegReg(cUnit, kOpXor, r1, r3); // r1 = r1 - r3 - CF
+ OpRegReg(cUnit, kOpXor, r0, r2); // r0 = r0 - r2
+ OpRegReg(cUnit, kOpXor, r1, r3); // r1 = r1 - r3 - CF
RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1,
INVALID_SREG, INVALID_SREG};
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-bool genNegLong(CompilationUnit* cUnit, RegLocation rlDest,
+bool GenNegLong(CompilationUnit* cUnit, RegLocation rlDest,
RegLocation rlSrc)
{
- oatFlushAllRegs(cUnit);
- oatLockCallTemps(cUnit); // Prepare for explicit register usage
- loadValueDirectWideFixed(cUnit, rlSrc, r0, r1);
+ FlushAllRegs(cUnit);
+ LockCallTemps(cUnit); // Prepare for explicit register usage
+ LoadValueDirectWideFixed(cUnit, rlSrc, r0, r1);
// Compute (r1:r0) = -(r1:r0)
- opRegReg(cUnit, kOpNeg, r0, r0); // r0 = -r0
- opRegImm(cUnit, kOpAdc, r1, 0); // r1 = r1 + CF
- opRegReg(cUnit, kOpNeg, r1, r1); // r1 = -r1
+ OpRegReg(cUnit, kOpNeg, r0, r0); // r0 = -r0
+ OpRegImm(cUnit, kOpAdc, r1, 0); // r1 = r1 + CF
+ OpRegReg(cUnit, kOpNeg, r1, r1); // r1 = -r1
RegLocation rlResult = {kLocPhysReg, 1, 0, 0, 0, 0, 0, 0, 1, r0, r1,
INVALID_SREG, INVALID_SREG};
- storeValueWide(cUnit, rlDest, rlResult);
+ StoreValueWide(cUnit, rlDest, rlResult);
return false;
}
-void opRegThreadMem(CompilationUnit* cUnit, OpKind op, int rDest, int threadOffset) {
+void OpRegThreadMem(CompilationUnit* cUnit, OpKind op, int rDest, int threadOffset) {
X86OpCode opcode = kX86Bkpt;
switch (op) {
case kOpCmp: opcode = kX86Cmp32RT; break;
@@ -432,7 +432,7 @@
LOG(FATAL) << "Bad opcode: " << op;
break;
}
- newLIR2(cUnit, opcode, rDest, threadOffset);
+ NewLIR2(cUnit, opcode, rDest, threadOffset);
}
} // namespace art
diff --git a/src/compiler/codegen/x86/target_x86.cc b/src/compiler/codegen/x86/target_x86.cc
index 7c2adf1..64343e5 100644
--- a/src/compiler/codegen/x86/target_x86.cc
+++ b/src/compiler/codegen/x86/target_x86.cc
@@ -30,9 +30,9 @@
r8, r9, r10, r11, r12, r13, r14, 15
#endif
};
-/*static*/ int reservedRegs[] = {rX86_SP};
+/*static*/ int ReservedRegs[] = {rX86_SP};
/*static*/ int coreTemps[] = {rAX, rCX, rDX, rBX};
-/*static*/ int fpRegs[] = {
+/*static*/ int FpRegs[] = {
fr0, fr1, fr2, fr3, fr4, fr5, fr6, fr7,
#ifdef TARGET_REX_SUPPORT
fr8, fr9, fr10, fr11, fr12, fr13, fr14, fr15
@@ -45,32 +45,32 @@
#endif
};
-RegLocation locCReturn()
+RegLocation LocCReturn()
{
RegLocation res = X86_LOC_C_RETURN;
return res;
}
-RegLocation locCReturnWide()
+RegLocation LocCReturnWide()
{
RegLocation res = X86_LOC_C_RETURN_WIDE;
return res;
}
-RegLocation locCReturnFloat()
+RegLocation LocCReturnFloat()
{
RegLocation res = X86_LOC_C_RETURN_FLOAT;
return res;
}
-RegLocation locCReturnDouble()
+RegLocation LocCReturnDouble()
{
RegLocation res = X86_LOC_C_RETURN_DOUBLE;
return res;
}
// Return a target-dependent special register.
-int targetReg(SpecialTargetRegister reg) {
+int TargetReg(SpecialTargetRegister reg) {
int res = INVALID_REG;
switch (reg) {
case kSelf: res = rX86_SELF; break;
@@ -95,37 +95,37 @@
}
// Create a double from a pair of singles.
-int s2d(int lowReg, int highReg)
+int S2d(int lowReg, int highReg)
{
return X86_S2D(lowReg, highReg);
}
// Is reg a single or double?
-bool fpReg(int reg)
+bool FpReg(int reg)
{
return X86_FPREG(reg);
}
// Is reg a single?
-bool singleReg(int reg)
+bool SingleReg(int reg)
{
return X86_SINGLEREG(reg);
}
// Is reg a double?
-bool doubleReg(int reg)
+bool DoubleReg(int reg)
{
return X86_DOUBLEREG(reg);
}
// Return mask to strip off fp reg flags and bias.
-uint32_t fpRegMask()
+uint32_t FpRegMask()
{
return X86_FP_REG_MASK;
}
// True if both regs single, both core or both double.
-bool sameRegType(int reg1, int reg2)
+bool SameRegType(int reg1, int reg2)
{
return (X86_REGTYPE(reg1) == X86_REGTYPE(reg2));
}
@@ -133,7 +133,7 @@
/*
* Decode the register id.
*/
-uint64_t getRegMaskCommon(CompilationUnit* cUnit, int reg)
+uint64_t GetRegMaskCommon(CompilationUnit* cUnit, int reg)
{
uint64_t seed;
int shift;
@@ -149,17 +149,17 @@
return (seed << shift);
}
-uint64_t getPCUseDefEncoding()
+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";
+ LOG(FATAL) << "Unexpected call to GetPCUseDefEncoding for x86";
return 0ULL;
}
-void setupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir)
+void SetupTargetResourceMasks(CompilationUnit* cUnit, LIR* lir)
{
DCHECK_EQ(cUnit->instructionSet, kX86);
@@ -175,22 +175,22 @@
}
if (flags & REG_DEFA) {
- oatSetupRegMask(cUnit, &lir->defMask, rAX);
+ SetupRegMask(cUnit, &lir->defMask, rAX);
}
if (flags & REG_DEFD) {
- oatSetupRegMask(cUnit, &lir->defMask, rDX);
+ SetupRegMask(cUnit, &lir->defMask, rDX);
}
if (flags & REG_USEA) {
- oatSetupRegMask(cUnit, &lir->useMask, rAX);
+ SetupRegMask(cUnit, &lir->useMask, rAX);
}
if (flags & REG_USEC) {
- oatSetupRegMask(cUnit, &lir->useMask, rCX);
+ SetupRegMask(cUnit, &lir->useMask, rCX);
}
if (flags & REG_USED) {
- oatSetupRegMask(cUnit, &lir->useMask, rDX);
+ SetupRegMask(cUnit, &lir->useMask, rDX);
}
}
@@ -223,7 +223,7 @@
* Interpret a format string and build a string no longer than size
* See format key in Assemble.cc.
*/
-std::string buildInsnString(const char *fmt, LIR *lir, unsigned char* baseAddr) {
+std::string BuildInsnString(const char *fmt, LIR *lir, unsigned char* baseAddr) {
std::string buf;
size_t i = 0;
size_t fmt_len = strlen(fmt);
@@ -281,7 +281,7 @@
return buf;
}
-void oatDumpResourceMask(LIR *x86LIR, uint64_t mask, const char *prefix)
+void DumpResourceMask(LIR *x86LIR, uint64_t mask, const char *prefix)
{
char buf[256];
buf[0] = 0;
@@ -322,7 +322,7 @@
LOG(INFO) << prefix << ": " << buf;
}
}
-void oatAdjustSpillMask(CompilationUnit* cUnit) {
+void AdjustSpillMask(CompilationUnit* cUnit) {
// Adjustment for LR spilling, x86 has no LR so nothing to do here
cUnit->coreSpillMask |= (1 << rRET);
cUnit->numCoreSpills++;
@@ -334,18 +334,18 @@
* include any holes in the mask. Associate holes with
* Dalvik register INVALID_VREG (0xFFFFU).
*/
-void oatMarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg)
+void MarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg)
{
- UNIMPLEMENTED(WARNING) << "oatMarkPreservedSingle";
+ UNIMPLEMENTED(WARNING) << "MarkPreservedSingle";
#if 0
LOG(FATAL) << "No support yet for promoted FP regs";
#endif
}
-void oatFlushRegWide(CompilationUnit* cUnit, int reg1, int reg2)
+void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2)
{
- RegisterInfo* info1 = oatGetRegInfo(cUnit, reg1);
- RegisterInfo* info2 = oatGetRegInfo(cUnit, reg2);
+ RegisterInfo* info1 = GetRegInfo(cUnit, reg1);
+ RegisterInfo* info2 = GetRegInfo(cUnit, reg2);
DCHECK(info1 && info2 && info1->pair && info2->pair &&
(info1->partner == info2->reg) &&
(info2->partner == info1->reg));
@@ -360,109 +360,96 @@
if (SRegToVReg(cUnit, info2->sReg) < SRegToVReg(cUnit, info1->sReg))
info1 = info2;
int vReg = SRegToVReg(cUnit, info1->sReg);
- storeBaseDispWide(cUnit, rX86_SP, oatVRegOffset(cUnit, vReg), info1->reg, info1->partner);
+ StoreBaseDispWide(cUnit, rX86_SP, VRegOffset(cUnit, vReg), info1->reg, info1->partner);
}
}
-void oatFlushReg(CompilationUnit* cUnit, int reg)
+void FlushReg(CompilationUnit* cUnit, int reg)
{
- RegisterInfo* info = oatGetRegInfo(cUnit, reg);
+ RegisterInfo* info = GetRegInfo(cUnit, reg);
if (info->live && info->dirty) {
info->dirty = false;
int vReg = SRegToVReg(cUnit, info->sReg);
- storeBaseDisp(cUnit, rX86_SP, oatVRegOffset(cUnit, vReg), reg, kWord);
+ StoreBaseDisp(cUnit, rX86_SP, VRegOffset(cUnit, vReg), reg, kWord);
}
}
/* Give access to the target-dependent FP register encoding to common code */
-bool oatIsFpReg(int reg) {
+bool IsFpReg(int reg) {
return X86_FPREG(reg);
}
-uint32_t oatFpRegMask() {
- return X86_FP_REG_MASK;
-}
-
/* Clobber all regs that might be used by an external C call */
-extern void oatClobberCalleeSave(CompilationUnit *cUnit)
+extern void ClobberCalleeSave(CompilationUnit *cUnit)
{
- oatClobber(cUnit, rAX);
- oatClobber(cUnit, rCX);
- oatClobber(cUnit, rDX);
+ Clobber(cUnit, rAX);
+ Clobber(cUnit, rCX);
+ Clobber(cUnit, rDX);
}
-extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit) {
- RegLocation res = locCReturnWide();
+extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit) {
+ RegLocation res = LocCReturnWide();
CHECK(res.lowReg == rAX);
CHECK(res.highReg == rDX);
- oatClobber(cUnit, rAX);
- oatClobber(cUnit, rDX);
- oatMarkInUse(cUnit, rAX);
- oatMarkInUse(cUnit, rDX);
- oatMarkPair(cUnit, res.lowReg, res.highReg);
+ Clobber(cUnit, rAX);
+ Clobber(cUnit, rDX);
+ MarkInUse(cUnit, rAX);
+ MarkInUse(cUnit, rDX);
+ MarkPair(cUnit, res.lowReg, res.highReg);
return res;
}
-extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit)
+extern RegLocation GetReturnAlt(CompilationUnit* cUnit)
{
- RegLocation res = locCReturn();
+ RegLocation res = LocCReturn();
res.lowReg = rDX;
- oatClobber(cUnit, rDX);
- oatMarkInUse(cUnit, rDX);
+ Clobber(cUnit, rDX);
+ MarkInUse(cUnit, rDX);
return res;
}
-extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg)
+extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg)
{
return X86_FPREG(reg) ? &cUnit->regPool->FPRegs[reg & X86_FP_REG_MASK]
: &cUnit->regPool->coreRegs[reg];
}
/* To be used when explicitly managing register use */
-extern void oatLockCallTemps(CompilationUnit* cUnit)
+extern void LockCallTemps(CompilationUnit* cUnit)
{
- oatLockTemp(cUnit, rX86_ARG0);
- oatLockTemp(cUnit, rX86_ARG1);
- oatLockTemp(cUnit, rX86_ARG2);
- oatLockTemp(cUnit, rX86_ARG3);
+ LockTemp(cUnit, rX86_ARG0);
+ LockTemp(cUnit, rX86_ARG1);
+ LockTemp(cUnit, rX86_ARG2);
+ LockTemp(cUnit, rX86_ARG3);
}
/* To be used when explicitly managing register use */
-extern void oatFreeCallTemps(CompilationUnit* cUnit)
+extern void FreeCallTemps(CompilationUnit* cUnit)
{
- oatFreeTemp(cUnit, rX86_ARG0);
- oatFreeTemp(cUnit, rX86_ARG1);
- oatFreeTemp(cUnit, rX86_ARG2);
- oatFreeTemp(cUnit, rX86_ARG3);
-}
-
-/*
- * Determine the initial instruction set to be used for this trace.
- * Later components may decide to change this.
- */
-InstructionSet oatInstructionSet()
-{
- return kX86;
+ FreeTemp(cUnit, rX86_ARG0);
+ FreeTemp(cUnit, rX86_ARG1);
+ FreeTemp(cUnit, rX86_ARG2);
+ FreeTemp(cUnit, rX86_ARG3);
}
/* Architecture-specific initializations and checks go here */
-bool oatArchVariantInit(void)
+bool ArchVariantInit(void)
{
return true;
}
-void oatGenMemBarrier(CompilationUnit *cUnit, MemBarrierKind barrierKind)
+void GenMemBarrier(CompilationUnit *cUnit, MemBarrierKind barrierKind)
{
#if ANDROID_SMP != 0
// TODO: optimize fences
- newLIR0(cUnit, kX86Mfence);
+ NewLIR0(cUnit, kX86Mfence);
#endif
}
/*
* Alloc a pair of core registers, or a double. Low reg in low byte,
* high reg in next byte.
*/
-int oatAllocTypedTempPair(CompilationUnit *cUnit, bool fpHint,
+int AllocTypedTempPair(CompilationUnit *cUnit, bool fpHint,
int regClass)
{
int highReg;
@@ -470,58 +457,58 @@
int res = 0;
if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg)) {
- lowReg = oatAllocTempDouble(cUnit);
+ lowReg = AllocTempDouble(cUnit);
highReg = lowReg + 1;
res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
return res;
}
- lowReg = oatAllocTemp(cUnit);
- highReg = oatAllocTemp(cUnit);
+ lowReg = AllocTemp(cUnit);
+ highReg = AllocTemp(cUnit);
res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
return res;
}
-int oatAllocTypedTemp(CompilationUnit *cUnit, bool fpHint, int regClass) {
+int AllocTypedTemp(CompilationUnit *cUnit, bool fpHint, int regClass) {
if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg)) {
- return oatAllocTempFloat(cUnit);
+ return AllocTempFloat(cUnit);
}
- return oatAllocTemp(cUnit);
+ return AllocTemp(cUnit);
}
-void oatInitializeRegAlloc(CompilationUnit* cUnit) {
+void CompilerInitializeRegAlloc(CompilationUnit* cUnit) {
int numRegs = sizeof(coreRegs)/sizeof(*coreRegs);
- int numReserved = sizeof(reservedRegs)/sizeof(*reservedRegs);
+ int numReserved = sizeof(ReservedRegs)/sizeof(*ReservedRegs);
int numTemps = sizeof(coreTemps)/sizeof(*coreTemps);
- int numFPRegs = sizeof(fpRegs)/sizeof(*fpRegs);
+ int numFPRegs = sizeof(FpRegs)/sizeof(*FpRegs);
int numFPTemps = sizeof(fpTemps)/sizeof(*fpTemps);
RegisterPool *pool =
- static_cast<RegisterPool*>(oatNew(cUnit, sizeof(*pool), true, kAllocRegAlloc));
+ static_cast<RegisterPool*>(NewMem(cUnit, sizeof(*pool), true, kAllocRegAlloc));
cUnit->regPool = pool;
pool->numCoreRegs = numRegs;
pool->coreRegs =
- static_cast<RegisterInfo*>(oatNew(cUnit, numRegs * sizeof(*cUnit->regPool->coreRegs),
+ static_cast<RegisterInfo*>(NewMem(cUnit, numRegs * sizeof(*cUnit->regPool->coreRegs),
true, kAllocRegAlloc));
pool->numFPRegs = numFPRegs;
pool->FPRegs =
- static_cast<RegisterInfo *>(oatNew(cUnit, numFPRegs * sizeof(*cUnit->regPool->FPRegs),
+ static_cast<RegisterInfo *>(NewMem(cUnit, numFPRegs * sizeof(*cUnit->regPool->FPRegs),
true, kAllocRegAlloc));
- oatInitPool(pool->coreRegs, coreRegs, pool->numCoreRegs);
- oatInitPool(pool->FPRegs, fpRegs, pool->numFPRegs);
+ CompilerInitPool(pool->coreRegs, coreRegs, pool->numCoreRegs);
+ CompilerInitPool(pool->FPRegs, FpRegs, pool->numFPRegs);
// Keep special registers from being allocated
for (int i = 0; i < numReserved; i++) {
- oatMarkInUse(cUnit, reservedRegs[i]);
+ MarkInUse(cUnit, ReservedRegs[i]);
}
// Mark temp regs - all others not in use can be used for promotion
for (int i = 0; i < numTemps; i++) {
- oatMarkTemp(cUnit, coreTemps[i]);
+ MarkTemp(cUnit, coreTemps[i]);
}
for (int i = 0; i < numFPTemps; i++) {
- oatMarkTemp(cUnit, fpTemps[i]);
+ MarkTemp(cUnit, fpTemps[i]);
}
// Construct the alias map.
cUnit->phiAliasMap = static_cast<int*>
- (oatNew(cUnit, cUnit->numSSARegs * sizeof(cUnit->phiAliasMap[0]), false, kAllocDFInfo));
+ (NewMem(cUnit, cUnit->numSSARegs * sizeof(cUnit->phiAliasMap[0]), false, kAllocDFInfo));
for (int i = 0; i < cUnit->numSSARegs; i++) {
cUnit->phiAliasMap[i] = i;
}
@@ -537,18 +524,18 @@
}
}
-void freeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep,
+void FreeRegLocTemps(CompilationUnit* cUnit, RegLocation rlKeep,
RegLocation rlFree)
{
if ((rlFree.lowReg != rlKeep.lowReg) && (rlFree.lowReg != rlKeep.highReg) &&
(rlFree.highReg != rlKeep.lowReg) && (rlFree.highReg != rlKeep.highReg)) {
// No overlap, free both
- oatFreeTemp(cUnit, rlFree.lowReg);
- oatFreeTemp(cUnit, rlFree.highReg);
+ FreeTemp(cUnit, rlFree.lowReg);
+ FreeTemp(cUnit, rlFree.highReg);
}
}
-void spillCoreRegs(CompilationUnit* cUnit) {
+void SpillCoreRegs(CompilationUnit* cUnit) {
if (cUnit->numCoreSpills == 0) {
return;
}
@@ -557,13 +544,13 @@
int offset = cUnit->frameSize - (4 * cUnit->numCoreSpills);
for (int reg = 0; mask; mask >>= 1, reg++) {
if (mask & 0x1) {
- storeWordDisp(cUnit, rX86_SP, offset, reg);
+ StoreWordDisp(cUnit, rX86_SP, offset, reg);
offset += 4;
}
}
}
-void unSpillCoreRegs(CompilationUnit* cUnit) {
+void UnSpillCoreRegs(CompilationUnit* cUnit) {
if (cUnit->numCoreSpills == 0) {
return;
}
@@ -572,19 +559,19 @@
int offset = cUnit->frameSize - (4 * cUnit->numCoreSpills);
for (int reg = 0; mask; mask >>= 1, reg++) {
if (mask & 0x1) {
- loadWordDisp(cUnit, rX86_SP, offset, reg);
+ LoadWordDisp(cUnit, rX86_SP, offset, reg);
offset += 4;
}
}
}
-bool branchUnconditional(LIR* lir)
+bool BranchUnconditional(LIR* lir)
{
return (lir->opcode == kX86Jmp8 || lir->opcode == kX86Jmp32);
}
/* Common initialization routine for an architecture family */
-bool oatArchInit() {
+bool ArchInit() {
int i;
for (i = 0; i < kX86Last; i++) {
@@ -595,27 +582,27 @@
}
}
- return oatArchVariantInit();
+ return ArchVariantInit();
}
// Not used in x86
-int loadHelper(CompilationUnit* cUnit, int offset)
+int LoadHelper(CompilationUnit* cUnit, int offset)
{
- LOG(FATAL) << "Unexpected use of loadHelper in x86";
+ LOG(FATAL) << "Unexpected use of LoadHelper in x86";
return INVALID_REG;
}
-uint64_t getTargetInstFlags(int opcode)
+uint64_t GetTargetInstFlags(int opcode)
{
return EncodingMap[opcode].flags;
}
-const char* getTargetInstName(int opcode)
+const char* GetTargetInstName(int opcode)
{
return EncodingMap[opcode].name;
}
-const char* getTargetInstFmt(int opcode)
+const char* GetTargetInstFmt(int opcode)
{
return EncodingMap[opcode].fmt;
}
diff --git a/src/compiler/codegen/x86/utility_x86.cc b/src/compiler/codegen/x86/utility_x86.cc
index 9d24dda..87a7942 100644
--- a/src/compiler/codegen/x86/utility_x86.cc
+++ b/src/compiler/codegen/x86/utility_x86.cc
@@ -22,15 +22,15 @@
/* This file contains codegen for the X86 ISA */
-void genBarrier(CompilationUnit *cUnit);
-void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg);
-LIR *loadWordDisp(CompilationUnit *cUnit, int rBase, int displacement,
+void GenBarrier(CompilationUnit *cUnit);
+void LoadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg);
+LIR *LoadWordDisp(CompilationUnit *cUnit, int rBase, int displacement,
int rDest);
-LIR *storeWordDisp(CompilationUnit *cUnit, int rBase,
+LIR *StoreWordDisp(CompilationUnit *cUnit, int rBase,
int displacement, int rSrc);
-LIR *loadConstant(CompilationUnit *cUnit, int rDest, int value);
+LIR *LoadConstant(CompilationUnit *cUnit, int rDest, int value);
-LIR *fpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
+LIR *FpRegCopy(CompilationUnit *cUnit, int rDest, int rSrc)
{
int opcode;
/* must be both DOUBLE or both not DOUBLE */
@@ -50,7 +50,7 @@
}
}
DCHECK_NE((EncodingMap[opcode].flags & IS_BINARY_OP), 0ULL);
- LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
+ LIR* res = RawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
if (rDest == rSrc) {
res->flags.isNop = true;
}
@@ -63,54 +63,54 @@
* a high register, build constant into a low register and copy.
*
* No additional register clobbering operation performed. Use this version when
- * 1) rDest is freshly returned from oatAllocTemp or
+ * 1) rDest is freshly returned from AllocTemp or
* 2) The codegen is under fixed register usage
*/
-LIR *loadConstantNoClobber(CompilationUnit *cUnit, int rDest, int value)
+LIR *LoadConstantNoClobber(CompilationUnit *cUnit, int rDest, int value)
{
int rDestSave = rDest;
if (X86_FPREG(rDest)) {
if (value == 0) {
- return newLIR2(cUnit, kX86XorpsRR, rDest, rDest);
+ return NewLIR2(cUnit, kX86XorpsRR, rDest, rDest);
}
DCHECK(X86_SINGLEREG(rDest));
- rDest = oatAllocTemp(cUnit);
+ rDest = AllocTemp(cUnit);
}
LIR *res;
if (value == 0) {
- res = newLIR2(cUnit, kX86Xor32RR, rDest, rDest);
+ res = NewLIR2(cUnit, kX86Xor32RR, rDest, rDest);
} else {
// Note, there is no byte immediate form of a 32 bit immediate move.
- res = newLIR2(cUnit, kX86Mov32RI, rDest, value);
+ res = NewLIR2(cUnit, kX86Mov32RI, rDest, value);
}
if (X86_FPREG(rDestSave)) {
- newLIR2(cUnit, kX86MovdxrRR, rDestSave, rDest);
- oatFreeTemp(cUnit, rDest);
+ NewLIR2(cUnit, kX86MovdxrRR, rDestSave, rDest);
+ FreeTemp(cUnit, rDest);
}
return res;
}
-LIR* opBranchUnconditional(CompilationUnit *cUnit, OpKind op)
+LIR* OpBranchUnconditional(CompilationUnit *cUnit, OpKind op)
{
CHECK_EQ(op, kOpUncondBr);
- return newLIR1(cUnit, kX86Jmp8, 0 /* offset to be patched */ );
+ return NewLIR1(cUnit, kX86Jmp8, 0 /* offset to be patched */ );
}
-LIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
+LIR *LoadMultiple(CompilationUnit *cUnit, int rBase, int rMask);
-X86ConditionCode oatX86ConditionEncoding(ConditionCode cond);
-LIR* opCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target)
+X86ConditionCode X86ConditionEncoding(ConditionCode cond);
+LIR* OpCondBranch(CompilationUnit* cUnit, ConditionCode cc, LIR* target)
{
- LIR* branch = newLIR2(cUnit, kX86Jcc8, 0 /* offset to be patched */,
- oatX86ConditionEncoding(cc));
+ LIR* branch = NewLIR2(cUnit, kX86Jcc8, 0 /* offset to be patched */,
+ X86ConditionEncoding(cc));
branch->target = target;
return branch;
}
-LIR *opReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
+LIR *OpReg(CompilationUnit *cUnit, OpKind op, int rDestSrc)
{
X86OpCode opcode = kX86Bkpt;
switch (op) {
@@ -118,12 +118,12 @@
case kOpNot: opcode = kX86Not32R; break;
case kOpBlx: opcode = kX86CallR; break;
default:
- LOG(FATAL) << "Bad case in opReg " << op;
+ LOG(FATAL) << "Bad case in OpReg " << op;
}
- return newLIR1(cUnit, opcode, rDestSrc);
+ return NewLIR1(cUnit, opcode, rDestSrc);
}
-LIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int value)
+LIR *OpRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int value)
{
X86OpCode opcode = kX86Bkpt;
bool byteImm = IS_SIMM8(value);
@@ -140,28 +140,28 @@
case kOpSub: opcode = byteImm ? kX86Sub32RI8 : kX86Sub32RI; break;
case kOpXor: opcode = byteImm ? kX86Xor32RI8 : kX86Xor32RI; break;
case kOpCmp: opcode = byteImm ? kX86Cmp32RI8 : kX86Cmp32RI; break;
- case kOpMov: return loadConstantNoClobber(cUnit, rDestSrc1, value);
+ case kOpMov: return LoadConstantNoClobber(cUnit, rDestSrc1, value);
case kOpMul:
opcode = byteImm ? kX86Imul32RRI8 : kX86Imul32RRI;
- return newLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, value);
+ return NewLIR3(cUnit, opcode, rDestSrc1, rDestSrc1, value);
default:
- LOG(FATAL) << "Bad case in opRegImm " << op;
+ LOG(FATAL) << "Bad case in OpRegImm " << op;
}
- return newLIR2(cUnit, opcode, rDestSrc1, value);
+ return NewLIR2(cUnit, opcode, rDestSrc1, value);
}
-LIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int rSrc2)
+LIR *OpRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int rSrc2)
{
X86OpCode opcode = kX86Nop;
bool src2_must_be_cx = false;
switch (op) {
// X86 unary opcodes
case kOpMvn:
- opRegCopy(cUnit, rDestSrc1, rSrc2);
- return opReg(cUnit, kOpNot, rDestSrc1);
+ OpRegCopy(cUnit, rDestSrc1, rSrc2);
+ return OpReg(cUnit, kOpNot, rDestSrc1);
case kOpNeg:
- opRegCopy(cUnit, rDestSrc1, rSrc2);
- return opReg(cUnit, kOpNeg, rDestSrc1);
+ OpRegCopy(cUnit, rDestSrc1, rSrc2);
+ return OpReg(cUnit, kOpNeg, rDestSrc1);
// X86 binary opcodes
case kOpSub: opcode = kX86Sub32RR; break;
case kOpSbc: opcode = kX86Sbb32RR; break;
@@ -178,9 +178,9 @@
case kOp2Byte:
// Use shifts instead of a byte operand if the source can't be byte accessed.
if (rSrc2 >= 4) {
- newLIR2(cUnit, kX86Mov32RR, rDestSrc1, rSrc2);
- newLIR2(cUnit, kX86Sal32RI, rDestSrc1, 24);
- return newLIR2(cUnit, kX86Sar32RI, rDestSrc1, 24);
+ NewLIR2(cUnit, kX86Mov32RR, rDestSrc1, rSrc2);
+ NewLIR2(cUnit, kX86Sal32RI, rDestSrc1, 24);
+ return NewLIR2(cUnit, kX86Sar32RI, rDestSrc1, 24);
} else {
opcode = kX86Movsx8RR;
}
@@ -189,14 +189,14 @@
case kOp2Char: opcode = kX86Movzx16RR; break;
case kOpMul: opcode = kX86Imul32RR; break;
default:
- LOG(FATAL) << "Bad case in opRegReg " << op;
+ LOG(FATAL) << "Bad case in OpRegReg " << op;
break;
}
CHECK(!src2_must_be_cx || rSrc2 == rCX);
- return newLIR2(cUnit, opcode, rDestSrc1, rSrc2);
+ return NewLIR2(cUnit, opcode, rDestSrc1, rSrc2);
}
-LIR* opRegMem(CompilationUnit *cUnit, OpKind op, int rDest, int rBase,
+LIR* OpRegMem(CompilationUnit *cUnit, OpKind op, int rDest, int rBase,
int offset)
{
X86OpCode opcode = kX86Nop;
@@ -214,46 +214,46 @@
case kOp2Char: opcode = kX86Movzx16RM; break;
case kOpMul:
default:
- LOG(FATAL) << "Bad case in opRegMem " << op;
+ LOG(FATAL) << "Bad case in OpRegMem " << op;
break;
}
- return newLIR3(cUnit, opcode, rDest, rBase, offset);
+ return NewLIR3(cUnit, opcode, rDest, rBase, offset);
}
-LIR* opRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest, int rSrc1,
+LIR* OpRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest, int rSrc1,
int rSrc2)
{
if (rDest != rSrc1 && rDest != rSrc2) {
if (op == kOpAdd) { // lea special case, except can't encode rbp as base
if (rSrc1 == rSrc2) {
- opRegCopy(cUnit, rDest, rSrc1);
- return opRegImm(cUnit, kOpLsl, rDest, 1);
+ OpRegCopy(cUnit, rDest, rSrc1);
+ return OpRegImm(cUnit, kOpLsl, rDest, 1);
} else if (rSrc1 != rBP) {
- return newLIR5(cUnit, kX86Lea32RA, rDest, rSrc1 /* base */,
+ return NewLIR5(cUnit, kX86Lea32RA, rDest, rSrc1 /* base */,
rSrc2 /* index */, 0 /* scale */, 0 /* disp */);
} else {
- return newLIR5(cUnit, kX86Lea32RA, rDest, rSrc2 /* base */,
+ return NewLIR5(cUnit, kX86Lea32RA, rDest, rSrc2 /* base */,
rSrc1 /* index */, 0 /* scale */, 0 /* disp */);
}
} else {
- opRegCopy(cUnit, rDest, rSrc1);
- return opRegReg(cUnit, op, rDest, rSrc2);
+ OpRegCopy(cUnit, rDest, rSrc1);
+ return OpRegReg(cUnit, op, rDest, rSrc2);
}
} else if (rDest == rSrc1) {
- return opRegReg(cUnit, op, rDest, rSrc2);
+ return OpRegReg(cUnit, op, rDest, rSrc2);
} else { // rDest == rSrc2
switch (op) {
case kOpSub: // non-commutative
- opReg(cUnit, kOpNeg, rDest);
+ OpReg(cUnit, kOpNeg, rDest);
op = kOpAdd;
break;
case kOpSbc:
case kOpLsl: case kOpLsr: case kOpAsr: case kOpRor: {
- int tReg = oatAllocTemp(cUnit);
- opRegCopy(cUnit, tReg, rSrc1);
- opRegReg(cUnit, op, tReg, rSrc2);
- LIR* res = opRegCopy(cUnit, rDest, tReg);
- oatFreeTemp(cUnit, tReg);
+ int tReg = AllocTemp(cUnit);
+ OpRegCopy(cUnit, tReg, rSrc1);
+ OpRegReg(cUnit, op, tReg, rSrc2);
+ LIR* res = OpRegCopy(cUnit, rDest, tReg);
+ FreeTemp(cUnit, tReg);
return res;
}
case kOpAdd: // commutative
@@ -263,40 +263,40 @@
case kOpXor:
break;
default:
- LOG(FATAL) << "Bad case in opRegRegReg " << op;
+ LOG(FATAL) << "Bad case in OpRegRegReg " << op;
}
- return opRegReg(cUnit, op, rDest, rSrc1);
+ return OpRegReg(cUnit, op, rDest, rSrc1);
}
}
-LIR* opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest, int rSrc,
+LIR* OpRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest, int rSrc,
int value)
{
if (op == kOpMul) {
X86OpCode opcode = IS_SIMM8(value) ? kX86Imul32RRI8 : kX86Imul32RRI;
- return newLIR3(cUnit, opcode, rDest, rSrc, value);
+ return NewLIR3(cUnit, opcode, rDest, rSrc, value);
} else if (op == kOpAnd) {
if (value == 0xFF && rSrc < 4) {
- return newLIR2(cUnit, kX86Movzx8RR, rDest, rSrc);
+ return NewLIR2(cUnit, kX86Movzx8RR, rDest, rSrc);
} else if (value == 0xFFFF) {
- return newLIR2(cUnit, kX86Movzx16RR, rDest, rSrc);
+ return NewLIR2(cUnit, kX86Movzx16RR, rDest, rSrc);
}
}
if (rDest != rSrc) {
if (false && op == kOpLsl && value >= 0 && value <= 3) { // lea shift special case
// TODO: fix bug in LEA encoding when disp == 0
- return newLIR5(cUnit, kX86Lea32RA, rDest, r5sib_no_base /* base */,
+ return NewLIR5(cUnit, kX86Lea32RA, rDest, r5sib_no_base /* base */,
rSrc /* index */, value /* scale */, 0 /* disp */);
} else if (op == kOpAdd) { // lea add special case
- return newLIR5(cUnit, kX86Lea32RA, rDest, rSrc /* base */,
+ return NewLIR5(cUnit, kX86Lea32RA, rDest, rSrc /* base */,
r4sib_no_index /* index */, 0 /* scale */, value /* disp */);
}
- opRegCopy(cUnit, rDest, rSrc);
+ OpRegCopy(cUnit, rDest, rSrc);
}
- return opRegImm(cUnit, op, rDest, value);
+ return OpRegImm(cUnit, op, rDest, value);
}
-LIR* opThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset)
+LIR* OpThreadMem(CompilationUnit* cUnit, OpKind op, int threadOffset)
{
X86OpCode opcode = kX86Bkpt;
switch (op) {
@@ -305,10 +305,10 @@
LOG(FATAL) << "Bad opcode: " << op;
break;
}
- return newLIR1(cUnit, opcode, threadOffset);
+ return NewLIR1(cUnit, opcode, threadOffset);
}
-LIR* opMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp)
+LIR* OpMem(CompilationUnit* cUnit, OpKind op, int rBase, int disp)
{
X86OpCode opcode = kX86Bkpt;
switch (op) {
@@ -317,51 +317,51 @@
LOG(FATAL) << "Bad opcode: " << op;
break;
}
- return newLIR2(cUnit, opcode, rBase, disp);
+ return NewLIR2(cUnit, opcode, rBase, disp);
}
-LIR *loadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
+LIR *LoadConstantValueWide(CompilationUnit *cUnit, int rDestLo,
int rDestHi, int valLo, int valHi)
{
LIR *res;
if (X86_FPREG(rDestLo)) {
DCHECK(X86_FPREG(rDestHi)); // ignore rDestHi
if (valLo == 0 && valHi == 0) {
- return newLIR2(cUnit, kX86XorpsRR, rDestLo, rDestLo);
+ return NewLIR2(cUnit, kX86XorpsRR, rDestLo, rDestLo);
} else {
if (valLo == 0) {
- res = newLIR2(cUnit, kX86XorpsRR, rDestLo, rDestLo);
+ res = NewLIR2(cUnit, kX86XorpsRR, rDestLo, rDestLo);
} else {
- res = loadConstantNoClobber(cUnit, rDestLo, valLo);
+ res = LoadConstantNoClobber(cUnit, rDestLo, valLo);
}
if (valHi != 0) {
- loadConstantNoClobber(cUnit, rDestHi, valHi);
- newLIR2(cUnit, kX86PsllqRI, rDestHi, 32);
- newLIR2(cUnit, kX86OrpsRR, rDestLo, rDestHi);
+ LoadConstantNoClobber(cUnit, rDestHi, valHi);
+ NewLIR2(cUnit, kX86PsllqRI, rDestHi, 32);
+ NewLIR2(cUnit, kX86OrpsRR, rDestLo, rDestHi);
}
}
} else {
- res = loadConstantNoClobber(cUnit, rDestLo, valLo);
- loadConstantNoClobber(cUnit, rDestHi, valHi);
+ res = LoadConstantNoClobber(cUnit, rDestLo, valLo);
+ LoadConstantNoClobber(cUnit, rDestHi, valHi);
}
return res;
}
-LIR *loadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
+LIR *LoadMultiple(CompilationUnit *cUnit, int rBase, int rMask)
{
- UNIMPLEMENTED(FATAL) << "loadMultiple";
- newLIR0(cUnit, kX86Bkpt);
+ UNIMPLEMENTED(FATAL) << "LoadMultiple";
+ NewLIR0(cUnit, kX86Bkpt);
return NULL;
}
-LIR *storeMultiple(CompilationUnit *cUnit, int rBase, int rMask)
+LIR *StoreMultiple(CompilationUnit *cUnit, int rBase, int rMask)
{
- UNIMPLEMENTED(FATAL) << "storeMultiple";
- newLIR0(cUnit, kX86Bkpt);
+ UNIMPLEMENTED(FATAL) << "StoreMultiple";
+ NewLIR0(cUnit, kX86Bkpt);
return NULL;
}
-LIR* loadBaseIndexedDisp(CompilationUnit *cUnit,
+LIR* LoadBaseIndexedDisp(CompilationUnit *cUnit,
int rBase, int rIndex, int scale, int displacement,
int rDest, int rDestHi,
OpSize size, int sReg) {
@@ -380,7 +380,7 @@
if (X86_SINGLEREG(rDest)) {
DCHECK(X86_FPREG(rDestHi));
DCHECK_EQ(rDest, (rDestHi - 1));
- rDest = s2d(rDest, rDestHi);
+ rDest = S2d(rDest, rDestHi);
}
rDestHi = rDest + 1;
} else {
@@ -414,45 +414,45 @@
opcode = isArray ? kX86Movsx8RA : kX86Movsx8RM;
break;
default:
- LOG(FATAL) << "Bad case in loadBaseIndexedDispBody";
+ LOG(FATAL) << "Bad case in LoadBaseIndexedDispBody";
}
if (!isArray) {
if (!pair) {
- load = newLIR3(cUnit, opcode, rDest, rBase, displacement + LOWORD_OFFSET);
+ load = NewLIR3(cUnit, opcode, rDest, rBase, displacement + LOWORD_OFFSET);
} else {
if (rBase == rDest) {
- load2 = newLIR3(cUnit, opcode, rDestHi, rBase,
+ load2 = NewLIR3(cUnit, opcode, rDestHi, rBase,
displacement + HIWORD_OFFSET);
- load = newLIR3(cUnit, opcode, rDest, rBase, displacement + LOWORD_OFFSET);
+ load = NewLIR3(cUnit, opcode, rDest, rBase, displacement + LOWORD_OFFSET);
} else {
- load = newLIR3(cUnit, opcode, rDest, rBase, displacement + LOWORD_OFFSET);
- load2 = newLIR3(cUnit, opcode, rDestHi, rBase,
+ load = NewLIR3(cUnit, opcode, rDest, rBase, displacement + LOWORD_OFFSET);
+ load2 = NewLIR3(cUnit, opcode, rDestHi, rBase,
displacement + HIWORD_OFFSET);
}
}
if (rBase == rX86_SP) {
- annotateDalvikRegAccess(load, (displacement + (pair ? LOWORD_OFFSET : 0))
+ AnnotateDalvikRegAccess(load, (displacement + (pair ? LOWORD_OFFSET : 0))
>> 2, true /* isLoad */, is64bit);
if (pair) {
- annotateDalvikRegAccess(load2, (displacement + HIWORD_OFFSET) >> 2,
+ AnnotateDalvikRegAccess(load2, (displacement + HIWORD_OFFSET) >> 2,
true /* isLoad */, is64bit);
}
}
} else {
if (!pair) {
- load = newLIR5(cUnit, opcode, rDest, rBase, rIndex, scale,
+ load = NewLIR5(cUnit, opcode, rDest, rBase, rIndex, scale,
displacement + LOWORD_OFFSET);
} else {
if (rBase == rDest) {
- load2 = newLIR5(cUnit, opcode, rDestHi, rBase, rIndex, scale,
+ load2 = NewLIR5(cUnit, opcode, rDestHi, rBase, rIndex, scale,
displacement + HIWORD_OFFSET);
- load = newLIR5(cUnit, opcode, rDest, rBase, rIndex, scale,
+ load = NewLIR5(cUnit, opcode, rDest, rBase, rIndex, scale,
displacement + LOWORD_OFFSET);
} else {
- load = newLIR5(cUnit, opcode, rDest, rBase, rIndex, scale,
+ load = NewLIR5(cUnit, opcode, rDest, rBase, rIndex, scale,
displacement + LOWORD_OFFSET);
- load2 = newLIR5(cUnit, opcode, rDestHi, rBase, rIndex, scale,
+ load2 = NewLIR5(cUnit, opcode, rDestHi, rBase, rIndex, scale,
displacement + HIWORD_OFFSET);
}
}
@@ -462,29 +462,29 @@
}
/* Load value from base + scaled index. */
-LIR *loadBaseIndexed(CompilationUnit *cUnit, int rBase,
+LIR *LoadBaseIndexed(CompilationUnit *cUnit, int rBase,
int rIndex, int rDest, int scale, OpSize size) {
- return loadBaseIndexedDisp(cUnit, rBase, rIndex, scale, 0,
+ return LoadBaseIndexedDisp(cUnit, rBase, rIndex, scale, 0,
rDest, INVALID_REG, size, INVALID_SREG);
}
-LIR *loadBaseDisp(CompilationUnit *cUnit,
+LIR *LoadBaseDisp(CompilationUnit *cUnit,
int rBase, int displacement,
int rDest,
OpSize size, int sReg) {
- return loadBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0, displacement,
+ return LoadBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0, displacement,
rDest, INVALID_REG, size, sReg);
}
-LIR *loadBaseDispWide(CompilationUnit *cUnit,
+LIR *LoadBaseDispWide(CompilationUnit *cUnit,
int rBase, int displacement,
int rDestLo, int rDestHi,
int sReg) {
- return loadBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0, displacement,
+ return LoadBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0, displacement,
rDestLo, rDestHi, kLong, sReg);
}
-LIR* storeBaseIndexedDisp(CompilationUnit *cUnit,
+LIR* StoreBaseIndexedDisp(CompilationUnit *cUnit,
int rBase, int rIndex, int scale, int displacement,
int rSrc, int rSrcHi,
OpSize size, int sReg) {
@@ -503,7 +503,7 @@
if (X86_SINGLEREG(rSrc)) {
DCHECK(X86_FPREG(rSrcHi));
DCHECK_EQ(rSrc, (rSrcHi - 1));
- rSrc = s2d(rSrc, rSrcHi);
+ rSrc = S2d(rSrc, rSrcHi);
}
rSrcHi = rSrc + 1;
} else {
@@ -532,32 +532,32 @@
opcode = isArray ? kX86Mov8AR : kX86Mov8MR;
break;
default:
- LOG(FATAL) << "Bad case in loadBaseIndexedDispBody";
+ LOG(FATAL) << "Bad case in LoadBaseIndexedDispBody";
}
if (!isArray) {
if (!pair) {
- store = newLIR3(cUnit, opcode, rBase, displacement + LOWORD_OFFSET, rSrc);
+ store = NewLIR3(cUnit, opcode, rBase, displacement + LOWORD_OFFSET, rSrc);
} else {
- store = newLIR3(cUnit, opcode, rBase, displacement + LOWORD_OFFSET, rSrc);
- store2 = newLIR3(cUnit, opcode, rBase, displacement + HIWORD_OFFSET, rSrcHi);
+ store = NewLIR3(cUnit, opcode, rBase, displacement + LOWORD_OFFSET, rSrc);
+ store2 = NewLIR3(cUnit, opcode, rBase, displacement + HIWORD_OFFSET, rSrcHi);
}
if (rBase == rX86_SP) {
- annotateDalvikRegAccess(store, (displacement + (pair ? LOWORD_OFFSET : 0))
+ AnnotateDalvikRegAccess(store, (displacement + (pair ? LOWORD_OFFSET : 0))
>> 2, false /* isLoad */, is64bit);
if (pair) {
- annotateDalvikRegAccess(store2, (displacement + HIWORD_OFFSET) >> 2,
+ AnnotateDalvikRegAccess(store2, (displacement + HIWORD_OFFSET) >> 2,
false /* isLoad */, is64bit);
}
}
} else {
if (!pair) {
- store = newLIR5(cUnit, opcode, rBase, rIndex, scale,
+ store = NewLIR5(cUnit, opcode, rBase, rIndex, scale,
displacement + LOWORD_OFFSET, rSrc);
} else {
- store = newLIR5(cUnit, opcode, rBase, rIndex, scale,
+ store = NewLIR5(cUnit, opcode, rBase, rIndex, scale,
displacement + LOWORD_OFFSET, rSrc);
- store2 = newLIR5(cUnit, opcode, rBase, rIndex, scale,
+ store2 = NewLIR5(cUnit, opcode, rBase, rIndex, scale,
displacement + HIWORD_OFFSET, rSrcHi);
}
}
@@ -566,31 +566,31 @@
}
/* store value base base + scaled index. */
-LIR *storeBaseIndexed(CompilationUnit *cUnit, int rBase, int rIndex, int rSrc,
+LIR *StoreBaseIndexed(CompilationUnit *cUnit, int rBase, int rIndex, int rSrc,
int scale, OpSize size)
{
- return storeBaseIndexedDisp(cUnit, rBase, rIndex, scale, 0,
+ return StoreBaseIndexedDisp(cUnit, rBase, rIndex, scale, 0,
rSrc, INVALID_REG, size, INVALID_SREG);
}
-LIR *storeBaseDisp(CompilationUnit *cUnit, int rBase, int displacement,
+LIR *StoreBaseDisp(CompilationUnit *cUnit, int rBase, int displacement,
int rSrc, OpSize size)
{
- return storeBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0,
+ return StoreBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0,
displacement, rSrc, INVALID_REG, size,
INVALID_SREG);
}
-LIR *storeBaseDispWide(CompilationUnit *cUnit, int rBase, int displacement,
+LIR *StoreBaseDispWide(CompilationUnit *cUnit, int rBase, int displacement,
int rSrcLo, int rSrcHi)
{
- return storeBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0, displacement,
+ return StoreBaseIndexedDisp(cUnit, rBase, INVALID_REG, 0, displacement,
rSrcLo, rSrcHi, kLong, INVALID_SREG);
}
-void loadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
+void LoadPair(CompilationUnit *cUnit, int base, int lowReg, int highReg)
{
- loadBaseDispWide(cUnit, base, 0, lowReg, highReg, INVALID_SREG);
+ LoadBaseDispWide(cUnit, base, 0, lowReg, highReg, INVALID_SREG);
}
} // namespace art
diff --git a/src/compiler/compiler_ir.h b/src/compiler/compiler_ir.h
index df0bd77..4fa019f 100644
--- a/src/compiler/compiler_ir.h
+++ b/src/compiler/compiler_ir.h
@@ -47,7 +47,7 @@
RegLocationType coreLocation:3;
uint8_t coreReg;
RegLocationType fpLocation:3;
- uint8_t fpReg;
+ uint8_t FpReg;
bool firstInPair;
};
@@ -491,7 +491,7 @@
const uint16_t* insns;
uint32_t insnsSize;
bool disableDataflow; // Skip dataflow analysis if possible
- SafeMap<unsigned int, BasicBlock*> blockMap; // findBlock lookup cache
+ SafeMap<unsigned int, BasicBlock*> blockMap; // FindBlock lookup cache
SafeMap<unsigned int, unsigned int> blockIdMap; // Block collapse lookup cache
SafeMap<unsigned int, LIR*> boundaryMap; // boundary lookup cache
int defCount; // Used to estimate number of SSA names
@@ -583,23 +583,23 @@
{{Instruction::RETURN_WIDE}, kIdentity},
};
-BasicBlock* oatNewBB(CompilationUnit* cUnit, BBType blockType, int blockId);
+BasicBlock* NewMemBB(CompilationUnit* cUnit, BBType blockType, int blockId);
-void oatAppendMIR(BasicBlock* bb, MIR* mir);
+void AppendMIR(BasicBlock* bb, MIR* mir);
-void oatPrependMIR(BasicBlock* bb, MIR* mir);
+void PrependMIR(BasicBlock* bb, MIR* mir);
-void oatInsertMIRAfter(BasicBlock* bb, MIR* currentMIR, MIR* newMIR);
+void InsertMIRAfter(BasicBlock* bb, MIR* currentMIR, MIR* newMIR);
-void oatAppendLIR(CompilationUnit* cUnit, LIR* lir);
+void AppendLIR(CompilationUnit* cUnit, LIR* lir);
-void oatInsertLIRBefore(LIR* currentLIR, LIR* newLIR);
+void InsertLIRBefore(LIR* currentLIR, LIR* newLIR);
-void oatInsertLIRAfter(LIR* currentLIR, LIR* newLIR);
+void InsertLIRAfter(LIR* currentLIR, LIR* newLIR);
-MIR* oatFindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
+MIR* FindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
/* Debug Utilities */
-void oatDumpCompilationUnit(CompilationUnit* cUnit);
+void DumpCompilationUnit(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/compiler_utility.cc b/src/compiler/compiler_utility.cc
index a0ab292..47dfb50 100644
--- a/src/compiler/compiler_utility.cc
+++ b/src/compiler/compiler_utility.cc
@@ -99,7 +99,7 @@
#define kArenaBitVectorGrowth 4 /* increase by 4 uint32_ts when limit hit */
/* Allocate the initial memory block for arena-based allocation */
-bool oatHeapInit(CompilationUnit* cUnit)
+bool HeapInit(CompilationUnit* cUnit)
{
DCHECK(cUnit->arenaHead == NULL);
cUnit->arenaHead =
@@ -113,14 +113,14 @@
cUnit->currentArena->next = NULL;
cUnit->numArenaBlocks = 1;
#ifdef WITH_MEMSTATS
- cUnit->mstats = (Memstats*) oatNew(cUnit, sizeof(Memstats), true,
+ cUnit->mstats = (Memstats*) NewMem(cUnit, sizeof(Memstats), true,
kAllocDebugInfo);
#endif
return true;
}
/* Arena-based malloc for compilation tasks */
-void* oatNew(CompilationUnit* cUnit, size_t size, bool zero, oatAllocKind kind)
+void* NewMem(CompilationUnit* cUnit, size_t size, bool zero, oatAllocKind kind)
{
size = (size + 3) & ~3;
#ifdef WITH_MEMSTATS
@@ -171,7 +171,7 @@
}
/* Reclaim all the arena blocks allocated so far */
-void oatArenaReset(CompilationUnit* cUnit)
+void ArenaReset(CompilationUnit* cUnit)
{
ArenaMemBlock* head = cUnit->arenaHead;
while (head != NULL) {
@@ -184,12 +184,12 @@
}
/* Growable List initialization */
-void oatInitGrowableList(CompilationUnit* cUnit, GrowableList* gList,
+void CompilerInitGrowableList(CompilationUnit* cUnit, GrowableList* gList,
size_t initLength, oatListKind kind)
{
gList->numAllocated = initLength;
gList->numUsed = 0;
- gList->elemList = static_cast<uintptr_t *>(oatNew(cUnit, sizeof(intptr_t) * initLength,
+ gList->elemList = static_cast<uintptr_t *>(NewMem(cUnit, sizeof(intptr_t) * initLength,
true, kAllocGrowableList));
#ifdef WITH_MEMSTATS
cUnit->mstats->listSizes[kind] += sizeof(uintptr_t) * initLength;
@@ -201,7 +201,7 @@
}
/* Expand the capacity of a growable list */
-void expandGrowableList(CompilationUnit* cUnit, GrowableList* gList)
+static void ExpandGrowableList(CompilationUnit* cUnit, GrowableList* gList)
{
int newLength = gList->numAllocated;
if (newLength < 128) {
@@ -210,7 +210,7 @@
newLength += 128;
}
uintptr_t *newArray =
- static_cast<uintptr_t*>(oatNew(cUnit, sizeof(uintptr_t) * newLength, true,
+ static_cast<uintptr_t*>(NewMem(cUnit, sizeof(uintptr_t) * newLength, true,
kAllocGrowableList));
memcpy(newArray, gList->elemList, sizeof(uintptr_t) * gList->numAllocated);
#ifdef WITH_MEMSTATS
@@ -227,18 +227,18 @@
}
/* Insert a new element into the growable list */
-void oatInsertGrowableList(CompilationUnit* cUnit, GrowableList* gList,
+void InsertGrowableList(CompilationUnit* cUnit, GrowableList* gList,
uintptr_t elem)
{
DCHECK_NE(gList->numAllocated, 0U);
if (gList->numUsed == gList->numAllocated) {
- expandGrowableList(cUnit, gList);
+ ExpandGrowableList(cUnit, gList);
}
gList->elemList[gList->numUsed++] = elem;
}
/* Delete an element from a growable list. Element must be present */
-void oatDeleteGrowableList(GrowableList* gList, uintptr_t elem)
+void DeleteGrowableList(GrowableList* gList, uintptr_t elem)
{
bool found = false;
for (unsigned int i = 0; i < gList->numUsed; i++) {
@@ -253,7 +253,7 @@
gList->numUsed--;
}
-void oatGrowableListIteratorInit(GrowableList* gList,
+void GrowableListIteratorInit(GrowableList* gList,
GrowableListIterator* iterator)
{
iterator->list = gList;
@@ -261,14 +261,14 @@
iterator->size = gList->numUsed;
}
-uintptr_t oatGrowableListIteratorNext(GrowableListIterator* iterator)
+uintptr_t GrowableListIteratorNext(GrowableListIterator* iterator)
{
DCHECK_EQ(iterator->size, iterator->list->numUsed);
if (iterator->idx == iterator->size) return 0;
return iterator->list->elemList[iterator->idx++];
}
-uintptr_t oatGrowableListGetElement(const GrowableList* gList, size_t idx)
+uintptr_t GrowableListGetElement(const GrowableList* gList, size_t idx)
{
DCHECK_LT(idx, gList->numUsed);
return gList->elemList[idx];
@@ -276,7 +276,7 @@
#ifdef WITH_MEMSTATS
/* Dump memory usage stats */
-void oatDumpMemStats(CompilationUnit* cUnit)
+void DumpMemStats(CompilationUnit* cUnit)
{
uint32_t total = 0;
for (int i = 0; i < kNumAllocKinds; i++) {
@@ -314,7 +314,7 @@
#endif
/* Debug Utility - dump a compilation unit */
-void oatDumpCompilationUnit(CompilationUnit* cUnit)
+void DumpCompilationUnit(CompilationUnit* cUnit)
{
BasicBlock* bb;
const char* blockTypeNames[] = {
@@ -330,10 +330,10 @@
LOG(INFO) << cUnit->numBlocks << " blocks in total";
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->blockList, &iterator);
+ GrowableListIteratorInit(&cUnit->blockList, &iterator);
while (true) {
- bb = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iterator));
+ bb = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iterator));
if (bb == NULL) break;
LOG(INFO) << StringPrintf("Block %d (%s) (insn %04x - %04x%s)",
bb->id,
@@ -367,7 +367,7 @@
*
* NOTE: memory is allocated from the compiler arena.
*/
-ArenaBitVector* oatAllocBitVector(CompilationUnit* cUnit,
+ArenaBitVector* AllocBitVector(CompilationUnit* cUnit,
unsigned int startBits, bool expandable,
oatBitMapKind kind)
{
@@ -376,14 +376,14 @@
DCHECK_EQ(sizeof(bv->storage[0]), 4U); /* assuming 32-bit units */
- bv = static_cast<ArenaBitVector*>(oatNew(cUnit, sizeof(ArenaBitVector), false,
+ bv = static_cast<ArenaBitVector*>(NewMem(cUnit, sizeof(ArenaBitVector), false,
kAllocGrowableBitMap));
count = (startBits + 31) >> 5;
bv->storageSize = count;
bv->expandable = expandable;
- bv->storage = static_cast<uint32_t*>(oatNew(cUnit, count * sizeof(uint32_t), true,
+ bv->storage = static_cast<uint32_t*>(NewMem(cUnit, count * sizeof(uint32_t), true,
kAllocGrowableBitMap));
#ifdef WITH_MEMSTATS
bv->kind = kind;
@@ -395,7 +395,7 @@
/*
* Determine whether or not the specified bit is set.
*/
-bool oatIsBitSet(const ArenaBitVector* pBits, unsigned int num)
+bool IsBitSet(const ArenaBitVector* pBits, unsigned int num)
{
DCHECK_LT(num, pBits->storageSize * sizeof(uint32_t) * 8);
@@ -406,7 +406,7 @@
/*
* Mark all bits bit as "clear".
*/
-void oatClearAllBits(ArenaBitVector* pBits)
+void ClearAllBits(ArenaBitVector* pBits)
{
unsigned int count = pBits->storageSize;
memset(pBits->storage, 0, count * sizeof(uint32_t));
@@ -420,7 +420,7 @@
*
* NOTE: memory is allocated from the compiler arena.
*/
-bool oatSetBit(CompilationUnit* cUnit, ArenaBitVector* pBits, unsigned int num)
+bool SetBit(CompilationUnit* cUnit, ArenaBitVector* pBits, unsigned int num)
{
if (num >= pBits->storageSize * sizeof(uint32_t) * 8) {
if (!pBits->expandable) {
@@ -430,7 +430,7 @@
/* Round up to word boundaries for "num+1" bits */
unsigned int newSize = (num + 1 + 31) >> 5;
DCHECK_GT(newSize, pBits->storageSize);
- uint32_t *newStorage = static_cast<uint32_t*>(oatNew(cUnit, newSize * sizeof(uint32_t), false,
+ uint32_t *newStorage = static_cast<uint32_t*>(NewMem(cUnit, newSize * sizeof(uint32_t), false,
kAllocGrowableBitMap));
memcpy(newStorage, pBits->storage, pBits->storageSize * sizeof(uint32_t));
memset(&newStorage[pBits->storageSize], 0,
@@ -457,7 +457,7 @@
*
* NOTE: memory is allocated from the compiler arena.
*/
-bool oatClearBit(ArenaBitVector* pBits, unsigned int num)
+bool ClearBit(ArenaBitVector* pBits, unsigned int num)
{
if (num >= pBits->storageSize * sizeof(uint32_t) * 8) {
LOG(FATAL) << "Attempt to clear a bit not set in the vector yet";;
@@ -467,49 +467,8 @@
return true;
}
-/*
- * If set is true, mark all bits as 1. Otherwise mark all bits as 0.
- */
-void oatMarkAllBits(ArenaBitVector* pBits, bool set)
-{
- int value = set ? -1 : 0;
- memset(pBits->storage, value, pBits->storageSize * static_cast<int>(sizeof(uint32_t)));
-}
-
-void oatDebugBitVector(char* msg, const ArenaBitVector* bv, int length)
-{
- int i;
-
- LOG(INFO) << msg;
- for (i = 0; i < length; i++) {
- if (oatIsBitSet(bv, i)) {
- LOG(INFO) << " Bit " << i << " is set";
- }
- }
-}
-
-void oatAbort(CompilationUnit* cUnit)
-{
- LOG(FATAL) << "Compiler aborting";
-}
-
-void oatDumpBlockBitVector(const GrowableList* blocks, char* msg,
- const ArenaBitVector* bv, int length)
-{
- int i;
-
- LOG(INFO) << msg;
- for (i = 0; i < length; i++) {
- if (oatIsBitSet(bv, i)) {
- BasicBlock *bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blocks, i));
- char blockName[BLOCK_NAME_LEN];
- oatGetBlockName(bb, blockName);
- LOG(INFO) << "Bit " << i << " / " << blockName << " is set";
- }
- }
-}
/* Initialize the iterator structure */
-void oatBitVectorIteratorInit(ArenaBitVector* pBits,
+void BitVectorIteratorInit(ArenaBitVector* pBits,
ArenaBitVectorIterator* iterator)
{
iterator->pBits = pBits;
@@ -520,7 +479,7 @@
/*
* If the vector sizes don't match, log an error and abort.
*/
-void checkSizes(const ArenaBitVector* bv1, const ArenaBitVector* bv2)
+static void CheckSizes(const ArenaBitVector* bv1, const ArenaBitVector* bv2)
{
if (bv1->storageSize != bv2->storageSize) {
LOG(FATAL) << "Mismatched vector sizes (" << bv1->storageSize
@@ -532,10 +491,10 @@
* Copy a whole vector to the other. Only do that when the both vectors have
* the same size.
*/
-void oatCopyBitVector(ArenaBitVector* dest, const ArenaBitVector* src)
+void CopyBitVector(ArenaBitVector* dest, const ArenaBitVector* src)
{
/* if dest is expandable and < src, we could expand dest to match */
- checkSizes(dest, src);
+ CheckSizes(dest, src);
memcpy(dest->storage, src->storage, sizeof(uint32_t) * dest->storageSize);
}
@@ -544,7 +503,7 @@
* Intersect two bit vectors and store the result to the dest vector.
*/
-bool oatIntersectBitVectors(ArenaBitVector* dest, const ArenaBitVector* src1,
+bool IntersectBitVectors(ArenaBitVector* dest, const ArenaBitVector* src1,
const ArenaBitVector* src2)
{
DCHECK(src1 != NULL);
@@ -565,7 +524,7 @@
/*
* Unify two bit vectors and store the result to the dest vector.
*/
-bool oatUnifyBitVectors(ArenaBitVector* dest, const ArenaBitVector* src1,
+bool UnifyBitVetors(ArenaBitVector* dest, const ArenaBitVector* src1,
const ArenaBitVector* src2)
{
DCHECK(src1 != NULL);
@@ -586,7 +545,7 @@
/*
* Return true if any bits collide. Vectors must be same size.
*/
-bool oatTestBitVectors(const ArenaBitVector* src1,
+bool TestBitVectors(const ArenaBitVector* src1,
const ArenaBitVector* src2)
{
DCHECK_EQ(src1->storageSize, src2->storageSize);
@@ -599,7 +558,7 @@
/*
* Compare two bit vectors and return true if difference is seen.
*/
-bool oatCompareBitVectors(const ArenaBitVector* src1,
+bool CompareBitVectors(const ArenaBitVector* src1,
const ArenaBitVector* src2)
{
if (src1->storageSize != src2->storageSize ||
@@ -616,7 +575,7 @@
/*
* Count the number of bits that are set.
*/
-int oatCountSetBits(const ArenaBitVector* pBits)
+int CountSetBits(const ArenaBitVector* pBits)
{
unsigned int word;
unsigned int count = 0;
@@ -641,7 +600,7 @@
}
/* Return the next position set to 1. -1 means end-of-element reached */
-int oatBitVectorIteratorNext(ArenaBitVectorIterator* iterator)
+int BitVectorIteratorNext(ArenaBitVectorIterator* iterator)
{
ArenaBitVector* pBits = iterator->pBits;
uint32_t bitIndex = iterator->idx;
@@ -684,7 +643,7 @@
* since there might be unused bits - setting those to one will confuse the
* iterator.
*/
-void oatSetInitialBits(ArenaBitVector* pBits, unsigned int numBits)
+void SetInitialBits(ArenaBitVector* pBits, unsigned int numBits)
{
unsigned int idx;
DCHECK_LE(((numBits + 31) >> 5), pBits->storageSize);
@@ -697,7 +656,7 @@
}
}
-void oatGetBlockName(BasicBlock* bb, char* name)
+void GetBlockName(BasicBlock* bb, char* name)
{
switch (bb->blockType) {
case kEntryBlock:
@@ -719,7 +678,7 @@
}
}
-const char* oatGetShortyFromTargetIdx(CompilationUnit *cUnit, int targetIdx)
+const char* GetShortyFromTargetIdx(CompilationUnit *cUnit, int targetIdx)
{
const DexFile::MethodId& methodId = cUnit->dex_file->GetMethodId(targetIdx);
return cUnit->dex_file->GetShorty(methodId.proto_idx_);
diff --git a/src/compiler/compiler_utility.h b/src/compiler/compiler_utility.h
index ab91549..f498d35 100644
--- a/src/compiler/compiler_utility.h
+++ b/src/compiler/compiler_utility.h
@@ -84,7 +84,7 @@
};
/* Allocate the initial memory block for arena-based allocation */
-bool oatHeapInit(CompilationUnit* cUnit);
+bool HeapInit(CompilationUnit* cUnit);
/* Collect memory usage statistics */
//#define WITH_MEMSTATS
@@ -96,9 +96,9 @@
char ptr[0];
};
-void* oatNew(CompilationUnit* cUnit, size_t size, bool zero, oatAllocKind kind);
+void* NewMem(CompilationUnit* cUnit, size_t size, bool zero, oatAllocKind kind);
-void oatArenaReset(CompilationUnit *cUnit);
+void ArenaReset(CompilationUnit *cUnit);
struct GrowableList {
GrowableList() : numAllocated(0), numUsed(0), elemList(NULL) {
@@ -150,48 +150,46 @@
struct LIR;
struct RegLocation;
-void oatInitGrowableList(CompilationUnit* cUnit,GrowableList* gList,
+void CompilerInitGrowableList(CompilationUnit* cUnit,GrowableList* gList,
size_t initLength, oatListKind kind = kListMisc);
-void oatInsertGrowableList(CompilationUnit* cUnit, GrowableList* gList,
+void InsertGrowableList(CompilationUnit* cUnit, GrowableList* gList,
uintptr_t elem);
-void oatDeleteGrowableList(GrowableList* gList, uintptr_t elem);
-void oatGrowableListIteratorInit(GrowableList* gList,
+void DeleteGrowableList(GrowableList* gList, uintptr_t elem);
+void GrowableListIteratorInit(GrowableList* gList,
GrowableListIterator* iterator);
-uintptr_t oatGrowableListIteratorNext(GrowableListIterator* iterator);
-uintptr_t oatGrowableListGetElement(const GrowableList* gList, size_t idx);
+uintptr_t GrowableListIteratorNext(GrowableListIterator* iterator);
+uintptr_t GrowableListGetElement(const GrowableList* gList, size_t idx);
-ArenaBitVector* oatAllocBitVector(CompilationUnit* cUnit,
+ArenaBitVector* AllocBitVector(CompilationUnit* cUnit,
unsigned int startBits, bool expandable,
oatBitMapKind = kBitMapMisc);
-void oatBitVectorIteratorInit(ArenaBitVector* pBits,
+void BitVectorIteratorInit(ArenaBitVector* pBits,
ArenaBitVectorIterator* iterator);
-int oatBitVectorIteratorNext(ArenaBitVectorIterator* iterator);
-bool oatSetBit(CompilationUnit *cUnit, ArenaBitVector* pBits, unsigned int num);
-bool oatClearBit(ArenaBitVector* pBits, unsigned int num);
-void oatMarkAllBits(ArenaBitVector* pBits, bool set);
-void oatDebugBitVector(char* msg, const ArenaBitVector* bv, int length);
-bool oatIsBitSet(const ArenaBitVector* pBits, unsigned int num);
-void oatClearAllBits(ArenaBitVector* pBits);
-void oatSetInitialBits(ArenaBitVector* pBits, unsigned int numBits);
-void oatCopyBitVector(ArenaBitVector* dest, const ArenaBitVector* src);
-bool oatIntersectBitVectors(ArenaBitVector* dest, const ArenaBitVector* src1,
+int BitVectorIteratorNext(ArenaBitVectorIterator* iterator);
+bool SetBit(CompilationUnit *cUnit, ArenaBitVector* pBits, unsigned int num);
+bool ClearBit(ArenaBitVector* pBits, unsigned int num);
+void MarkAllBits(ArenaBitVector* pBits, bool set);
+void DebugBitVector(char* msg, const ArenaBitVector* bv, int length);
+bool IsBitSet(const ArenaBitVector* pBits, unsigned int num);
+void ClearAllBits(ArenaBitVector* pBits);
+void SetInitialBits(ArenaBitVector* pBits, unsigned int numBits);
+void CopyBitVector(ArenaBitVector* dest, const ArenaBitVector* src);
+bool IntersectBitVectors(ArenaBitVector* dest, const ArenaBitVector* src1,
const ArenaBitVector* src2);
-bool oatUnifyBitVectors(ArenaBitVector* dest, const ArenaBitVector* src1,
+bool UnifyBitVetors(ArenaBitVector* dest, const ArenaBitVector* src1,
const ArenaBitVector* src2);
-bool oatCompareBitVectors(const ArenaBitVector* src1,
+bool CompareBitVectors(const ArenaBitVector* src1,
const ArenaBitVector* src2);
-bool oatTestBitVectors(const ArenaBitVector* src1, const ArenaBitVector* src2);
-int oatCountSetBits(const ArenaBitVector* pBits);
+bool TestBitVectors(const ArenaBitVector* src1, const ArenaBitVector* src2);
+int CountSetBits(const ArenaBitVector* pBits);
-void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* lir, unsigned char* baseAddr);
-void oatDumpResourceMask(LIR* lir, uint64_t mask, const char* prefix);
-void oatDumpBlockBitVector(const GrowableList* blocks, char* msg,
+void DumpLIRInsn(CompilationUnit* cUnit, LIR* lir, unsigned char* baseAddr);
+void DumpResourceMask(LIR* lir, uint64_t mask, const char* prefix);
+void DumpBlockBitVector(const GrowableList* blocks, char* msg,
const ArenaBitVector* bv, int length);
-void oatGetBlockName(BasicBlock* bb, char* name);
-const char* oatGetShortyFromTargetIdx(CompilationUnit*, int);
-void oatDumpRegLocTable(RegLocation*, int);
-void oatDumpMemStats(CompilationUnit* cUnit);
-void oatDumpRegLoc(RegLocation loc);
+void GetBlockName(BasicBlock* bb, char* name);
+const char* GetShortyFromTargetIdx(CompilationUnit*, int);
+void DumpMemStats(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/dataflow.cc b/src/compiler/dataflow.cc
index 5ec5bc2..f538fc4 100644
--- a/src/compiler/dataflow.cc
+++ b/src/compiler/dataflow.cc
@@ -848,14 +848,14 @@
return GET_ELEM_N(cUnit->ssaSubscripts, int, ssaReg);
}
-int getSSAUseCount(CompilationUnit* cUnit, int sReg)
+static int GetSSAUseCount(CompilationUnit* cUnit, int sReg)
{
DCHECK(sReg < static_cast<int>(cUnit->rawUseCounts.numUsed));
return cUnit->rawUseCounts.elemList[sReg];
}
-char* oatGetDalvikDisassembly(CompilationUnit* cUnit,
+char* GetDalvikDisassembly(CompilationUnit* cUnit,
const DecodedInstruction& insn, const char* note)
{
std::string str;
@@ -931,12 +931,12 @@
}
}
int length = str.length() + 1;
- ret = static_cast<char*>(oatNew(cUnit, length, false, kAllocDFInfo));
+ ret = static_cast<char*>(NewMem(cUnit, length, false, kAllocDFInfo));
strncpy(ret, str.c_str(), length);
return ret;
}
-std::string getSSAName(const CompilationUnit* cUnit, int ssaReg)
+static std::string GetSSAName(const CompilationUnit* cUnit, int ssaReg)
{
return StringPrintf("v%d_%d", SRegToVReg(cUnit, ssaReg),
SRegToSubscript(cUnit, ssaReg));
@@ -945,7 +945,7 @@
/*
* Dalvik instruction disassembler with optional SSA printing.
*/
-char* oatFullDisassembler(CompilationUnit* cUnit, const MIR* mir)
+char* FullDisassembler(CompilationUnit* cUnit, const MIR* mir)
{
std::string str;
const DecodedInstruction* insn = &mir->dalvikInsn;
@@ -958,13 +958,13 @@
if (opcode == kMirOpPhi) {
int* incoming = reinterpret_cast<int*>(mir->dalvikInsn.vB);
str.append(StringPrintf("PHI %s = (%s",
- getSSAName(cUnit, mir->ssaRep->defs[0]).c_str(),
- getSSAName(cUnit, mir->ssaRep->uses[0]).c_str()));
+ GetSSAName(cUnit, mir->ssaRep->defs[0]).c_str(),
+ GetSSAName(cUnit, mir->ssaRep->uses[0]).c_str()));
str.append(StringPrintf(":%d",incoming[0]));
int i;
for (i = 1; i < mir->ssaRep->numUses; i++) {
str.append(StringPrintf(", %s:%d",
- getSSAName(cUnit, mir->ssaRep->uses[i]).c_str(),
+ GetSSAName(cUnit, mir->ssaRep->uses[i]).c_str(),
incoming[i]));
}
str.append(")");
@@ -988,13 +988,13 @@
switch (dalvikFormat) {
case Instruction::k21t:
str.append(StringPrintf(" %s, ",
- getSSAName(cUnit, mir->ssaRep->uses[0]).c_str()));
+ GetSSAName(cUnit, mir->ssaRep->uses[0]).c_str()));
delta = insn->vB;
break;
case Instruction::k22t:
str.append(StringPrintf(" %s, %s, ",
- getSSAName(cUnit, mir->ssaRep->uses[0]).c_str(),
- getSSAName(cUnit, mir->ssaRep->uses[1]).c_str()));
+ GetSSAName(cUnit, mir->ssaRep->uses[0]).c_str(),
+ GetSSAName(cUnit, mir->ssaRep->uses[1]).c_str()));
delta = insn->vC;
break;
case Instruction::k10t:
@@ -1011,7 +1011,7 @@
for (i = 0; i < insn->vA; i++) {
if (i != 0) str.append(",");
str.append(" ");
- str.append(getSSAName(cUnit, mir->ssaRep->uses[i]));
+ str.append(GetSSAName(cUnit, mir->ssaRep->uses[i]));
}
} else {
int udIdx;
@@ -1019,17 +1019,17 @@
for (udIdx = 0; udIdx < mir->ssaRep->numDefs; udIdx++) {
str.append(" ");
- str.append(getSSAName(cUnit, mir->ssaRep->defs[udIdx]));
+ str.append(GetSSAName(cUnit, mir->ssaRep->defs[udIdx]));
}
str.append(",");
}
if (mir->ssaRep->numUses) {
/* No leading ',' for the first use */
str.append(" ");
- str.append(getSSAName(cUnit, mir->ssaRep->uses[0]));
+ str.append(GetSSAName(cUnit, mir->ssaRep->uses[0]));
for (udIdx = 1; udIdx < mir->ssaRep->numUses; udIdx++) {
str.append(", ");
- str.append(getSSAName(cUnit, mir->ssaRep->uses[udIdx]));
+ str.append(GetSSAName(cUnit, mir->ssaRep->uses[udIdx]));
}
}
if (static_cast<int>(opcode) < static_cast<int>(kMirOpFirst)) {
@@ -1062,12 +1062,12 @@
done:
length = str.length() + 1;
- ret = static_cast<char*>(oatNew(cUnit, length, false, kAllocDFInfo));
+ ret = static_cast<char*>(NewMem(cUnit, length, false, kAllocDFInfo));
strncpy(ret, str.c_str(), length);
return ret;
}
-char* oatGetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep)
+char* GetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep)
{
std::string str;
char* ret;
@@ -1091,34 +1091,32 @@
}
int length = str.length() + 1;
- ret = static_cast<char*>(oatNew(cUnit, length, false, kAllocDFInfo));
+ ret = static_cast<char*>(NewMem(cUnit, length, false, kAllocDFInfo));
strncpy(ret, str.c_str(), length);
return ret;
}
/* Any register that is used before being defined is considered live-in */
-inline void handleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV,
- ArenaBitVector* defV, ArenaBitVector* liveInV,
- int dalvikRegId)
+static inline void HandleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV,
+ ArenaBitVector* defV, ArenaBitVector* liveInV, int dalvikRegId)
{
- oatSetBit(cUnit, useV, dalvikRegId);
- if (!oatIsBitSet(defV, dalvikRegId)) {
- oatSetBit(cUnit, liveInV, dalvikRegId);
+ SetBit(cUnit, useV, dalvikRegId);
+ if (!IsBitSet(defV, dalvikRegId)) {
+ SetBit(cUnit, liveInV, dalvikRegId);
}
}
/* Mark a reg as being defined */
-inline void handleDef(CompilationUnit* cUnit, ArenaBitVector* defV,
- int dalvikRegId)
+static inline void HandleDef(CompilationUnit* cUnit, ArenaBitVector* defV, int dalvikRegId)
{
- oatSetBit(cUnit, defV, dalvikRegId);
+ SetBit(cUnit, defV, dalvikRegId);
}
/*
* Find out live-in variables for natural loops. Variables that are live-in in
* the main loop body are considered to be defined in the entry block.
*/
-bool oatFindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb)
+bool FindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb)
{
MIR* mir;
ArenaBitVector *useV, *defV, *liveInV;
@@ -1126,11 +1124,11 @@
if (bb->dataFlowInfo == NULL) return false;
useV = bb->dataFlowInfo->useV =
- oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapUse);
+ AllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapUse);
defV = bb->dataFlowInfo->defV =
- oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapDef);
+ AllocBitVector(cUnit, cUnit->numDalvikRegisters, false, kBitMapDef);
liveInV = bb->dataFlowInfo->liveInV =
- oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false,
+ AllocBitVector(cUnit, cUnit->numDalvikRegisters, false,
kBitMapLiveIn);
for (mir = bb->firstMIRInsn; mir; mir = mir->next) {
@@ -1139,122 +1137,120 @@
if (dfAttributes & DF_HAS_USES) {
if (dfAttributes & DF_UA) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA);
if (dfAttributes & DF_A_WIDE) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA+1);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vA+1);
}
}
if (dfAttributes & DF_UB) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB);
if (dfAttributes & DF_B_WIDE) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB+1);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vB+1);
}
}
if (dfAttributes & DF_UC) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC);
if (dfAttributes & DF_C_WIDE) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+1);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+1);
}
}
}
if (dfAttributes & DF_FORMAT_35C) {
for (unsigned int i = 0; i < dInsn->vA; i++) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->arg[i]);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->arg[i]);
}
}
if (dfAttributes & DF_FORMAT_3RC) {
for (unsigned int i = 0; i < dInsn->vA; i++) {
- handleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+i);
+ HandleLiveInUse(cUnit, useV, defV, liveInV, dInsn->vC+i);
}
}
if (dfAttributes & DF_HAS_DEFS) {
- handleDef(cUnit, defV, dInsn->vA);
+ HandleDef(cUnit, defV, dInsn->vA);
if (dfAttributes & DF_A_WIDE) {
- handleDef(cUnit, defV, dInsn->vA+1);
+ HandleDef(cUnit, defV, dInsn->vA+1);
}
}
}
return true;
}
-int addNewSReg(CompilationUnit* cUnit, int vReg)
+static int AddNewSReg(CompilationUnit* cUnit, int vReg)
{
// Compiler temps always have a subscript of 0
int subscript = (vReg < 0) ? 0 : ++cUnit->SSALastDefs[vReg];
int ssaReg = cUnit->numSSARegs++;
- oatInsertGrowableList(cUnit, cUnit->ssaBaseVRegs, vReg);
- oatInsertGrowableList(cUnit, cUnit->ssaSubscripts, subscript);
- std::string ssaName = getSSAName(cUnit, ssaReg);
- char* name = static_cast<char*>(oatNew(cUnit, ssaName.length() + 1, false, kAllocDFInfo));
+ InsertGrowableList(cUnit, cUnit->ssaBaseVRegs, vReg);
+ InsertGrowableList(cUnit, cUnit->ssaSubscripts, subscript);
+ std::string ssaName = GetSSAName(cUnit, ssaReg);
+ char* name = static_cast<char*>(NewMem(cUnit, ssaName.length() + 1, false, kAllocDFInfo));
strncpy(name, ssaName.c_str(), ssaName.length() + 1);
- oatInsertGrowableList(cUnit, cUnit->ssaStrings, reinterpret_cast<uintptr_t>(name));
+ InsertGrowableList(cUnit, cUnit->ssaStrings, reinterpret_cast<uintptr_t>(name));
DCHECK_EQ(cUnit->ssaBaseVRegs->numUsed, cUnit->ssaSubscripts->numUsed);
return ssaReg;
}
/* Find out the latest SSA register for a given Dalvik register */
-void handleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg,
- int regIndex)
+static void HandleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg, int regIndex)
{
DCHECK((dalvikReg >= 0) && (dalvikReg < cUnit->numDalvikRegisters));
uses[regIndex] = cUnit->vRegToSSAMap[dalvikReg];
}
/* Setup a new SSA register for a given Dalvik register */
-void handleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg,
- int regIndex)
+static void HandleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg, int regIndex)
{
DCHECK((dalvikReg >= 0) && (dalvikReg < cUnit->numDalvikRegisters));
- int ssaReg = addNewSReg(cUnit, dalvikReg);
+ int ssaReg = AddNewSReg(cUnit, dalvikReg);
cUnit->vRegToSSAMap[dalvikReg] = ssaReg;
defs[regIndex] = ssaReg;
}
/* Look up new SSA names for format_35c instructions */
-void dataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir)
+static void DataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir)
{
DecodedInstruction *dInsn = &mir->dalvikInsn;
int numUses = dInsn->vA;
int i;
mir->ssaRep->numUses = numUses;
- mir->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, true, kAllocDFInfo));
+ mir->ssaRep->uses = static_cast<int*>(NewMem(cUnit, sizeof(int) * numUses, true, kAllocDFInfo));
// NOTE: will be filled in during type & size inference pass
- mir->ssaRep->fpUse = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, true,
+ mir->ssaRep->fpUse = static_cast<bool*>(NewMem(cUnit, sizeof(bool) * numUses, true,
kAllocDFInfo));
for (i = 0; i < numUses; i++) {
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->arg[i], i);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->arg[i], i);
}
}
/* Look up new SSA names for format_3rc instructions */
-void dataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir)
+static void DataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir)
{
DecodedInstruction *dInsn = &mir->dalvikInsn;
int numUses = dInsn->vA;
int i;
mir->ssaRep->numUses = numUses;
- mir->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, true, kAllocDFInfo));
+ mir->ssaRep->uses = static_cast<int*>(NewMem(cUnit, sizeof(int) * numUses, true, kAllocDFInfo));
// NOTE: will be filled in during type & size inference pass
- mir->ssaRep->fpUse = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, true,
+ mir->ssaRep->fpUse = static_cast<bool*>(NewMem(cUnit, sizeof(bool) * numUses, true,
kAllocDFInfo));
for (i = 0; i < numUses; i++) {
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+i, i);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+i, i);
}
}
/* Entry function to convert a block into SSA representation */
-bool oatDoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb)
+bool DoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb)
{
MIR* mir;
if (bb->dataFlowInfo == NULL) return false;
for (mir = bb->firstMIRInsn; mir; mir = mir->next) {
- mir->ssaRep = static_cast<struct SSARepresentation *>(oatNew(cUnit, sizeof(SSARepresentation),
+ mir->ssaRep = static_cast<struct SSARepresentation *>(NewMem(cUnit, sizeof(SSARepresentation),
true, kAllocDFInfo));
int dfAttributes = oatDataFlowAttributes[mir->dalvikInsn.opcode];
@@ -1276,12 +1272,12 @@
int numUses = 0;
if (dfAttributes & DF_FORMAT_35C) {
- dataFlowSSAFormat35C(cUnit, mir);
+ DataFlowSSAFormat35C(cUnit, mir);
continue;
}
if (dfAttributes & DF_FORMAT_3RC) {
- dataFlowSSAFormat3RC(cUnit, mir);
+ DataFlowSSAFormat3RC(cUnit, mir);
continue;
}
@@ -1308,9 +1304,9 @@
if (numUses) {
mir->ssaRep->numUses = numUses;
- mir->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, false,
+ mir->ssaRep->uses = static_cast<int*>(NewMem(cUnit, sizeof(int) * numUses, false,
kAllocDFInfo));
- mir->ssaRep->fpUse = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, false,
+ mir->ssaRep->fpUse = static_cast<bool*>(NewMem(cUnit, sizeof(bool) * numUses, false,
kAllocDFInfo));
}
@@ -1325,9 +1321,9 @@
if (numDefs) {
mir->ssaRep->numDefs = numDefs;
- mir->ssaRep->defs = static_cast<int*>(oatNew(cUnit, sizeof(int) * numDefs, false,
+ mir->ssaRep->defs = static_cast<int*>(NewMem(cUnit, sizeof(int) * numDefs, false,
kAllocDFInfo));
- mir->ssaRep->fpDef = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numDefs, false,
+ mir->ssaRep->fpDef = static_cast<bool*>(NewMem(cUnit, sizeof(bool) * numDefs, false,
kAllocDFInfo));
}
@@ -1337,35 +1333,35 @@
numUses = 0;
if (dfAttributes & DF_UA) {
mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A;
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA, numUses++);
if (dfAttributes & DF_A_WIDE) {
mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_A;
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA+1, numUses++);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vA+1, numUses++);
}
}
if (dfAttributes & DF_UB) {
mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B;
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB, numUses++);
if (dfAttributes & DF_B_WIDE) {
mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_B;
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB+1, numUses++);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vB+1, numUses++);
}
}
if (dfAttributes & DF_UC) {
mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C;
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC, numUses++);
if (dfAttributes & DF_C_WIDE) {
mir->ssaRep->fpUse[numUses] = dfAttributes & DF_FP_C;
- handleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+1, numUses++);
+ HandleSSAUse(cUnit, mir->ssaRep->uses, dInsn->vC+1, numUses++);
}
}
}
if (dfAttributes & DF_HAS_DEFS) {
mir->ssaRep->fpDef[0] = dfAttributes & DF_FP_A;
- handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA, 0);
+ HandleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA, 0);
if (dfAttributes & DF_A_WIDE) {
mir->ssaRep->fpDef[1] = dfAttributes & DF_FP_A;
- handleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA+1, 1);
+ HandleSSADef(cUnit, mir->ssaRep->defs, dInsn->vA+1, 1);
}
}
}
@@ -1377,7 +1373,7 @@
* predecessor blocks.
*/
bb->dataFlowInfo->vRegToSSAMap =
- static_cast<int*>(oatNew(cUnit, sizeof(int) * cUnit->numDalvikRegisters, false,
+ static_cast<int*>(NewMem(cUnit, sizeof(int) * cUnit->numDalvikRegisters, false,
kAllocDFInfo));
memcpy(bb->dataFlowInfo->vRegToSSAMap, cUnit->vRegToSSAMap,
@@ -1387,13 +1383,13 @@
}
/* Setup a constant value for opcodes thare have the DF_SETS_CONST attribute */
-void setConstant(CompilationUnit* cUnit, int ssaReg, int value)
+static void SetConstant(CompilationUnit* cUnit, int ssaReg, int value)
{
- oatSetBit(cUnit, cUnit->isConstantV, ssaReg);
+ SetBit(cUnit, cUnit->isConstantV, ssaReg);
cUnit->constantValues[ssaReg] = value;
}
-bool oatDoConstantPropagation(CompilationUnit* cUnit, BasicBlock* bb)
+bool DoConstantPropogation(CompilationUnit* cUnit, BasicBlock* bb)
{
MIR* mir;
ArenaBitVector *isConstantV = cUnit->isConstantV;
@@ -1412,23 +1408,23 @@
case Instruction::CONST_4:
case Instruction::CONST_16:
case Instruction::CONST:
- setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB);
+ SetConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB);
break;
case Instruction::CONST_HIGH16:
- setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB << 16);
+ SetConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB << 16);
break;
case Instruction::CONST_WIDE_16:
case Instruction::CONST_WIDE_32:
- setConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB);
- setConstant(cUnit, mir->ssaRep->defs[1], 0);
+ SetConstant(cUnit, mir->ssaRep->defs[0], dInsn->vB);
+ SetConstant(cUnit, mir->ssaRep->defs[1], 0);
break;
case Instruction::CONST_WIDE:
- setConstant(cUnit, mir->ssaRep->defs[0], static_cast<int>(dInsn->vB_wide));
- setConstant(cUnit, mir->ssaRep->defs[1], static_cast<int>(dInsn->vB_wide >> 32));
+ SetConstant(cUnit, mir->ssaRep->defs[0], static_cast<int>(dInsn->vB_wide));
+ SetConstant(cUnit, mir->ssaRep->defs[1], static_cast<int>(dInsn->vB_wide >> 32));
break;
case Instruction::CONST_WIDE_HIGH16:
- setConstant(cUnit, mir->ssaRep->defs[0], 0);
- setConstant(cUnit, mir->ssaRep->defs[1], dInsn->vB << 16);
+ SetConstant(cUnit, mir->ssaRep->defs[0], 0);
+ SetConstant(cUnit, mir->ssaRep->defs[1], dInsn->vB << 16);
break;
default:
break;
@@ -1439,14 +1435,14 @@
int i;
for (i = 0; i < mir->ssaRep->numUses; i++) {
- if (!oatIsBitSet(isConstantV, mir->ssaRep->uses[i])) break;
+ if (!IsBitSet(isConstantV, mir->ssaRep->uses[i])) break;
}
/* Move a register holding a constant to another register */
if (i == mir->ssaRep->numUses) {
- setConstant(cUnit, mir->ssaRep->defs[0],
+ SetConstant(cUnit, mir->ssaRep->defs[0],
cUnit->constantValues[mir->ssaRep->uses[0]]);
if (dfAttributes & DF_A_WIDE) {
- setConstant(cUnit, mir->ssaRep->defs[1],
+ SetConstant(cUnit, mir->ssaRep->defs[1],
cUnit->constantValues[mir->ssaRep->uses[1]]);
}
}
@@ -1457,25 +1453,25 @@
}
/* Setup the basic data structures for SSA conversion */
-void oatInitializeSSAConversion(CompilationUnit* cUnit)
+void CompilerInitializeSSAConversion(CompilationUnit* cUnit)
{
int i;
int numDalvikReg = cUnit->numDalvikRegisters;
cUnit->ssaBaseVRegs =
- static_cast<GrowableList*>(oatNew(cUnit, sizeof(GrowableList), false, kAllocDFInfo));
+ static_cast<GrowableList*>(NewMem(cUnit, sizeof(GrowableList), false, kAllocDFInfo));
cUnit->ssaSubscripts =
- static_cast<GrowableList*>(oatNew(cUnit, sizeof(GrowableList), false, kAllocDFInfo));
+ static_cast<GrowableList*>(NewMem(cUnit, sizeof(GrowableList), false, kAllocDFInfo));
cUnit->ssaStrings =
- static_cast<GrowableList*>(oatNew(cUnit, sizeof(GrowableList), false, kAllocDFInfo));
+ static_cast<GrowableList*>(NewMem(cUnit, sizeof(GrowableList), false, kAllocDFInfo));
// Create the ssa mappings, estimating the max size
- oatInitGrowableList(cUnit, cUnit->ssaBaseVRegs,
+ CompilerInitGrowableList(cUnit, cUnit->ssaBaseVRegs,
numDalvikReg + cUnit->defCount + 128,
kListSSAtoDalvikMap);
- oatInitGrowableList(cUnit, cUnit->ssaSubscripts,
+ CompilerInitGrowableList(cUnit, cUnit->ssaSubscripts,
numDalvikReg + cUnit->defCount + 128,
kListSSAtoDalvikMap);
- oatInitGrowableList(cUnit, cUnit->ssaStrings,
+ CompilerInitGrowableList(cUnit, cUnit->ssaStrings,
numDalvikReg + cUnit->defCount + 128,
kListSSAtoDalvikMap);
/*
@@ -1490,12 +1486,12 @@
* into "(0 << 16) | i"
*/
for (i = 0; i < numDalvikReg; i++) {
- oatInsertGrowableList(cUnit, cUnit->ssaBaseVRegs, i);
- oatInsertGrowableList(cUnit, cUnit->ssaSubscripts, 0);
- std::string ssaName = getSSAName(cUnit, i);
- char* name = static_cast<char*>(oatNew(cUnit, ssaName.length() + 1, true, kAllocDFInfo));
+ InsertGrowableList(cUnit, cUnit->ssaBaseVRegs, i);
+ InsertGrowableList(cUnit, cUnit->ssaSubscripts, 0);
+ std::string ssaName = GetSSAName(cUnit, i);
+ char* name = static_cast<char*>(NewMem(cUnit, ssaName.length() + 1, true, kAllocDFInfo));
strncpy(name, ssaName.c_str(), ssaName.length() + 1);
- oatInsertGrowableList(cUnit, cUnit->ssaStrings, reinterpret_cast<uintptr_t>(name));
+ InsertGrowableList(cUnit, cUnit->ssaStrings, reinterpret_cast<uintptr_t>(name));
}
/*
@@ -1503,10 +1499,10 @@
* Dalvik register, and the SSA names for those are the same.
*/
cUnit->vRegToSSAMap =
- static_cast<int*>(oatNew(cUnit, sizeof(int) * numDalvikReg, false, kAllocDFInfo));
+ static_cast<int*>(NewMem(cUnit, sizeof(int) * numDalvikReg, false, kAllocDFInfo));
/* Keep track of the higest def for each dalvik reg */
cUnit->SSALastDefs =
- static_cast<int*>(oatNew(cUnit, sizeof(int) * numDalvikReg, false, kAllocDFInfo));
+ static_cast<int*>(NewMem(cUnit, sizeof(int) * numDalvikReg, false, kAllocDFInfo));
for (i = 0; i < numDalvikReg; i++) {
cUnit->vRegToSSAMap[i] = i;
@@ -1514,36 +1510,36 @@
}
/* Add ssa reg for Method* */
- cUnit->methodSReg = addNewSReg(cUnit, SSA_METHOD_BASEREG);
+ cUnit->methodSReg = AddNewSReg(cUnit, SSA_METHOD_BASEREG);
/*
* Allocate the BasicBlockDataFlow structure for the entry and code blocks
*/
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->blockList, &iterator);
+ GrowableListIteratorInit(&cUnit->blockList, &iterator);
while (true) {
- BasicBlock* bb = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iterator));
+ BasicBlock* bb = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iterator));
if (bb == NULL) break;
if (bb->hidden == true) continue;
if (bb->blockType == kDalvikByteCode ||
bb->blockType == kEntryBlock ||
bb->blockType == kExitBlock) {
- bb->dataFlowInfo = static_cast<BasicBlockDataFlow*>(oatNew(cUnit, sizeof(BasicBlockDataFlow),
+ bb->dataFlowInfo = static_cast<BasicBlockDataFlow*>(NewMem(cUnit, sizeof(BasicBlockDataFlow),
true, kAllocDFInfo));
}
}
}
/* Clear the visited flag for each BB */
-bool oatClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb)
+bool ClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
bb->visited = false;
return true;
}
-void oatDataFlowAnalysisDispatcher(CompilationUnit* cUnit,
+void DataFlowAnalysisDispatcher(CompilationUnit* cUnit,
bool (*func)(CompilationUnit*, BasicBlock*),
DataFlowAnalysisMode dfaMode,
bool isIterative)
@@ -1558,9 +1554,9 @@
case kAllNodes:
{
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&cUnit->blockList, &iterator);
+ GrowableListIteratorInit(&cUnit->blockList, &iterator);
while (true) {
- BasicBlock* bb = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iterator));
+ BasicBlock* bb = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iterator));
if (bb == NULL) break;
if (bb->hidden == true) continue;
change |= (*func)(cUnit, bb);
@@ -1577,7 +1573,7 @@
for (idx = 0; idx < numReachableBlocks; idx++) {
int blockIdx = cUnit->dfsOrder.elemList[idx];
BasicBlock* bb =
- reinterpret_cast<BasicBlock*>( oatGrowableListGetElement(blockList, blockIdx));
+ reinterpret_cast<BasicBlock*>( GrowableListGetElement(blockList, blockIdx));
change |= (*func)(cUnit, bb);
}
}
@@ -1593,7 +1589,7 @@
for (idx = 0; idx < numReachableBlocks; idx++) {
int dfsIdx = cUnit->dfsOrder.elemList[idx];
BasicBlock* bb =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, dfsIdx));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, dfsIdx));
change |= (*func)(cUnit, bb);
}
}
@@ -1608,7 +1604,7 @@
for (idx = numReachableBlocks - 1; idx >= 0; idx--) {
int dfsIdx = cUnit->dfsOrder.elemList[idx];
BasicBlock* bb =
- reinterpret_cast<BasicBlock *>( oatGrowableListGetElement(blockList, dfsIdx));
+ reinterpret_cast<BasicBlock *>( GrowableListGetElement(blockList, dfsIdx));
change |= (*func)(cUnit, bb);
}
}
@@ -1623,7 +1619,7 @@
for (idx = 0; idx < numReachableBlocks; idx++) {
int domIdx = cUnit->domPostOrderTraversal.elemList[idx];
BasicBlock* bb =
- reinterpret_cast<BasicBlock*>( oatGrowableListGetElement(blockList, domIdx));
+ reinterpret_cast<BasicBlock*>( GrowableListGetElement(blockList, domIdx));
change |= (*func)(cUnit, bb);
}
}
@@ -1638,7 +1634,7 @@
for (idx = numReachableBlocks - 1; idx >= 0; idx--) {
int revIdx = cUnit->dfsPostOrder.elemList[idx];
BasicBlock* bb =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, revIdx));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, revIdx));
change |= (*func)(cUnit, bb);
}
}
@@ -1652,8 +1648,8 @@
}
/* Advance to next strictly dominated MIR node in an extended basic block */
-MIR* advanceMIR(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir,
- ArenaBitVector* bv, bool clearMark) {
+static MIR* AdvanceMIR(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir,
+ ArenaBitVector* bv, bool clearMark) {
BasicBlock* bb = *pBb;
if (mir != NULL) {
mir = mir->next;
@@ -1663,7 +1659,7 @@
mir = NULL;
} else {
if (bv) {
- oatSetBit(cUnit, bv, bb->id);
+ SetBit(cUnit, bv, bb->id);
}
*pBb = bb;
mir = bb->firstMIRInsn;
@@ -1683,10 +1679,10 @@
* opcodes or incoming arcs. However, if the result of the invoke is not
* used, a move-result may not be present.
*/
-MIR* oatFindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
+MIR* FindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
{
BasicBlock* tbb = bb;
- mir = advanceMIR(cUnit, &tbb, mir, NULL, false);
+ mir = AdvanceMIR(cUnit, &tbb, mir, NULL, false);
while (mir != NULL) {
int opcode = mir->dalvikInsn.opcode;
if ((mir->dalvikInsn.opcode == Instruction::MOVE_RESULT) ||
@@ -1698,17 +1694,17 @@
if (opcode < kNumPackedOpcodes) {
mir = NULL;
} else {
- mir = advanceMIR(cUnit, &tbb, mir, NULL, false);
+ mir = AdvanceMIR(cUnit, &tbb, mir, NULL, false);
}
}
return mir;
}
-void squashDupRangeChecks(CompilationUnit* cUnit, BasicBlock** pBp, MIR* mir,
- int arraySreg, int indexSreg)
+static void SquashDupRangeChecks(CompilationUnit* cUnit, BasicBlock** pBp, MIR* mir,
+ int arraySreg, int indexSreg)
{
while (true) {
- mir = advanceMIR(cUnit, pBp, mir, NULL, false);
+ mir = AdvanceMIR(cUnit, pBp, mir, NULL, false);
if (!mir) {
break;
}
@@ -1756,55 +1752,8 @@
}
}
-/* Allocate a compiler temp, return Sreg. Reuse existing if no conflict */
-int allocCompilerTempSreg(CompilationUnit* cUnit, ArenaBitVector* bv)
-{
- for (int i = 0; i < cUnit->numCompilerTemps; i++) {
- CompilerTemp* ct = reinterpret_cast<CompilerTemp*>(cUnit->compilerTemps.elemList[i]);
- ArenaBitVector* tBv = ct->bv;
- if (!oatTestBitVectors(bv, tBv)) {
- // Combine live maps and reuse existing temp
- oatUnifyBitVectors(tBv, tBv, bv);
- return ct->sReg;
- }
- }
-
- // Create a new compiler temp & associated live bitmap
- CompilerTemp* ct =
- static_cast<CompilerTemp*>(oatNew(cUnit, sizeof(CompilerTemp), true, kAllocMisc));
- ArenaBitVector *nBv = oatAllocBitVector(cUnit, cUnit->numBlocks, true,
- kBitMapMisc);
- oatCopyBitVector(nBv, bv);
- ct->bv = nBv;
- ct->sReg = addNewSReg(cUnit, SSA_CTEMP_BASEREG - cUnit->numCompilerTemps);
- cUnit->numCompilerTemps++;
- oatInsertGrowableList(cUnit, &cUnit->compilerTemps, reinterpret_cast<uintptr_t>(ct));
- DCHECK_EQ(cUnit->numCompilerTemps, static_cast<int>(cUnit->compilerTemps.numUsed));
- return ct->sReg;
-}
-
-/* Creata a new MIR node for a new pseudo op. */
-MIR* rawMIR(CompilationUnit* cUnit, Instruction::Code opcode, int defs,
- int uses)
-{
- MIR* res = static_cast<MIR*>(oatNew(cUnit, sizeof(MIR), true, kAllocMIR));
- res->ssaRep = static_cast<struct SSARepresentation*>
- (oatNew(cUnit, sizeof(SSARepresentation), true, kAllocDFInfo));
- if (uses) {
- res->ssaRep->numUses = uses;
- res->ssaRep->uses = static_cast<int*>(oatNew(cUnit, sizeof(int) * uses, false, kAllocDFInfo));
- }
- if (defs) {
- res->ssaRep->numDefs = defs;
- res->ssaRep->defs = static_cast<int*>(oatNew(cUnit, sizeof(int) * defs, false, kAllocDFInfo));
- res->ssaRep->fpDef = static_cast<bool*>(oatNew(cUnit, sizeof(bool) * defs, true, kAllocDFInfo));
- }
- res->dalvikInsn.opcode = opcode;
- return res;
-}
-
/* Do some MIR-level basic block optimizations */
-bool basicBlockOpt(CompilationUnit* cUnit, BasicBlock* bb)
+static bool BasicBlockOpt(CompilationUnit* cUnit, BasicBlock* bb)
{
int numTemps = 0;
@@ -1823,7 +1772,7 @@
int arrSreg = mir->ssaRep->uses[0];
int idxSreg = mir->ssaRep->uses[1];
BasicBlock* tbb = bb;
- squashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg);
+ SquashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg);
}
break;
case Instruction::APUT:
@@ -1838,7 +1787,7 @@
int arrSreg = mir->ssaRep->uses[start];
int idxSreg = mir->ssaRep->uses[start + 1];
BasicBlock* tbb = bb;
- squashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg);
+ SquashDupRangeChecks(cUnit, &tbb, mir, arrSreg, idxSreg);
}
break;
case Instruction::CMPL_FLOAT:
@@ -1879,7 +1828,7 @@
// Make sure result of cmp is used by next insn and nowhere else
if ((ccode != kCondNv) &&
(mir->ssaRep->defs[0] == mirNext->ssaRep->uses[0]) &&
- (getSSAUseCount(cUnit, mir->ssaRep->defs[0]) == 1)) {
+ (GetSSAUseCount(cUnit, mir->ssaRep->defs[0]) == 1)) {
mirNext->dalvikInsn.arg[0] = ccode;
switch(opcode) {
case Instruction::CMPL_FLOAT:
@@ -1925,18 +1874,17 @@
return true;
}
-bool nullCheckEliminationInit(struct CompilationUnit* cUnit,
- struct BasicBlock* bb)
+static bool NullCheckEliminationInit(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
if (bb->dataFlowInfo == NULL) return false;
bb->dataFlowInfo->endingNullCheckV =
- oatAllocBitVector(cUnit, cUnit->numSSARegs, false, kBitMapNullCheck);
- oatClearAllBits(bb->dataFlowInfo->endingNullCheckV);
+ AllocBitVector(cUnit, cUnit->numSSARegs, false, kBitMapNullCheck);
+ ClearAllBits(bb->dataFlowInfo->endingNullCheckV);
return true;
}
/* Collect stats on number of checks removed */
-bool countChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb)
+static bool CountChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
if (bb->dataFlowInfo == NULL) return false;
for (MIR* mir = bb->firstMIRInsn; mir; mir = mir->next) {
@@ -1961,7 +1909,7 @@
}
/* Try to make common case the fallthrough path */
-bool layoutBlocks(struct CompilationUnit* cUnit, struct BasicBlock* bb)
+static bool LayoutBlocks(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
// TODO: For now, just looking for direct throws. Consider generalizing for profile feedback
if (!bb->explicitThrow) {
@@ -2009,7 +1957,7 @@
}
/* Combine any basic blocks terminated by instructions that we now know can't throw */
-bool combineBlocks(struct CompilationUnit* cUnit, struct BasicBlock* bb)
+static bool CombineBlocks(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
// Loop here to allow combining a sequence of blocks
while (true) {
@@ -2073,7 +2021,7 @@
}
/* Eliminate unnecessary null checks for a basic block. */
-bool eliminateNullChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb)
+static bool EliminateNullChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
if (bb->dataFlowInfo == NULL) return false;
@@ -2083,28 +2031,28 @@
* status (except for "this").
*/
if ((bb->blockType == kEntryBlock) | bb->catchEntry) {
- oatClearAllBits(cUnit->tempSSARegisterV);
+ ClearAllBits(cUnit->tempSSARegisterV);
if ((cUnit->access_flags & kAccStatic) == 0) {
// If non-static method, mark "this" as non-null
int thisReg = cUnit->numDalvikRegisters - cUnit->numIns;
- oatSetBit(cUnit, cUnit->tempSSARegisterV, thisReg);
+ SetBit(cUnit, cUnit->tempSSARegisterV, thisReg);
}
} else {
// Starting state is intesection of all incoming arcs
GrowableListIterator iter;
- oatGrowableListIteratorInit(bb->predecessors, &iter);
- BasicBlock* predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ GrowableListIteratorInit(bb->predecessors, &iter);
+ BasicBlock* predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
DCHECK(predBB != NULL);
- oatCopyBitVector(cUnit->tempSSARegisterV,
+ CopyBitVector(cUnit->tempSSARegisterV,
predBB->dataFlowInfo->endingNullCheckV);
while (true) {
- predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
if (!predBB) break;
if ((predBB->dataFlowInfo == NULL) ||
(predBB->dataFlowInfo->endingNullCheckV == NULL)) {
continue;
}
- oatIntersectBitVectors(cUnit->tempSSARegisterV,
+ IntersectBitVectors(cUnit->tempSSARegisterV,
cUnit->tempSSARegisterV,
predBB->dataFlowInfo->endingNullCheckV);
}
@@ -2119,7 +2067,7 @@
// Mark target of NEW* as non-null
if (dfAttributes & DF_NON_NULL_DST) {
- oatSetBit(cUnit, cUnit->tempSSARegisterV, mir->ssaRep->defs[0]);
+ SetBit(cUnit, cUnit->tempSSARegisterV, mir->ssaRep->defs[0]);
}
// Mark non-null returns from invoke-style NEW*
@@ -2129,7 +2077,7 @@
if (nextMir &&
nextMir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) {
// Mark as null checked
- oatSetBit(cUnit, cUnit->tempSSARegisterV, nextMir->ssaRep->defs[0]);
+ SetBit(cUnit, cUnit->tempSSARegisterV, nextMir->ssaRep->defs[0]);
} else {
if (nextMir) {
LOG(WARNING) << "Unexpected opcode following new: " << nextMir->dalvikInsn.opcode;
@@ -2144,7 +2092,7 @@
// First non-pseudo should be MOVE_RESULT_OBJECT
if (tmir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) {
// Mark as null checked
- oatSetBit(cUnit, cUnit->tempSSARegisterV, tmir->ssaRep->defs[0]);
+ SetBit(cUnit, cUnit->tempSSARegisterV, tmir->ssaRep->defs[0]);
} else {
LOG(WARNING) << "Unexpected op after new: " << tmir->dalvikInsn.opcode;
}
@@ -2165,11 +2113,11 @@
mir->ssaRep->numUses;
bool nullChecked = true;
for (int i = 0; i < operands; i++) {
- nullChecked &= oatIsBitSet(cUnit->tempSSARegisterV,
+ nullChecked &= IsBitSet(cUnit->tempSSARegisterV,
mir->ssaRep->uses[i]);
}
if (nullChecked) {
- oatSetBit(cUnit, cUnit->tempSSARegisterV, tgtSreg);
+ SetBit(cUnit, cUnit->tempSSARegisterV, tgtSreg);
}
}
@@ -2184,54 +2132,54 @@
srcIdx = 0;
}
int srcSreg = mir->ssaRep->uses[srcIdx];
- if (oatIsBitSet(cUnit->tempSSARegisterV, srcSreg)) {
+ if (IsBitSet(cUnit->tempSSARegisterV, srcSreg)) {
// Eliminate the null check
mir->optimizationFlags |= MIR_IGNORE_NULL_CHECK;
} else {
// Mark sReg as null-checked
- oatSetBit(cUnit, cUnit->tempSSARegisterV, srcSreg);
+ SetBit(cUnit, cUnit->tempSSARegisterV, srcSreg);
}
}
}
// Did anything change?
- bool res = oatCompareBitVectors(bb->dataFlowInfo->endingNullCheckV,
+ bool res = CompareBitVectors(bb->dataFlowInfo->endingNullCheckV,
cUnit->tempSSARegisterV);
if (res) {
- oatCopyBitVector(bb->dataFlowInfo->endingNullCheckV,
+ CopyBitVector(bb->dataFlowInfo->endingNullCheckV,
cUnit->tempSSARegisterV);
}
return res;
}
-void oatMethodNullCheckElimination(CompilationUnit *cUnit)
+void NullCheckElimination(CompilationUnit *cUnit)
{
if (!(cUnit->disableOpt & (1 << kNullCheckElimination))) {
DCHECK(cUnit->tempSSARegisterV != NULL);
- oatDataFlowAnalysisDispatcher(cUnit, nullCheckEliminationInit, kAllNodes,
+ DataFlowAnalysisDispatcher(cUnit, NullCheckEliminationInit, kAllNodes,
false /* isIterative */);
- oatDataFlowAnalysisDispatcher(cUnit, eliminateNullChecks,
+ DataFlowAnalysisDispatcher(cUnit, EliminateNullChecks,
kPreOrderDFSTraversal,
true /* isIterative */);
}
}
-void oatMethodBasicBlockCombine(CompilationUnit* cUnit)
+void BasicBlockCombine(CompilationUnit* cUnit)
{
- oatDataFlowAnalysisDispatcher(cUnit, combineBlocks, kPreOrderDFSTraversal, false);
+ DataFlowAnalysisDispatcher(cUnit, CombineBlocks, kPreOrderDFSTraversal, false);
}
-void oatMethodCodeLayout(CompilationUnit* cUnit)
+void CodeLayout(CompilationUnit* cUnit)
{
- oatDataFlowAnalysisDispatcher(cUnit, layoutBlocks, kAllNodes, false);
+ DataFlowAnalysisDispatcher(cUnit, LayoutBlocks, kAllNodes, false);
}
-void oatDumpCheckStats(CompilationUnit *cUnit)
+void DumpCheckStats(CompilationUnit *cUnit)
{
Checkstats* stats =
- static_cast<Checkstats*>(oatNew(cUnit, sizeof(Checkstats), true, kAllocDFInfo));
+ static_cast<Checkstats*>(NewMem(cUnit, sizeof(Checkstats), true, kAllocDFInfo));
cUnit->checkstats = stats;
- oatDataFlowAnalysisDispatcher(cUnit, countChecks, kAllNodes, false /* isIterative */);
+ DataFlowAnalysisDispatcher(cUnit, CountChecks, kAllNodes, false /* isIterative */);
if (stats->nullChecks > 0) {
float eliminated = static_cast<float>(stats->nullChecksEliminated);
float checks = static_cast<float>(stats->nullChecks);
@@ -2248,37 +2196,37 @@
}
}
-void oatMethodBasicBlockOptimization(CompilationUnit *cUnit)
+void BasicBlockOptimization(CompilationUnit *cUnit)
{
if (!(cUnit->disableOpt & (1 << kBBOpt))) {
- oatInitGrowableList(cUnit, &cUnit->compilerTemps, 6, kListMisc);
+ CompilerInitGrowableList(cUnit, &cUnit->compilerTemps, 6, kListMisc);
DCHECK_EQ(cUnit->numCompilerTemps, 0);
- oatDataFlowAnalysisDispatcher(cUnit, basicBlockOpt,
+ DataFlowAnalysisDispatcher(cUnit, BasicBlockOpt,
kAllNodes, false /* isIterative */);
}
}
-void addLoopHeader(CompilationUnit* cUnit, BasicBlock* header,
- BasicBlock* backEdge)
+static void AddLoopHeader(CompilationUnit* cUnit, BasicBlock* header,
+ BasicBlock* backEdge)
{
GrowableListIterator iter;
- oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter);
- for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter));
- (loop != NULL); loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) {
+ GrowableListIteratorInit(&cUnit->loopHeaders, &iter);
+ for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter));
+ (loop != NULL); loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter))) {
if (loop->header == header) {
- oatInsertGrowableList(cUnit, &loop->incomingBackEdges,
+ InsertGrowableList(cUnit, &loop->incomingBackEdges,
reinterpret_cast<uintptr_t>(backEdge));
return;
}
}
- LoopInfo* info = static_cast<LoopInfo*>(oatNew(cUnit, sizeof(LoopInfo), true, kAllocDFInfo));
+ LoopInfo* info = static_cast<LoopInfo*>(NewMem(cUnit, sizeof(LoopInfo), true, kAllocDFInfo));
info->header = header;
- oatInitGrowableList(cUnit, &info->incomingBackEdges, 2, kListMisc);
- oatInsertGrowableList(cUnit, &info->incomingBackEdges, reinterpret_cast<uintptr_t>(backEdge));
- oatInsertGrowableList(cUnit, &cUnit->loopHeaders, reinterpret_cast<uintptr_t>(info));
+ CompilerInitGrowableList(cUnit, &info->incomingBackEdges, 2, kListMisc);
+ InsertGrowableList(cUnit, &info->incomingBackEdges, reinterpret_cast<uintptr_t>(backEdge));
+ InsertGrowableList(cUnit, &cUnit->loopHeaders, reinterpret_cast<uintptr_t>(info));
}
-bool findBackEdges(struct CompilationUnit* cUnit, struct BasicBlock* bb)
+static bool FindBackEdges(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
if ((bb->dataFlowInfo == NULL) || (bb->lastMIRInsn == NULL)) {
return false;
@@ -2287,58 +2235,58 @@
if (Instruction::FlagsOf(opcode) & Instruction::kBranch) {
if (bb->taken && (bb->taken->startOffset <= bb->startOffset)) {
DCHECK(bb->dominators != NULL);
- if (oatIsBitSet(bb->dominators, bb->taken->id)) {
+ if (IsBitSet(bb->dominators, bb->taken->id)) {
if (cUnit->printMe) {
LOG(INFO) << "Loop backedge from 0x"
<< std::hex << bb->lastMIRInsn->offset
<< " to 0x" << std::hex << bb->taken->startOffset;
}
- addLoopHeader(cUnit, bb->taken, bb);
+ AddLoopHeader(cUnit, bb->taken, bb);
}
}
}
return false;
}
-void addBlocksToLoop(CompilationUnit* cUnit, ArenaBitVector* blocks,
- BasicBlock* bb, int headId)
+static void AddBlocksToLoop(CompilationUnit* cUnit, ArenaBitVector* blocks,
+ BasicBlock* bb, int headId)
{
- if (!oatIsBitSet(bb->dominators, headId) ||
- oatIsBitSet(blocks, bb->id)) {
+ if (!IsBitSet(bb->dominators, headId) ||
+ IsBitSet(blocks, bb->id)) {
return;
}
- oatSetBit(cUnit, blocks, bb->id);
+ SetBit(cUnit, blocks, bb->id);
GrowableListIterator iter;
- oatGrowableListIteratorInit(bb->predecessors, &iter);
+ GrowableListIteratorInit(bb->predecessors, &iter);
BasicBlock* predBB;
- for (predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); predBB;
- predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter))) {
- addBlocksToLoop(cUnit, blocks, predBB, headId);
+ for (predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter)); predBB;
+ predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter))) {
+ AddBlocksToLoop(cUnit, blocks, predBB, headId);
}
}
-void oatDumpLoops(CompilationUnit *cUnit)
+static void DumpLoops(CompilationUnit *cUnit)
{
GrowableListIterator iter;
- oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter);
- for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter));
- (loop != NULL); loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) {
+ GrowableListIteratorInit(&cUnit->loopHeaders, &iter);
+ for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter));
+ (loop != NULL); loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter))) {
LOG(INFO) << "Loop head block id " << loop->header->id
<< ", offset 0x" << std::hex << loop->header->startOffset
<< ", Depth: " << loop->header->nestingDepth;
GrowableListIterator iter;
- oatGrowableListIteratorInit(&loop->incomingBackEdges, &iter);
+ GrowableListIteratorInit(&loop->incomingBackEdges, &iter);
BasicBlock* edgeBB;
- for (edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); edgeBB;
- edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter))) {
+ for (edgeBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter)); edgeBB;
+ edgeBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter))) {
LOG(INFO) << " Backedge block id " << edgeBB->id
<< ", offset 0x" << std::hex << edgeBB->startOffset;
ArenaBitVectorIterator bIter;
- oatBitVectorIteratorInit(loop->blocks, &bIter);
- for (int bbId = oatBitVectorIteratorNext(&bIter); bbId != -1;
- bbId = oatBitVectorIteratorNext(&bIter)) {
+ BitVectorIteratorInit(loop->blocks, &bIter);
+ for (int bbId = BitVectorIteratorNext(&bIter); bbId != -1;
+ bbId = BitVectorIteratorNext(&bIter)) {
BasicBlock *bb;
- bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(&cUnit->blockList, bbId));
+ bb = reinterpret_cast<BasicBlock*>(GrowableListGetElement(&cUnit->blockList, bbId));
LOG(INFO) << " (" << bb->id << ", 0x" << std::hex
<< bb->startOffset << ")";
}
@@ -2346,60 +2294,60 @@
}
}
-void oatMethodLoopDetection(CompilationUnit *cUnit)
+void LoopDetection(CompilationUnit *cUnit)
{
if (cUnit->disableOpt & (1 << kPromoteRegs)) {
return;
}
- oatInitGrowableList(cUnit, &cUnit->loopHeaders, 6, kListMisc);
+ CompilerInitGrowableList(cUnit, &cUnit->loopHeaders, 6, kListMisc);
// Find the loop headers
- oatDataFlowAnalysisDispatcher(cUnit, findBackEdges, kAllNodes, false /* isIterative */);
+ DataFlowAnalysisDispatcher(cUnit, FindBackEdges, kAllNodes, false /* isIterative */);
GrowableListIterator iter;
- oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter);
+ GrowableListIteratorInit(&cUnit->loopHeaders, &iter);
// Add blocks to each header
- for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter));
- loop; loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) {
- loop->blocks = oatAllocBitVector(cUnit, cUnit->numBlocks, true,
+ for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter));
+ loop; loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter))) {
+ loop->blocks = AllocBitVector(cUnit, cUnit->numBlocks, true,
kBitMapMisc);
- oatSetBit(cUnit, loop->blocks, loop->header->id);
+ SetBit(cUnit, loop->blocks, loop->header->id);
GrowableListIterator iter;
- oatGrowableListIteratorInit(&loop->incomingBackEdges, &iter);
+ GrowableListIteratorInit(&loop->incomingBackEdges, &iter);
BasicBlock* edgeBB;
- for (edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter)); edgeBB;
- edgeBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter))) {
- addBlocksToLoop(cUnit, loop->blocks, edgeBB, loop->header->id);
+ for (edgeBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter)); edgeBB;
+ edgeBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter))) {
+ AddBlocksToLoop(cUnit, loop->blocks, edgeBB, loop->header->id);
}
}
// Compute the nesting depth of each header
- oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter);
- for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter));
- loop; loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) {
+ GrowableListIteratorInit(&cUnit->loopHeaders, &iter);
+ for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter));
+ loop; loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter))) {
GrowableListIterator iter2;
- oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter2);
+ GrowableListIteratorInit(&cUnit->loopHeaders, &iter2);
LoopInfo* loop2;
- for (loop2 = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter2));
- loop2; loop2 = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter2))) {
- if (oatIsBitSet(loop2->blocks, loop->header->id)) {
+ for (loop2 = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter2));
+ loop2; loop2 = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter2))) {
+ if (IsBitSet(loop2->blocks, loop->header->id)) {
loop->header->nestingDepth++;
}
}
}
// Assign nesting depth to each block in all loops
- oatGrowableListIteratorInit(&cUnit->loopHeaders, &iter);
- for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter));
- (loop != NULL); loop = reinterpret_cast<LoopInfo*>(oatGrowableListIteratorNext(&iter))) {
+ GrowableListIteratorInit(&cUnit->loopHeaders, &iter);
+ for (LoopInfo* loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter));
+ (loop != NULL); loop = reinterpret_cast<LoopInfo*>(GrowableListIteratorNext(&iter))) {
ArenaBitVectorIterator bIter;
- oatBitVectorIteratorInit(loop->blocks, &bIter);
- for (int bbId = oatBitVectorIteratorNext(&bIter); bbId != -1;
- bbId = oatBitVectorIteratorNext(&bIter)) {
+ BitVectorIteratorInit(loop->blocks, &bIter);
+ for (int bbId = BitVectorIteratorNext(&bIter); bbId != -1;
+ bbId = BitVectorIteratorNext(&bIter)) {
BasicBlock *bb;
- bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(&cUnit->blockList, bbId));
+ bb = reinterpret_cast<BasicBlock*>(GrowableListGetElement(&cUnit->blockList, bbId));
bb->nestingDepth = std::max(bb->nestingDepth,
loop->header->nestingDepth);
}
}
if (cUnit->printMe) {
- oatDumpLoops(cUnit);
+ DumpLoops(cUnit);
}
}
@@ -2409,7 +2357,7 @@
* and attempting to do would involve more complexity than it's
* worth.
*/
-bool invokeUsesMethodStar(CompilationUnit* cUnit, MIR* mir)
+static bool InvokeUsesMethodStar(CompilationUnit* cUnit, MIR* mir)
{
InvokeType type;
Instruction::Code opcode = mir->dalvikInsn.opcode;
@@ -2460,7 +2408,7 @@
* counts explicitly used sRegs. A later phase will add implicit
* counts for things such as Method*, null-checked references, etc.
*/
-bool countUses(struct CompilationUnit* cUnit, struct BasicBlock* bb)
+static bool CountUses(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
if (bb->blockType != kDalvikByteCode) {
return false;
@@ -2482,14 +2430,14 @@
if (dfAttributes & DF_UMS) {
/*
* Some invokes will not use Method* - need to perform test similar
- * to that found in genInvoke() to decide whether to count refs
+ * to that found in GenInvoke() to decide whether to count refs
* for Method* on invoke-class opcodes.
- * TODO: refactor for common test here, save results for genInvoke
+ * TODO: refactor for common test here, save results for GenInvoke
*/
int usesMethodStar = true;
if ((dfAttributes & (DF_FORMAT_35C | DF_FORMAT_3RC)) &&
!(dfAttributes & DF_NON_NULL_RET)) {
- usesMethodStar &= invokeUsesMethodStar(cUnit, mir);
+ usesMethodStar &= InvokeUsesMethodStar(cUnit, mir);
}
if (usesMethodStar) {
cUnit->rawUseCounts.elemList[cUnit->methodSReg]++;
@@ -2501,19 +2449,19 @@
return false;
}
-void oatMethodUseCount(CompilationUnit *cUnit)
+void MethodUseCount(CompilationUnit *cUnit)
{
- oatInitGrowableList(cUnit, &cUnit->useCounts, cUnit->numSSARegs + 32, kListMisc);
- oatInitGrowableList(cUnit, &cUnit->rawUseCounts, cUnit->numSSARegs + 32, kListMisc);
+ CompilerInitGrowableList(cUnit, &cUnit->useCounts, cUnit->numSSARegs + 32, kListMisc);
+ CompilerInitGrowableList(cUnit, &cUnit->rawUseCounts, cUnit->numSSARegs + 32, kListMisc);
// Initialize list
for (int i = 0; i < cUnit->numSSARegs; i++) {
- oatInsertGrowableList(cUnit, &cUnit->useCounts, 0);
- oatInsertGrowableList(cUnit, &cUnit->rawUseCounts, 0);
+ InsertGrowableList(cUnit, &cUnit->useCounts, 0);
+ InsertGrowableList(cUnit, &cUnit->rawUseCounts, 0);
}
if (cUnit->disableOpt & (1 << kPromoteRegs)) {
return;
}
- oatDataFlowAnalysisDispatcher(cUnit, countUses,
+ DataFlowAnalysisDispatcher(cUnit, CountUses,
kAllNodes, false /* isIterative */);
}
diff --git a/src/compiler/dataflow.h b/src/compiler/dataflow.h
index ff15939..35259ed 100644
--- a/src/compiler/dataflow.h
+++ b/src/compiler/dataflow.h
@@ -158,24 +158,23 @@
};
int SRegToVReg(const CompilationUnit* cUnit, int ssaReg);
-char* oatGetDalvikDisassembly(CompilationUnit* cUnit, const DecodedInstruction& insn, const char* note);
-char* oatFullDisassembler(CompilationUnit* cUnit, const MIR* mir);
-char* oatGetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep);
-bool oatFindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb);
-bool oatDoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb);
-bool oatDoConstantPropagation(CompilationUnit* cUnit, BasicBlock* bb);
-void oatInitializeSSAConversion(CompilationUnit* cUnit);
-bool oatClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb);
-void oatDataFlowAnalysisDispatcher(CompilationUnit* cUnit, bool (*func)(CompilationUnit*, BasicBlock*), DataFlowAnalysisMode dfaMode, bool isIterative);
-MIR* oatFindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
-void oatMethodNullCheckElimination(CompilationUnit *cUnit);
-void oatMethodBasicBlockCombine(CompilationUnit* cUnit);
-void oatMethodCodeLayout(CompilationUnit* cUnit);
-void oatDumpCheckStats(CompilationUnit *cUnit);
-void oatMethodBasicBlockOptimization(CompilationUnit *cUnit);
-void oatDumpLoops(CompilationUnit *cUnit);
-void oatMethodLoopDetection(CompilationUnit *cUnit);
-void oatMethodUseCount(CompilationUnit *cUnit);
+char* GetDalvikDisassembly(CompilationUnit* cUnit, const DecodedInstruction& insn, const char* note);
+char* FullDisassembler(CompilationUnit* cUnit, const MIR* mir);
+char* GetSSAString(CompilationUnit* cUnit, SSARepresentation* ssaRep);
+bool FindLocalLiveIn(CompilationUnit* cUnit, BasicBlock* bb);
+bool DoSSAConversion(CompilationUnit* cUnit, BasicBlock* bb);
+bool DoConstantPropogation(CompilationUnit* cUnit, BasicBlock* bb);
+void CompilerInitializeSSAConversion(CompilationUnit* cUnit);
+bool ClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb);
+void DataFlowAnalysisDispatcher(CompilationUnit* cUnit, bool (*func)(CompilationUnit*, BasicBlock*), DataFlowAnalysisMode dfaMode, bool isIterative);
+MIR* FindMoveResult(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
+void NullCheckElimination(CompilationUnit *cUnit);
+void BasicBlockCombine(CompilationUnit* cUnit);
+void CodeLayout(CompilationUnit* cUnit);
+void DumpCheckStats(CompilationUnit *cUnit);
+void BasicBlockOptimization(CompilationUnit *cUnit);
+void LoopDetection(CompilationUnit *cUnit);
+void MethodUseCount(CompilationUnit *cUnit);
} // namespace art
diff --git a/src/compiler/frontend.cc b/src/compiler/frontend.cc
index c329e9d..7fb8011 100644
--- a/src/compiler/frontend.cc
+++ b/src/compiler/frontend.cc
@@ -98,7 +98,7 @@
//(1 << kDebugVerifyBitcode) |
0;
-inline bool contentIsInsn(const uint16_t* codePtr) {
+static inline bool ContentIsInsn(const uint16_t* codePtr) {
uint16_t instr = *codePtr;
Instruction::Code opcode = static_cast<Instruction::Code>(instr & 0xff);
@@ -112,11 +112,11 @@
/*
* Parse an instruction, return the length of the instruction
*/
-inline int parseInsn(CompilationUnit* cUnit, const uint16_t* codePtr,
- DecodedInstruction* decoded_instruction, bool printMe)
+static inline int ParseInsn(CompilationUnit* cUnit, const uint16_t* codePtr,
+ DecodedInstruction* decoded_instruction, bool printMe)
{
// Don't parse instruction data
- if (!contentIsInsn(codePtr)) {
+ if (!ContentIsInsn(codePtr)) {
return 0;
}
@@ -124,7 +124,7 @@
*decoded_instruction = DecodedInstruction(instruction);
if (printMe) {
- char* decodedString = oatGetDalvikDisassembly(cUnit, *decoded_instruction,
+ char* decodedString = GetDalvikDisassembly(cUnit, *decoded_instruction,
NULL);
LOG(INFO) << codePtr << ": 0x" << std::hex << static_cast<int>(decoded_instruction->opcode)
<< " " << decodedString;
@@ -134,7 +134,7 @@
#define UNKNOWN_TARGET 0xffffffff
-inline bool isGoto(MIR* insn) {
+static inline bool IsGoto(MIR* insn) {
switch (insn->dalvikInsn.opcode) {
case Instruction::GOTO:
case Instruction::GOTO_16:
@@ -145,24 +145,9 @@
}
}
-/*
- * Identify unconditional branch instructions
- */
-inline bool isUnconditionalBranch(MIR* insn) {
- switch (insn->dalvikInsn.opcode) {
- case Instruction::RETURN_VOID:
- case Instruction::RETURN:
- case Instruction::RETURN_WIDE:
- case Instruction::RETURN_OBJECT:
- return true;
- default:
- return isGoto(insn);
- }
-}
-
/* Split an existing block from the specified code offset into two */
-BasicBlock *splitBlock(CompilationUnit* cUnit, unsigned int codeOffset,
- BasicBlock* origBlock, BasicBlock** immedPredBlockP)
+static BasicBlock *SplitBlock(CompilationUnit* cUnit, unsigned int codeOffset,
+ BasicBlock* origBlock, BasicBlock** immedPredBlockP)
{
MIR* insn = origBlock->firstMIRInsn;
while (insn) {
@@ -172,9 +157,9 @@
if (insn == NULL) {
LOG(FATAL) << "Break split failed";
}
- BasicBlock *bottomBlock = oatNewBB(cUnit, kDalvikByteCode,
+ BasicBlock *bottomBlock = NewMemBB(cUnit, kDalvikByteCode,
cUnit->numBlocks++);
- oatInsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(bottomBlock));
+ InsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(bottomBlock));
bottomBlock->startOffset = codeOffset;
bottomBlock->firstMIRInsn = insn;
@@ -187,20 +172,20 @@
bottomBlock->taken = origBlock->taken;
if (bottomBlock->taken) {
origBlock->taken = NULL;
- oatDeleteGrowableList(bottomBlock->taken->predecessors, reinterpret_cast<uintptr_t>(origBlock));
- oatInsertGrowableList(cUnit, bottomBlock->taken->predecessors,
+ DeleteGrowableList(bottomBlock->taken->predecessors, reinterpret_cast<uintptr_t>(origBlock));
+ InsertGrowableList(cUnit, bottomBlock->taken->predecessors,
reinterpret_cast<uintptr_t>(bottomBlock));
}
/* Handle the fallthrough path */
bottomBlock->fallThrough = origBlock->fallThrough;
origBlock->fallThrough = bottomBlock;
- oatInsertGrowableList(cUnit, bottomBlock->predecessors,
+ InsertGrowableList(cUnit, bottomBlock->predecessors,
reinterpret_cast<uintptr_t>(origBlock));
if (bottomBlock->fallThrough) {
- oatDeleteGrowableList(bottomBlock->fallThrough->predecessors,
+ DeleteGrowableList(bottomBlock->fallThrough->predecessors,
reinterpret_cast<uintptr_t>(origBlock));
- oatInsertGrowableList(cUnit, bottomBlock->fallThrough->predecessors,
+ InsertGrowableList(cUnit, bottomBlock->fallThrough->predecessors,
reinterpret_cast<uintptr_t>(bottomBlock));
}
@@ -210,15 +195,15 @@
origBlock->successorBlockList.blockListType = kNotUsed;
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&bottomBlock->successorBlockList.blocks,
+ GrowableListIteratorInit(&bottomBlock->successorBlockList.blocks,
&iterator);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
if (successorBlockInfo == NULL) break;
BasicBlock *bb = successorBlockInfo->block;
- oatDeleteGrowableList(bb->predecessors, reinterpret_cast<uintptr_t>(origBlock));
- oatInsertGrowableList(cUnit, bb->predecessors, reinterpret_cast<uintptr_t>(bottomBlock));
+ DeleteGrowableList(bb->predecessors, reinterpret_cast<uintptr_t>(origBlock));
+ InsertGrowableList(cUnit, bb->predecessors, reinterpret_cast<uintptr_t>(bottomBlock));
}
}
@@ -245,7 +230,7 @@
* (by the caller)
* Utilizes a map for fast lookup of the typical cases.
*/
-BasicBlock *findBlock(CompilationUnit* cUnit, unsigned int codeOffset,
+BasicBlock *FindBlock(CompilationUnit* cUnit, unsigned int codeOffset,
bool split, bool create, BasicBlock** immedPredBlockP)
{
GrowableList* blockList = &cUnit->blockList;
@@ -267,7 +252,7 @@
/* Check if a branch jumps into the middle of an existing block */
if ((codeOffset > bb->startOffset) && (bb->lastMIRInsn != NULL) &&
(codeOffset <= bb->lastMIRInsn->offset)) {
- BasicBlock *newBB = splitBlock(cUnit, codeOffset, bb,
+ BasicBlock *newBB = SplitBlock(cUnit, codeOffset, bb,
bb == *immedPredBlockP ?
immedPredBlockP : NULL);
return newBB;
@@ -276,21 +261,21 @@
}
/* Create a new one */
- bb = oatNewBB(cUnit, kDalvikByteCode, cUnit->numBlocks++);
- oatInsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(bb));
+ bb = NewMemBB(cUnit, kDalvikByteCode, cUnit->numBlocks++);
+ InsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(bb));
bb->startOffset = codeOffset;
cUnit->blockMap.Put(bb->startOffset, bb);
return bb;
}
/* Find existing block */
-BasicBlock* oatFindBlock(CompilationUnit* cUnit, unsigned int codeOffset)
+BasicBlock* FindBlock(CompilationUnit* cUnit, unsigned int codeOffset)
{
- return findBlock(cUnit, codeOffset, false, false, NULL);
+ return FindBlock(cUnit, codeOffset, false, false, NULL);
}
/* Turn method name into a legal Linux file name */
-void oatReplaceSpecialChars(std::string& str)
+void ReplaceSpecialChars(std::string& str)
{
static const struct { const char before; const char after; } match[] =
{{'/','-'}, {';','#'}, {' ','#'}, {'$','+'},
@@ -301,11 +286,11 @@
}
/* Dump the CFG into a DOT graph */
-void oatDumpCFG(CompilationUnit* cUnit, const char* dirPrefix)
+void DumpCFG(CompilationUnit* cUnit, const char* dirPrefix)
{
FILE* file;
std::string fname(PrettyMethod(cUnit->method_idx, *cUnit->dex_file));
- oatReplaceSpecialChars(fname);
+ ReplaceSpecialChars(fname);
fname = StringPrintf("%s%s%x.dot", dirPrefix, fname.c_str(),
cUnit->entryBlock->fallThrough->startOffset);
file = fopen(fname.c_str(), "w");
@@ -322,7 +307,7 @@
for (idx = 0; idx < numReachableBlocks; idx++) {
int blockIdx = cUnit->dfsOrder.elemList[idx];
- BasicBlock *bb = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, blockIdx));
+ BasicBlock *bb = reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, blockIdx));
if (bb == NULL) break;
if (bb->blockType == kDead) continue;
if (bb->blockType == kEntryBlock) {
@@ -337,7 +322,7 @@
bb->firstMIRInsn ? " | " : " ");
for (mir = bb->firstMIRInsn; mir; mir = mir->next) {
fprintf(file, " {%04x %s\\l}%s\\\n", mir->offset,
- mir->ssaRep ? oatFullDisassembler(cUnit, mir) :
+ mir->ssaRep ? FullDisassembler(cUnit, mir) :
Instruction::Name(mir->dalvikInsn.opcode),
mir->next ? " | " : " ");
}
@@ -345,21 +330,21 @@
} else if (bb->blockType == kExceptionHandling) {
char blockName[BLOCK_NAME_LEN];
- oatGetBlockName(bb, blockName);
+ GetBlockName(bb, blockName);
fprintf(file, " %s [shape=invhouse];\n", blockName);
}
char blockName1[BLOCK_NAME_LEN], blockName2[BLOCK_NAME_LEN];
if (bb->taken) {
- oatGetBlockName(bb, blockName1);
- oatGetBlockName(bb->taken, blockName2);
+ GetBlockName(bb, blockName1);
+ GetBlockName(bb->taken, blockName2);
fprintf(file, " %s:s -> %s:n [style=dotted]\n",
blockName1, blockName2);
}
if (bb->fallThrough) {
- oatGetBlockName(bb, blockName1);
- oatGetBlockName(bb->fallThrough, blockName2);
+ GetBlockName(bb, blockName1);
+ GetBlockName(bb->fallThrough, blockName2);
fprintf(file, " %s:s -> %s:n\n", blockName1, blockName2);
}
@@ -369,10 +354,10 @@
(bb->successorBlockList.blockListType == kCatch) ?
"Mrecord" : "record");
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&bb->successorBlockList.blocks,
+ GrowableListIteratorInit(&bb->successorBlockList.blocks,
&iterator);
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
int succId = 0;
while (true) {
@@ -380,7 +365,7 @@
BasicBlock *destBlock = successorBlockInfo->block;
SuccessorBlockInfo *nextSuccessorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
fprintf(file, " {<f%d> %04x: %04x\\l}%s\\\n",
succId++,
@@ -392,25 +377,25 @@
}
fprintf(file, " }\"];\n\n");
- oatGetBlockName(bb, blockName1);
+ GetBlockName(bb, blockName1);
fprintf(file, " %s:s -> succ%04x_%d:n [style=dashed]\n",
blockName1, bb->startOffset, bb->id);
if (bb->successorBlockList.blockListType == kPackedSwitch ||
bb->successorBlockList.blockListType == kSparseSwitch) {
- oatGrowableListIteratorInit(&bb->successorBlockList.blocks,
+ GrowableListIteratorInit(&bb->successorBlockList.blocks,
&iterator);
succId = 0;
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>( oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>( GrowableListIteratorNext(&iterator));
if (successorBlockInfo == NULL) break;
BasicBlock *destBlock = successorBlockInfo->block;
- oatGetBlockName(destBlock, blockName2);
+ GetBlockName(destBlock, blockName2);
fprintf(file, " succ%04x_%d:f%d:e -> %s:n\n", bb->startOffset,
bb->id, succId++, blockName2);
}
@@ -419,11 +404,11 @@
fprintf(file, "\n");
/* Display the dominator tree */
- oatGetBlockName(bb, blockName1);
+ GetBlockName(bb, blockName1);
fprintf(file, " cfg%s [label=\"%s\", shape=none];\n",
blockName1, blockName1);
if (bb->iDom) {
- oatGetBlockName(bb->iDom, blockName2);
+ GetBlockName(bb->iDom, blockName2);
fprintf(file, " cfg%s:s -> cfg%s:n\n\n", blockName2, blockName1);
}
}
@@ -432,13 +417,13 @@
}
/* Verify if all the successor is connected with all the claimed predecessors */
-bool verifyPredInfo(CompilationUnit* cUnit, BasicBlock* bb)
+static bool VerifyPredInfo(CompilationUnit* cUnit, BasicBlock* bb)
{
GrowableListIterator iter;
- oatGrowableListIteratorInit(bb->predecessors, &iter);
+ GrowableListIteratorInit(bb->predecessors, &iter);
while (true) {
- BasicBlock *predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ BasicBlock *predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
if (!predBB) break;
bool found = false;
if (predBB->taken == bb) {
@@ -447,11 +432,11 @@
found = true;
} else if (predBB->successorBlockList.blockListType != kNotUsed) {
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&predBB->successorBlockList.blocks,
+ GrowableListIteratorInit(&predBB->successorBlockList.blocks,
&iterator);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
if (successorBlockInfo == NULL) break;
BasicBlock *succBB = successorBlockInfo->block;
if (succBB == bb) {
@@ -462,9 +447,9 @@
}
if (found == false) {
char blockName1[BLOCK_NAME_LEN], blockName2[BLOCK_NAME_LEN];
- oatGetBlockName(bb, blockName1);
- oatGetBlockName(predBB, blockName2);
- oatDumpCFG(cUnit, "/sdcard/cfg/");
+ GetBlockName(bb, blockName1);
+ GetBlockName(predBB, blockName2);
+ DumpCFG(cUnit, "/sdcard/cfg/");
LOG(FATAL) << "Successor " << blockName1 << "not found from "
<< blockName2;
}
@@ -473,7 +458,7 @@
}
/* Identify code range in try blocks and set up the empty catch blocks */
-void processTryCatchBlocks(CompilationUnit* cUnit)
+static void ProcessTryCatchBlocks(CompilationUnit* cUnit)
{
const DexFile::CodeItem* code_item = cUnit->code_item;
int triesSize = code_item->tries_size_;
@@ -491,7 +476,7 @@
int startOffset = pTry->start_addr_;
int endOffset = startOffset + pTry->insn_count_;
for (offset = startOffset; offset < endOffset; offset++) {
- oatSetBit(cUnit, tryBlockAddr, offset);
+ SetBit(cUnit, tryBlockAddr, offset);
}
}
@@ -502,7 +487,7 @@
CatchHandlerIterator iterator(handlers_ptr);
for (; iterator.HasNext(); iterator.Next()) {
uint32_t address = iterator.GetHandlerAddress();
- findBlock(cUnit, address, false /* split */, true /*create*/,
+ FindBlock(cUnit, address, false /* split */, true /*create*/,
/* immedPredBlockP */ NULL);
}
handlers_ptr = iterator.EndDataPointer();
@@ -510,9 +495,9 @@
}
/* Process instructions with the kBranch flag */
-BasicBlock* processCanBranch(CompilationUnit* cUnit, BasicBlock* curBlock,
- MIR* insn, int curOffset, int width, int flags,
- const uint16_t* codePtr, const uint16_t* codeEnd)
+static BasicBlock* ProcessCanBranch(CompilationUnit* cUnit, BasicBlock* curBlock,
+ MIR* insn, int curOffset, int width, int flags,
+ const uint16_t* codePtr, const uint16_t* codeEnd)
{
int target = curOffset;
switch (insn->dalvikInsn.opcode) {
@@ -542,7 +527,7 @@
default:
LOG(FATAL) << "Unexpected opcode(" << insn->dalvikInsn.opcode << ") with kBranch set";
}
- BasicBlock *takenBlock = findBlock(cUnit, target,
+ BasicBlock *takenBlock = FindBlock(cUnit, target,
/* split */
true,
/* create */
@@ -550,11 +535,11 @@
/* immedPredBlockP */
&curBlock);
curBlock->taken = takenBlock;
- oatInsertGrowableList(cUnit, takenBlock->predecessors, reinterpret_cast<uintptr_t>(curBlock));
+ InsertGrowableList(cUnit, takenBlock->predecessors, reinterpret_cast<uintptr_t>(curBlock));
/* Always terminate the current block for conditional branches */
if (flags & Instruction::kContinue) {
- BasicBlock *fallthroughBlock = findBlock(cUnit,
+ BasicBlock *fallthroughBlock = FindBlock(cUnit,
curOffset + width,
/*
* If the method is processed
@@ -574,12 +559,12 @@
/* immedPredBlockP */
&curBlock);
curBlock->fallThrough = fallthroughBlock;
- oatInsertGrowableList(cUnit, fallthroughBlock->predecessors,
+ InsertGrowableList(cUnit, fallthroughBlock->predecessors,
reinterpret_cast<uintptr_t>(curBlock));
} else if (codePtr < codeEnd) {
/* Create a fallthrough block for real instructions (incl. NOP) */
- if (contentIsInsn(codePtr)) {
- findBlock(cUnit, curOffset + width,
+ if (ContentIsInsn(codePtr)) {
+ FindBlock(cUnit, curOffset + width,
/* split */
false,
/* create */
@@ -592,8 +577,8 @@
}
/* Process instructions with the kSwitch flag */
-void processCanSwitch(CompilationUnit* cUnit, BasicBlock* curBlock,
- MIR* insn, int curOffset, int width, int flags)
+static void ProcessCanSwitch(CompilationUnit* cUnit, BasicBlock* curBlock,
+ MIR* insn, int curOffset, int width, int flags)
{
const uint16_t* switchData =
reinterpret_cast<const uint16_t*>(cUnit->insns + curOffset + insn->dalvikInsn.vB);
@@ -644,11 +629,11 @@
curBlock->successorBlockList.blockListType =
(insn->dalvikInsn.opcode == Instruction::PACKED_SWITCH) ?
kPackedSwitch : kSparseSwitch;
- oatInitGrowableList(cUnit, &curBlock->successorBlockList.blocks, size,
+ CompilerInitGrowableList(cUnit, &curBlock->successorBlockList.blocks, size,
kListSuccessorBlocks);
for (i = 0; i < size; i++) {
- BasicBlock *caseBlock = findBlock(cUnit, curOffset + targetTable[i],
+ BasicBlock *caseBlock = FindBlock(cUnit, curOffset + targetTable[i],
/* split */
true,
/* create */
@@ -656,20 +641,20 @@
/* immedPredBlockP */
&curBlock);
SuccessorBlockInfo *successorBlockInfo =
- static_cast<SuccessorBlockInfo*>(oatNew(cUnit, sizeof(SuccessorBlockInfo),
+ static_cast<SuccessorBlockInfo*>(NewMem(cUnit, sizeof(SuccessorBlockInfo),
false, kAllocSuccessor));
successorBlockInfo->block = caseBlock;
successorBlockInfo->key =
(insn->dalvikInsn.opcode == Instruction::PACKED_SWITCH) ?
firstKey + i : keyTable[i];
- oatInsertGrowableList(cUnit, &curBlock->successorBlockList.blocks,
+ InsertGrowableList(cUnit, &curBlock->successorBlockList.blocks,
reinterpret_cast<uintptr_t>(successorBlockInfo));
- oatInsertGrowableList(cUnit, caseBlock->predecessors,
+ InsertGrowableList(cUnit, caseBlock->predecessors,
reinterpret_cast<uintptr_t>(curBlock));
}
/* Fall-through case */
- BasicBlock* fallthroughBlock = findBlock(cUnit,
+ BasicBlock* fallthroughBlock = FindBlock(cUnit,
curOffset + width,
/* split */
false,
@@ -678,18 +663,18 @@
/* immedPredBlockP */
NULL);
curBlock->fallThrough = fallthroughBlock;
- oatInsertGrowableList(cUnit, fallthroughBlock->predecessors,
+ InsertGrowableList(cUnit, fallthroughBlock->predecessors,
reinterpret_cast<uintptr_t>(curBlock));
}
/* Process instructions with the kThrow flag */
-BasicBlock* processCanThrow(CompilationUnit* cUnit, BasicBlock* curBlock,
- MIR* insn, int curOffset, int width, int flags,
- ArenaBitVector* tryBlockAddr, const uint16_t* codePtr,
- const uint16_t* codeEnd)
+static BasicBlock* ProcessCanThrow(CompilationUnit* cUnit, BasicBlock* curBlock,
+ MIR* insn, int curOffset, int width, int flags,
+ ArenaBitVector* tryBlockAddr, const uint16_t* codePtr,
+ const uint16_t* codeEnd)
{
const DexFile::CodeItem* code_item = cUnit->code_item;
- bool inTryBlock = oatIsBitSet(tryBlockAddr, curOffset);
+ bool inTryBlock = IsBitSet(tryBlockAddr, curOffset);
/* In try block */
if (inTryBlock) {
@@ -702,39 +687,39 @@
}
curBlock->successorBlockList.blockListType = kCatch;
- oatInitGrowableList(cUnit, &curBlock->successorBlockList.blocks, 2,
+ CompilerInitGrowableList(cUnit, &curBlock->successorBlockList.blocks, 2,
kListSuccessorBlocks);
for (;iterator.HasNext(); iterator.Next()) {
- BasicBlock *catchBlock = findBlock(cUnit, iterator.GetHandlerAddress(),
+ BasicBlock *catchBlock = FindBlock(cUnit, iterator.GetHandlerAddress(),
false /* split*/,
false /* creat */,
NULL /* immedPredBlockP */);
catchBlock->catchEntry = true;
cUnit->catches.insert(catchBlock->startOffset);
SuccessorBlockInfo *successorBlockInfo = reinterpret_cast<SuccessorBlockInfo*>
- (oatNew(cUnit, sizeof(SuccessorBlockInfo), false, kAllocSuccessor));
+ (NewMem(cUnit, sizeof(SuccessorBlockInfo), false, kAllocSuccessor));
successorBlockInfo->block = catchBlock;
successorBlockInfo->key = iterator.GetHandlerTypeIndex();
- oatInsertGrowableList(cUnit, &curBlock->successorBlockList.blocks,
+ InsertGrowableList(cUnit, &curBlock->successorBlockList.blocks,
reinterpret_cast<uintptr_t>(successorBlockInfo));
- oatInsertGrowableList(cUnit, catchBlock->predecessors,
+ InsertGrowableList(cUnit, catchBlock->predecessors,
reinterpret_cast<uintptr_t>(curBlock));
}
} else {
- BasicBlock *ehBlock = oatNewBB(cUnit, kExceptionHandling,
+ BasicBlock *ehBlock = NewMemBB(cUnit, kExceptionHandling,
cUnit->numBlocks++);
curBlock->taken = ehBlock;
- oatInsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(ehBlock));
+ InsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(ehBlock));
ehBlock->startOffset = curOffset;
- oatInsertGrowableList(cUnit, ehBlock->predecessors, reinterpret_cast<uintptr_t>(curBlock));
+ InsertGrowableList(cUnit, ehBlock->predecessors, reinterpret_cast<uintptr_t>(curBlock));
}
if (insn->dalvikInsn.opcode == Instruction::THROW){
curBlock->explicitThrow = true;
- if ((codePtr < codeEnd) && contentIsInsn(codePtr)) {
+ if ((codePtr < codeEnd) && ContentIsInsn(codePtr)) {
// Force creation of new block following THROW via side-effect
- findBlock(cUnit, curOffset + width, /* split */ false,
+ FindBlock(cUnit, curOffset + width, /* split */ false,
/* create */ true, /* immedPredBlockP */ NULL);
}
if (!inTryBlock) {
@@ -757,39 +742,38 @@
* not automatically terminated after the work portion, and may
* contain following instructions.
*/
- BasicBlock *newBlock = oatNewBB(cUnit, kDalvikByteCode, cUnit->numBlocks++);
- oatInsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(newBlock));
+ BasicBlock *newBlock = NewMemBB(cUnit, kDalvikByteCode, cUnit->numBlocks++);
+ InsertGrowableList(cUnit, &cUnit->blockList, reinterpret_cast<uintptr_t>(newBlock));
newBlock->startOffset = insn->offset;
curBlock->fallThrough = newBlock;
- oatInsertGrowableList(cUnit, newBlock->predecessors, reinterpret_cast<uintptr_t>(curBlock));
- MIR* newInsn = static_cast<MIR*>(oatNew(cUnit, sizeof(MIR), true, kAllocMIR));
+ InsertGrowableList(cUnit, newBlock->predecessors, reinterpret_cast<uintptr_t>(curBlock));
+ MIR* newInsn = static_cast<MIR*>(NewMem(cUnit, sizeof(MIR), true, kAllocMIR));
*newInsn = *insn;
insn->dalvikInsn.opcode =
static_cast<Instruction::Code>(kMirOpCheck);
// Associate the two halves
insn->meta.throwInsn = newInsn;
newInsn->meta.throwInsn = insn;
- oatAppendMIR(newBlock, newInsn);
+ AppendMIR(newBlock, newInsn);
return newBlock;
}
-void oatInit(CompilationUnit* cUnit, const Compiler& compiler) {
- if (!oatArchInit()) {
+void CompilerInit(CompilationUnit* cUnit, const Compiler& compiler) {
+ if (!ArchInit()) {
LOG(FATAL) << "Failed to initialize oat";
}
- if (!oatHeapInit(cUnit)) {
+ if (!HeapInit(cUnit)) {
LOG(FATAL) << "Failed to initialize oat heap";
}
}
-CompiledMethod* compileMethod(Compiler& compiler,
- const CompilerBackend compilerBackend,
- const DexFile::CodeItem* code_item,
- uint32_t access_flags, InvokeType invoke_type,
- uint32_t method_idx, jobject class_loader,
- const DexFile& dex_file,
- LLVMInfo* llvm_info
- )
+static CompiledMethod* CompileMethod(Compiler& compiler,
+ const CompilerBackend compilerBackend,
+ const DexFile::CodeItem* code_item,
+ uint32_t access_flags, InvokeType invoke_type,
+ uint32_t method_idx, jobject class_loader,
+ const DexFile& dex_file,
+ LLVMInfo* llvm_info)
{
VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "...";
@@ -801,7 +785,7 @@
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
UniquePtr<CompilationUnit> cUnit(new CompilationUnit);
- oatInit(cUnit.get(), compiler);
+ CompilerInit(cUnit.get(), compiler);
cUnit->compiler = &compiler;
cUnit->class_linker = class_linker;
@@ -890,61 +874,61 @@
/* Gathering opcode stats? */
if (kCompilerDebugFlags & (1 << kDebugCountOpcodes)) {
cUnit->opcodeCount =
- static_cast<int*>(oatNew(cUnit.get(), kNumPackedOpcodes * sizeof(int), true, kAllocMisc));
+ static_cast<int*>(NewMem(cUnit.get(), kNumPackedOpcodes * sizeof(int), true, kAllocMisc));
}
/* Assume non-throwing leaf */
cUnit->attrs = (METHOD_IS_LEAF | METHOD_IS_THROW_FREE);
/* Initialize the block list, estimate size based on insnsSize */
- oatInitGrowableList(cUnit.get(), &cUnit->blockList, cUnit->insnsSize,
+ CompilerInitGrowableList(cUnit.get(), &cUnit->blockList, cUnit->insnsSize,
kListBlockList);
/* Initialize the switchTables list */
- oatInitGrowableList(cUnit.get(), &cUnit->switchTables, 4,
+ CompilerInitGrowableList(cUnit.get(), &cUnit->switchTables, 4,
kListSwitchTables);
/* Intialize the fillArrayData list */
- oatInitGrowableList(cUnit.get(), &cUnit->fillArrayData, 4,
+ CompilerInitGrowableList(cUnit.get(), &cUnit->fillArrayData, 4,
kListFillArrayData);
/* Intialize the throwLaunchpads list, estimate size based on insnsSize */
- oatInitGrowableList(cUnit.get(), &cUnit->throwLaunchpads, cUnit->insnsSize,
+ CompilerInitGrowableList(cUnit.get(), &cUnit->throwLaunchpads, cUnit->insnsSize,
kListThrowLaunchPads);
/* Intialize the instrinsicLaunchpads list */
- oatInitGrowableList(cUnit.get(), &cUnit->intrinsicLaunchpads, 4,
+ CompilerInitGrowableList(cUnit.get(), &cUnit->intrinsicLaunchpads, 4,
kListMisc);
/* Intialize the suspendLaunchpads list */
- oatInitGrowableList(cUnit.get(), &cUnit->suspendLaunchpads, 2048,
+ CompilerInitGrowableList(cUnit.get(), &cUnit->suspendLaunchpads, 2048,
kListSuspendLaunchPads);
/* Allocate the bit-vector to track the beginning of basic blocks */
- ArenaBitVector *tryBlockAddr = oatAllocBitVector(cUnit.get(),
+ ArenaBitVector *tryBlockAddr = AllocBitVector(cUnit.get(),
cUnit->insnsSize,
true /* expandable */);
cUnit->tryBlockAddr = tryBlockAddr;
/* Create the default entry and exit blocks and enter them to the list */
- BasicBlock *entryBlock = oatNewBB(cUnit.get(), kEntryBlock, numBlocks++);
- BasicBlock *exitBlock = oatNewBB(cUnit.get(), kExitBlock, numBlocks++);
+ BasicBlock *entryBlock = NewMemBB(cUnit.get(), kEntryBlock, numBlocks++);
+ BasicBlock *exitBlock = NewMemBB(cUnit.get(), kExitBlock, numBlocks++);
cUnit->entryBlock = entryBlock;
cUnit->exitBlock = exitBlock;
- oatInsertGrowableList(cUnit.get(), &cUnit->blockList, reinterpret_cast<uintptr_t>(entryBlock));
- oatInsertGrowableList(cUnit.get(), &cUnit->blockList, reinterpret_cast<uintptr_t>(exitBlock));
+ InsertGrowableList(cUnit.get(), &cUnit->blockList, reinterpret_cast<uintptr_t>(entryBlock));
+ InsertGrowableList(cUnit.get(), &cUnit->blockList, reinterpret_cast<uintptr_t>(exitBlock));
/* Current block to record parsed instructions */
- BasicBlock *curBlock = oatNewBB(cUnit.get(), kDalvikByteCode, numBlocks++);
+ BasicBlock *curBlock = NewMemBB(cUnit.get(), kDalvikByteCode, numBlocks++);
curBlock->startOffset = 0;
- oatInsertGrowableList(cUnit.get(), &cUnit->blockList, reinterpret_cast<uintptr_t>(curBlock));
+ InsertGrowableList(cUnit.get(), &cUnit->blockList, reinterpret_cast<uintptr_t>(curBlock));
/* Add first block to the fast lookup cache */
cUnit->blockMap.Put(curBlock->startOffset, curBlock);
entryBlock->fallThrough = curBlock;
- oatInsertGrowableList(cUnit.get(), curBlock->predecessors,
+ InsertGrowableList(cUnit.get(), curBlock->predecessors,
reinterpret_cast<uintptr_t>(entryBlock));
/*
@@ -954,21 +938,21 @@
cUnit->numBlocks = numBlocks;
/* Identify code range in try blocks and set up the empty catch blocks */
- processTryCatchBlocks(cUnit.get());
+ ProcessTryCatchBlocks(cUnit.get());
/* Set up for simple method detection */
int numPatterns = sizeof(specialPatterns)/sizeof(specialPatterns[0]);
bool livePattern = (numPatterns > 0) && !(cUnit->disableOpt & (1 << kMatch));
bool* deadPattern =
- static_cast<bool*>(oatNew(cUnit.get(), sizeof(bool) * numPatterns, true, kAllocMisc));
+ static_cast<bool*>(NewMem(cUnit.get(), sizeof(bool) * numPatterns, true, kAllocMisc));
SpecialCaseHandler specialCase = kNoHandler;
int patternPos = 0;
/* Parse all instructions and put them into containing basic blocks */
while (codePtr < codeEnd) {
- MIR *insn = static_cast<MIR *>(oatNew(cUnit.get(), sizeof(MIR), true, kAllocMIR));
+ MIR *insn = static_cast<MIR *>(NewMem(cUnit.get(), sizeof(MIR), true, kAllocMIR));
insn->offset = curOffset;
- int width = parseInsn(cUnit.get(), codePtr, &insn->dalvikInsn, false);
+ int width = ParseInsn(cUnit.get(), codePtr, &insn->dalvikInsn, false);
insn->width = width;
Instruction::Code opcode = insn->dalvikInsn.opcode;
if (cUnit->opcodeCount != NULL) {
@@ -996,7 +980,7 @@
patternPos++;
}
- oatAppendMIR(curBlock, insn);
+ AppendMIR(curBlock, insn);
codePtr += width;
int flags = Instruction::FlagsOf(insn->dalvikInsn.opcode);
@@ -1008,11 +992,11 @@
}
if (flags & Instruction::kBranch) {
- curBlock = processCanBranch(cUnit.get(), curBlock, insn, curOffset,
+ curBlock = ProcessCanBranch(cUnit.get(), curBlock, insn, curOffset,
width, flags, codePtr, codeEnd);
} else if (flags & Instruction::kReturn) {
curBlock->fallThrough = exitBlock;
- oatInsertGrowableList(cUnit.get(), exitBlock->predecessors,
+ InsertGrowableList(cUnit.get(), exitBlock->predecessors,
reinterpret_cast<uintptr_t>(curBlock));
/*
* Terminate the current block if there are instructions
@@ -1023,8 +1007,8 @@
* Create a fallthrough block for real instructions
* (incl. NOP).
*/
- if (contentIsInsn(codePtr)) {
- findBlock(cUnit.get(), curOffset + width,
+ if (ContentIsInsn(codePtr)) {
+ FindBlock(cUnit.get(), curOffset + width,
/* split */
false,
/* create */
@@ -1034,13 +1018,13 @@
}
}
} else if (flags & Instruction::kThrow) {
- curBlock = processCanThrow(cUnit.get(), curBlock, insn, curOffset,
+ curBlock = ProcessCanThrow(cUnit.get(), curBlock, insn, curOffset,
width, flags, tryBlockAddr, codePtr, codeEnd);
} else if (flags & Instruction::kSwitch) {
- processCanSwitch(cUnit.get(), curBlock, insn, curOffset, width, flags);
+ ProcessCanSwitch(cUnit.get(), curBlock, insn, curOffset, width, flags);
}
curOffset += width;
- BasicBlock *nextBlock = findBlock(cUnit.get(), curOffset,
+ BasicBlock *nextBlock = FindBlock(cUnit.get(), curOffset,
/* split */
false,
/* create */
@@ -1060,7 +1044,7 @@
if ((curBlock->fallThrough == NULL) && (flags & Instruction::kContinue)) {
curBlock->fallThrough = nextBlock;
- oatInsertGrowableList(cUnit.get(), nextBlock->predecessors,
+ InsertGrowableList(cUnit.get(), nextBlock->predecessors,
reinterpret_cast<uintptr_t>(curBlock));
}
curBlock = nextBlock;
@@ -1089,67 +1073,67 @@
}
if (cUnit->printMe) {
- oatDumpCompilationUnit(cUnit.get());
+ DumpCompilationUnit(cUnit.get());
}
/* Do a code layout pass */
- oatMethodCodeLayout(cUnit.get());
+ CodeLayout(cUnit.get());
if (cUnit->enableDebug & (1 << kDebugVerifyDataflow)) {
/* Verify if all blocks are connected as claimed */
- oatDataFlowAnalysisDispatcher(cUnit.get(), verifyPredInfo, kAllNodes,
+ DataFlowAnalysisDispatcher(cUnit.get(), VerifyPredInfo, kAllNodes,
false /* isIterative */);
}
/* Perform SSA transformation for the whole method */
- oatMethodSSATransformation(cUnit.get());
+ SSATransformation(cUnit.get());
/* Do constant propagation */
// TODO: Probably need to make these expandable to support new ssa names
// introducted during MIR optimization passes
- cUnit->isConstantV = oatAllocBitVector(cUnit.get(), cUnit->numSSARegs,
+ cUnit->isConstantV = AllocBitVector(cUnit.get(), cUnit->numSSARegs,
false /* not expandable */);
cUnit->constantValues =
- static_cast<int*>(oatNew(cUnit.get(), sizeof(int) * cUnit->numSSARegs, true, kAllocDFInfo));
- oatDataFlowAnalysisDispatcher(cUnit.get(), oatDoConstantPropagation,
+ static_cast<int*>(NewMem(cUnit.get(), sizeof(int) * cUnit->numSSARegs, true, kAllocDFInfo));
+ DataFlowAnalysisDispatcher(cUnit.get(), DoConstantPropogation,
kAllNodes,
false /* isIterative */);
/* Detect loops */
- oatMethodLoopDetection(cUnit.get());
+ LoopDetection(cUnit.get());
/* Count uses */
- oatMethodUseCount(cUnit.get());
+ MethodUseCount(cUnit.get());
/* Perform null check elimination */
- oatMethodNullCheckElimination(cUnit.get());
+ NullCheckElimination(cUnit.get());
/* Combine basic blocks where possible */
- oatMethodBasicBlockCombine(cUnit.get());
+ BasicBlockCombine(cUnit.get());
/* Do some basic block optimizations */
- oatMethodBasicBlockOptimization(cUnit.get());
+ BasicBlockOptimization(cUnit.get());
if (cUnit->enableDebug & (1 << kDebugDumpCheckStats)) {
- oatDumpCheckStats(cUnit.get());
+ DumpCheckStats(cUnit.get());
}
- oatInitializeRegAlloc(cUnit.get()); // Needs to happen after SSA naming
+ CompilerInitializeRegAlloc(cUnit.get()); // Needs to happen after SSA naming
/* Allocate Registers using simple local allocation scheme */
- oatSimpleRegAlloc(cUnit.get());
+ SimpleRegAlloc(cUnit.get());
/* Go the LLVM path? */
if (cUnit->genBitcode) {
// MIR->Bitcode
- oatMethodMIR2Bitcode(cUnit.get());
+ MethodMIR2Bitcode(cUnit.get());
if (compilerBackend == kPortable) {
// all done
- oatArenaReset(cUnit.get());
+ ArenaReset(cUnit.get());
return NULL;
}
// Bitcode->LIR
- oatMethodBitcode2LIR(cUnit.get());
+ MethodBitcode2LIR(cUnit.get());
} else {
if (specialCase != kNoHandler) {
/*
@@ -1157,31 +1141,31 @@
* special codegen doesn't succeed, cUnit->firstLIRInsn will
* set to NULL;
*/
- oatSpecialMIR2LIR(cUnit.get(), specialCase);
+ SpecialMIR2LIR(cUnit.get(), specialCase);
}
/* Convert MIR to LIR, etc. */
if (cUnit->firstLIRInsn == NULL) {
- oatMethodMIR2LIR(cUnit.get());
+ MethodMIR2LIR(cUnit.get());
}
}
// Debugging only
if (cUnit->enableDebug & (1 << kDebugDumpCFG)) {
- oatDumpCFG(cUnit.get(), "/sdcard/cfg/");
+ DumpCFG(cUnit.get(), "/sdcard/cfg/");
}
/* Method is not empty */
if (cUnit->firstLIRInsn) {
// mark the targets of switch statement case labels
- oatProcessSwitchTables(cUnit.get());
+ ProcessSwitchTables(cUnit.get());
/* Convert LIR into machine code. */
- oatAssembleLIR(cUnit.get());
+ AssembleLIR(cUnit.get());
if (cUnit->printMe) {
- oatCodegenDump(cUnit.get());
+ CodegenDump(cUnit.get());
}
if (cUnit->opcodeCount != NULL) {
@@ -1226,16 +1210,16 @@
#ifdef WITH_MEMSTATS
if (cUnit->enableDebug & (1 << kDebugShowMemoryUsage)) {
- oatDumpMemStats(cUnit.get());
+ DumpMemStats(cUnit.get());
}
#endif
- oatArenaReset(cUnit.get());
+ ArenaReset(cUnit.get());
return result;
}
-CompiledMethod* oatCompileMethod(Compiler& compiler,
+CompiledMethod* CompileOneMethod(Compiler& compiler,
const CompilerBackend backend,
const DexFile::CodeItem* code_item,
uint32_t access_flags, InvokeType invoke_type,
@@ -1243,7 +1227,7 @@
const DexFile& dex_file,
LLVMInfo* llvmInfo)
{
- return compileMethod(compiler, backend, code_item, access_flags, invoke_type, method_idx, class_loader,
+ return CompileMethod(compiler, backend, code_item, access_flags, invoke_type, method_idx, class_loader,
dex_file, llvmInfo);
}
@@ -1256,9 +1240,8 @@
uint32_t method_idx, jobject class_loader,
const art::DexFile& dex_file)
{
- CHECK_EQ(compiler.GetInstructionSet(), art::oatInstructionSet());
// TODO: check method fingerprint here to determine appropriate backend type. Until then, use build default
art::CompilerBackend backend = compiler.GetCompilerBackend();
- return art::oatCompileMethod(compiler, backend, code_item, access_flags, invoke_type,
+ return art::CompileOneMethod(compiler, backend, code_item, access_flags, invoke_type,
method_idx, class_loader, dex_file, NULL /* use thread llvmInfo */);
}
diff --git a/src/compiler/frontend.h b/src/compiler/frontend.h
index 702d5d4..1898b9b 100644
--- a/src/compiler/frontend.h
+++ b/src/compiler/frontend.h
@@ -136,8 +136,8 @@
struct CompilationUnit;
struct BasicBlock;
-BasicBlock* oatFindBlock(CompilationUnit* cUnit, unsigned int codeOffset);
-void oatReplaceSpecialChars(std::string& str);
+BasicBlock* FindBlock(CompilationUnit* cUnit, unsigned int codeOffset);
+void ReplaceSpecialChars(std::string& str);
} // namespace art
diff --git a/src/compiler/intermediate_rep.cc b/src/compiler/intermediate_rep.cc
index 6930d76..dd2740d 100644
--- a/src/compiler/intermediate_rep.cc
+++ b/src/compiler/intermediate_rep.cc
@@ -19,14 +19,14 @@
namespace art {
/* Allocate a new basic block */
-BasicBlock* oatNewBB(CompilationUnit* cUnit, BBType blockType, int blockId)
+BasicBlock* NewMemBB(CompilationUnit* cUnit, BBType blockType, int blockId)
{
- BasicBlock* bb = static_cast<BasicBlock*>(oatNew(cUnit, sizeof(BasicBlock), true, kAllocBB));
+ BasicBlock* bb = static_cast<BasicBlock*>(NewMem(cUnit, sizeof(BasicBlock), true, kAllocBB));
bb->blockType = blockType;
bb->id = blockId;
bb->predecessors = static_cast<GrowableList*>
- (oatNew(cUnit, sizeof(GrowableList), false, kAllocPredecessors));
- oatInitGrowableList(cUnit, bb->predecessors,
+ (NewMem(cUnit, sizeof(GrowableList), false, kAllocPredecessors));
+ CompilerInitGrowableList(cUnit, bb->predecessors,
(blockType == kExitBlock) ? 2048 : 2,
kListPredecessors);
cUnit->blockIdMap.Put(blockId, blockId);
@@ -34,7 +34,7 @@
}
/* Insert an MIR instruction to the end of a basic block */
-void oatAppendMIR(BasicBlock* bb, MIR* mir)
+void AppendMIR(BasicBlock* bb, MIR* mir)
{
if (bb->firstMIRInsn == NULL) {
DCHECK(bb->lastMIRInsn == NULL);
@@ -49,7 +49,7 @@
}
/* Insert an MIR instruction to the head of a basic block */
-void oatPrependMIR(BasicBlock* bb, MIR* mir)
+void PrependMIR(BasicBlock* bb, MIR* mir)
{
if (bb->firstMIRInsn == NULL) {
DCHECK(bb->lastMIRInsn == NULL);
@@ -64,7 +64,7 @@
}
/* Insert a MIR instruction after the specified MIR */
-void oatInsertMIRAfter(BasicBlock* bb, MIR* currentMIR, MIR* newMIR)
+void InsertMIRAfter(BasicBlock* bb, MIR* currentMIR, MIR* newMIR)
{
newMIR->prev = currentMIR;
newMIR->next = currentMIR->next;
@@ -83,7 +83,7 @@
* Append an LIR instruction to the LIR list maintained by a compilation
* unit
*/
-void oatAppendLIR(CompilationUnit *cUnit, LIR* lir)
+void AppendLIR(CompilationUnit *cUnit, LIR* lir)
{
if (cUnit->firstLIRInsn == NULL) {
DCHECK(cUnit->lastLIRInsn == NULL);
@@ -103,7 +103,7 @@
*
* prevLIR <-> newLIR <-> currentLIR
*/
-void oatInsertLIRBefore(LIR* currentLIR, LIR* newLIR)
+void InsertLIRBefore(LIR* currentLIR, LIR* newLIR)
{
DCHECK(currentLIR->prev != NULL);
LIR *prevLIR = currentLIR->prev;
@@ -120,7 +120,7 @@
*
* currentLIR -> newLIR -> oldNext
*/
-void oatInsertLIRAfter(LIR* currentLIR, LIR* newLIR)
+void InsertLIRAfter(LIR* currentLIR, LIR* newLIR)
{
newLIR->prev = currentLIR;
newLIR->next = currentLIR->next;
diff --git a/src/compiler/ralloc.cc b/src/compiler/ralloc.cc
index 34edb51..4eab177 100644
--- a/src/compiler/ralloc.cc
+++ b/src/compiler/ralloc.cc
@@ -20,7 +20,7 @@
namespace art {
-bool setFp(CompilationUnit* cUnit, int index, bool isFP) {
+static bool SetFp(CompilationUnit* cUnit, int index, bool isFP) {
bool change = false;
if (isFP && !cUnit->regLocation[index].fp) {
cUnit->regLocation[index].fp = true;
@@ -30,7 +30,7 @@
return change;
}
-bool setCore(CompilationUnit* cUnit, int index, bool isCore) {
+static bool SetCore(CompilationUnit* cUnit, int index, bool isCore) {
bool change = false;
if (isCore && !cUnit->regLocation[index].defined) {
cUnit->regLocation[index].core = true;
@@ -40,7 +40,7 @@
return change;
}
-bool setRef(CompilationUnit* cUnit, int index, bool isRef) {
+static bool SetRef(CompilationUnit* cUnit, int index, bool isRef) {
bool change = false;
if (isRef && !cUnit->regLocation[index].defined) {
cUnit->regLocation[index].ref = true;
@@ -50,7 +50,7 @@
return change;
}
-bool setWide(CompilationUnit* cUnit, int index, bool isWide) {
+static bool SetWide(CompilationUnit* cUnit, int index, bool isWide) {
bool change = false;
if (isWide && !cUnit->regLocation[index].wide) {
cUnit->regLocation[index].wide = true;
@@ -59,7 +59,7 @@
return change;
}
-bool setHigh(CompilationUnit* cUnit, int index, bool isHigh) {
+static bool SetHigh(CompilationUnit* cUnit, int index, bool isHigh) {
bool change = false;
if (isHigh && !cUnit->regLocation[index].highWord) {
cUnit->regLocation[index].highWord = true;
@@ -68,7 +68,7 @@
return change;
}
-bool remapNames(CompilationUnit* cUnit, BasicBlock* bb)
+static bool RemapNames(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb->blockType != kDalvikByteCode && bb->blockType != kEntryBlock &&
bb->blockType != kExitBlock)
@@ -93,7 +93,7 @@
* as it doesn't propagate. We're guaranteed at least one pass through
* the cfg.
*/
-bool inferTypeAndSize(CompilationUnit* cUnit, BasicBlock* bb)
+static bool InferTypeAndSize(CompilationUnit* cUnit, BasicBlock* bb)
{
MIR *mir;
bool changed = false; // Did anything change?
@@ -110,10 +110,10 @@
// Handle defs
if (attrs & DF_DA) {
if (attrs & DF_CORE_A) {
- changed |= setCore(cUnit, ssaRep->defs[0], true);
+ changed |= SetCore(cUnit, ssaRep->defs[0], true);
}
if (attrs & DF_REF_A) {
- changed |= setRef(cUnit, ssaRep->defs[0], true);
+ changed |= SetRef(cUnit, ssaRep->defs[0], true);
}
if (attrs & DF_A_WIDE) {
cUnit->regLocation[ssaRep->defs[0]].wide = true;
@@ -128,10 +128,10 @@
int next = 0;
if (attrs & DF_UA) {
if (attrs & DF_CORE_A) {
- changed |= setCore(cUnit, ssaRep->uses[next], true);
+ changed |= SetCore(cUnit, ssaRep->uses[next], true);
}
if (attrs & DF_REF_A) {
- changed |= setRef(cUnit, ssaRep->uses[next], true);
+ changed |= SetRef(cUnit, ssaRep->uses[next], true);
}
if (attrs & DF_A_WIDE) {
cUnit->regLocation[ssaRep->uses[next]].wide = true;
@@ -146,10 +146,10 @@
}
if (attrs & DF_UB) {
if (attrs & DF_CORE_B) {
- changed |= setCore(cUnit, ssaRep->uses[next], true);
+ changed |= SetCore(cUnit, ssaRep->uses[next], true);
}
if (attrs & DF_REF_B) {
- changed |= setRef(cUnit, ssaRep->uses[next], true);
+ changed |= SetRef(cUnit, ssaRep->uses[next], true);
}
if (attrs & DF_B_WIDE) {
cUnit->regLocation[ssaRep->uses[next]].wide = true;
@@ -164,10 +164,10 @@
}
if (attrs & DF_UC) {
if (attrs & DF_CORE_C) {
- changed |= setCore(cUnit, ssaRep->uses[next], true);
+ changed |= SetCore(cUnit, ssaRep->uses[next], true);
}
if (attrs & DF_REF_C) {
- changed |= setRef(cUnit, ssaRep->uses[next], true);
+ changed |= SetRef(cUnit, ssaRep->uses[next], true);
}
if (attrs & DF_C_WIDE) {
cUnit->regLocation[ssaRep->uses[next]].wide = true;
@@ -184,27 +184,27 @@
(mir->dalvikInsn.opcode == Instruction::RETURN_OBJECT)) {
switch(cUnit->shorty[0]) {
case 'I':
- changed |= setCore(cUnit, ssaRep->uses[0], true);
+ changed |= SetCore(cUnit, ssaRep->uses[0], true);
break;
case 'J':
- changed |= setCore(cUnit, ssaRep->uses[0], true);
- changed |= setCore(cUnit, ssaRep->uses[1], true);
+ changed |= SetCore(cUnit, ssaRep->uses[0], true);
+ changed |= SetCore(cUnit, ssaRep->uses[1], true);
cUnit->regLocation[ssaRep->uses[0]].wide = true;
cUnit->regLocation[ssaRep->uses[1]].wide = true;
cUnit->regLocation[ssaRep->uses[1]].highWord = true;
break;
case 'F':
- changed |= setFp(cUnit, ssaRep->uses[0], true);
+ changed |= SetFp(cUnit, ssaRep->uses[0], true);
break;
case 'D':
- changed |= setFp(cUnit, ssaRep->uses[0], true);
- changed |= setFp(cUnit, ssaRep->uses[1], true);
+ changed |= SetFp(cUnit, ssaRep->uses[0], true);
+ changed |= SetFp(cUnit, ssaRep->uses[1], true);
cUnit->regLocation[ssaRep->uses[0]].wide = true;
cUnit->regLocation[ssaRep->uses[1]].wide = true;
cUnit->regLocation[ssaRep->uses[1]].highWord = true;
break;
case 'L':
- changed |= setRef(cUnit, ssaRep->uses[0], true);
+ changed |= SetRef(cUnit, ssaRep->uses[0], true);
break;
default: break;
}
@@ -218,20 +218,20 @@
(attrs & (DF_FORMAT_35C | DF_FORMAT_3RC))) {
DCHECK_EQ(next, 0);
int target_idx = mir->dalvikInsn.vB;
- const char* shorty = oatGetShortyFromTargetIdx(cUnit, target_idx);
+ const char* shorty = GetShortyFromTargetIdx(cUnit, target_idx);
// Handle result type if floating point
if ((shorty[0] == 'F') || (shorty[0] == 'D')) {
- MIR* moveResultMIR = oatFindMoveResult(cUnit, bb, mir);
+ MIR* moveResultMIR = FindMoveResult(cUnit, bb, mir);
// Result might not be used at all, so no move-result
if (moveResultMIR && (moveResultMIR->dalvikInsn.opcode !=
Instruction::MOVE_RESULT_OBJECT)) {
SSARepresentation* tgtRep = moveResultMIR->ssaRep;
DCHECK(tgtRep != NULL);
tgtRep->fpDef[0] = true;
- changed |= setFp(cUnit, tgtRep->defs[0], true);
+ changed |= SetFp(cUnit, tgtRep->defs[0], true);
if (shorty[0] == 'D') {
tgtRep->fpDef[1] = true;
- changed |= setFp(cUnit, tgtRep->defs[1], true);
+ changed |= SetFp(cUnit, tgtRep->defs[1], true);
}
}
}
@@ -264,17 +264,17 @@
cUnit->regLocation[ssaRep->uses[i+1]].highWord = true;
DCHECK_EQ(SRegToVReg(cUnit, ssaRep->uses[i])+1,
SRegToVReg(cUnit, ssaRep->uses[i+1]));
- changed |= setCore(cUnit, ssaRep->uses[i],true);
+ changed |= SetCore(cUnit, ssaRep->uses[i],true);
i++;
break;
case 'F':
ssaRep->fpUse[i] = true;
break;
case 'L':
- changed |= setRef(cUnit,ssaRep->uses[i], true);
+ changed |= SetRef(cUnit,ssaRep->uses[i], true);
break;
default:
- changed |= setCore(cUnit,ssaRep->uses[i], true);
+ changed |= SetCore(cUnit,ssaRep->uses[i], true);
break;
}
i++;
@@ -284,11 +284,11 @@
for (int i=0; ssaRep->fpUse && i< ssaRep->numUses; i++) {
if (ssaRep->fpUse[i])
- changed |= setFp(cUnit, ssaRep->uses[i], true);
+ changed |= SetFp(cUnit, ssaRep->uses[i], true);
}
for (int i=0; ssaRep->fpDef && i< ssaRep->numDefs; i++) {
if (ssaRep->fpDef[i])
- changed |= setFp(cUnit, ssaRep->defs[i], true);
+ changed |= SetFp(cUnit, ssaRep->defs[i], true);
}
// Special-case handling for moves & Phi
if (attrs & (DF_IS_MOVE | DF_NULL_TRANSFER_N)) {
@@ -335,26 +335,26 @@
<< " has both fp and core/ref uses for same def.";
cUnit->disableOpt |= (1 << kPromoteRegs);
}
- changed |= setFp(cUnit, ssaRep->defs[0], definedFP);
- changed |= setCore(cUnit, ssaRep->defs[0], definedCore);
- changed |= setRef(cUnit, ssaRep->defs[0], definedRef);
- changed |= setWide(cUnit, ssaRep->defs[0], isWide);
- changed |= setHigh(cUnit, ssaRep->defs[0], isHigh);
+ changed |= SetFp(cUnit, ssaRep->defs[0], definedFP);
+ changed |= SetCore(cUnit, ssaRep->defs[0], definedCore);
+ changed |= SetRef(cUnit, ssaRep->defs[0], definedRef);
+ changed |= SetWide(cUnit, ssaRep->defs[0], isWide);
+ changed |= SetHigh(cUnit, ssaRep->defs[0], isHigh);
if (attrs & DF_A_WIDE) {
- changed |= setWide(cUnit, ssaRep->defs[1], true);
- changed |= setHigh(cUnit, ssaRep->defs[1], true);
+ changed |= SetWide(cUnit, ssaRep->defs[1], true);
+ changed |= SetHigh(cUnit, ssaRep->defs[1], true);
}
for (int i = 0; i < ssaRep->numUses; i++) {
- changed |= setFp(cUnit, ssaRep->uses[i], definedFP);
- changed |= setCore(cUnit, ssaRep->uses[i], definedCore);
- changed |= setRef(cUnit, ssaRep->uses[i], definedRef);
- changed |= setWide(cUnit, ssaRep->uses[i], isWide);
- changed |= setHigh(cUnit, ssaRep->uses[i], isHigh);
+ changed |= SetFp(cUnit, ssaRep->uses[i], definedFP);
+ changed |= SetCore(cUnit, ssaRep->uses[i], definedCore);
+ changed |= SetRef(cUnit, ssaRep->uses[i], definedRef);
+ changed |= SetWide(cUnit, ssaRep->uses[i], isWide);
+ changed |= SetHigh(cUnit, ssaRep->uses[i], isHigh);
}
if (attrs & DF_A_WIDE) {
DCHECK_EQ(ssaRep->numUses, 2);
- changed |= setWide(cUnit, ssaRep->uses[1], true);
- changed |= setHigh(cUnit, ssaRep->uses[1], true);
+ changed |= SetWide(cUnit, ssaRep->uses[1], true);
+ changed |= SetHigh(cUnit, ssaRep->uses[1], true);
}
}
}
@@ -364,7 +364,7 @@
static const char* storageName[] = {" Frame ", "PhysReg", " Spill "};
-void oatDumpRegLocTable(RegLocation* table, int count)
+static void DumpRegLocTable(RegLocation* table, int count)
{
for (int i = 0; i < count; i++) {
LOG(INFO) << StringPrintf("Loc[%02d] : %s, %c %c %c %c %c %c%d %c%d S%d",
@@ -372,22 +372,18 @@
table[i].wide ? 'W' : 'N', table[i].defined ? 'D' : 'U',
table[i].fp ? 'F' : table[i].ref ? 'R' :'C',
table[i].highWord ? 'H' : 'L', table[i].home ? 'h' : 't',
- oatIsFpReg(table[i].lowReg) ? 's' : 'r',
- table[i].lowReg & oatFpRegMask(),
- oatIsFpReg(table[i].highReg) ? 's' : 'r',
- table[i].highReg & oatFpRegMask(), table[i].sRegLow);
+ IsFpReg(table[i].lowReg) ? 's' : 'r',
+ table[i].lowReg & FpRegMask(),
+ IsFpReg(table[i].highReg) ? 's' : 'r',
+ table[i].highReg & FpRegMask(), table[i].sRegLow);
}
}
-void oatDumpRegLoc(RegLocation loc) {
- oatDumpRegLocTable(&loc, 1);
-}
-
static const RegLocation freshLoc = {kLocDalvikFrame, 0, 0, 0, 0, 0, 0, 0, 0,
INVALID_REG, INVALID_REG, INVALID_SREG,
INVALID_SREG};
-int oatComputeFrameSize(CompilationUnit* cUnit) {
+int ComputeFrameSize(CompilationUnit* cUnit) {
/* Figure out the frame size */
static const uint32_t kAlignMask = kStackAlignment - 1;
uint32_t size = (cUnit->numCoreSpills + cUnit->numFPSpills +
@@ -404,18 +400,18 @@
* allocation is done on the fly. We also do some initialization and
* type inference here.
*/
-void oatSimpleRegAlloc(CompilationUnit* cUnit)
+void SimpleRegAlloc(CompilationUnit* cUnit)
{
int i;
RegLocation* loc;
/* Allocate the location map */
- loc = static_cast<RegLocation*>(oatNew(cUnit, cUnit->numSSARegs * sizeof(*loc),
+ loc = static_cast<RegLocation*>(NewMem(cUnit, cUnit->numSSARegs * sizeof(*loc),
true, kAllocRegAlloc));
for (i=0; i< cUnit->numSSARegs; i++) {
loc[i] = freshLoc;
loc[i].sRegLow = i;
- loc[i].isConst = oatIsBitSet(cUnit->isConstantV, i);
+ loc[i].isConst = IsBitSet(cUnit->isConstantV, i);
}
/* Patch up the locations for Method* and the compiler temps */
@@ -432,7 +428,7 @@
/* Allocation the promotion map */
int numRegs = cUnit->numDalvikRegisters;
cUnit->promotionMap = static_cast<PromotionMap*>
- (oatNew(cUnit, (numRegs + cUnit->numCompilerTemps + 1) * sizeof(cUnit->promotionMap[0]),
+ (NewMem(cUnit, (numRegs + cUnit->numCompilerTemps + 1) * sizeof(cUnit->promotionMap[0]),
true, kAllocRegAlloc));
/* Add types of incoming arguments based on signature */
@@ -485,13 +481,13 @@
if (!cUnit->genBitcode) {
/* Remap names */
- oatDataFlowAnalysisDispatcher(cUnit, remapNames,
+ DataFlowAnalysisDispatcher(cUnit, RemapNames,
kPreOrderDFSTraversal,
false /* isIterative */);
}
/* Do type & size inference pass */
- oatDataFlowAnalysisDispatcher(cUnit, inferTypeAndSize,
+ DataFlowAnalysisDispatcher(cUnit, InferTypeAndSize,
kPreOrderDFSTraversal,
true /* isIterative */);
@@ -512,18 +508,18 @@
cUnit->fpSpillMask = 0;
cUnit->numCoreSpills = 0;
- oatDoPromotion(cUnit);
+ DoPromotion(cUnit);
/* Get easily-accessable post-promotion copy of RegLocation for Method* */
cUnit->methodLoc = cUnit->regLocation[cUnit->methodSReg];
if (cUnit->printMe && !(cUnit->disableOpt & (1 << kPromoteRegs))) {
LOG(INFO) << "After Promotion";
- oatDumpRegLocTable(cUnit->regLocation, cUnit->numSSARegs);
+ DumpRegLocTable(cUnit->regLocation, cUnit->numSSARegs);
}
/* Set the frame size */
- cUnit->frameSize = oatComputeFrameSize(cUnit);
+ cUnit->frameSize = ComputeFrameSize(cUnit);
}
} // namespace art
diff --git a/src/compiler/ralloc.h b/src/compiler/ralloc.h
index be94419..51bee9f 100644
--- a/src/compiler/ralloc.h
+++ b/src/compiler/ralloc.h
@@ -21,7 +21,7 @@
namespace art {
-void oatSimpleRegAlloc(CompilationUnit* cUnit);
+void SimpleRegAlloc(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler/ssa_transformation.cc b/src/compiler/ssa_transformation.cc
index bbe08f5..664893e 100644
--- a/src/compiler/ssa_transformation.cc
+++ b/src/compiler/ssa_transformation.cc
@@ -22,7 +22,7 @@
// Make sure iterative dfs recording matches old recursive version
//#define TEST_DFS
-inline BasicBlock* needsVisit(BasicBlock* bb) {
+static inline BasicBlock* NeedsVisit(BasicBlock* bb) {
if (bb != NULL) {
if (bb->visited || bb->hidden) {
bb = NULL;
@@ -31,21 +31,21 @@
return bb;
}
-BasicBlock* nextUnvisitedSuccessor(BasicBlock* bb)
+static BasicBlock* NextUnvisitedSuccessor(BasicBlock* bb)
{
- BasicBlock* res = needsVisit(bb->fallThrough);
+ BasicBlock* res = NeedsVisit(bb->fallThrough);
if (res == NULL) {
- res = needsVisit(bb->taken);
+ res = NeedsVisit(bb->taken);
if (res == NULL) {
if (bb->successorBlockList.blockListType != kNotUsed) {
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&bb->successorBlockList.blocks,
+ GrowableListIteratorInit(&bb->successorBlockList.blocks,
&iterator);
while (true) {
SuccessorBlockInfo *sbi = reinterpret_cast<SuccessorBlockInfo*>
- (oatGrowableListIteratorNext(&iterator));
+ (GrowableListIteratorNext(&iterator));
if (sbi == NULL) break;
- res = needsVisit(sbi->block);
+ res = NeedsVisit(sbi->block);
if (res != NULL) break;
}
}
@@ -54,35 +54,35 @@
return res;
}
-void markPreOrder(CompilationUnit* cUnit, BasicBlock* block)
+static void MarkPreOrder(CompilationUnit* cUnit, BasicBlock* block)
{
block->visited = true;
/* Enqueue the preOrder block id */
- oatInsertGrowableList(cUnit, &cUnit->dfsOrder, block->id);
+ InsertGrowableList(cUnit, &cUnit->dfsOrder, block->id);
}
-void recordDFSOrders(CompilationUnit* cUnit, BasicBlock* block)
+static void RecordDFSOrders(CompilationUnit* cUnit, BasicBlock* block)
{
std::vector<BasicBlock*> succ;
- markPreOrder(cUnit, block);
+ MarkPreOrder(cUnit, block);
succ.push_back(block);
while (!succ.empty()) {
BasicBlock* curr = succ.back();
- BasicBlock* nextSuccessor = nextUnvisitedSuccessor(curr);
+ BasicBlock* nextSuccessor = NextUnvisitedSuccessor(curr);
if (nextSuccessor != NULL) {
- markPreOrder(cUnit, nextSuccessor);
+ MarkPreOrder(cUnit, nextSuccessor);
succ.push_back(nextSuccessor);
continue;
}
curr->dfsId = cUnit->dfsPostOrder.numUsed;
- oatInsertGrowableList(cUnit, &cUnit->dfsPostOrder, curr->id);
+ InsertGrowableList(cUnit, &cUnit->dfsPostOrder, curr->id);
succ.pop_back();
}
}
#if defined(TEST_DFS)
/* Enter the node to the dfsOrder list then visit its successors */
-void recursiveRecordDFSOrders(CompilationUnit* cUnit, BasicBlock* block)
+static void RecursiveRecordDFSOrders(CompilationUnit* cUnit, BasicBlock* block)
{
if (block->visited || block->hidden) return;
@@ -98,38 +98,38 @@
}
/* Enqueue the preOrder block id */
- oatInsertGrowableList(cUnit, &cUnit->dfsOrder, block->id);
+ InsertGrowableList(cUnit, &cUnit->dfsOrder, block->id);
if (block->fallThrough) {
- recursiveRecordDFSOrders(cUnit, block->fallThrough);
+ RecursiveRecordDFSOrders(cUnit, block->fallThrough);
}
- if (block->taken) recursiveRecordDFSOrders(cUnit, block->taken);
+ if (block->taken) RecursiveRecordDFSOrders(cUnit, block->taken);
if (block->successorBlockList.blockListType != kNotUsed) {
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&block->successorBlockList.blocks,
+ GrowableListIteratorInit(&block->successorBlockList.blocks,
&iterator);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- (SuccessorBlockInfo *) oatGrowableListIteratorNext(&iterator);
+ (SuccessorBlockInfo *) GrowableListIteratorNext(&iterator);
if (successorBlockInfo == NULL) break;
BasicBlock* succBB = successorBlockInfo->block;
- recursiveRecordDFSOrders(cUnit, succBB);
+ RecursiveRecordDFSOrders(cUnit, succBB);
}
}
/* Record postorder in basic block and enqueue normal id in dfsPostOrder */
block->dfsId = cUnit->dfsPostOrder.numUsed;
- oatInsertGrowableList(cUnit, &cUnit->dfsPostOrder, block->id);
+ InsertGrowableList(cUnit, &cUnit->dfsPostOrder, block->id);
return;
}
#endif
/* Sort the blocks by the Depth-First-Search */
-void computeDFSOrders(CompilationUnit* cUnit)
+static void ComputeDFSOrders(CompilationUnit* cUnit)
{
/* Initialize or reset the DFS preOrder list */
if (cUnit->dfsOrder.elemList == NULL) {
- oatInitGrowableList(cUnit, &cUnit->dfsOrder, cUnit->numBlocks,
+ CompilerInitGrowableList(cUnit, &cUnit->dfsOrder, cUnit->numBlocks,
kListDfsOrder);
} else {
/* Just reset the used length on the counter */
@@ -138,7 +138,7 @@
/* Initialize or reset the DFS postOrder list */
if (cUnit->dfsPostOrder.elemList == NULL) {
- oatInitGrowableList(cUnit, &cUnit->dfsPostOrder, cUnit->numBlocks,
+ CompilerInitGrowableList(cUnit, &cUnit->dfsPostOrder, cUnit->numBlocks,
kListDfsPostOrder);
} else {
/* Just reset the used length on the counter */
@@ -147,34 +147,34 @@
#if defined(TEST_DFS)
// Reset visited flags
- oatDataFlowAnalysisDispatcher(cUnit, oatClearVisitedFlag,
+ DataFlowAnalysisDispatcher(cUnit, ClearVisitedFlag,
kAllNodes, false /* isIterative */);
// Record pre and post order dfs
- recursiveRecordDFSOrders(cUnit, cUnit->entryBlock);
+ RecursiveRecordDFSOrders(cUnit, cUnit->entryBlock);
// Copy the results for later comparison and reset the lists
GrowableList recursiveDfsOrder;
GrowableList recursiveDfsPostOrder;
- oatInitGrowableList(cUnit, &recursiveDfsOrder, cUnit->dfsOrder.numUsed,
+ CompilerInitGrowableList(cUnit, &recursiveDfsOrder, cUnit->dfsOrder.numUsed,
kListDfsOrder);
for (unsigned int i = 0; i < cUnit->dfsOrder.numUsed; i++) {
- oatInsertGrowableList(cUnit, &recursiveDfsOrder,
+ InsertGrowableList(cUnit, &recursiveDfsOrder,
cUnit->dfsOrder.elemList[i]);
}
cUnit->dfsOrder.numUsed = 0;
- oatInitGrowableList(cUnit, &recursiveDfsPostOrder,
+ CompilerInitGrowableList(cUnit, &recursiveDfsPostOrder,
cUnit->dfsPostOrder.numUsed, kListDfsOrder);
for (unsigned int i = 0; i < cUnit->dfsPostOrder.numUsed; i++) {
- oatInsertGrowableList(cUnit, &recursiveDfsPostOrder,
+ InsertGrowableList(cUnit, &recursiveDfsPostOrder,
cUnit->dfsPostOrder.elemList[i]);
}
cUnit->dfsPostOrder.numUsed = 0;
#endif
// Reset visited flags from all nodes
- oatDataFlowAnalysisDispatcher(cUnit, oatClearVisitedFlag,
+ DataFlowAnalysisDispatcher(cUnit, ClearVisitedFlag,
kAllNodes, false /* isIterative */);
// Record dfs orders
- recordDFSOrders(cUnit, cUnit->entryBlock);
+ RecordDFSOrders(cUnit, cUnit->entryBlock);
#if defined(TEST_DFS)
bool mismatch = false;
@@ -226,38 +226,38 @@
* Mark block bit on the per-Dalvik register vector to denote that Dalvik
* register idx is defined in BasicBlock bb.
*/
-bool fillDefBlockMatrix(CompilationUnit* cUnit, BasicBlock* bb)
+static bool FillDefBlockMatrix(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb->dataFlowInfo == NULL) return false;
ArenaBitVectorIterator iterator;
- oatBitVectorIteratorInit(bb->dataFlowInfo->defV, &iterator);
+ BitVectorIteratorInit(bb->dataFlowInfo->defV, &iterator);
while (true) {
- int idx = oatBitVectorIteratorNext(&iterator);
+ int idx = BitVectorIteratorNext(&iterator);
if (idx == -1) break;
/* Block bb defines register idx */
- oatSetBit(cUnit, cUnit->defBlockMatrix[idx], bb->id);
+ SetBit(cUnit, cUnit->defBlockMatrix[idx], bb->id);
}
return true;
}
-void computeDefBlockMatrix(CompilationUnit* cUnit)
+static void ComputeDefBlockMatrix(CompilationUnit* cUnit)
{
int numRegisters = cUnit->numDalvikRegisters;
/* Allocate numDalvikRegisters bit vector pointers */
cUnit->defBlockMatrix = static_cast<ArenaBitVector**>
- (oatNew(cUnit, sizeof(ArenaBitVector *) * numRegisters, true, kAllocDFInfo));
+ (NewMem(cUnit, sizeof(ArenaBitVector *) * numRegisters, true, kAllocDFInfo));
int i;
/* Initialize numRegister vectors with numBlocks bits each */
for (i = 0; i < numRegisters; i++) {
- cUnit->defBlockMatrix[i] = oatAllocBitVector(cUnit, cUnit->numBlocks,
+ cUnit->defBlockMatrix[i] = AllocBitVector(cUnit, cUnit->numBlocks,
false, kBitMapBMatrix);
}
- oatDataFlowAnalysisDispatcher(cUnit, oatFindLocalLiveIn,
+ DataFlowAnalysisDispatcher(cUnit, FindLocalLiveIn,
kAllNodes, false /* isIterative */);
- oatDataFlowAnalysisDispatcher(cUnit, fillDefBlockMatrix,
+ DataFlowAnalysisDispatcher(cUnit, FillDefBlockMatrix,
kAllNodes, false /* isIterative */);
/*
@@ -267,38 +267,38 @@
int numRegs = cUnit->numDalvikRegisters;
int inReg = numRegs - cUnit->numIns;
for (; inReg < numRegs; inReg++) {
- oatSetBit(cUnit, cUnit->defBlockMatrix[inReg], cUnit->entryBlock->id);
+ SetBit(cUnit, cUnit->defBlockMatrix[inReg], cUnit->entryBlock->id);
}
}
/* Compute the post-order traversal of the CFG */
-void computeDomPostOrderTraversal(CompilationUnit* cUnit, BasicBlock* bb)
+static void ComputeDomPostOrderTraversal(CompilationUnit* cUnit, BasicBlock* bb)
{
ArenaBitVectorIterator bvIterator;
- oatBitVectorIteratorInit(bb->iDominated, &bvIterator);
+ BitVectorIteratorInit(bb->iDominated, &bvIterator);
GrowableList* blockList = &cUnit->blockList;
/* Iterate through the dominated blocks first */
while (true) {
- //TUNING: hot call to oatBitVectorIteratorNext
- int bbIdx = oatBitVectorIteratorNext(&bvIterator);
+ //TUNING: hot call to BitVectorIteratorNext
+ int bbIdx = BitVectorIteratorNext(&bvIterator);
if (bbIdx == -1) break;
BasicBlock* dominatedBB =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, bbIdx));
- computeDomPostOrderTraversal(cUnit, dominatedBB);
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, bbIdx));
+ ComputeDomPostOrderTraversal(cUnit, dominatedBB);
}
/* Enter the current block id */
- oatInsertGrowableList(cUnit, &cUnit->domPostOrderTraversal, bb->id);
+ InsertGrowableList(cUnit, &cUnit->domPostOrderTraversal, bb->id);
/* hacky loop detection */
- if (bb->taken && oatIsBitSet(bb->dominators, bb->taken->id)) {
+ if (bb->taken && IsBitSet(bb->dominators, bb->taken->id)) {
cUnit->hasLoop = true;
}
}
-void checkForDominanceFrontier(CompilationUnit* cUnit, BasicBlock* domBB,
- const BasicBlock* succBB)
+static void CheckForDominanceFrontier(CompilationUnit* cUnit, BasicBlock* domBB,
+ const BasicBlock* succBB)
{
/*
* TODO - evaluate whether phi will ever need to be inserted into exit
@@ -307,53 +307,53 @@
if (succBB->iDom != domBB &&
succBB->blockType == kDalvikByteCode &&
succBB->hidden == false) {
- oatSetBit(cUnit, domBB->domFrontier, succBB->id);
+ SetBit(cUnit, domBB->domFrontier, succBB->id);
}
}
/* Worker function to compute the dominance frontier */
-bool computeDominanceFrontier(CompilationUnit* cUnit, BasicBlock* bb)
+static bool ComputeDominanceFrontier(CompilationUnit* cUnit, BasicBlock* bb)
{
GrowableList* blockList = &cUnit->blockList;
/* Calculate DF_local */
if (bb->taken) {
- checkForDominanceFrontier(cUnit, bb, bb->taken);
+ CheckForDominanceFrontier(cUnit, bb, bb->taken);
}
if (bb->fallThrough) {
- checkForDominanceFrontier(cUnit, bb, bb->fallThrough);
+ CheckForDominanceFrontier(cUnit, bb, bb->fallThrough);
}
if (bb->successorBlockList.blockListType != kNotUsed) {
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&bb->successorBlockList.blocks,
+ GrowableListIteratorInit(&bb->successorBlockList.blocks,
&iterator);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
if (successorBlockInfo == NULL) break;
BasicBlock* succBB = successorBlockInfo->block;
- checkForDominanceFrontier(cUnit, bb, succBB);
+ CheckForDominanceFrontier(cUnit, bb, succBB);
}
}
/* Calculate DF_up */
ArenaBitVectorIterator bvIterator;
- oatBitVectorIteratorInit(bb->iDominated, &bvIterator);
+ BitVectorIteratorInit(bb->iDominated, &bvIterator);
while (true) {
- //TUNING: hot call to oatBitVectorIteratorNext
- int dominatedIdx = oatBitVectorIteratorNext(&bvIterator);
+ //TUNING: hot call to BitVectorIteratorNext
+ int dominatedIdx = BitVectorIteratorNext(&bvIterator);
if (dominatedIdx == -1) break;
BasicBlock* dominatedBB =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, dominatedIdx));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, dominatedIdx));
ArenaBitVectorIterator dfIterator;
- oatBitVectorIteratorInit(dominatedBB->domFrontier, &dfIterator);
+ BitVectorIteratorInit(dominatedBB->domFrontier, &dfIterator);
while (true) {
- //TUNING: hot call to oatBitVectorIteratorNext
- int dfUpIdx = oatBitVectorIteratorNext(&dfIterator);
+ //TUNING: hot call to BitVectorIteratorNext
+ int dfUpIdx = BitVectorIteratorNext(&dfIterator);
if (dfUpIdx == -1) break;
BasicBlock* dfUpBlock =
- reinterpret_cast<BasicBlock*>( oatGrowableListGetElement(blockList, dfUpIdx));
- checkForDominanceFrontier(cUnit, bb, dfUpBlock);
+ reinterpret_cast<BasicBlock*>( GrowableListGetElement(blockList, dfUpIdx));
+ CheckForDominanceFrontier(cUnit, bb, dfUpBlock);
}
}
@@ -361,27 +361,27 @@
}
/* Worker function for initializing domination-related data structures */
-bool initializeDominationInfo(CompilationUnit* cUnit, BasicBlock* bb)
+static bool InitializeDominationInfo(CompilationUnit* cUnit, BasicBlock* bb)
{
int numTotalBlocks = cUnit->blockList.numUsed;
if (bb->dominators == NULL ) {
- bb->dominators = oatAllocBitVector(cUnit, numTotalBlocks,
+ bb->dominators = AllocBitVector(cUnit, numTotalBlocks,
false /* expandable */,
kBitMapDominators);
- bb->iDominated = oatAllocBitVector(cUnit, numTotalBlocks,
+ bb->iDominated = AllocBitVector(cUnit, numTotalBlocks,
false /* expandable */,
kBitMapIDominated);
- bb->domFrontier = oatAllocBitVector(cUnit, numTotalBlocks,
+ bb->domFrontier = AllocBitVector(cUnit, numTotalBlocks,
false /* expandable */,
kBitMapDomFrontier);
} else {
- oatClearAllBits(bb->dominators);
- oatClearAllBits(bb->iDominated);
- oatClearAllBits(bb->domFrontier);
+ ClearAllBits(bb->dominators);
+ ClearAllBits(bb->iDominated);
+ ClearAllBits(bb->domFrontier);
}
/* Set all bits in the dominator vector */
- oatSetInitialBits(bb->dominators, numTotalBlocks);
+ SetInitialBits(bb->dominators, numTotalBlocks);
return true;
}
@@ -389,9 +389,9 @@
/*
* Worker function to compute each block's dominators. This implementation
* is only used when kDebugVerifyDataflow is active and should compute
- * the same dominator sets as computeBlockDominators.
+ * the same dominator sets as ComputeBlockDominiators.
*/
-bool slowComputeBlockDominators(CompilationUnit* cUnit, BasicBlock* bb)
+static bool SlowComputeBlockDominators(CompilationUnit* cUnit, BasicBlock* bb)
{
GrowableList* blockList = &cUnit->blockList;
int numTotalBlocks = blockList->numUsed;
@@ -404,21 +404,21 @@
*/
if (bb == cUnit->entryBlock) return false;
- oatSetInitialBits(tempBlockV, numTotalBlocks);
+ SetInitialBits(tempBlockV, numTotalBlocks);
/* Iterate through the predecessors */
- oatGrowableListIteratorInit(bb->predecessors, &iter);
+ GrowableListIteratorInit(bb->predecessors, &iter);
while (true) {
- BasicBlock* predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ BasicBlock* predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
if (!predBB) break;
/* tempBlockV = tempBlockV ^ dominators */
if (predBB->dominators != NULL) {
- oatIntersectBitVectors(tempBlockV, tempBlockV, predBB->dominators);
+ IntersectBitVectors(tempBlockV, tempBlockV, predBB->dominators);
}
}
- oatSetBit(cUnit, tempBlockV, bb->id);
- if (oatCompareBitVectors(tempBlockV, bb->dominators)) {
- oatCopyBitVector(bb->dominators, tempBlockV);
+ SetBit(cUnit, tempBlockV, bb->id);
+ if (CompareBitVectors(tempBlockV, bb->dominators)) {
+ CopyBitVector(bb->dominators, tempBlockV);
return true;
}
return false;
@@ -427,9 +427,9 @@
/*
* Worker function to compute the idom. This implementation is only
* used when kDebugVerifyDataflow is active and should compute the
- * same iDom as computeBlockIDom.
+ * same iDom as ComputeblockIDom.
*/
-bool slowComputeBlockIDom(CompilationUnit* cUnit, BasicBlock* bb)
+static bool SlowComputeBlockIDom(CompilationUnit* cUnit, BasicBlock* bb)
{
GrowableList* blockList = &cUnit->blockList;
ArenaBitVector* tempBlockV = cUnit->tempBlockV;
@@ -438,36 +438,36 @@
if (bb == cUnit->entryBlock) return false;
- oatCopyBitVector(tempBlockV, bb->dominators);
- oatClearBit(tempBlockV, bb->id);
- oatBitVectorIteratorInit(tempBlockV, &bvIterator);
+ CopyBitVector(tempBlockV, bb->dominators);
+ ClearBit(tempBlockV, bb->id);
+ BitVectorIteratorInit(tempBlockV, &bvIterator);
/* Should not see any dead block */
- DCHECK_NE(oatCountSetBits(tempBlockV), 0);
- if (oatCountSetBits(tempBlockV) == 1) {
+ DCHECK_NE(CountSetBits(tempBlockV), 0);
+ if (CountSetBits(tempBlockV) == 1) {
iDom = reinterpret_cast<BasicBlock*>
- (oatGrowableListGetElement(blockList, oatBitVectorIteratorNext(&bvIterator)));
+ (GrowableListGetElement(blockList, BitVectorIteratorNext(&bvIterator)));
bb->iDom = iDom;
} else {
- int iDomIdx = oatBitVectorIteratorNext(&bvIterator);
+ int iDomIdx = BitVectorIteratorNext(&bvIterator);
DCHECK_NE(iDomIdx, -1);
while (true) {
- int nextDom = oatBitVectorIteratorNext(&bvIterator);
+ int nextDom = BitVectorIteratorNext(&bvIterator);
if (nextDom == -1) break;
BasicBlock* nextDomBB =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, nextDom));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, nextDom));
/* iDom dominates nextDom - set new iDom */
- if (oatIsBitSet(nextDomBB->dominators, iDomIdx)) {
+ if (IsBitSet(nextDomBB->dominators, iDomIdx)) {
iDomIdx = nextDom;
}
}
- iDom = reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, iDomIdx));
+ iDom = reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, iDomIdx));
/* Set the immediate dominator block for bb */
bb->iDom = iDom;
}
/* Add bb to the iDominated set of the immediate dominator block */
- oatSetBit(cUnit, iDom->iDominated, bb->id);
+ SetBit(cUnit, iDom->iDominated, bb->id);
return true;
}
@@ -476,7 +476,7 @@
* Given the ordering of iDomList, this common parent represents the
* last element of the intersection of block1 and block2 dominators.
*/
-int findCommonParent(CompilationUnit *cUnit, int block1, int block2)
+static int FindCommonParent(CompilationUnit *cUnit, int block1, int block2)
{
while (block1 != block2) {
while (block1 < block2) {
@@ -492,7 +492,7 @@
}
/* Worker function to compute each block's immediate dominator */
-bool computeBlockIDom(CompilationUnit* cUnit, BasicBlock* bb)
+static bool ComputeblockIDom(CompilationUnit* cUnit, BasicBlock* bb)
{
GrowableListIterator iter;
int idom = -1;
@@ -503,11 +503,11 @@
}
/* Iterate through the predecessors */
- oatGrowableListIteratorInit(bb->predecessors, &iter);
+ GrowableListIteratorInit(bb->predecessors, &iter);
/* Find the first processed predecessor */
while (true) {
- BasicBlock* predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ BasicBlock* predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
CHECK(predBB != NULL);
if (cUnit->iDomList[predBB->dfsId] != NOTVISITED) {
idom = predBB->dfsId;
@@ -517,12 +517,12 @@
/* Scan the rest of the predecessors */
while (true) {
- BasicBlock* predBB = reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ BasicBlock* predBB = reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
if (!predBB) break;
if (cUnit->iDomList[predBB->dfsId] == NOTVISITED) {
continue;
} else {
- idom = findCommonParent(cUnit, predBB->dfsId, idom);
+ idom = FindCommonParent(cUnit, predBB->dfsId, idom);
}
}
@@ -537,48 +537,48 @@
}
/* Worker function to compute each block's domintors */
-bool computeBlockDominators(CompilationUnit* cUnit, BasicBlock* bb)
+static bool ComputeBlockDominiators(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb == cUnit->entryBlock) {
- oatClearAllBits(bb->dominators);
+ ClearAllBits(bb->dominators);
} else {
- oatCopyBitVector(bb->dominators, bb->iDom->dominators);
+ CopyBitVector(bb->dominators, bb->iDom->dominators);
}
- oatSetBit(cUnit, bb->dominators, bb->id);
+ SetBit(cUnit, bb->dominators, bb->id);
return false;
}
-bool setDominators(CompilationUnit* cUnit, BasicBlock* bb)
+static bool SetDominators(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb != cUnit->entryBlock) {
int iDomDFSIdx = cUnit->iDomList[bb->dfsId];
DCHECK_NE(iDomDFSIdx, NOTVISITED);
int iDomIdx = cUnit->dfsPostOrder.elemList[iDomDFSIdx];
BasicBlock* iDom =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(&cUnit->blockList, iDomIdx));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(&cUnit->blockList, iDomIdx));
if (cUnit->enableDebug & (1 << kDebugVerifyDataflow)) {
DCHECK_EQ(bb->iDom->id, iDom->id);
}
bb->iDom = iDom;
/* Add bb to the iDominated set of the immediate dominator block */
- oatSetBit(cUnit, iDom->iDominated, bb->id);
+ SetBit(cUnit, iDom->iDominated, bb->id);
}
return false;
}
/* Compute dominators, immediate dominator, and dominance fronter */
-void computeDominators(CompilationUnit* cUnit)
+static void ComputeDominators(CompilationUnit* cUnit)
{
int numReachableBlocks = cUnit->numReachableBlocks;
int numTotalBlocks = cUnit->blockList.numUsed;
/* Initialize domination-related data structures */
- oatDataFlowAnalysisDispatcher(cUnit, initializeDominationInfo,
+ DataFlowAnalysisDispatcher(cUnit, InitializeDominationInfo,
kReachableNodes, false /* isIterative */);
/* Initalize & Clear iDomList */
if (cUnit->iDomList == NULL) {
- cUnit->iDomList = static_cast<int*>(oatNew(cUnit, sizeof(int) * numReachableBlocks,
+ cUnit->iDomList = static_cast<int*>(NewMem(cUnit, sizeof(int) * numReachableBlocks,
false, kAllocDFInfo));
}
for (int i = 0; i < numReachableBlocks; i++) {
@@ -590,40 +590,40 @@
cUnit->iDomList[cUnit->entryBlock->dfsId] = cUnit->entryBlock->dfsId;
/* Compute the immediate dominators */
- oatDataFlowAnalysisDispatcher(cUnit, computeBlockIDom,
+ DataFlowAnalysisDispatcher(cUnit, ComputeblockIDom,
kReversePostOrderTraversal,
true /* isIterative */);
/* Set the dominator for the root node */
- oatClearAllBits(cUnit->entryBlock->dominators);
- oatSetBit(cUnit, cUnit->entryBlock->dominators, cUnit->entryBlock->id);
+ ClearAllBits(cUnit->entryBlock->dominators);
+ SetBit(cUnit, cUnit->entryBlock->dominators, cUnit->entryBlock->id);
if (cUnit->tempBlockV == NULL) {
- cUnit->tempBlockV = oatAllocBitVector(cUnit, numTotalBlocks,
+ cUnit->tempBlockV = AllocBitVector(cUnit, numTotalBlocks,
false /* expandable */,
kBitMapTmpBlockV);
} else {
- oatClearAllBits(cUnit->tempBlockV);
+ ClearAllBits(cUnit->tempBlockV);
}
cUnit->entryBlock->iDom = NULL;
/* For testing, compute sets using alternate mechanism */
if (cUnit->enableDebug & (1 << kDebugVerifyDataflow)) {
// Use alternate mechanism to compute dominators for comparison
- oatDataFlowAnalysisDispatcher(cUnit, slowComputeBlockDominators,
+ DataFlowAnalysisDispatcher(cUnit, SlowComputeBlockDominators,
kPreOrderDFSTraversal,
true /* isIterative */);
- oatDataFlowAnalysisDispatcher(cUnit, slowComputeBlockIDom,
+ DataFlowAnalysisDispatcher(cUnit, SlowComputeBlockIDom,
kReachableNodes,
false /* isIterative */);
}
- oatDataFlowAnalysisDispatcher(cUnit, setDominators,
+ DataFlowAnalysisDispatcher(cUnit, SetDominators,
kReachableNodes,
false /* isIterative */);
- oatDataFlowAnalysisDispatcher(cUnit, computeBlockDominators,
+ DataFlowAnalysisDispatcher(cUnit, ComputeBlockDominiators,
kReversePostOrderTraversal,
false /* isIterative */);
@@ -632,17 +632,17 @@
* iDominated sets.
*/
if (cUnit->domPostOrderTraversal.elemList == NULL) {
- oatInitGrowableList(cUnit, &cUnit->domPostOrderTraversal,
+ CompilerInitGrowableList(cUnit, &cUnit->domPostOrderTraversal,
numReachableBlocks, kListDomPostOrderTraversal);
} else {
cUnit->domPostOrderTraversal.numUsed = 0;
}
- computeDomPostOrderTraversal(cUnit, cUnit->entryBlock);
+ ComputeDomPostOrderTraversal(cUnit, cUnit->entryBlock);
DCHECK_EQ(cUnit->domPostOrderTraversal.numUsed, static_cast<unsigned>(cUnit->numReachableBlocks));
/* Now compute the dominance frontier for each block */
- oatDataFlowAnalysisDispatcher(cUnit, computeDominanceFrontier,
+ DataFlowAnalysisDispatcher(cUnit, ComputeDominanceFrontier,
kPostOrderDOMTraversal,
false /* isIterative */);
}
@@ -651,9 +651,8 @@
* Perform dest U= src1 ^ ~src2
* This is probably not general enough to be placed in BitVector.[ch].
*/
-void computeSuccLiveIn(ArenaBitVector* dest,
- const ArenaBitVector* src1,
- const ArenaBitVector* src2)
+static void ComputeSuccLineIn(ArenaBitVector* dest, const ArenaBitVector* src1,
+ const ArenaBitVector* src2)
{
if (dest->storageSize != src1->storageSize ||
dest->storageSize != src2->storageSize ||
@@ -673,59 +672,59 @@
* The calculated result is used for phi-node pruning - where we only need to
* insert a phi node if the variable is live-in to the block.
*/
-bool computeBlockLiveIns(CompilationUnit* cUnit, BasicBlock* bb)
+static bool ComputeBlockLiveIns(CompilationUnit* cUnit, BasicBlock* bb)
{
ArenaBitVector* tempDalvikRegisterV = cUnit->tempDalvikRegisterV;
if (bb->dataFlowInfo == NULL) return false;
- oatCopyBitVector(tempDalvikRegisterV, bb->dataFlowInfo->liveInV);
+ CopyBitVector(tempDalvikRegisterV, bb->dataFlowInfo->liveInV);
if (bb->taken && bb->taken->dataFlowInfo)
- computeSuccLiveIn(tempDalvikRegisterV, bb->taken->dataFlowInfo->liveInV,
+ ComputeSuccLineIn(tempDalvikRegisterV, bb->taken->dataFlowInfo->liveInV,
bb->dataFlowInfo->defV);
if (bb->fallThrough && bb->fallThrough->dataFlowInfo)
- computeSuccLiveIn(tempDalvikRegisterV,
+ ComputeSuccLineIn(tempDalvikRegisterV,
bb->fallThrough->dataFlowInfo->liveInV,
bb->dataFlowInfo->defV);
if (bb->successorBlockList.blockListType != kNotUsed) {
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&bb->successorBlockList.blocks,
+ GrowableListIteratorInit(&bb->successorBlockList.blocks,
&iterator);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
if (successorBlockInfo == NULL) break;
BasicBlock* succBB = successorBlockInfo->block;
if (succBB->dataFlowInfo) {
- computeSuccLiveIn(tempDalvikRegisterV,
+ ComputeSuccLineIn(tempDalvikRegisterV,
succBB->dataFlowInfo->liveInV,
bb->dataFlowInfo->defV);
}
}
}
- if (oatCompareBitVectors(tempDalvikRegisterV, bb->dataFlowInfo->liveInV)) {
- oatCopyBitVector(bb->dataFlowInfo->liveInV, tempDalvikRegisterV);
+ if (CompareBitVectors(tempDalvikRegisterV, bb->dataFlowInfo->liveInV)) {
+ CopyBitVector(bb->dataFlowInfo->liveInV, tempDalvikRegisterV);
return true;
}
return false;
}
/* Insert phi nodes to for each variable to the dominance frontiers */
-void insertPhiNodes(CompilationUnit* cUnit)
+static void InsertPhiNodes(CompilationUnit* cUnit)
{
int dalvikReg;
const GrowableList* blockList = &cUnit->blockList;
ArenaBitVector* phiBlocks =
- oatAllocBitVector(cUnit, cUnit->numBlocks, false, kBitMapPhi);
+ AllocBitVector(cUnit, cUnit->numBlocks, false, kBitMapPhi);
ArenaBitVector* tmpBlocks =
- oatAllocBitVector(cUnit, cUnit->numBlocks, false, kBitMapTmpBlocks);
+ AllocBitVector(cUnit, cUnit->numBlocks, false, kBitMapTmpBlocks);
ArenaBitVector* inputBlocks =
- oatAllocBitVector(cUnit, cUnit->numBlocks, false, kBitMapInputBlocks);
+ AllocBitVector(cUnit, cUnit->numBlocks, false, kBitMapInputBlocks);
cUnit->tempDalvikRegisterV =
- oatAllocBitVector(cUnit, cUnit->numDalvikRegisters, false,
+ AllocBitVector(cUnit, cUnit->numDalvikRegisters, false,
kBitMapRegisterV);
- oatDataFlowAnalysisDispatcher(cUnit, computeBlockLiveIns,
+ DataFlowAnalysisDispatcher(cUnit, ComputeBlockLiveIns,
kPostOrderDFSTraversal, true /* isIterative */);
/* Iterate through each Dalvik register */
@@ -733,37 +732,37 @@
bool change;
ArenaBitVectorIterator iterator;
- oatCopyBitVector(inputBlocks, cUnit->defBlockMatrix[dalvikReg]);
- oatClearAllBits(phiBlocks);
+ CopyBitVector(inputBlocks, cUnit->defBlockMatrix[dalvikReg]);
+ ClearAllBits(phiBlocks);
/* Calculate the phi blocks for each Dalvik register */
do {
change = false;
- oatClearAllBits(tmpBlocks);
- oatBitVectorIteratorInit(inputBlocks, &iterator);
+ ClearAllBits(tmpBlocks);
+ BitVectorIteratorInit(inputBlocks, &iterator);
while (true) {
- int idx = oatBitVectorIteratorNext(&iterator);
+ int idx = BitVectorIteratorNext(&iterator);
if (idx == -1) break;
BasicBlock* defBB =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, idx));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, idx));
/* Merge the dominance frontier to tmpBlocks */
- //TUNING: hot call to oatUnifyBitVectors
+ //TUNING: hot call to UnifyBitVetors
if (defBB->domFrontier != NULL) {
- oatUnifyBitVectors(tmpBlocks, tmpBlocks, defBB->domFrontier);
+ UnifyBitVetors(tmpBlocks, tmpBlocks, defBB->domFrontier);
}
}
- if (oatCompareBitVectors(phiBlocks, tmpBlocks)) {
+ if (CompareBitVectors(phiBlocks, tmpBlocks)) {
change = true;
- oatCopyBitVector(phiBlocks, tmpBlocks);
+ CopyBitVector(phiBlocks, tmpBlocks);
/*
* Iterate through the original blocks plus the new ones in
* the dominance frontier.
*/
- oatCopyBitVector(inputBlocks, phiBlocks);
- oatUnifyBitVectors(inputBlocks, inputBlocks,
+ CopyBitVector(inputBlocks, phiBlocks);
+ UnifyBitVetors(inputBlocks, inputBlocks,
cUnit->defBlockMatrix[dalvikReg]);
}
} while (change);
@@ -772,21 +771,21 @@
* Insert a phi node for dalvikReg in the phiBlocks if the Dalvik
* register is in the live-in set.
*/
- oatBitVectorIteratorInit(phiBlocks, &iterator);
+ BitVectorIteratorInit(phiBlocks, &iterator);
while (true) {
- int idx = oatBitVectorIteratorNext(&iterator);
+ int idx = BitVectorIteratorNext(&iterator);
if (idx == -1) break;
BasicBlock* phiBB =
- reinterpret_cast<BasicBlock*>(oatGrowableListGetElement(blockList, idx));
+ reinterpret_cast<BasicBlock*>(GrowableListGetElement(blockList, idx));
/* Variable will be clobbered before being used - no need for phi */
- if (!oatIsBitSet(phiBB->dataFlowInfo->liveInV, dalvikReg)) continue;
- MIR *phi = static_cast<MIR*>(oatNew(cUnit, sizeof(MIR), true, kAllocDFInfo));
+ if (!IsBitSet(phiBB->dataFlowInfo->liveInV, dalvikReg)) continue;
+ MIR *phi = static_cast<MIR*>(NewMem(cUnit, sizeof(MIR), true, kAllocDFInfo));
phi->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpPhi);
phi->dalvikInsn.vA = dalvikReg;
phi->offset = phiBB->startOffset;
phi->meta.phiNext = cUnit->phiList;
cUnit->phiList = phi;
- oatPrependMIR(phiBB, phi);
+ PrependMIR(phiBB, phi);
}
}
}
@@ -795,7 +794,7 @@
* Worker function to insert phi-operands with latest SSA names from
* predecessor blocks
*/
-bool insertPhiNodeOperands(CompilationUnit* cUnit, BasicBlock* bb)
+static bool InsertPhiNodeOperands(CompilationUnit* cUnit, BasicBlock* bb)
{
GrowableListIterator iter;
MIR *mir;
@@ -814,10 +813,10 @@
incomingArc.clear();
/* Iterate through the predecessors */
- oatGrowableListIteratorInit(bb->predecessors, &iter);
+ GrowableListIteratorInit(bb->predecessors, &iter);
while (true) {
BasicBlock* predBB =
- reinterpret_cast<BasicBlock*>(oatGrowableListIteratorNext(&iter));
+ reinterpret_cast<BasicBlock*>(GrowableListIteratorNext(&iter));
if (!predBB) break;
int ssaReg = predBB->dataFlowInfo->vRegToSSAMap[vReg];
uses.push_back(ssaReg);
@@ -828,11 +827,11 @@
int numUses = uses.size();
mir->ssaRep->numUses = numUses;
mir->ssaRep->uses =
- static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, false, kAllocDFInfo));
+ static_cast<int*>(NewMem(cUnit, sizeof(int) * numUses, false, kAllocDFInfo));
mir->ssaRep->fpUse =
- static_cast<bool*>(oatNew(cUnit, sizeof(bool) * numUses, true, kAllocDFInfo));
+ static_cast<bool*>(NewMem(cUnit, sizeof(bool) * numUses, true, kAllocDFInfo));
int* incoming =
- static_cast<int*>(oatNew(cUnit, sizeof(int) * numUses, false, kAllocDFInfo));
+ static_cast<int*>(NewMem(cUnit, sizeof(int) * numUses, false, kAllocDFInfo));
// TODO: Ugly, rework (but don't burden each MIR/LIR for Phi-only needs)
mir->dalvikInsn.vB = reinterpret_cast<uintptr_t>(incoming);
@@ -847,39 +846,39 @@
return true;
}
-void doDFSPreOrderSSARename(CompilationUnit* cUnit, BasicBlock* block)
+static void DoDFSPreOrderSSARename(CompilationUnit* cUnit, BasicBlock* block)
{
if (block->visited || block->hidden) return;
block->visited = true;
/* Process this block */
- oatDoSSAConversion(cUnit, block);
+ DoSSAConversion(cUnit, block);
int mapSize = sizeof(int) * cUnit->numDalvikRegisters;
/* Save SSA map snapshot */
- int* savedSSAMap = static_cast<int*>(oatNew(cUnit, mapSize, false, kAllocDalvikToSSAMap));
+ int* savedSSAMap = static_cast<int*>(NewMem(cUnit, mapSize, false, kAllocDalvikToSSAMap));
memcpy(savedSSAMap, cUnit->vRegToSSAMap, mapSize);
if (block->fallThrough) {
- doDFSPreOrderSSARename(cUnit, block->fallThrough);
+ DoDFSPreOrderSSARename(cUnit, block->fallThrough);
/* Restore SSA map snapshot */
memcpy(cUnit->vRegToSSAMap, savedSSAMap, mapSize);
}
if (block->taken) {
- doDFSPreOrderSSARename(cUnit, block->taken);
+ DoDFSPreOrderSSARename(cUnit, block->taken);
/* Restore SSA map snapshot */
memcpy(cUnit->vRegToSSAMap, savedSSAMap, mapSize);
}
if (block->successorBlockList.blockListType != kNotUsed) {
GrowableListIterator iterator;
- oatGrowableListIteratorInit(&block->successorBlockList.blocks, &iterator);
+ GrowableListIteratorInit(&block->successorBlockList.blocks, &iterator);
while (true) {
SuccessorBlockInfo *successorBlockInfo =
- reinterpret_cast<SuccessorBlockInfo*>(oatGrowableListIteratorNext(&iterator));
+ reinterpret_cast<SuccessorBlockInfo*>(GrowableListIteratorNext(&iterator));
if (successorBlockInfo == NULL) break;
BasicBlock* succBB = successorBlockInfo->block;
- doDFSPreOrderSSARename(cUnit, succBB);
+ DoDFSPreOrderSSARename(cUnit, succBB);
/* Restore SSA map snapshot */
memcpy(cUnit->vRegToSSAMap, savedSSAMap, mapSize);
}
@@ -889,45 +888,45 @@
}
/* Perform SSA transformation for the whole method */
-void oatMethodSSATransformation(CompilationUnit* cUnit)
+void SSATransformation(CompilationUnit* cUnit)
{
/* Compute the DFS order */
- computeDFSOrders(cUnit);
+ ComputeDFSOrders(cUnit);
if (!cUnit->disableDataflow) {
/* Compute the dominator info */
- computeDominators(cUnit);
+ ComputeDominators(cUnit);
}
/* Allocate data structures in preparation for SSA conversion */
- oatInitializeSSAConversion(cUnit);
+ CompilerInitializeSSAConversion(cUnit);
if (!cUnit->disableDataflow) {
/* Find out the "Dalvik reg def x block" relation */
- computeDefBlockMatrix(cUnit);
+ ComputeDefBlockMatrix(cUnit);
/* Insert phi nodes to dominance frontiers for all variables */
- insertPhiNodes(cUnit);
+ InsertPhiNodes(cUnit);
}
/* Rename register names by local defs and phi nodes */
- oatDataFlowAnalysisDispatcher(cUnit, oatClearVisitedFlag,
+ DataFlowAnalysisDispatcher(cUnit, ClearVisitedFlag,
kAllNodes, false /* isIterative */);
- doDFSPreOrderSSARename(cUnit, cUnit->entryBlock);
+ DoDFSPreOrderSSARename(cUnit, cUnit->entryBlock);
if (!cUnit->disableDataflow) {
/*
* Shared temp bit vector used by each block to count the number of defs
* from all the predecessor blocks.
*/
- cUnit->tempSSARegisterV = oatAllocBitVector(cUnit, cUnit->numSSARegs,
+ cUnit->tempSSARegisterV = AllocBitVector(cUnit, cUnit->numSSARegs,
false, kBitMapTempSSARegisterV);
cUnit->tempSSABlockIdV =
- static_cast<int*>(oatNew(cUnit, sizeof(int) * cUnit->numSSARegs, false, kAllocDFInfo));
+ static_cast<int*>(NewMem(cUnit, sizeof(int) * cUnit->numSSARegs, false, kAllocDFInfo));
/* Insert phi-operands with latest SSA names from predecessor blocks */
- oatDataFlowAnalysisDispatcher(cUnit, insertPhiNodeOperands,
+ DataFlowAnalysisDispatcher(cUnit, InsertPhiNodeOperands,
kReachableNodes, false /* isIterative */);
}
}
diff --git a/src/compiler/ssa_transformation.h b/src/compiler/ssa_transformation.h
index 4c3ceb3..aef7782 100644
--- a/src/compiler/ssa_transformation.h
+++ b/src/compiler/ssa_transformation.h
@@ -21,7 +21,7 @@
namespace art {
-void oatMethodSSATransformation(CompilationUnit* cUnit);
+void SSATransformation(CompilationUnit* cUnit);
} // namespace art
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index aa5ec82..a0264fe 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -40,7 +40,7 @@
#if defined(ART_USE_PORTABLE_COMPILER)
namespace art {
-void oatCompileMethod(Compiler& compiler,
+void CompileOneMethod(Compiler& compiler,
const CompilerBackend compilerBackend,
const DexFile::CodeItem* code_item,
uint32_t access_flags, InvokeType invoke_type,
@@ -164,7 +164,7 @@
return method_compiler->Compile();
} else {
// TODO: consolidate ArtCompileMethods
- oatCompileMethod(*compiler_,
+ CompileOneMethod(*compiler_,
kPortable,
oat_compilation_unit->GetCodeItem(),
oat_compilation_unit->access_flags_,