Quick Compiler: static, extern and inline cleanup
More declarations cleanup. Some dead code removal. No logic changes.
Change-Id: Ife3d0426082f4eeae7c0010ceb92d7dbdc823c71
diff --git a/src/compiler/codegen/arm/call_arm.cc b/src/compiler/codegen/arm/call_arm.cc
index 3250448..98137ad 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)
+static int InPosition(CompilationUnit* cUnit, int sReg)
{
int vReg = SRegToVReg(cUnit, sReg);
return vReg - cUnit->numRegs;
@@ -83,7 +83,7 @@
}
/* Lock any referenced arguments that arrive in registers */
-void LockLiveArgs(CompilationUnit* cUnit, MIR* mir)
+static void LockLiveArgs(CompilationUnit* cUnit, MIR* mir)
{
int firstIn = cUnit->numRegs;
const int numArgRegs = 3; // TODO: generalize & move to RegUtil.cc
@@ -97,7 +97,7 @@
}
/* Find the next MIR, which may be in a following basic block */
-MIR* GetNextMir(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir)
+static MIR* GetNextMir(CompilationUnit* cUnit, BasicBlock** pBb, MIR* mir)
{
BasicBlock* bb = *pBb;
MIR* origMir = mir;
@@ -135,8 +135,8 @@
}
}
-MIR* SpecialIGet(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
- OpSize size, bool longOrDouble, bool isObject)
+static MIR* SpecialIGet(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
+ OpSize size, bool longOrDouble, bool isObject)
{
int fieldOffset;
bool isVolatile;
@@ -162,8 +162,8 @@
return GetNextMir(cUnit, bb, mir);
}
-MIR* SpecialIPut(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
- OpSize size, bool longOrDouble, bool isObject)
+static MIR* SpecialIPut(CompilationUnit* cUnit, BasicBlock** bb, MIR* mir,
+ OpSize size, bool longOrDouble, bool isObject)
{
int fieldOffset;
bool isVolatile;
@@ -198,7 +198,7 @@
return GetNextMir(cUnit, bb, mir);
}
-MIR* SpecialIdentity(CompilationUnit* cUnit, MIR* mir)
+static MIR* SpecialIdentity(CompilationUnit* cUnit, MIR* mir)
{
RegLocation rlSrc;
RegLocation rlDest;
diff --git a/src/compiler/codegen/arm/target_arm.cc b/src/compiler/codegen/arm/target_arm.cc
index 744800d..f5d13d3 100644
--- a/src/compiler/codegen/arm/target_arm.cc
+++ b/src/compiler/codegen/arm/target_arm.cc
@@ -275,7 +275,7 @@
"ror"};
/* Decode and print a ARM register name */
-char* DecodeRegList(int opcode, int vector, char* buf)
+static 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)
+static 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)
+static int ExpandImmediate(int value)
{
int mode = (value & 0xf00) >> 8;
uint32_t bits = value & 0xff;
@@ -738,7 +738,7 @@
Clobber(cUnit, fr15);
}
-extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit)
+RegLocation GetReturnWideAlt(CompilationUnit* cUnit)
{
RegLocation res = LocCReturnWide();
res.lowReg = r2;
@@ -751,7 +751,7 @@
return res;
}
-extern RegLocation GetReturnAlt(CompilationUnit* cUnit)
+RegLocation GetReturnAlt(CompilationUnit* cUnit)
{
RegLocation res = LocCReturn();
res.lowReg = r1;
@@ -760,14 +760,14 @@
return res;
}
-extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg)
+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 LockCallTemps(CompilationUnit* cUnit)
+void LockCallTemps(CompilationUnit* cUnit)
{
LockTemp(cUnit, r0);
LockTemp(cUnit, r1);
@@ -776,7 +776,7 @@
}
/* To be used when explicitly managing register use */
-extern void FreeCallTemps(CompilationUnit* cUnit)
+void FreeCallTemps(CompilationUnit* cUnit)
{
FreeTemp(cUnit, r0);
FreeTemp(cUnit, r1);
diff --git a/src/compiler/codegen/arm/utility_arm.cc b/src/compiler/codegen/arm/utility_arm.cc
index 1c8ea89..bfb05d5 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)
+static int EncodeImmSingle(int value)
{
int res;
int bitA = (value & 0x80000000) >> 31;
@@ -44,7 +44,7 @@
return res;
}
-LIR* LoadFPConstantValue(CompilationUnit* cUnit, int rDest, int value)
+static LIR* LoadFPConstantValue(CompilationUnit* cUnit, int rDest, int value)
{
int encodedImm = EncodeImmSingle(value);
DCHECK(ARM_SINGLEREG(rDest));
@@ -63,7 +63,7 @@
return loadPcRel;
}
-int LeadingZeros(uint32_t val)
+static int LeadingZeros(uint32_t val)
{
uint32_t alt;
int n;
@@ -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)
+static int EncodeImmDoubleHigh(int value)
{
int res;
int bitA = (value & 0x80000000) >> 31;
@@ -589,7 +589,7 @@
return res;
}
-int EncodeImmDouble(int valLo, int valHi)
+static int EncodeImmDouble(int valLo, int valHi)
{
int res = -1;
if (valLo == 0)
diff --git a/src/compiler/codegen/codegen_util.cc b/src/compiler/codegen/codegen_util.cc
index 26bf613..5082185 100644
--- a/src/compiler/codegen/codegen_util.cc
+++ b/src/compiler/codegen/codegen_util.cc
@@ -276,9 +276,9 @@
}
/* Dump a mapping table */
-void DumpMappingTable(const char* table_name, const std::string& descriptor,
- const std::string& name, const std::string& signature,
- const std::vector<uint32_t>& v) {
+static 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) {
std::string line(StringPrintf("\n %s %s%s_%s_table[%zu] = {", table_name,
descriptor.c_str(), name.c_str(), signature.c_str(), v.size()));
@@ -488,26 +488,21 @@
return AddWordData(cUnit, constantListP, valLo);
}
-void PushWord(std::vector<uint8_t>&buf, int data) {
+static 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) {
+static void AlignBuffer(std::vector<uint8_t>&buf, size_t offset) {
while (buf.size() < offset) {
buf.push_back(0);
}
}
-bool IsDirect(int invokeType) {
- InvokeType type = static_cast<InvokeType>(invokeType);
- return type == kStatic || type == kDirect;
-}
-
/* Write the literal pool to the output stream */
-void InstallLiteralPools(CompilationUnit* cUnit)
+static void InstallLiteralPools(CompilationUnit* cUnit)
{
AlignBuffer(cUnit->codeBuffer, cUnit->dataOffset);
LIR* dataLIR = cUnit->literalList;
@@ -549,7 +544,7 @@
}
/* Write the switch tables to the output stream */
-void InstallSwitchTables(CompilationUnit* cUnit)
+static void InstallSwitchTables(CompilationUnit* cUnit)
{
GrowableListIterator iterator;
GrowableListIteratorInit(&cUnit->switchTables, &iterator);
@@ -608,7 +603,7 @@
}
/* Write the fill array dta to the output stream */
-void InstallFillArrayData(CompilationUnit* cUnit)
+static void InstallFillArrayData(CompilationUnit* cUnit)
{
GrowableListIterator iterator;
GrowableListIteratorInit(&cUnit->fillArrayData, &iterator);
@@ -624,7 +619,7 @@
}
}
-int AssignLiteralOffsetCommon(LIR* lir, int offset)
+static int AssignLiteralOffsetCommon(LIR* lir, int offset)
{
for (;lir != NULL; lir = lir->next) {
lir->offset = offset;
@@ -634,7 +629,7 @@
}
// Make sure we have a code address for every declared catch entry
-bool VerifyCatchEntries(CompilationUnit* cUnit)
+static bool VerifyCatchEntries(CompilationUnit* cUnit)
{
bool success = true;
for (std::set<uint32_t>::const_iterator it = cUnit->catches.begin(); it != cUnit->catches.end(); ++it) {
@@ -667,7 +662,7 @@
return success;
}
-void CreateMappingTables(CompilationUnit* cUnit)
+static void CreateMappingTables(CompilationUnit* cUnit)
{
for (LIR* tgtLIR = cUnit->firstLIRInsn; tgtLIR != NULL; tgtLIR = NEXT_LIR(tgtLIR)) {
if (!tgtLIR->flags.isNop && (tgtLIR->opcode == kPseudoSafepointPC)) {
@@ -796,7 +791,7 @@
}
/* Determine the offset of each literal field */
-int AssignLiteralOffset(CompilationUnit* cUnit, int offset)
+static int AssignLiteralOffset(CompilationUnit* cUnit, int offset)
{
offset = AssignLiteralOffsetCommon(cUnit->literalList, offset);
offset = AssignLiteralOffsetCommon(cUnit->codeLiteralList, offset);
@@ -804,7 +799,7 @@
return offset;
}
-int AssignSiwtchTablesOffset(CompilationUnit* cUnit, int offset)
+static int AssignSwitchTablesOffset(CompilationUnit* cUnit, int offset)
{
GrowableListIterator iterator;
GrowableListIteratorInit(&cUnit->switchTables, &iterator);
@@ -823,7 +818,7 @@
return offset;
}
-int AssignFillArrayDataOffset(CompilationUnit* cUnit, int offset)
+static int AssignFillArrayDataOffset(CompilationUnit* cUnit, int offset)
{
GrowableListIterator iterator;
GrowableListIteratorInit(&cUnit->fillArrayData, &iterator);
@@ -843,7 +838,7 @@
* Walk the compilation unit and assign offsets to instructions
* and literals and compute the total size of the compiled unit.
*/
-void AssignOffsets(CompilationUnit* cUnit)
+static void AssignOffsets(CompilationUnit* cUnit)
{
int offset = AssignInsnOffsets(cUnit);
@@ -855,7 +850,7 @@
offset = AssignLiteralOffset(cUnit, offset);
- offset = AssignSiwtchTablesOffset(cUnit, offset);
+ offset = AssignSwitchTablesOffset(cUnit, offset);
offset = AssignFillArrayDataOffset(cUnit, offset);
@@ -913,7 +908,7 @@
* 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)
+static LIR* InsertCaseLabel(CompilationUnit* cUnit, int vaddr, int keyVal)
{
SafeMap<unsigned int, LIR*>::iterator it;
it = cUnit->boundaryMap.find(vaddr);
@@ -928,7 +923,7 @@
return newLabel;
}
-void MarkPackedCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
+static void MarkPackedCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
{
const uint16_t* table = tabRec->table;
int baseVaddr = tabRec->vaddr;
@@ -940,7 +935,7 @@
}
}
-void MarkSparseCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
+static void MarkSparseCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec)
{
const uint16_t* table = tabRec->table;
int baseVaddr = tabRec->vaddr;
diff --git a/src/compiler/codegen/codegen_util.h b/src/compiler/codegen/codegen_util.h
index 9920014..a4574f9 100644
--- a/src/compiler/codegen/codegen_util.h
+++ b/src/compiler/codegen/codegen_util.h
@@ -29,7 +29,6 @@
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);
diff --git a/src/compiler/codegen/gen_common.cc b/src/compiler/codegen/gen_common.cc
index af7d4e0..7108825 100644
--- a/src/compiler/codegen/gen_common.cc
+++ b/src/compiler/codegen/gen_common.cc
@@ -1767,20 +1767,20 @@
* or produce corresponding Thumb instructions directly.
*/
-bool IsPowerOfTwo(int x)
+static 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)
+static 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) {
+static int LowestSetBit(unsigned int x) {
int bit_posn = 0;
while ((x & 0xf) == 0) {
bit_posn += 4;
@@ -1795,8 +1795,8 @@
// 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,
- RegLocation rlSrc, RegLocation rlDest, int lit)
+static bool HandleEasyDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
+ RegLocation rlSrc, RegLocation rlDest, int lit)
{
if ((lit < 2) || ((cUnit->instructionSet != kThumb2) && !IsPowerOfTwo(lit))) {
return false;
@@ -1849,8 +1849,8 @@
// 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,
- RegLocation rlDest, int lit)
+static bool HandleEasyMultiply(CompilationUnit* cUnit, RegLocation rlSrc,
+ RegLocation rlDest, int lit)
{
// Can we simplify this multiplication?
bool powerOfTwo = false;
diff --git a/src/compiler/codegen/gen_common.h b/src/compiler/codegen/gen_common.h
index 04e32f2..3254756 100644
--- a/src/compiler/codegen/gen_common.h
+++ b/src/compiler/codegen/gen_common.h
@@ -68,8 +68,6 @@
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);
diff --git a/src/compiler/codegen/gen_invoke.cc b/src/compiler/codegen/gen_invoke.cc
index 6f8b092..bc55800 100644
--- a/src/compiler/codegen/gen_invoke.cc
+++ b/src/compiler/codegen/gen_invoke.cc
@@ -110,34 +110,14 @@
}
}
-void ScanMethodLiteralPool(CompilationUnit* cUnit, LIR** methodTarget, LIR** codeTarget,
- const DexFile* dexFile, uint32_t dexMethodIdx)
-{
- LIR* curTarget = cUnit->methodLiteralList;
- LIR* nextTarget = curTarget != NULL ? curTarget->next : NULL;
- while (curTarget != NULL && nextTarget != NULL) {
- if (curTarget->operands[0] == reinterpret_cast<intptr_t>(dexFile) &&
- nextTarget->operands[0] == static_cast<int>(dexMethodIdx)) {
- *codeTarget = curTarget;
- *methodTarget = nextTarget;
- DCHECK((*codeTarget)->next == *methodTarget);
- DCHECK_EQ((*codeTarget)->operands[0], reinterpret_cast<intptr_t>(dexFile));
- DCHECK_EQ((*methodTarget)->operands[0], static_cast<int>(dexMethodIdx));
- break;
- }
- curTarget = nextTarget->next;
- nextTarget = curTarget != NULL ? curTarget->next : NULL;
- }
-}
-
/*
* 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 state, uint32_t dexIdx, uint32_t unused,
- uintptr_t directCode, uintptr_t directMethod,
- InvokeType type)
+static int NextSDCallInsn(CompilationUnit* cUnit, CallInfo* info,
+ int state, uint32_t dexIdx, uint32_t unused,
+ uintptr_t directCode, uintptr_t directMethod,
+ InvokeType type)
{
if (cUnit->instructionSet != kThumb2) {
// Disable sharpening
@@ -227,9 +207,9 @@
* Note also that we'll load the first argument ("this") into
* kArg1 here rather than the standard LoadArgRegs.
*/
-int NextVCallInsn(CompilationUnit* cUnit, CallInfo* info,
- int state, uint32_t dexIdx, uint32_t methodIdx,
- uintptr_t unused, uintptr_t unused2, InvokeType unused3)
+static int NextVCallInsn(CompilationUnit* cUnit, CallInfo* info,
+ int state, uint32_t dexIdx, uint32_t methodIdx,
+ uintptr_t unused, uintptr_t unused2, InvokeType unused3)
{
/*
* This is the fast path in which the target virtual method is
@@ -272,9 +252,9 @@
* 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,
- uint32_t dexIdx, uint32_t unused, uintptr_t unused2,
- uintptr_t directMethod, InvokeType unused4)
+static int NextInterfaceCallInsn(CompilationUnit* cUnit, CallInfo* info, int state,
+ uint32_t dexIdx, uint32_t unused, uintptr_t unused2,
+ uintptr_t directMethod, InvokeType unused4)
{
if (cUnit->instructionSet != kThumb2) {
// Disable sharpening
@@ -333,8 +313,8 @@
return state + 1;
}
-int NextInvokeInsnSP(CompilationUnit* cUnit, CallInfo* info, int trampoline,
- int state, uint32_t dexIdx, uint32_t methodIdx)
+static int NextInvokeInsnSP(CompilationUnit* cUnit, CallInfo* info, int trampoline,
+ int state, uint32_t dexIdx, uint32_t methodIdx)
{
/*
* This handles the case in which the base method is not fully
@@ -352,41 +332,41 @@
return -1;
}
-int NextStaticCallInsnSP(CompilationUnit* cUnit, CallInfo* info,
- int state, uint32_t dexIdx, uint32_t methodIdx,
- uintptr_t unused, uintptr_t unused2,
+static 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);
}
-int NextDirectCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
- uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
- uintptr_t unused2, InvokeType unused3)
+static 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);
}
-int NextSuperCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
- uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
+static 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);
}
-int NextVCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
- uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
- uintptr_t unused2, InvokeType unused3)
+static 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);
}
-int NextInterfaceCallInsnWithAccessCheck(CompilationUnit* cUnit,
- CallInfo* info, int state,
+static int NextInterfaceCallInsnWithAccessCheck(CompilationUnit* cUnit,
+ CallInfo* info, int state,
uint32_t dexIdx, uint32_t unused,
uintptr_t unused2, uintptr_t unused3,
InvokeType unused4)
@@ -395,10 +375,10 @@
return NextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
}
-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)
+static 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);
diff --git a/src/compiler/codegen/gen_loadstore.cc b/src/compiler/codegen/gen_loadstore.cc
index 8c3f059..7262c13 100644
--- a/src/compiler/codegen/gen_loadstore.cc
+++ b/src/compiler/codegen/gen_loadstore.cc
@@ -271,10 +271,4 @@
return LoadValue(cUnit, cUnit->methodLoc, kCoreReg);
}
-bool MethodStarInReg(CompilationUnit* cUnit)
-{
- return (cUnit->methodLoc.location == kLocPhysReg);
-}
-
-
} // namespace art
diff --git a/src/compiler/codegen/local_optimizations.cc b/src/compiler/codegen/local_optimizations.cc
index d3897e7..1e6e0d8 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)
+static bool IsDalvikRegisterClobbered(LIR* lir1, LIR* lir2)
{
int reg1Lo = DECODE_ALIAS_INFO_REG(lir1->aliasInfo);
int reg1Hi = reg1Lo + DECODE_ALIAS_INFO_WIDE(lir1->aliasInfo);
@@ -40,8 +40,7 @@
}
/* Convert a more expensive instruction (ie load) into a move */
-void ConvertMemOpIntoMove(CompilationUnit* cUnit, LIR* origLIR, int dest,
- int src)
+static void ConvertMemOpIntoMove(CompilationUnit* cUnit, LIR* origLIR, int dest, int src)
{
/* Insert a move to replace the load */
LIR* moveLIR;
@@ -73,8 +72,7 @@
* 1) They are must-aliases
* 2) The memory location is not written to in between
*/
-void ApplyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR,
- LIR* tailLIR)
+static void ApplyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR, LIR* tailLIR)
{
LIR* thisLIR;
diff --git a/src/compiler/codegen/method_bitcode.cc b/src/compiler/codegen/method_bitcode.cc
index 0115484..1c576bc 100644
--- a/src/compiler/codegen/method_bitcode.cc
+++ b/src/compiler/codegen/method_bitcode.cc
@@ -43,20 +43,20 @@
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);
+static RegLocation GetLoc(CompilationUnit* cUnit, llvm::Value* val);
-llvm::BasicBlock* GetLLVMBlock(CompilationUnit* cUnit, int id)
+static llvm::BasicBlock* GetLLVMBlock(CompilationUnit* cUnit, int id)
{
return cUnit->idToBlockMap.Get(id);
}
-llvm::Value* GetLLVMValue(CompilationUnit* cUnit, int sReg)
+static llvm::Value* GetLLVMValue(CompilationUnit* cUnit, int 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)
+static void DefineValue(CompilationUnit* cUnit, llvm::Value* val, int sReg)
{
llvm::Value* placeholder = GetLLVMValue(cUnit, sReg);
if (placeholder == NULL) {
@@ -83,7 +83,7 @@
}
}
-llvm::Type* LlvmTypeFromLocRec(CompilationUnit* cUnit, RegLocation loc)
+static 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)
+static 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());
@@ -186,7 +186,8 @@
}
cUnit->locMap.Put(val, loc);
}
-void InitIR(CompilationUnit* cUnit)
+
+static void InitIR(CompilationUnit* cUnit)
{
LLVMInfo* llvmInfo = cUnit->llvm_info;
if (llvmInfo == NULL) {
@@ -204,7 +205,7 @@
cUnit->irb = llvmInfo->GetIRBuilder();
}
-const char* LlvmSSAName(CompilationUnit* cUnit, int ssaReg) {
+static const char* LlvmSSAName(CompilationUnit* cUnit, int ssaReg) {
return GET_ELEM_N(cUnit->ssaStrings, char*, ssaReg);
}
@@ -215,8 +216,8 @@
return GetLLVMBlock(cUnit, bb->id);
}
-void ConvertPackedSwitch(CompilationUnit* cUnit, BasicBlock* bb,
- int32_t tableOffset, RegLocation rlSrc)
+static void ConvertPackedSwitch(CompilationUnit* cUnit, BasicBlock* bb,
+ int32_t tableOffset, RegLocation rlSrc)
{
const Instruction::PackedSwitchPayload* payload =
reinterpret_cast<const Instruction::PackedSwitchPayload*>(
@@ -240,8 +241,8 @@
bb->fallThrough = NULL;
}
-void ConvertSparseSwitch(CompilationUnit* cUnit, BasicBlock* bb,
- int32_t tableOffset, RegLocation rlSrc)
+static void ConvertSparseSwitch(CompilationUnit* cUnit, BasicBlock* bb,
+ int32_t tableOffset, RegLocation rlSrc)
{
const Instruction::SparseSwitchPayload* payload =
reinterpret_cast<const Instruction::SparseSwitchPayload*>(
@@ -268,9 +269,8 @@
bb->fallThrough = NULL;
}
-void ConvertSget(CompilationUnit* cUnit, int32_t fieldIndex,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest)
+static 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);
@@ -278,9 +278,8 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertSput(CompilationUnit* cUnit, int32_t fieldIndex,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlSrc)
+static 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));
@@ -289,8 +288,7 @@
cUnit->irb->CreateCall(intr, args);
}
-void ConvertFillArrayData(CompilationUnit* cUnit, int32_t offset,
- RegLocation rlArray)
+static void ConvertFillArrayData(CompilationUnit* cUnit, int32_t offset, RegLocation rlArray)
{
greenland::IntrinsicHelper::IntrinsicId id;
id = greenland::IntrinsicHelper::HLFillArrayData;
@@ -301,8 +299,8 @@
cUnit->irb->CreateCall(intr, args);
}
-llvm::Value* EmitConst(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
- RegLocation loc)
+static llvm::Value* EmitConst(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
+ RegLocation loc)
{
greenland::IntrinsicHelper::IntrinsicId id;
if (loc.wide) {
@@ -324,15 +322,15 @@
return cUnit->irb->CreateCall(intr, src);
}
-void EmitPopShadowFrame(CompilationUnit* cUnit)
+static 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,
- RegLocation loc)
+static llvm::Value* EmitCopy(CompilationUnit* cUnit, llvm::ArrayRef<llvm::Value*> src,
+ RegLocation loc)
{
greenland::IntrinsicHelper::IntrinsicId id;
if (loc.wide) {
@@ -354,7 +352,7 @@
return cUnit->irb->CreateCall(intr, src);
}
-void ConvertMoveException(CompilationUnit* cUnit, RegLocation rlDest)
+static void ConvertMoveException(CompilationUnit* cUnit, RegLocation rlDest)
{
llvm::Function* func = cUnit->intrinsic_helper->GetIntrinsicFunction(
greenland::IntrinsicHelper::GetException);
@@ -362,7 +360,7 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertThrow(CompilationUnit* cUnit, RegLocation rlSrc)
+static void ConvertThrow(CompilationUnit* cUnit, RegLocation rlSrc)
{
llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Function* func = cUnit->intrinsic_helper->GetIntrinsicFunction(
@@ -370,9 +368,9 @@
cUnit->irb->CreateCall(func, src);
}
-void ConvertMonitorEnterExit(CompilationUnit* cUnit, int optFlags,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlSrc)
+static 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));
@@ -381,8 +379,8 @@
cUnit->irb->CreateCall(func, args);
}
-void ConvertArrayLength(CompilationUnit* cUnit, int optFlags,
- RegLocation rlDest, RegLocation rlSrc)
+static void ConvertArrayLength(CompilationUnit* cUnit, int optFlags,
+ RegLocation rlDest, RegLocation rlSrc)
{
llvm::SmallVector<llvm::Value*, 2> args;
args.push_back(cUnit->irb->getInt32(optFlags));
@@ -393,7 +391,7 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void EmitSuspendCheck(CompilationUnit* cUnit)
+static void EmitSuspendCheck(CompilationUnit* cUnit)
{
greenland::IntrinsicHelper::IntrinsicId id =
greenland::IntrinsicHelper::CheckSuspend;
@@ -401,8 +399,8 @@
cUnit->irb->CreateCall(intr);
}
-llvm::Value* ConvertCompare(CompilationUnit* cUnit, ConditionCode cc,
- llvm::Value* src1, llvm::Value* src2)
+static llvm::Value* ConvertCompare(CompilationUnit* cUnit, ConditionCode cc,
+ llvm::Value* src1, llvm::Value* src2)
{
llvm::Value* res = NULL;
DCHECK_EQ(src1->getType(), src2->getType());
@@ -418,9 +416,8 @@
return res;
}
-void ConvertCompareAndBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
- ConditionCode cc, RegLocation rlSrc1,
- RegLocation rlSrc2)
+static void ConvertCompareAndBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+ ConditionCode cc, RegLocation rlSrc1, RegLocation rlSrc2)
{
if (bb->taken->startOffset <= mir->offset) {
EmitSuspendCheck(cUnit);
@@ -435,8 +432,8 @@
bb->fallThrough = NULL;
}
-void ConvertCompareZeroAndBranch(CompilationUnit* cUnit, BasicBlock* bb,
- MIR* mir, ConditionCode cc, RegLocation rlSrc1)
+static void ConvertCompareZeroAndBranch(CompilationUnit* cUnit, BasicBlock* bb,
+ MIR* mir, ConditionCode cc, RegLocation rlSrc1)
{
if (bb->taken->startOffset <= mir->offset) {
EmitSuspendCheck(cUnit);
@@ -455,8 +452,8 @@
bb->fallThrough = NULL;
}
-llvm::Value* GenDivModOp(CompilationUnit* cUnit, bool isDiv, bool isLong,
- llvm::Value* src1, llvm::Value* src2)
+static llvm::Value* GenDivModOp(CompilationUnit* cUnit, bool isDiv, bool isLong,
+ llvm::Value* src1, llvm::Value* src2)
{
greenland::IntrinsicHelper::IntrinsicId id;
if (isLong) {
@@ -479,8 +476,8 @@
return cUnit->irb->CreateCall(intr, args);
}
-llvm::Value* GenArithOp(CompilationUnit* cUnit, OpKind op, bool isLong,
- llvm::Value* src1, llvm::Value* src2)
+static llvm::Value* GenArithOp(CompilationUnit* cUnit, OpKind op, bool isLong,
+ llvm::Value* src1, llvm::Value* src2)
{
llvm::Value* res = NULL;
switch(op) {
@@ -502,8 +499,8 @@
return res;
}
-void ConvertFPArithOp(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
- RegLocation rlSrc1, RegLocation rlSrc2)
+static 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);
@@ -520,9 +517,8 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertShift(CompilationUnit* cUnit,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest, RegLocation rlSrc1, RegLocation rlSrc2)
+static 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;
@@ -532,9 +528,8 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertShiftLit(CompilationUnit* cUnit,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest, RegLocation rlSrc, int shiftAmount)
+static 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;
@@ -544,8 +539,8 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertArithOp(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
- RegLocation rlSrc1, RegLocation rlSrc2)
+static 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);
@@ -554,7 +549,7 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void SetShadowFrameEntry(CompilationUnit* cUnit, llvm::Value* newVal)
+static void SetShadowFrameEntry(CompilationUnit* cUnit, llvm::Value* newVal)
{
int index = -1;
DCHECK(newVal != NULL);
@@ -582,8 +577,8 @@
cUnit->irb->CreateCall(func, args);
}
-void ConvertArithOpLit(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
- RegLocation rlSrc1, int32_t imm)
+static void ConvertArithOpLit(CompilationUnit* cUnit, OpKind op, RegLocation rlDest,
+ RegLocation rlSrc1, int32_t imm)
{
llvm::Value* src1 = GetLLVMValue(cUnit, rlSrc1.origSReg);
llvm::Value* src2 = cUnit->irb->getInt32(imm);
@@ -596,8 +591,8 @@
* 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,
- InvokeType invokeType, bool isRange, bool isFilledNewArray)
+static void ConvertInvoke(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+ InvokeType invokeType, bool isRange, bool isFilledNewArray)
{
CallInfo* info = NewMemCallInfo(cUnit, bb, mir, invokeType, isRange);
llvm::SmallVector<llvm::Value*, 10> args;
@@ -649,9 +644,8 @@
}
}
-void ConvertConstObject(CompilationUnit* cUnit, uint32_t idx,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest)
+static 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);
@@ -659,8 +653,7 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertCheckCast(CompilationUnit* cUnit, uint32_t type_idx,
- RegLocation rlSrc)
+static void ConvertCheckCast(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlSrc)
{
greenland::IntrinsicHelper::IntrinsicId id;
id = greenland::IntrinsicHelper::HLCheckCast;
@@ -671,8 +664,7 @@
cUnit->irb->CreateCall(intr, args);
}
-void ConvertNewInstance(CompilationUnit* cUnit, uint32_t type_idx,
- RegLocation rlDest)
+static void ConvertNewInstance(CompilationUnit* cUnit, uint32_t type_idx, RegLocation rlDest)
{
greenland::IntrinsicHelper::IntrinsicId id;
id = greenland::IntrinsicHelper::NewInstance;
@@ -682,8 +674,8 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertNewArray(CompilationUnit* cUnit, uint32_t type_idx,
- RegLocation rlDest, RegLocation rlSrc)
+static void ConvertNewArray(CompilationUnit* cUnit, uint32_t type_idx,
+ RegLocation rlDest, RegLocation rlSrc)
{
greenland::IntrinsicHelper::IntrinsicId id;
id = greenland::IntrinsicHelper::NewArray;
@@ -695,9 +687,9 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertAget(CompilationUnit* cUnit, int optFlags,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest, RegLocation rlArray, RegLocation rlIndex)
+static 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));
@@ -708,9 +700,9 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertAput(CompilationUnit* cUnit, int optFlags,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlSrc, RegLocation rlArray, RegLocation rlIndex)
+static 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));
@@ -721,9 +713,9 @@
cUnit->irb->CreateCall(intr, args);
}
-void ConvertIget(CompilationUnit* cUnit, int optFlags,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest, RegLocation rlObj, int fieldIndex)
+static 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));
@@ -734,9 +726,9 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertIput(CompilationUnit* cUnit, int optFlags,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlSrc, RegLocation rlObj, int fieldIndex)
+static 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));
@@ -747,8 +739,8 @@
cUnit->irb->CreateCall(intr, args);
}
-void ConvertInstanceOf(CompilationUnit* cUnit, uint32_t type_idx,
- RegLocation rlDest, RegLocation rlSrc)
+static void ConvertInstanceOf(CompilationUnit* cUnit, uint32_t type_idx,
+ RegLocation rlDest, RegLocation rlSrc)
{
greenland::IntrinsicHelper::IntrinsicId id;
id = greenland::IntrinsicHelper::InstanceOf;
@@ -760,41 +752,37 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertIntToLong(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertIntToLong(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* res = cUnit->irb->CreateSExt(GetLLVMValue(cUnit, rlSrc.origSReg),
cUnit->irb->getInt64Ty());
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertLongToInt(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertLongToInt(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateTrunc(src, cUnit->irb->getInt32Ty());
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertFloatToDouble(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertFloatToDouble(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateFPExt(src, cUnit->irb->getDoubleTy());
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertDoubleToFloat(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertDoubleToFloat(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateFPTrunc(src, cUnit->irb->getFloatTy());
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertWideComparison(CompilationUnit* cUnit,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest, RegLocation rlSrc1,
+static void ConvertWideComparison(CompilationUnit* cUnit,
+ greenland::IntrinsicHelper::IntrinsicId id,
+ RegLocation rlDest, RegLocation rlSrc1,
RegLocation rlSrc2)
{
DCHECK_EQ(rlSrc1.fp, rlSrc2.fp);
@@ -807,9 +795,8 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertIntNarrowing(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc,
- greenland::IntrinsicHelper::IntrinsicId id)
+static void ConvertIntNarrowing(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc,
+ greenland::IntrinsicHelper::IntrinsicId id)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* res =
@@ -817,24 +804,22 @@
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertNeg(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertNeg(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* res = cUnit->irb->CreateNeg(GetLLVMValue(cUnit, rlSrc.origSReg));
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertIntToFP(CompilationUnit* cUnit, llvm::Type* ty, RegLocation rlDest,
- RegLocation rlSrc)
+static 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);
}
-void ConvertFPToInt(CompilationUnit* cUnit,
- greenland::IntrinsicHelper::IntrinsicId id,
- RegLocation rlDest,
+static void ConvertFPToInt(CompilationUnit* cUnit, greenland::IntrinsicHelper::IntrinsicId id,
+ RegLocation rlDest,
RegLocation rlSrc)
{
llvm::Function* intr = cUnit->intrinsic_helper->GetIntrinsicFunction(id);
@@ -843,16 +828,14 @@
}
-void ConvertNegFP(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertNegFP(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* res =
cUnit->irb->CreateFNeg(GetLLVMValue(cUnit, rlSrc.origSReg));
DefineValue(cUnit, res, rlDest.origSReg);
}
-void ConvertNot(CompilationUnit* cUnit, RegLocation rlDest,
- RegLocation rlSrc)
+static void ConvertNot(CompilationUnit* cUnit, RegLocation rlDest, RegLocation rlSrc)
{
llvm::Value* src = GetLLVMValue(cUnit, rlSrc.origSReg);
llvm::Value* res = cUnit->irb->CreateXor(src, static_cast<uint64_t>(-1));
@@ -864,8 +847,8 @@
* load/store utilities here, or target-dependent genXX() handlers
* when necessary.
*/
-bool ConvertMIRNode(CompilationUnit* cUnit, MIR* mir, BasicBlock* bb,
- llvm::BasicBlock* llvmBB, LIR* labelList)
+static bool ConvertMIRNode(CompilationUnit* cUnit, MIR* mir, BasicBlock* bb,
+ llvm::BasicBlock* llvmBB, LIR* labelList)
{
bool res = false; // Assume success
RegLocation rlSrc[3];
@@ -1691,8 +1674,8 @@
}
/* Extended MIR instructions like PHI */
-void ConvertExtendedMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
- llvm::BasicBlock* llvmBB)
+static void ConvertExtendedMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
+ llvm::BasicBlock* llvmBB)
{
switch (static_cast<ExtendedMIROpcode>(mir->dalvikInsn.opcode)) {
@@ -1762,7 +1745,7 @@
}
}
-void SetDexOffset(CompilationUnit* cUnit, int32_t offset)
+static void SetDexOffset(CompilationUnit* cUnit, int32_t offset)
{
cUnit->currentDalvikOffset = offset;
llvm::SmallVector<llvm::Value*, 1> arrayRef;
@@ -1772,7 +1755,7 @@
}
// Attach method info as metadata to special intrinsic
-void SetMethodInfo(CompilationUnit* cUnit)
+static void SetMethodInfo(CompilationUnit* cUnit)
{
// We don't want dex offset on this
cUnit->irb->SetDexOffset(NULL);
@@ -1805,7 +1788,7 @@
}
/* Handle the content in each basic block */
-bool MethodBlockBitcodeConversion(CompilationUnit* cUnit, BasicBlock* bb)
+static bool BlockBitcodeConversion(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb->blockType == kDead) return false;
llvm::BasicBlock* llvmBB = GetLLVMBlock(cUnit, bb->id);
@@ -1964,7 +1947,7 @@
return shortyType;
}
-llvm::FunctionType* GetFunctionType(CompilationUnit* cUnit) {
+static llvm::FunctionType* GetFunctionType(CompilationUnit* cUnit) {
// Get return type
llvm::Type* ret_type = cUnit->irb->GetJType(RemapShorty(cUnit->shorty[0]),
@@ -1989,7 +1972,7 @@
return llvm::FunctionType::get(ret_type, args_type, false);
}
-bool CreateFunction(CompilationUnit* cUnit) {
+static bool CreateFunction(CompilationUnit* cUnit) {
std::string func_name(PrettyMethod(cUnit->method_idx, *cUnit->dex_file,
/* with_signature */ false));
llvm::FunctionType* func_type = GetFunctionType(cUnit);
@@ -2018,7 +2001,7 @@
return true;
}
-bool CreateLLVMBasicBlock(CompilationUnit* cUnit, BasicBlock* bb)
+static bool CreateLLVMBasicBlock(CompilationUnit* cUnit, BasicBlock* bb)
{
// Skip the exit block
if ((bb->blockType == kDead) ||(bb->blockType == kExitBlock)) {
@@ -2088,7 +2071,7 @@
}
}
- DataFlowAnalysisDispatcher(cUnit, MethodBlockBitcodeConversion,
+ DataFlowAnalysisDispatcher(cUnit, BlockBitcodeConversion,
kPreOrderDFSTraversal, false /* Iterative */);
/*
@@ -2160,7 +2143,7 @@
}
}
-RegLocation GetLoc(CompilationUnit* cUnit, llvm::Value* val) {
+static RegLocation GetLoc(CompilationUnit* cUnit, llvm::Value* val) {
RegLocation res;
DCHECK(val != NULL);
SafeMap<llvm::Value*, RegLocation>::iterator it = cUnit->locMap.find(val);
@@ -2196,7 +2179,7 @@
return res;
}
-Instruction::Code GetDalvikOpcode(OpKind op, bool isConst, bool isWide)
+static Instruction::Code GetDalvikOpcode(OpKind op, bool isConst, bool isWide)
{
Instruction::Code res = Instruction::NOP;
if (isWide) {
@@ -2248,7 +2231,7 @@
return res;
}
-Instruction::Code GetDalvikFPOpcode(OpKind op, bool isConst, bool isWide)
+static Instruction::Code GetDalvikFPOpcode(OpKind op, bool isConst, bool isWide)
{
Instruction::Code res = Instruction::NOP;
if (isWide) {
@@ -2273,7 +2256,7 @@
return res;
}
-void CvtBinFPOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
+static void CvtBinFPOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
{
RegLocation rlDest = GetLoc(cUnit, inst);
/*
@@ -2305,7 +2288,7 @@
}
}
-void CvtIntNarrowing(CompilationUnit* cUnit, llvm::Instruction* inst,
+static void CvtIntNarrowing(CompilationUnit* cUnit, llvm::Instruction* inst,
Instruction::Code opcode)
{
RegLocation rlDest = GetLoc(cUnit, inst);
@@ -2313,7 +2296,7 @@
GenIntNarrowing(cUnit, opcode, rlDest, rlSrc);
}
-void CvtIntToFP(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtIntToFP(CompilationUnit* cUnit, llvm::Instruction* inst)
{
RegLocation rlDest = GetLoc(cUnit, inst);
RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
@@ -2334,7 +2317,7 @@
GenConversion(cUnit, opcode, rlDest, rlSrc);
}
-void CvtFPToInt(CompilationUnit* cUnit, llvm::CallInst* call_inst)
+static void CvtFPToInt(CompilationUnit* cUnit, llvm::CallInst* call_inst)
{
RegLocation rlDest = GetLoc(cUnit, call_inst);
RegLocation rlSrc = GetLoc(cUnit, call_inst->getOperand(0));
@@ -2355,14 +2338,14 @@
GenConversion(cUnit, opcode, rlDest, rlSrc);
}
-void CvtFloatToDouble(CompilationUnit* cUnit, llvm::Instruction* inst)
+static 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);
}
-void CvtTrunc(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtTrunc(CompilationUnit* cUnit, llvm::Instruction* inst)
{
RegLocation rlDest = GetLoc(cUnit, inst);
RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
@@ -2371,7 +2354,7 @@
StoreValue(cUnit, rlDest, rlSrc);
}
-void CvtDoubleToFloat(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtDoubleToFloat(CompilationUnit* cUnit, llvm::Instruction* inst)
{
RegLocation rlDest = GetLoc(cUnit, inst);
RegLocation rlSrc = GetLoc(cUnit, inst->getOperand(0));
@@ -2379,7 +2362,7 @@
}
-void CvtIntExt(CompilationUnit* cUnit, llvm::Instruction* inst, bool isSigned)
+static 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);
@@ -2402,7 +2385,7 @@
StoreValueWide(cUnit, rlDest, rlResult);
}
-void CvtBinOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
+static void CvtBinOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst)
{
RegLocation rlDest = GetLoc(cUnit, inst);
llvm::Value* lhs = inst->getOperand(0);
@@ -2446,8 +2429,7 @@
}
}
-void CvtShiftOp(CompilationUnit* cUnit, Instruction::Code opcode,
- llvm::CallInst* callInst)
+static void CvtShiftOp(CompilationUnit* cUnit, Instruction::Code opcode, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
RegLocation rlDest = GetLoc(cUnit, callInst);
@@ -2466,7 +2448,7 @@
}
}
-void CvtBr(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtBr(CompilationUnit* cUnit, llvm::Instruction* inst)
{
llvm::BranchInst* brInst = llvm::dyn_cast<llvm::BranchInst>(inst);
DCHECK(brInst != NULL);
@@ -2475,12 +2457,12 @@
OpUnconditionalBranch(cUnit, cUnit->blockToLabelMap.Get(targetBB));
}
-void CvtPhi(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtPhi(CompilationUnit* cUnit, llvm::Instruction* inst)
{
// Nop - these have already been processed
}
-void CvtRet(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtRet(CompilationUnit* cUnit, llvm::Instruction* inst)
{
llvm::ReturnInst* retInst = llvm::dyn_cast<llvm::ReturnInst>(inst);
llvm::Value* retVal = retInst->getReturnValue();
@@ -2495,7 +2477,7 @@
GenExitSequence(cUnit);
}
-ConditionCode GetCond(llvm::ICmpInst::Predicate llvmCond)
+static ConditionCode GetCond(llvm::ICmpInst::Predicate llvmCond)
{
ConditionCode res = kCondAl;
switch(llvmCond) {
@@ -2510,13 +2492,13 @@
return res;
}
-void CvtICmp(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtICmp(CompilationUnit* cUnit, llvm::Instruction* inst)
{
// GenCmpLong(cUnit, rlDest, rlSrc1, rlSrc2)
UNIMPLEMENTED(FATAL);
}
-void CvtICmpBr(CompilationUnit* cUnit, llvm::Instruction* inst,
+static void CvtICmpBr(CompilationUnit* cUnit, llvm::Instruction* inst,
llvm::BranchInst* brInst)
{
// Get targets
@@ -2553,13 +2535,7 @@
OpUnconditionalBranch(cUnit, fallThrough);
}
-void CvtCall(CompilationUnit* cUnit, llvm::CallInst* callInst,
- llvm::Function* callee)
-{
- UNIMPLEMENTED(FATAL);
-}
-
-void CvtCopy(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtCopy(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
RegLocation rlSrc = GetLoc(cUnit, callInst->getArgOperand(0));
@@ -2574,7 +2550,7 @@
}
// Note: Immediate arg is a ConstantInt regardless of result type
-void CvtConst(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtConst(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* src =
@@ -2592,8 +2568,7 @@
}
}
-void CvtConstObject(CompilationUnit* cUnit, llvm::CallInst* callInst,
- bool isString)
+static void CvtConstObject(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isString)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* idxVal =
@@ -2607,7 +2582,7 @@
}
}
-void CvtFillArrayData(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtFillArrayData(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* offsetVal =
@@ -2616,7 +2591,7 @@
GenFillArrayData(cUnit, offsetVal->getSExtValue(), rlSrc);
}
-void CvtNewInstance(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtNewInstance(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* typeIdxVal =
@@ -2626,7 +2601,7 @@
GenNewInstance(cUnit, typeIdx, rlDest);
}
-void CvtNewArray(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtNewArray(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdxVal =
@@ -2638,7 +2613,7 @@
GenNewArray(cUnit, typeIdx, rlDest, rlLen);
}
-void CvtInstanceOf(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtInstanceOf(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdxVal =
@@ -2650,7 +2625,7 @@
GenInstanceof(cUnit, typeIdx, rlDest, rlSrc);
}
-void CvtThrow(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtThrow(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::Value* src = callInst->getArgOperand(0);
@@ -2658,7 +2633,7 @@
GenThrow(cUnit, rlSrc);
}
-void CvtMonitorEnterExit(CompilationUnit* cUnit, bool isEnter,
+static void CvtMonitorEnterExit(CompilationUnit* cUnit, bool isEnter,
llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
@@ -2673,7 +2648,7 @@
}
}
-void CvtArrayLength(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtArrayLength(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* optFlags =
@@ -2689,14 +2664,13 @@
StoreValue(cUnit, rlDest, rlResult);
}
-void CvtMoveException(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtMoveException(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
RegLocation rlDest = GetLoc(cUnit, callInst);
GenMoveException(cUnit, rlDest);
}
-void CvtSget(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide,
- bool isObject)
+static void CvtSget(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide, bool isObject)
{
DCHECK_EQ(callInst->getNumArgOperands(), 1U);
llvm::ConstantInt* typeIdxVal =
@@ -2706,8 +2680,7 @@
GenSget(cUnit, typeIdx, rlDest, isWide, isObject);
}
-void CvtSput(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide,
- bool isObject)
+static void CvtSput(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isWide, bool isObject)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdxVal =
@@ -2718,8 +2691,7 @@
GenSput(cUnit, typeIdx, rlSrc, isWide, isObject);
}
-void CvtAget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
- int scale)
+static void CvtAget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size, int scale)
{
DCHECK_EQ(callInst->getNumArgOperands(), 3U);
llvm::ConstantInt* optFlags =
@@ -2731,8 +2703,8 @@
rlDest, scale);
}
-void CvtAput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
- int scale, bool isObject)
+static void CvtAput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+ int scale, bool isObject)
{
DCHECK_EQ(callInst->getNumArgOperands(), 4U);
llvm::ConstantInt* optFlags =
@@ -2749,19 +2721,19 @@
}
}
-void CvtAputObj(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtAputObj(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
CvtAput(cUnit, callInst, kWord, 2, true /* isObject */);
}
-void CvtAputPrimitive(CompilationUnit* cUnit, llvm::CallInst* callInst,
+static void CvtAputPrimitive(CompilationUnit* cUnit, llvm::CallInst* callInst,
OpSize size, int scale)
{
CvtAput(cUnit, callInst, size, scale, false /* isObject */);
}
-void CvtIget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
- bool isWide, bool isObj)
+static void CvtIget(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+ bool isWide, bool isObj)
{
DCHECK_EQ(callInst->getNumArgOperands(), 3U);
llvm::ConstantInt* optFlags =
@@ -2774,8 +2746,8 @@
size, rlDest, rlObj, isWide, isObj);
}
-void CvtIput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
- bool isWide, bool isObj)
+static void CvtIput(CompilationUnit* cUnit, llvm::CallInst* callInst, OpSize size,
+ bool isWide, bool isObj)
{
DCHECK_EQ(callInst->getNumArgOperands(), 4U);
llvm::ConstantInt* optFlags =
@@ -2788,7 +2760,7 @@
size, rlSrc, rlObj, isWide, isObj);
}
-void CvtCheckCast(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtCheckCast(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
DCHECK_EQ(callInst->getNumArgOperands(), 2U);
llvm::ConstantInt* typeIdx =
@@ -2797,8 +2769,8 @@
GenCheckCast(cUnit, typeIdx->getZExtValue(), rlSrc);
}
-void CvtFPCompare(CompilationUnit* cUnit, llvm::CallInst* callInst,
- Instruction::Code opcode)
+static void CvtFPCompare(CompilationUnit* cUnit, llvm::CallInst* callInst,
+ Instruction::Code opcode)
{
RegLocation rlSrc1 = GetLoc(cUnit, callInst->getArgOperand(0));
RegLocation rlSrc2 = GetLoc(cUnit, callInst->getArgOperand(1));
@@ -2806,7 +2778,7 @@
GenCmpFP(cUnit, opcode, rlDest, rlSrc1, rlSrc2);
}
-void CvtLongCompare(CompilationUnit* cUnit, llvm::CallInst* callInst)
+static void CvtLongCompare(CompilationUnit* cUnit, llvm::CallInst* callInst)
{
RegLocation rlSrc1 = GetLoc(cUnit, callInst->getArgOperand(0));
RegLocation rlSrc2 = GetLoc(cUnit, callInst->getArgOperand(1));
@@ -2814,7 +2786,7 @@
GenCmpLong(cUnit, rlDest, rlSrc1, rlSrc2);
}
-void CvtSwitch(CompilationUnit* cUnit, llvm::Instruction* inst)
+static void CvtSwitch(CompilationUnit* cUnit, llvm::Instruction* inst)
{
llvm::SwitchInst* swInst = llvm::dyn_cast<llvm::SwitchInst>(inst);
DCHECK(swInst != NULL);
@@ -2835,8 +2807,8 @@
}
}
-void CvtInvoke(CompilationUnit* cUnit, llvm::CallInst* callInst,
- bool isVoid, bool isFilledNewArray)
+static void CvtInvoke(CompilationUnit* cUnit, llvm::CallInst* callInst, bool isVoid,
+ bool isFilledNewArray)
{
CallInfo* info = static_cast<CallInfo*>(NewMem(cUnit, sizeof(CallInfo), true, kAllocMisc));
if (isVoid) {
@@ -2885,14 +2857,14 @@
}
/* Look up the RegLocation associated with a Value. Must already be defined */
-RegLocation ValToLoc(CompilationUnit* cUnit, llvm::Value* val)
+static 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)
+static bool BitcodeBlockCodeGen(CompilationUnit* cUnit, llvm::BasicBlock* bb)
{
while (cUnit->llvmBlocks.find(bb) == cUnit->llvmBlocks.end()) {
llvm::BasicBlock* nextBB = NULL;
@@ -3528,7 +3500,7 @@
// 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));
+ BitcodeBlockCodeGen(cUnit, static_cast<llvm::BasicBlock*>(i));
}
HandleSuspendLaunchPads(cUnit);
diff --git a/src/compiler/codegen/method_codegen_driver.cc b/src/compiler/codegen/method_codegen_driver.cc
index f7480b1..3808a35 100644
--- a/src/compiler/codegen/method_codegen_driver.cc
+++ b/src/compiler/codegen/method_codegen_driver.cc
@@ -61,8 +61,8 @@
* load/store utilities here, or target-dependent genXX() handlers
* when necessary.
*/
-bool CompileDalvikInstruction(CompilationUnit* cUnit, MIR* mir,
- BasicBlock* bb, LIR* labelList)
+static bool CompileDalvikInstruction(CompilationUnit* cUnit, MIR* mir, BasicBlock* bb,
+ LIR* labelList)
{
bool res = false; // Assume success
RegLocation rlSrc[3];
@@ -644,7 +644,7 @@
}
/* Extended MIR instructions like PHI */
-void HandleExtendedMethodMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
+static void HandleExtendedMethodMIR(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir)
{
int opOffset = mir->dalvikInsn.opcode - kMirOpFirst;
char* msg = NULL;
@@ -692,7 +692,7 @@
}
/* Handle the content in each basic block */
-bool MethodBlockCodeGen(CompilationUnit* cUnit, BasicBlock* bb)
+static bool MethodBlockCodeGen(CompilationUnit* cUnit, BasicBlock* bb)
{
if (bb->blockType == kDead) return false;
cUnit->currentDalvikOffset = bb->startOffset;
@@ -806,20 +806,6 @@
return false;
}
-/* Set basic block labels */
-bool LabelBlocks(CompilationUnit* cUnit, BasicBlock* bb)
-{
- LIR* labelList = cUnit->blockLabelList;
- int blockId = bb->id;
-
- cUnit->curBlock = bb;
- labelList[blockId].operands[0] = bb->startOffset;
-
- /* Insert the block label */
- labelList[blockId].opcode = kPseudoNormalBlockLabel;
- return false;
-}
-
void SpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase)
{
/* Find the first DalvikByteCode block */
diff --git a/src/compiler/codegen/mips/assemble_mips.cc b/src/compiler/codegen/mips/assemble_mips.cc
index 889541f..9bee7af 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)
+static void ConvertShortToLongBranch(CompilationUnit* cUnit, LIR* lir)
{
// For conditional branches we'll need to reverse the sense
bool unconditional = false;
diff --git a/src/compiler/codegen/mips/target_mips.cc b/src/compiler/codegen/mips/target_mips.cc
index 3623800..d264343 100644
--- a/src/compiler/codegen/mips/target_mips.cc
+++ b/src/compiler/codegen/mips/target_mips.cc
@@ -381,7 +381,7 @@
}
/* Clobber all regs that might be used by an external C call */
-extern void ClobberCalleeSave(CompilationUnit *cUnit)
+void ClobberCalleeSave(CompilationUnit *cUnit)
{
Clobber(cUnit, r_ZERO);
Clobber(cUnit, r_AT);
@@ -424,28 +424,28 @@
Clobber(cUnit, r_F15);
}
-extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit)
+RegLocation GetReturnWideAlt(CompilationUnit* cUnit)
{
UNIMPLEMENTED(FATAL) << "No GetReturnWideAlt for MIPS";
RegLocation res = LocCReturnWide();
return res;
}
-extern RegLocation GetReturnAlt(CompilationUnit* cUnit)
+RegLocation GetReturnAlt(CompilationUnit* cUnit)
{
UNIMPLEMENTED(FATAL) << "No GetReturnAlt for MIPS";
RegLocation res = LocCReturn();
return res;
}
-extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg)
+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 LockCallTemps(CompilationUnit* cUnit)
+void LockCallTemps(CompilationUnit* cUnit)
{
LockTemp(cUnit, rMIPS_ARG0);
LockTemp(cUnit, rMIPS_ARG1);
@@ -454,7 +454,7 @@
}
/* To be used when explicitly managing register use */
-extern void FreeCallTemps(CompilationUnit* cUnit)
+void FreeCallTemps(CompilationUnit* cUnit)
{
FreeTemp(cUnit, rMIPS_ARG0);
FreeTemp(cUnit, rMIPS_ARG1);
diff --git a/src/compiler/codegen/ralloc_util.cc b/src/compiler/codegen/ralloc_util.cc
index 2a4880a..e9a99c1 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 ResetRegPool(CompilationUnit* cUnit)
+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 CompilerInitPool(RegisterInfo* regs, int* regNums, int num)
+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)
+static void DumpRegPool(RegisterInfo* p, int numRegs)
{
LOG(INFO) << "================================================";
for (int i = 0; i < numRegs; i++) {
@@ -84,7 +84,7 @@
}
/* Mark a temp register as dead. Does not affect allocation state. */
-static inline void ClobberBody(CompilationUnit *cUnit, RegisterInfo* p)
+static void ClobberBody(CompilationUnit *cUnit, RegisterInfo* p)
{
if (p->isTemp) {
DCHECK(!(p->live && p->dirty)) << "Live & dirty temp in clobber";
@@ -105,7 +105,7 @@
ClobberBody(cUnit, GetRegInfo(cUnit, reg));
}
-void ClobberSRegBody(RegisterInfo* p, int numRegs, int sReg)
+static 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 ClobberSReg(CompilationUnit* cUnit, int sReg)
+void ClobberSReg(CompilationUnit* cUnit, int sReg)
{
#ifndef NDEBUG
/* Reset live temp tracking sanity checker */
@@ -141,7 +141,7 @@
* ssa name (above the last original Dalvik register). This function
* maps SSA names to positions in the promotionMap array.
*/
-int SRegToPMap(CompilationUnit* cUnit, int sReg)
+static int SRegToPMap(CompilationUnit* cUnit, int sReg)
{
DCHECK_LT(sReg, cUnit->numSSARegs);
DCHECK_GE(sReg, 0);
@@ -171,7 +171,7 @@
}
/* Reserve a callee-save register. Return -1 if none available */
-extern int AllocPreservedCoreReg(CompilationUnit* cUnit, int sReg)
+static int AllocPreservedCoreReg(CompilationUnit* cUnit, int sReg)
{
int res = -1;
RegisterInfo* coreRegs = cUnit->regPool->coreRegs;
@@ -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)
+static int AllocPreservedSingle(CompilationUnit* cUnit, int sReg, bool even)
{
int res = -1;
RegisterInfo* FPRegs = cUnit->regPool->FPRegs;
@@ -223,7 +223,7 @@
* 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)
+static int AllocPreservedDouble(CompilationUnit* cUnit, int sReg)
{
int res = -1; // Assume failure
int vReg = SRegToVReg(cUnit, sReg);
@@ -280,8 +280,7 @@
* single regs (but if can't still attempt to allocate a single, preferring
* first to allocate an odd register.
*/
-extern int AllocPreservedFPReg(CompilationUnit* cUnit, int sReg,
- bool doubleStart)
+static int AllocPreservedFPReg(CompilationUnit* cUnit, int sReg, bool doubleStart)
{
int res = -1;
if (doubleStart) {
@@ -295,8 +294,8 @@
return res;
}
-int AllocTempBody(CompilationUnit* cUnit, RegisterInfo* p, int numRegs,
- int* nextTemp, bool required)
+static int AllocTempBody(CompilationUnit* cUnit, RegisterInfo* p, int numRegs, int* nextTemp,
+ bool required)
{
int i;
int next = *nextTemp;
@@ -335,7 +334,7 @@
}
//REDO: too many assumptions.
-extern int AllocTempDouble(CompilationUnit* cUnit)
+int AllocTempDouble(CompilationUnit* cUnit)
{
RegisterInfo* p = cUnit->regPool->FPRegs;
int numRegs = cUnit->regPool->numFPRegs;
@@ -389,28 +388,28 @@
}
/* Return a temp if one is available, -1 otherwise */
-extern int AllocFreeTemp(CompilationUnit* cUnit)
+int AllocFreeTemp(CompilationUnit* cUnit)
{
return AllocTempBody(cUnit, cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs,
&cUnit->regPool->nextCoreReg, true);
}
-extern int AllocTemp(CompilationUnit* cUnit)
+int AllocTemp(CompilationUnit* cUnit)
{
return AllocTempBody(cUnit, cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs,
&cUnit->regPool->nextCoreReg, true);
}
-extern int AllocTempFloat(CompilationUnit* cUnit)
+int AllocTempFloat(CompilationUnit* cUnit)
{
return AllocTempBody(cUnit, cUnit->regPool->FPRegs,
cUnit->regPool->numFPRegs,
&cUnit->regPool->nextFPReg, true);
}
-RegisterInfo* AllocLiveBody(RegisterInfo* p, int numRegs, int sReg)
+static RegisterInfo* AllocLiveBody(RegisterInfo* p, int numRegs, int sReg)
{
int i;
if (sReg == -1)
@@ -449,7 +448,7 @@
return res;
}
-extern void FreeTemp(CompilationUnit* cUnit, int reg)
+void FreeTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = cUnit->regPool->coreRegs;
int numRegs = cUnit->regPool->numCoreRegs;
@@ -477,7 +476,7 @@
LOG(FATAL) << "Tried to free a non-existant temp: r" << reg;
}
-extern RegisterInfo* IsLive(CompilationUnit* cUnit, int reg)
+RegisterInfo* IsLive(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = cUnit->regPool->coreRegs;
int numRegs = cUnit->regPool->numCoreRegs;
@@ -497,19 +496,19 @@
return NULL;
}
-extern RegisterInfo* IsTemp(CompilationUnit* cUnit, int reg)
+RegisterInfo* IsTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = GetRegInfo(cUnit, reg);
return (p->isTemp) ? p : NULL;
}
-extern RegisterInfo* IsPromoted(CompilationUnit* cUnit, int reg)
+RegisterInfo* IsPromoted(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = GetRegInfo(cUnit, reg);
return (p->isTemp) ? NULL : p;
}
-extern bool IsDirty(CompilationUnit* cUnit, int reg)
+bool IsDirty(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = GetRegInfo(cUnit, reg);
return p->dirty;
@@ -520,7 +519,7 @@
* register. No check is made to see if the register was previously
* allocated. Use with caution.
*/
-extern void LockTemp(CompilationUnit* cUnit, int reg)
+void LockTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* p = cUnit->regPool->coreRegs;
int numRegs = cUnit->regPool->numCoreRegs;
@@ -546,19 +545,18 @@
LOG(FATAL) << "Tried to lock a non-existant temp: r" << reg;
}
-static inline void ResetDefBody(RegisterInfo* p)
+static void ResetDefBody(RegisterInfo* p)
{
p->defStart = NULL;
p->defEnd = NULL;
}
-extern void ResetDef(CompilationUnit* cUnit, int reg)
+void ResetDef(CompilationUnit* cUnit, int reg)
{
ResetDefBody(GetRegInfo(cUnit, reg));
}
-void NullifyRange(CompilationUnit* cUnit, LIR *start, LIR *finish,
- int sReg1, int sReg2)
+static void NullifyRange(CompilationUnit* cUnit, LIR *start, LIR *finish, int sReg1, int sReg2)
{
if (start && finish) {
LIR *p;
@@ -576,7 +574,7 @@
* on entry start points to the LIR prior to the beginning of the
* sequence.
*/
-extern void MarkDef(CompilationUnit* cUnit, RegLocation rl,
+void MarkDef(CompilationUnit* cUnit, RegLocation rl,
LIR *start, LIR *finish)
{
DCHECK(!rl.wide);
@@ -592,7 +590,7 @@
* on entry start points to the LIR prior to the beginning of the
* sequence.
*/
-extern void MarkDefWide(CompilationUnit* cUnit, RegLocation rl,
+void MarkDefWide(CompilationUnit* cUnit, RegLocation rl,
LIR *start, LIR *finish)
{
DCHECK(rl.wide);
@@ -604,7 +602,7 @@
p->defEnd = finish;
}
-extern RegLocation WideToNarrow(CompilationUnit* cUnit, RegLocation rl)
+RegLocation WideToNarrow(CompilationUnit* cUnit, RegLocation rl)
{
DCHECK(rl.wide);
if (rl.location == kLocPhysReg) {
@@ -625,7 +623,7 @@
return rl;
}
-extern void ResetDefLoc(CompilationUnit* cUnit, RegLocation rl)
+void ResetDefLoc(CompilationUnit* cUnit, RegLocation rl)
{
DCHECK(!rl.wide);
RegisterInfo* p = IsTemp(cUnit, rl.lowReg);
@@ -636,7 +634,7 @@
ResetDef(cUnit, rl.lowReg);
}
-extern void ResetDefLocWide(CompilationUnit* cUnit, RegLocation rl)
+void ResetDefLocWide(CompilationUnit* cUnit, RegLocation rl)
{
DCHECK(rl.wide);
RegisterInfo* pLow = IsTemp(cUnit, rl.lowReg);
@@ -652,7 +650,7 @@
ResetDef(cUnit, rl.highReg);
}
-extern void ResetDefTracking(CompilationUnit* cUnit)
+void ResetDefTracking(CompilationUnit* cUnit)
{
int i;
for (i=0; i< cUnit->regPool->numCoreRegs; i++) {
@@ -663,7 +661,7 @@
}
}
-extern void ClobberAllRegs(CompilationUnit* cUnit)
+void ClobberAllRegs(CompilationUnit* cUnit)
{
int i;
for (i=0; i< cUnit->regPool->numCoreRegs; i++) {
@@ -675,8 +673,7 @@
}
// Make sure nothing is live and dirty
-void FlushAllRegsBody(CompilationUnit* cUnit, RegisterInfo* info,
- int numRegs)
+static void FlushAllRegsBody(CompilationUnit* cUnit, RegisterInfo* info, int numRegs)
{
int i;
for (i=0; i < numRegs; i++) {
@@ -690,7 +687,7 @@
}
}
-extern void FlushAllRegs(CompilationUnit* cUnit)
+void FlushAllRegs(CompilationUnit* cUnit)
{
FlushAllRegsBody(cUnit, cUnit->regPool->coreRegs,
cUnit->regPool->numCoreRegs);
@@ -701,7 +698,7 @@
//TUNING: rewrite all of this reg stuff. Probably use an attribute table
-bool RegClassMatches(int regClass, int reg)
+static bool RegClassMatches(int regClass, int reg)
{
if (regClass == kAnyReg) {
return true;
@@ -712,7 +709,7 @@
}
}
-extern void MarkLive(CompilationUnit* cUnit, int reg, int sReg)
+void MarkLive(CompilationUnit* cUnit, int reg, int sReg)
{
RegisterInfo* info = GetRegInfo(cUnit, reg);
if ((info->reg == reg) && (info->sReg == sReg) && info->live) {
@@ -730,19 +727,19 @@
info->sReg = sReg;
}
-extern void MarkTemp(CompilationUnit* cUnit, int reg)
+void MarkTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* info = GetRegInfo(cUnit, reg);
info->isTemp = true;
}
-extern void UnmarkTemp(CompilationUnit* cUnit, int reg)
+void UnmarkTemp(CompilationUnit* cUnit, int reg)
{
RegisterInfo* info = GetRegInfo(cUnit, reg);
info->isTemp = false;
}
-extern void MarkPair(CompilationUnit* cUnit, int lowReg, int highReg)
+void MarkPair(CompilationUnit* cUnit, int lowReg, int highReg)
{
RegisterInfo* infoLo = GetRegInfo(cUnit, lowReg);
RegisterInfo* infoHi = GetRegInfo(cUnit, highReg);
@@ -751,7 +748,7 @@
infoHi->partner = lowReg;
}
-extern void MarkClean(CompilationUnit* cUnit, RegLocation loc)
+void MarkClean(CompilationUnit* cUnit, RegLocation loc)
{
RegisterInfo* info = GetRegInfo(cUnit, loc.lowReg);
info->dirty = false;
@@ -761,7 +758,7 @@
}
}
-extern void MarkDirty(CompilationUnit* cUnit, RegLocation loc)
+void MarkDirty(CompilationUnit* cUnit, RegLocation loc)
{
if (loc.home) {
// If already home, can't be dirty
@@ -775,13 +772,13 @@
}
}
-extern void MarkInUse(CompilationUnit* cUnit, int reg)
+void MarkInUse(CompilationUnit* cUnit, int reg)
{
RegisterInfo* info = GetRegInfo(cUnit, reg);
info->inUse = true;
}
-void CopyRegInfo(CompilationUnit* cUnit, int newReg, int oldReg)
+static void CopyRegInfo(CompilationUnit* cUnit, int newReg, int oldReg)
{
RegisterInfo* newInfo = GetRegInfo(cUnit, newReg);
RegisterInfo* oldInfo = GetRegInfo(cUnit, oldReg);
@@ -793,40 +790,7 @@
newInfo->reg = newReg;
}
-/*
- * Return an updated location record with current in-register status.
- * If the value lives in live temps, reflect that fact. No code
- * is generated. If the live value is part of an older pair,
- * clobber both low and high.
- * TUNING: clobbering both is a bit heavy-handed, but the alternative
- * is a bit complex when dealing with FP regs. Examine code to see
- * if it's worthwhile trying to be more clever here.
- */
-
-extern RegLocation UpdateLoc(CompilationUnit* cUnit, RegLocation loc)
-{
- DCHECK(!loc.wide);
- DCHECK(CheckCorePoolSanity(cUnit));
- if (loc.location != kLocPhysReg) {
- DCHECK((loc.location == kLocDalvikFrame) ||
- (loc.location == kLocCompilerTemp));
- RegisterInfo* infoLo = AllocLive(cUnit, loc.sRegLow, kAnyReg);
- if (infoLo) {
- if (infoLo->pair) {
- Clobber(cUnit, infoLo->reg);
- Clobber(cUnit, infoLo->partner);
- FreeTemp(cUnit, infoLo->reg);
- } else {
- loc.lowReg = infoLo->reg;
- loc.location = kLocPhysReg;
- }
- }
- }
-
- return loc;
-}
-
-bool CheckCorePoolSanity(CompilationUnit* cUnit)
+static bool CheckCorePoolSanity(CompilationUnit* cUnit)
{
for (static int i = 0; i < cUnit->regPool->numCoreRegs; i++) {
if (cUnit->regPool->coreRegs[i].pair) {
@@ -853,8 +817,41 @@
return true;
}
+/*
+ * Return an updated location record with current in-register status.
+ * If the value lives in live temps, reflect that fact. No code
+ * is generated. If the live value is part of an older pair,
+ * clobber both low and high.
+ * TUNING: clobbering both is a bit heavy-handed, but the alternative
+ * is a bit complex when dealing with FP regs. Examine code to see
+ * if it's worthwhile trying to be more clever here.
+ */
+
+RegLocation UpdateLoc(CompilationUnit* cUnit, RegLocation loc)
+{
+ DCHECK(!loc.wide);
+ DCHECK(CheckCorePoolSanity(cUnit));
+ if (loc.location != kLocPhysReg) {
+ DCHECK((loc.location == kLocDalvikFrame) ||
+ (loc.location == kLocCompilerTemp));
+ RegisterInfo* infoLo = AllocLive(cUnit, loc.sRegLow, kAnyReg);
+ if (infoLo) {
+ if (infoLo->pair) {
+ Clobber(cUnit, infoLo->reg);
+ Clobber(cUnit, infoLo->partner);
+ FreeTemp(cUnit, infoLo->reg);
+ } else {
+ loc.lowReg = infoLo->reg;
+ loc.location = kLocPhysReg;
+ }
+ }
+ }
+
+ return loc;
+}
+
/* see comments for updateLoc */
-extern RegLocation UpdateLocWide(CompilationUnit* cUnit, RegLocation loc)
+RegLocation UpdateLocWide(CompilationUnit* cUnit, RegLocation loc)
{
DCHECK(loc.wide);
DCHECK(CheckCorePoolSanity(cUnit));
@@ -909,7 +906,7 @@
/* For use in cases we don't know (or care) width */
-extern RegLocation UpdateRawLoc(CompilationUnit* cUnit, RegLocation loc)
+RegLocation UpdateRawLoc(CompilationUnit* cUnit, RegLocation loc)
{
if (loc.wide)
return UpdateLocWide(cUnit, loc);
@@ -917,8 +914,7 @@
return UpdateLoc(cUnit, loc);
}
-RegLocation EvalLocWide(CompilationUnit* cUnit, RegLocation loc,
- int regClass, bool update)
+RegLocation EvalLocWide(CompilationUnit* cUnit, RegLocation loc, int regClass, bool update)
{
DCHECK(loc.wide);
int newRegs;
@@ -967,7 +963,7 @@
return loc;
}
-extern RegLocation EvalLoc(CompilationUnit* cUnit, RegLocation loc,
+RegLocation EvalLoc(CompilationUnit* cUnit, RegLocation loc,
int regClass, bool update)
{
int newReg;
@@ -1001,42 +997,42 @@
return loc;
}
-extern RegLocation GetRawSrc(CompilationUnit* cUnit, MIR* mir, int num)
+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 GetRawDest(CompilationUnit* cUnit, MIR* mir)
+RegLocation GetRawDest(CompilationUnit* cUnit, MIR* mir)
{
DCHECK_GT(mir->ssaRep->numDefs, 0);
RegLocation res = cUnit->regLocation[mir->ssaRep->defs[0]];
return res;
}
-extern RegLocation GetDest(CompilationUnit* cUnit, MIR* mir)
+RegLocation GetDest(CompilationUnit* cUnit, MIR* mir)
{
RegLocation res = GetRawDest(cUnit, mir);
DCHECK(!res.wide);
return res;
}
-extern RegLocation GetSrc(CompilationUnit* cUnit, MIR* mir, int num)
+RegLocation GetSrc(CompilationUnit* cUnit, MIR* mir, int num)
{
RegLocation res = GetRawSrc(cUnit, mir, num);
DCHECK(!res.wide);
return res;
}
-extern RegLocation GetDestWide(CompilationUnit* cUnit, MIR* mir)
+RegLocation GetDestWide(CompilationUnit* cUnit, MIR* mir)
{
RegLocation res = GetRawDest(cUnit, mir);
DCHECK(res.wide);
return res;
}
-extern RegLocation GetSrcWide(CompilationUnit* cUnit, MIR* mir,
+RegLocation GetSrcWide(CompilationUnit* cUnit, MIR* mir,
int low)
{
RegLocation res = GetRawSrc(cUnit, mir, low);
@@ -1045,8 +1041,8 @@
}
/* USE SSA names to count references of base Dalvik vRegs. */
-void CountRefs(CompilationUnit *cUnit, BasicBlock* bb,
- RefCounts* coreCounts, RefCounts* fpCounts)
+static void CountRefs(CompilationUnit *cUnit, BasicBlock* bb, RefCounts* coreCounts,
+ RefCounts* fpCounts)
{
if ((cUnit->disableOpt & (1 << kPromoteRegs)) ||
!((bb->blockType == kEntryBlock) || (bb->blockType == kExitBlock) ||
@@ -1075,14 +1071,14 @@
}
/* qsort callback function, sort descending */
-int SortCounts(const void *val1, const void *val2)
+static 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 DumpCounts(const RefCounts* arr, int size, const char* msg)
+static void DumpCounts(const RefCounts* arr, int size, const char* msg)
{
LOG(INFO) << msg;
for (int i = 0; i < size; i++) {
@@ -1094,7 +1090,7 @@
* Note: some portions of this code required even if the kPromoteRegs
* optimization is disabled.
*/
-extern void DoPromotion(CompilationUnit* cUnit)
+void DoPromotion(CompilationUnit* cUnit)
{
int regBias = cUnit->numCompilerTemps + 1;
int dalvikRegs = cUnit->numDalvikRegisters;
@@ -1254,14 +1250,14 @@
}
/* Returns sp-relative offset in bytes for a VReg */
-extern int VRegOffset(CompilationUnit* cUnit, int vReg)
+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 SRegOffset(CompilationUnit* cUnit, int sReg)
+int SRegOffset(CompilationUnit* cUnit, int sReg)
{
return VRegOffset(cUnit, SRegToVReg(cUnit, sReg));
}
diff --git a/src/compiler/codegen/ralloc_util.h b/src/compiler/codegen/ralloc_util.h
index 6947656..31fda52c 100644
--- a/src/compiler/codegen/ralloc_util.h
+++ b/src/compiler/codegen/ralloc_util.h
@@ -60,162 +60,153 @@
return mir->ssaRep->uses[num];
}
-extern RegLocation EvalLoc(CompilationUnit* cUnit, RegLocation loc,
+void ClobberSReg(CompilationUnit* cUnit, int sReg);
+RegLocation EvalLoc(CompilationUnit* cUnit, RegLocation loc,
int regClass, bool update);
/* Mark a temp register as dead. Does not affect allocation state. */
-extern void Clobber(CompilationUnit* cUnit, int reg);
-extern RegLocation UpdateLoc(CompilationUnit* cUnit, RegLocation loc);
+void Clobber(CompilationUnit* cUnit, int reg);
+RegLocation UpdateLoc(CompilationUnit* cUnit, RegLocation loc);
/* see comments for updateLoc */
-extern RegLocation UpdateLocWide(CompilationUnit* cUnit, RegLocation loc);
+RegLocation UpdateLocWide(CompilationUnit* cUnit, RegLocation loc);
-extern RegLocation UpdateRawLoc(CompilationUnit* cUnit, RegLocation loc);
+RegLocation UpdateRawLoc(CompilationUnit* cUnit, RegLocation loc);
-extern void MarkLive(CompilationUnit* cUnit, int reg, int sReg);
+void MarkLive(CompilationUnit* cUnit, int reg, int sReg);
-extern void MarkTemp(CompilationUnit* cUnit, int reg);
+void MarkTemp(CompilationUnit* cUnit, int reg);
-extern void UnmarkTemp(CompilationUnit* cUnit, int reg);
+void UnmarkTemp(CompilationUnit* cUnit, int reg);
-extern void MarkDirty(CompilationUnit* cUnit, RegLocation loc);
+void MarkDirty(CompilationUnit* cUnit, RegLocation loc);
-extern void MarkPair(CompilationUnit* cUnit, int lowReg, int highReg);
+void MarkPair(CompilationUnit* cUnit, int lowReg, int highReg);
-extern void MarkClean(CompilationUnit* cUnit, RegLocation loc);
+void MarkClean(CompilationUnit* cUnit, RegLocation loc);
-extern void ResetDef(CompilationUnit* cUnit, int reg);
+void ResetDef(CompilationUnit* cUnit, int reg);
-extern void ResetDefLoc(CompilationUnit* cUnit, RegLocation rl);
+void ResetDefLoc(CompilationUnit* cUnit, RegLocation rl);
/* Set up temp & preserved register pools specialized by target */
-extern void CompilerInitPool(RegisterInfo* regs, int* regNums, int num);
+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 MarkDef(CompilationUnit* cUnit, RegLocation rl, LIR* start,
+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 MarkDefWide(CompilationUnit* cUnit, RegLocation rl,
+void MarkDefWide(CompilationUnit* cUnit, RegLocation rl,
LIR* start, LIR* finish);
// Get the LocRecord associated with an SSA name use.
-extern RegLocation GetSrc(CompilationUnit* cUnit, MIR* mir, int num);
-extern RegLocation GetSrcWide(CompilationUnit* cUnit, MIR* mir, int low);
+RegLocation GetSrc(CompilationUnit* cUnit, MIR* mir, int num);
+RegLocation GetSrcWide(CompilationUnit* cUnit, MIR* mir, int low);
// Non-width checking version
-extern RegLocation GetRawSrc(CompilationUnit* cUnit, MIR* mir, int num);
+RegLocation GetRawSrc(CompilationUnit* cUnit, MIR* mir, int num);
// Get the LocRecord associated with an SSA name def.
-extern RegLocation GetDest(CompilationUnit* cUnit, MIR* mir);
-extern RegLocation GetDestWide(CompilationUnit* cUnit, MIR* mir);
+RegLocation GetDest(CompilationUnit* cUnit, MIR* mir);
+RegLocation GetDestWide(CompilationUnit* cUnit, MIR* mir);
// Non-width checking version
-extern RegLocation GetRawDest(CompilationUnit* cUnit, MIR* mir);
+RegLocation GetRawDest(CompilationUnit* cUnit, MIR* mir);
-extern RegLocation GetReturnWide(CompilationUnit* cUnit, bool isDouble);
+RegLocation GetReturnWide(CompilationUnit* cUnit, bool isDouble);
/* Clobber all regs that might be used by an external C call */
-extern void ClobberCalleeSave(CompilationUnit* cUnit);
+void ClobberCalleeSave(CompilationUnit* cUnit);
-extern RegisterInfo *IsTemp(CompilationUnit* cUnit, int reg);
+RegisterInfo *IsTemp(CompilationUnit* cUnit, int reg);
-extern RegisterInfo *IsPromoted(CompilationUnit* cUnit, int reg);
+RegisterInfo *IsPromoted(CompilationUnit* cUnit, int reg);
-extern bool IsDirty(CompilationUnit* cUnit, int reg);
+bool IsDirty(CompilationUnit* cUnit, int reg);
-extern void MarkInUse(CompilationUnit* cUnit, int reg);
+void MarkInUse(CompilationUnit* cUnit, int reg);
-extern int AllocTemp(CompilationUnit* cUnit);
+int AllocTemp(CompilationUnit* cUnit);
-extern int AllocTempFloat(CompilationUnit* cUnit);
+int AllocTempFloat(CompilationUnit* cUnit);
//REDO: too many assumptions.
-extern int AllocTempDouble(CompilationUnit* cUnit);
+int AllocTempDouble(CompilationUnit* cUnit);
-extern void FreeTemp(CompilationUnit* cUnit, int reg);
+void FreeTemp(CompilationUnit* cUnit, int reg);
-extern void ResetDefLocWide(CompilationUnit* cUnit, RegLocation rl);
+void ResetDefLocWide(CompilationUnit* cUnit, RegLocation rl);
-extern void ResetDefTracking(CompilationUnit* cUnit);
+void ResetDefTracking(CompilationUnit* cUnit);
-extern RegisterInfo *IsLive(CompilationUnit* cUnit, int reg);
+RegisterInfo *IsLive(CompilationUnit* cUnit, int reg);
/* To be used when explicitly managing register use */
-extern void LockCallTemps(CompilationUnit* cUnit);
+void LockCallTemps(CompilationUnit* cUnit);
-extern void FreeCallTemps(CompilationUnit* cUnit);
+void FreeCallTemps(CompilationUnit* cUnit);
-extern void FlushAllRegs(CompilationUnit* cUnit);
+void FlushAllRegs(CompilationUnit* cUnit);
-extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit);
+RegLocation GetReturnWideAlt(CompilationUnit* cUnit);
-extern RegLocation GetReturn(CompilationUnit* cUnit, bool isFloat);
+RegLocation GetReturn(CompilationUnit* cUnit, bool isFloat);
-extern RegLocation GetReturnAlt(CompilationUnit* cUnit);
+RegLocation GetReturnAlt(CompilationUnit* cUnit);
/* Clobber any temp associated with an sReg. Could be in either class */
-extern void ClobberSReg(CompilationUnit* cUnit, int sReg);
/* Return a temp if one is available, -1 otherwise */
-extern int AllocFreeTemp(CompilationUnit* cUnit);
+int AllocFreeTemp(CompilationUnit* cUnit);
/* Attempt to allocate a callee-save register */
-extern int AllocPreservedCoreReg(CompilationUnit* cUnit, int sreg);
-extern int AllocPreservedFPReg(CompilationUnit* cUnit, int sReg,
- bool doubleStart);
-
/*
* 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 LockTemp(CompilationUnit* cUnit, int reg);
+void LockTemp(CompilationUnit* cUnit, int reg);
-extern RegLocation WideToNarrow(CompilationUnit* cUnit, RegLocation rl);
+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 ResetRegPool(CompilationUnit* cUnit);
+void ResetRegPool(CompilationUnit* cUnit);
-extern void ClobberAllRegs(CompilationUnit* cUnit);
+void ClobberAllRegs(CompilationUnit* cUnit);
-extern void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
+void FlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
-extern void FlushReg(CompilationUnit* cUnit, int reg);
+void FlushReg(CompilationUnit* cUnit, int reg);
-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);
+void DoPromotion(CompilationUnit* cUnit);
+int VRegOffset(CompilationUnit* cUnit, int reg);
+int SRegOffset(CompilationUnit* cUnit, int reg);
+void RecordCorePromotion(CompilationUnit* cUnit, int reg, int sReg);
+void RecordFpPromotion(CompilationUnit* cUnit, int reg, int sReg);
/* Architecture-dependent register allocation routines. */
-extern int AllocTypedTempPair(CompilationUnit* cUnit,
+int AllocTypedTempPair(CompilationUnit* cUnit,
bool fpHint, int regClass);
-extern int AllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass);
+int AllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass);
-extern void DumpCoreRegPool(CompilationUnit* cUint);
-extern void oatDumpFPRegPool(CompilationUnit* cUint);
-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 AdjustSpillMask(CompilationUnit* cUnit);
+void oatDumpFPRegPool(CompilationUnit* cUint);
+RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg);
+void NopLIR(LIR* lir);
+bool oatIsFPReg(int reg);
+uint32_t oatFPRegMask(void);
+void AdjustSpillMask(CompilationUnit* cUnit);
void MarkPreservedSingle(CompilationUnit* cUnit, int vReg, int reg);
int ComputeFrameSize(CompilationUnit* cUnit);
diff --git a/src/compiler/codegen/target_list.h b/src/compiler/codegen/target_list.h
index 970be2d..76c0bdb 100644
--- a/src/compiler/codegen/target_list.h
+++ b/src/compiler/codegen/target_list.h
@@ -22,8 +22,6 @@
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);
@@ -31,13 +29,7 @@
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);
@@ -55,7 +47,6 @@
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);
@@ -85,10 +76,6 @@
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);
@@ -102,7 +89,6 @@
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);
@@ -121,7 +107,6 @@
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);
diff --git a/src/compiler/codegen/x86/assemble_x86.cc b/src/compiler/codegen/x86/assemble_x86.cc
index 50300a5..61cc7d9 100644
--- a/src/compiler/codegen/x86/assemble_x86.cc
+++ b/src/compiler/codegen/x86/assemble_x86.cc
@@ -1176,7 +1176,7 @@
EmitRegImm(cUnit, &EncodingMap[kX86Sub32RI], reg, offset + 5 /* size of call +0 */);
}
-void EmitUnimplemented(CompilationUnit* cUnit, const X86EncodingMap* entry, LIR* lir) {
+static 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
diff --git a/src/compiler/codegen/x86/target_x86.cc b/src/compiler/codegen/x86/target_x86.cc
index 64343e5..272554d 100644
--- a/src/compiler/codegen/x86/target_x86.cc
+++ b/src/compiler/codegen/x86/target_x86.cc
@@ -380,14 +380,14 @@
}
/* Clobber all regs that might be used by an external C call */
-extern void ClobberCalleeSave(CompilationUnit *cUnit)
+void ClobberCalleeSave(CompilationUnit *cUnit)
{
Clobber(cUnit, rAX);
Clobber(cUnit, rCX);
Clobber(cUnit, rDX);
}
-extern RegLocation GetReturnWideAlt(CompilationUnit* cUnit) {
+RegLocation GetReturnWideAlt(CompilationUnit* cUnit) {
RegLocation res = LocCReturnWide();
CHECK(res.lowReg == rAX);
CHECK(res.highReg == rDX);
@@ -399,7 +399,7 @@
return res;
}
-extern RegLocation GetReturnAlt(CompilationUnit* cUnit)
+RegLocation GetReturnAlt(CompilationUnit* cUnit)
{
RegLocation res = LocCReturn();
res.lowReg = rDX;
@@ -408,14 +408,14 @@
return res;
}
-extern RegisterInfo* GetRegInfo(CompilationUnit* cUnit, int reg)
+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 LockCallTemps(CompilationUnit* cUnit)
+void LockCallTemps(CompilationUnit* cUnit)
{
LockTemp(cUnit, rX86_ARG0);
LockTemp(cUnit, rX86_ARG1);
@@ -424,7 +424,7 @@
}
/* To be used when explicitly managing register use */
-extern void FreeCallTemps(CompilationUnit* cUnit)
+void FreeCallTemps(CompilationUnit* cUnit)
{
FreeTemp(cUnit, rX86_ARG0);
FreeTemp(cUnit, rX86_ARG1);