summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/mips/CodegenCommon.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-02-28 15:36:15 -0800
committer buzbee <buzbee@google.com> 2012-02-29 18:52:47 -0800
commit31a4a6f5717f645da6b97ccc1e420ae1e1c71ce0 (patch)
treede07c7175bcda6c2e3f11329d72d142319354f3f /src/compiler/codegen/mips/CodegenCommon.cc
parent32c9a2decebe7b736e1f05b53b5822affea5e81d (diff)
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
Diffstat (limited to 'src/compiler/codegen/mips/CodegenCommon.cc')
-rw-r--r--src/compiler/codegen/mips/CodegenCommon.cc84
1 files changed, 12 insertions, 72 deletions
diff --git a/src/compiler/codegen/mips/CodegenCommon.cc b/src/compiler/codegen/mips/CodegenCommon.cc
index 3645643f14..8dbb9a3506 100644
--- a/src/compiler/codegen/mips/CodegenCommon.cc
+++ b/src/compiler/codegen/mips/CodegenCommon.cc
@@ -26,9 +26,6 @@ namespace art {
* applicable directory below this one.
*/
-/* Track exercised opcodes */
-static int opcodeCoverage[kNumPackedOpcodes];
-
static void setMemRefType(MipsLIR *lir, bool isLoad, int memType)
{
/* MIPSTODO simplify setMemRefType() */
@@ -230,46 +227,13 @@ STATIC void setupResourceMasks(MipsLIR *lir)
}
/*
- * Set up the accurate resource mask for branch instructions
- */
-static void relaxBranchMasks(MipsLIR *lir)
-{
- int flags = EncodingMap[lir->opcode].flags;
-
- /* Make sure only branch instructions are passed here */
- DCHECK(flags & IS_BRANCH);
-
- lir->defMask |= ENCODE_REG_PC;
- lir->useMask |= ENCODE_REG_PC;
-
-
- if (flags & REG_DEF_LR) {
- lir->defMask |= ENCODE_REG_LR;
- }
-
- if (flags & (REG_USE0 | REG_USE1 | REG_USE2 | REG_USE3)) {
- int i;
-
- for (i = 0; i < 4; i++) {
- if (flags & (1 << (kRegUse0 + i))) {
- setupRegMask(&lir->useMask, lir->operands[i]);
- }
- }
- }
-
- if (flags & USES_CCODES) {
- lir->useMask |= ENCODE_CCODE;
- }
-}
-
-/*
* The following are building blocks to construct low-level IRs with 0 - 4
* operands.
*/
-static MipsLIR *newLIR0(CompilationUnit *cUnit, MipsOpCode opcode)
+MipsLIR *newLIR0(CompilationUnit *cUnit, MipsOpCode opcode)
{
MipsLIR *insn = (MipsLIR *) oatNew(cUnit, sizeof(MipsLIR), true, kAllocLIR);
- DCHECK(isPseudoOpCode(opcode) || (EncodingMap[opcode].flags & NO_OPERAND));
+ DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & NO_OPERAND));
insn->opcode = opcode;
setupResourceMasks(insn);
insn->generic.dalvikOffset = cUnit->currentDalvikOffset;
@@ -277,11 +241,11 @@ static MipsLIR *newLIR0(CompilationUnit *cUnit, MipsOpCode opcode)
return insn;
}
-static MipsLIR *newLIR1(CompilationUnit *cUnit, MipsOpCode opcode,
+MipsLIR *newLIR1(CompilationUnit *cUnit, MipsOpCode opcode,
int dest)
{
MipsLIR *insn = (MipsLIR *) oatNew(cUnit, sizeof(MipsLIR), true, kAllocLIR);
- DCHECK(isPseudoOpCode(opcode) || (EncodingMap[opcode].flags & IS_UNARY_OP));
+ DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & IS_UNARY_OP));
insn->opcode = opcode;
insn->operands[0] = dest;
setupResourceMasks(insn);
@@ -290,11 +254,11 @@ static MipsLIR *newLIR1(CompilationUnit *cUnit, MipsOpCode opcode,
return insn;
}
-static MipsLIR *newLIR2(CompilationUnit *cUnit, MipsOpCode opcode,
+MipsLIR *newLIR2(CompilationUnit *cUnit, MipsOpCode opcode,
int dest, int src1)
{
MipsLIR *insn = (MipsLIR *) oatNew(cUnit, sizeof(MipsLIR), true, kAllocLIR);
- DCHECK(isPseudoOpCode(opcode) ||
+ DCHECK(isPseudoOpcode(opcode) ||
(EncodingMap[opcode].flags & IS_BINARY_OP));
insn->opcode = opcode;
insn->operands[0] = dest;
@@ -305,14 +269,14 @@ static MipsLIR *newLIR2(CompilationUnit *cUnit, MipsOpCode opcode,
return insn;
}
-static MipsLIR *newLIR3(CompilationUnit *cUnit, MipsOpCode opcode,
+MipsLIR *newLIR3(CompilationUnit *cUnit, MipsOpCode opcode,
int dest, int src1, int src2)
{
MipsLIR *insn = (MipsLIR *) oatNew(cUnit, sizeof(MipsLIR), true, kAllocLIR);
if (!(EncodingMap[opcode].flags & IS_TERTIARY_OP)) {
LOG(FATAL) << "Bad LIR3: " << EncodingMap[opcode].name;
}
- DCHECK(isPseudoOpCode(opcode) ||
+ DCHECK(isPseudoOpcode(opcode) ||
(EncodingMap[opcode].flags & IS_TERTIARY_OP));
insn->opcode = opcode;
insn->operands[0] = dest;
@@ -324,11 +288,11 @@ static MipsLIR *newLIR3(CompilationUnit *cUnit, MipsOpCode opcode,
return insn;
}
-static MipsLIR *newLIR4(CompilationUnit *cUnit, MipsOpCode opcode,
+MipsLIR *newLIR4(CompilationUnit *cUnit, MipsOpCode opcode,
int dest, int src1, int src2, int info)
{
MipsLIR *insn = (MipsLIR *) oatNew(cUnit, sizeof(MipsLIR), true, kAllocLIR);
- DCHECK(isPseudoOpCode(opcode) ||
+ DCHECK(isPseudoOpcode(opcode) ||
(EncodingMap[opcode].flags & IS_QUAD_OP));
insn->opcode = opcode;
insn->operands[0] = dest;
@@ -342,36 +306,12 @@ static MipsLIR *newLIR4(CompilationUnit *cUnit, MipsOpCode opcode,
}
/*
- * The following are building blocks to insert constants into the pool or
- * instruction streams.
- */
-
-/* Add a 32-bit constant either in the constant pool or mixed with code */
-static MipsLIR *addWordData(CompilationUnit *cUnit, LIR **constantListP,
- int value)
-{
- /* Add the constant to the literal pool */
- if (constantListP) {
- MipsLIR *newValue = (MipsLIR *) oatNew(cUnit, sizeof(MipsLIR), true,
- kAllocData);
- newValue->operands[0] = value;
- newValue->generic.next = *constantListP;
- *constantListP = (LIR *) newValue;
- return newValue;
- } else {
- /* Add the constant in the middle of code stream */
- newLIR1(cUnit, kMips32BitData, value);
- }
- return NULL;
-}
-
-/*
- * Generate an kMipsPseudoBarrier marker to indicate the boundary of special
+ * Generate an kPseudoBarrier marker to indicate the boundary of special
* blocks.
*/
static void genBarrier(CompilationUnit *cUnit)
{
- MipsLIR *barrier = newLIR0(cUnit, kMipsPseudoBarrier);
+ MipsLIR *barrier = newLIR0(cUnit, kPseudoBarrier);
/* Mark all resources as being clobbered */
barrier->defMask = -1;
}