More target-independence
Continuing to move target-specific code from the Arm
code generator into the independent realm. This will be
done in multiple small steps.
In this CL, the focus is on unifying the LIR data structure and
various enums that don't really need to be target specific. Also
creates two new shared source files: GenCommon.cc (to hold
top-level code generation functions) and GenInvoke.cc (which
is likely to be shared only by the Arm and Mips targets).
Also added is a makefile hack to build for Mips (which we'll
eventually remove when the compiler support multiple targets
via the command line) and various minor cleanups.
Overall, this CL moves more than 3,000 lines of code from
target dependent to target independent.
Change-Id: I431ca4ae728100ed7d0e9d83a966a3f789f731b1
diff --git a/src/compiler/Dataflow.cc b/src/compiler/Dataflow.cc
index 4572857..733552c 100644
--- a/src/compiler/Dataflow.cc
+++ b/src/compiler/Dataflow.cc
@@ -917,8 +917,7 @@
/*
* Dalvik instruction disassembler with optional SSA printing.
*/
-char* oatFullDisassembler(CompilationUnit* cUnit,
- const MIR* mir)
+char* oatFullDisassembler(CompilationUnit* cUnit, const MIR* mir)
{
char buffer[256];
char operand0[32], operand1[32];
@@ -1084,9 +1083,9 @@
}
/* Any register that is used before being defined is considered live-in */
-STATIC inline void handleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV,
- ArenaBitVector* defV,
- ArenaBitVector* liveInV, int dalvikRegId)
+inline void handleLiveInUse(CompilationUnit* cUnit, ArenaBitVector* useV,
+ ArenaBitVector* defV, ArenaBitVector* liveInV,
+ int dalvikRegId)
{
oatSetBit(cUnit, useV, dalvikRegId);
if (!oatIsBitSet(defV, dalvikRegId)) {
@@ -1095,8 +1094,8 @@
}
/* Mark a reg as being defined */
-STATIC inline void handleDef(CompilationUnit* cUnit, ArenaBitVector* defV,
- int dalvikRegId)
+inline void handleDef(CompilationUnit* cUnit, ArenaBitVector* defV,
+ int dalvikRegId)
{
oatSetBit(cUnit, defV, dalvikRegId);
}
@@ -1166,8 +1165,8 @@
}
/* Find out the latest SSA register for a given Dalvik register */
-STATIC void handleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg,
- int regIndex)
+void handleSSAUse(CompilationUnit* cUnit, int* uses, int dalvikReg,
+ int regIndex)
{
int encodedValue = cUnit->dalvikToSSAMap[dalvikReg];
int ssaReg = DECODE_REG(encodedValue);
@@ -1175,8 +1174,8 @@
}
/* Setup a new SSA register for a given Dalvik register */
-STATIC void handleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg,
- int regIndex)
+void handleSSADef(CompilationUnit* cUnit, int* defs, int dalvikReg,
+ int regIndex)
{
int ssaReg = cUnit->numSSARegs++;
/* Bump up the subscript */
@@ -1192,7 +1191,7 @@
}
/* Look up new SSA names for format_35c instructions */
-STATIC void dataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir)
+void dataFlowSSAFormat35C(CompilationUnit* cUnit, MIR* mir)
{
DecodedInstruction *dInsn = &mir->dalvikInsn;
int numUses = dInsn->vA;
@@ -1211,7 +1210,7 @@
}
/* Look up new SSA names for format_3rc instructions */
-STATIC void dataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir)
+void dataFlowSSAFormat3RC(CompilationUnit* cUnit, MIR* mir)
{
DecodedInstruction *dInsn = &mir->dalvikInsn;
int numUses = dInsn->vA;
@@ -1370,7 +1369,7 @@
}
/* Setup a constant value for opcodes thare have the DF_SETS_CONST attribute */
-STATIC void setConstant(CompilationUnit* cUnit, int ssaReg, int value)
+void setConstant(CompilationUnit* cUnit, int ssaReg, int value)
{
oatSetBit(cUnit, cUnit->isConstantV, ssaReg);
cUnit->constantValues[ssaReg] = value;
@@ -1515,8 +1514,7 @@
}
/* Clear the visited flag for each BB */
-bool oatClearVisitedFlag(struct CompilationUnit* cUnit,
- struct BasicBlock* bb)
+bool oatClearVisitedFlag(struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
bb->visited = false;
return true;
@@ -1636,8 +1634,8 @@
}
}
-STATIC bool nullCheckEliminationInit(struct CompilationUnit* cUnit,
- struct BasicBlock* bb)
+bool nullCheckEliminationInit(struct CompilationUnit* cUnit,
+ struct BasicBlock* bb)
{
if (bb->dataFlowInfo == NULL) return false;
bb->dataFlowInfo->endingNullCheckV =
@@ -1647,8 +1645,7 @@
}
/* Eliminate unnecessary null checks for a basic block. */
-STATIC bool eliminateNullChecks( struct CompilationUnit* cUnit,
- struct BasicBlock* bb)
+bool eliminateNullChecks( struct CompilationUnit* cUnit, struct BasicBlock* bb)
{
if (bb->dataFlowInfo == NULL) return false;