Quick compiler: minor cleanup
Remove dead software floating point support.
Move a common function from target specific to target independent.
Change-Id: Iaf793857f7e0faae02c672b9f1d45a0658143a51
diff --git a/src/compiler/codegen/arm/assemble_arm.cc b/src/compiler/codegen/arm/assemble_arm.cc
index 93c979b..27544d8 100644
--- a/src/compiler/codegen/arm/assemble_arm.cc
+++ b/src/compiler/codegen/arm/assemble_arm.cc
@@ -1366,32 +1366,4 @@
return EncodingMap[lir->opcode].size;
}
-/*
- * Target-dependent offset assignment.
- */
-int ArmCodegen::AssignInsnOffsets(CompilationUnit* cu)
-{
- LIR* arm_lir;
- int offset = 0;
-
- for (arm_lir = cu->first_lir_insn; arm_lir != NULL; arm_lir = NEXT_LIR(arm_lir)) {
- arm_lir->offset = offset;
- if (arm_lir->opcode >= 0) {
- if (!arm_lir->flags.is_nop) {
- offset += arm_lir->flags.size;
- }
- } else if (arm_lir->opcode == kPseudoPseudoAlign4) {
- if (offset & 0x2) {
- offset += 2;
- arm_lir->operands[0] = 1;
- } else {
- arm_lir->operands[0] = 0;
- }
- }
- /* Pseudo opcodes don't consume space */
- }
-
- return offset;
-}
-
} // namespace art
diff --git a/src/compiler/codegen/arm/codegen_arm.h b/src/compiler/codegen/arm/codegen_arm.h
index 4737d8c..f085a19 100644
--- a/src/compiler/codegen/arm/codegen_arm.h
+++ b/src/compiler/codegen/arm/codegen_arm.h
@@ -83,7 +83,6 @@
virtual void SetupTargetResourceMasks(CompilationUnit* cu, LIR* lir);
virtual const char* GetTargetInstFmt(int opcode);
virtual const char* GetTargetInstName(int opcode);
- virtual int AssignInsnOffsets(CompilationUnit* cu);
virtual std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* base_addr);
virtual uint64_t GetPCUseDefEncoding();
virtual uint64_t GetTargetInstFlags(int opcode);
diff --git a/src/compiler/codegen/arm/fp_arm.cc b/src/compiler/codegen/arm/fp_arm.cc
index a9ea916..5e0e73d 100644
--- a/src/compiler/codegen/arm/fp_arm.cc
+++ b/src/compiler/codegen/arm/fp_arm.cc
@@ -50,9 +50,14 @@
break;
case Instruction::REM_FLOAT_2ADDR:
case Instruction::REM_FLOAT:
- case Instruction::NEG_FLOAT: {
- return GenArithOpFloatPortable(cu, opcode, rl_dest, rl_src1, rl_src2);
- }
+ FlushAllRegs(cu); // Send everything to home location
+ CallRuntimeHelperRegLocationRegLocation(cu, ENTRYPOINT_OFFSET(pFmodf), rl_src1, rl_src2, false);
+ rl_result = GetReturn(cu, true);
+ StoreValue(cu, rl_dest, rl_result);
+ return false;
+ case Instruction::NEG_FLOAT:
+ GenNegFloat(cu, rl_dest, rl_src1);
+ return false;
default:
return true;
}
@@ -89,9 +94,14 @@
break;
case Instruction::REM_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE:
- case Instruction::NEG_DOUBLE: {
- return GenArithOpDoublePortable(cu, opcode, rl_dest, rl_src1, rl_src2);
- }
+ FlushAllRegs(cu); // Send everything to home location
+ CallRuntimeHelperRegLocationRegLocation(cu, ENTRYPOINT_OFFSET(pFmod), rl_src1, rl_src2, false);
+ rl_result = GetReturnWide(cu, true);
+ StoreValueWide(cu, rl_dest, rl_result);
+ return false;
+ case Instruction::NEG_DOUBLE:
+ GenNegDouble(cu, rl_dest, rl_src1);
+ return false;
default:
return true;
}
@@ -136,10 +146,13 @@
op = kThumb2VcvtDI;
break;
case Instruction::LONG_TO_DOUBLE:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2d), rl_dest, rl_src);
case Instruction::FLOAT_TO_LONG:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2l), rl_dest, rl_src);
case Instruction::LONG_TO_FLOAT:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2f), rl_dest, rl_src);
case Instruction::DOUBLE_TO_LONG:
- return GenConversionPortable(cu, opcode, rl_dest, rl_src);
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2l), rl_dest, rl_src);
default:
return true;
}
diff --git a/src/compiler/codegen/codegen.h b/src/compiler/codegen/codegen.h
index 9bc306d..9dfa609 100644
--- a/src/compiler/codegen/codegen.h
+++ b/src/compiler/codegen/codegen.h
@@ -153,12 +153,6 @@
RegLocation rl_src1, RegLocation rl_src2);
bool GenConversionCall(CompilationUnit* cu, int func_offset, RegLocation rl_dest,
RegLocation rl_src);
- bool GenArithOpFloatPortable(CompilationUnit* cu, Instruction::Code opcode, RegLocation rl_dest,
- RegLocation rl_src1, RegLocation rl_src2);
- bool GenArithOpDoublePortable(CompilationUnit* cu, Instruction::Code opcode, RegLocation rl_dest,
- RegLocation rl_src1, RegLocation rl_src2);
- bool GenConversionPortable(CompilationUnit* cu, Instruction::Code opcode, RegLocation rl_dest,
- RegLocation rl_src);
void GenSuspendTest(CompilationUnit* cu, int opt_flags);
void GenSuspendTestAndBranch(CompilationUnit* cu, int opt_flags, LIR* target);
@@ -294,7 +288,6 @@
virtual void SetupTargetResourceMasks(CompilationUnit* cu, LIR* lir) = 0;
virtual const char* GetTargetInstFmt(int opcode) = 0;
virtual const char* GetTargetInstName(int opcode) = 0;
- virtual int AssignInsnOffsets(CompilationUnit* cu) = 0;
virtual std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* base_addr) = 0;
virtual uint64_t GetPCUseDefEncoding() = 0;
virtual uint64_t GetTargetInstFlags(int opcode) = 0;
diff --git a/src/compiler/codegen/codegen_util.cc b/src/compiler/codegen/codegen_util.cc
index cf69ff9..11ab9c0 100644
--- a/src/compiler/codegen/codegen_util.cc
+++ b/src/compiler/codegen/codegen_util.cc
@@ -863,14 +863,39 @@
return offset;
}
+// LIR offset assignment.
+static int AssignInsnOffsets(CompilationUnit* cu)
+{
+ LIR* lir;
+ int offset = 0;
+
+ for (lir = cu->first_lir_insn; lir != NULL; lir = NEXT_LIR(lir)) {
+ lir->offset = offset;
+ if (lir->opcode >= 0) {
+ if (!lir->flags.is_nop) {
+ offset += lir->flags.size;
+ }
+ } else if (lir->opcode == kPseudoPseudoAlign4) {
+ if (offset & 0x2) {
+ offset += 2;
+ lir->operands[0] = 1;
+ } else {
+ lir->operands[0] = 0;
+ }
+ }
+ /* Pseudo opcodes don't consume space */
+ }
+
+ return offset;
+}
+
/*
* Walk the compilation unit and assign offsets to instructions
* and literals and compute the total size of the compiled unit.
*/
static void AssignOffsets(CompilationUnit* cu)
{
- Codegen* cg = cu->cg.get();
- int offset = cg->AssignInsnOffsets(cu);
+ int offset = AssignInsnOffsets(cu);
/* Const values have to be word aligned */
offset = (offset + 3) & ~3;
@@ -1056,5 +1081,4 @@
return res;
}
-}
- // namespace art
+} // namespace art
diff --git a/src/compiler/codegen/gen_common.cc b/src/compiler/codegen/gen_common.cc
index 8605b80..db99a30 100644
--- a/src/compiler/codegen/gen_common.cc
+++ b/src/compiler/codegen/gen_common.cc
@@ -1924,131 +1924,6 @@
return false;
}
-bool Codegen::GenArithOpFloatPortable(CompilationUnit* cu, Instruction::Code opcode,
- RegLocation rl_dest, RegLocation rl_src1,
- RegLocation rl_src2)
-{
- RegLocation rl_result;
- int func_offset;
-
- switch (opcode) {
- case Instruction::ADD_FLOAT_2ADDR:
- case Instruction::ADD_FLOAT:
- func_offset = ENTRYPOINT_OFFSET(pFadd);
- break;
- case Instruction::SUB_FLOAT_2ADDR:
- case Instruction::SUB_FLOAT:
- func_offset = ENTRYPOINT_OFFSET(pFsub);
- break;
- case Instruction::DIV_FLOAT_2ADDR:
- case Instruction::DIV_FLOAT:
- func_offset = ENTRYPOINT_OFFSET(pFdiv);
- break;
- case Instruction::MUL_FLOAT_2ADDR:
- case Instruction::MUL_FLOAT:
- func_offset = ENTRYPOINT_OFFSET(pFmul);
- break;
- case Instruction::REM_FLOAT_2ADDR:
- case Instruction::REM_FLOAT:
- func_offset = ENTRYPOINT_OFFSET(pFmodf);
- break;
- case Instruction::NEG_FLOAT: {
- GenNegFloat(cu, rl_dest, rl_src1);
- return false;
- }
- default:
- return true;
- }
- FlushAllRegs(cu); /* Send everything to home location */
- CallRuntimeHelperRegLocationRegLocation(cu, func_offset, rl_src1, rl_src2, false);
- rl_result = GetReturn(cu, true);
- StoreValue(cu, rl_dest, rl_result);
- return false;
-}
-
-bool Codegen::GenArithOpDoublePortable(CompilationUnit* cu, Instruction::Code opcode,
- RegLocation rl_dest, RegLocation rl_src1,
- RegLocation rl_src2)
-{
- RegLocation rl_result;
- int func_offset;
-
- switch (opcode) {
- case Instruction::ADD_DOUBLE_2ADDR:
- case Instruction::ADD_DOUBLE:
- func_offset = ENTRYPOINT_OFFSET(pDadd);
- break;
- case Instruction::SUB_DOUBLE_2ADDR:
- case Instruction::SUB_DOUBLE:
- func_offset = ENTRYPOINT_OFFSET(pDsub);
- break;
- case Instruction::DIV_DOUBLE_2ADDR:
- case Instruction::DIV_DOUBLE:
- func_offset = ENTRYPOINT_OFFSET(pDdiv);
- break;
- case Instruction::MUL_DOUBLE_2ADDR:
- case Instruction::MUL_DOUBLE:
- func_offset = ENTRYPOINT_OFFSET(pDmul);
- break;
- case Instruction::REM_DOUBLE_2ADDR:
- case Instruction::REM_DOUBLE:
- func_offset = ENTRYPOINT_OFFSET(pFmod);
- break;
- case Instruction::NEG_DOUBLE: {
- GenNegDouble(cu, rl_dest, rl_src1);
- return false;
- }
- default:
- return true;
- }
- FlushAllRegs(cu); /* Send everything to home location */
- CallRuntimeHelperRegLocationRegLocation(cu, func_offset, rl_src1, rl_src2, false);
- rl_result = GetReturnWide(cu, true);
- StoreValueWide(cu, rl_dest, rl_result);
- return false;
-}
-
-bool Codegen::GenConversionPortable(CompilationUnit* cu, Instruction::Code opcode,
- RegLocation rl_dest, RegLocation rl_src)
-{
-
- switch (opcode) {
- case Instruction::INT_TO_FLOAT:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pI2f),
- rl_dest, rl_src);
- case Instruction::FLOAT_TO_INT:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2iz),
- rl_dest, rl_src);
- case Instruction::DOUBLE_TO_FLOAT:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2f),
- rl_dest, rl_src);
- case Instruction::FLOAT_TO_DOUBLE:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2d),
- rl_dest, rl_src);
- case Instruction::INT_TO_DOUBLE:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pI2d),
- rl_dest, rl_src);
- case Instruction::DOUBLE_TO_INT:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2iz),
- rl_dest, rl_src);
- case Instruction::FLOAT_TO_LONG:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2l),
- rl_dest, rl_src);
- case Instruction::LONG_TO_FLOAT:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2f),
- rl_dest, rl_src);
- case Instruction::DOUBLE_TO_LONG:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2l),
- rl_dest, rl_src);
- case Instruction::LONG_TO_DOUBLE:
- return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2d),
- rl_dest, rl_src);
- default:
- return true;
- }
- return false;
-}
-
/* Check if we need to check for pending suspend request */
void Codegen::GenSuspendTest(CompilationUnit* cu, int opt_flags)
{
diff --git a/src/compiler/codegen/mips/assemble_mips.cc b/src/compiler/codegen/mips/assemble_mips.cc
index 4574a42..c0ed3b6 100644
--- a/src/compiler/codegen/mips/assemble_mips.cc
+++ b/src/compiler/codegen/mips/assemble_mips.cc
@@ -712,33 +712,5 @@
{
return EncodingMap[lir->opcode].size;
}
-/*
- * Target-dependent offset assignment.
- * independent.
- */
-int MipsCodegen::AssignInsnOffsets(CompilationUnit* cu)
-{
- LIR* mips_lir;
- int offset = 0;
-
- for (mips_lir = cu->first_lir_insn; mips_lir != NULL; mips_lir = NEXT_LIR(mips_lir)) {
- mips_lir->offset = offset;
- if (mips_lir->opcode >= 0) {
- if (!mips_lir->flags.is_nop) {
- offset += mips_lir->flags.size;
- }
- } else if (mips_lir->opcode == kPseudoPseudoAlign4) {
- if (offset & 0x2) {
- offset += 2;
- mips_lir->operands[0] = 1;
- } else {
- mips_lir->operands[0] = 0;
- }
- }
- /* Pseudo opcodes don't consume space */
- }
-
- return offset;
-}
} // namespace art
diff --git a/src/compiler/codegen/mips/codegen_mips.h b/src/compiler/codegen/mips/codegen_mips.h
index b0ecfce..aaa03c0 100644
--- a/src/compiler/codegen/mips/codegen_mips.h
+++ b/src/compiler/codegen/mips/codegen_mips.h
@@ -83,7 +83,6 @@
virtual void SetupTargetResourceMasks(CompilationUnit* cu, LIR* lir);
virtual const char* GetTargetInstFmt(int opcode);
virtual const char* GetTargetInstName(int opcode);
- virtual int AssignInsnOffsets(CompilationUnit* cu);
virtual std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* base_addr);
virtual uint64_t GetPCUseDefEncoding();
virtual uint64_t GetTargetInstFlags(int opcode);
diff --git a/src/compiler/codegen/mips/fp_mips.cc b/src/compiler/codegen/mips/fp_mips.cc
index efc4f80..e718c5c 100644
--- a/src/compiler/codegen/mips/fp_mips.cc
+++ b/src/compiler/codegen/mips/fp_mips.cc
@@ -49,11 +49,14 @@
case Instruction::MUL_FLOAT:
op = kMipsFmuls;
break;
- case Instruction::REM_FLOAT_2ADDR:
- case Instruction::REM_FLOAT:
- case Instruction::NEG_FLOAT: {
- return GenArithOpFloatPortable(cu, opcode, rl_dest, rl_src1, rl_src2);
- }
+ FlushAllRegs(cu); // Send everything to home location
+ CallRuntimeHelperRegLocationRegLocation(cu, ENTRYPOINT_OFFSET(pFmodf), rl_src1, rl_src2, false);
+ rl_result = GetReturn(cu, true);
+ StoreValue(cu, rl_dest, rl_result);
+ return false;
+ case Instruction::NEG_FLOAT:
+ GenNegFloat(cu, rl_dest, rl_src1);
+ return false;
default:
return true;
}
@@ -91,9 +94,14 @@
break;
case Instruction::REM_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE:
- case Instruction::NEG_DOUBLE: {
- return GenArithOpDoublePortable(cu, opcode, rl_dest, rl_src1, rl_src2);
- }
+ FlushAllRegs(cu); // Send everything to home location
+ CallRuntimeHelperRegLocationRegLocation(cu, ENTRYPOINT_OFFSET(pFmod), rl_src1, rl_src2, false);
+ rl_result = GetReturnWide(cu, true);
+ StoreValueWide(cu, rl_dest, rl_result);
+ return false;
+ case Instruction::NEG_DOUBLE:
+ GenNegDouble(cu, rl_dest, rl_src1);
+ return false;
default:
return true;
}
@@ -130,12 +138,17 @@
op = kMipsFcvtdw;
break;
case Instruction::FLOAT_TO_INT:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2iz), rl_dest, rl_src);
case Instruction::DOUBLE_TO_INT:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2iz), rl_dest, rl_src);
case Instruction::LONG_TO_DOUBLE:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2d), rl_dest, rl_src);
case Instruction::FLOAT_TO_LONG:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2l), rl_dest, rl_src);
case Instruction::LONG_TO_FLOAT:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2f), rl_dest, rl_src);
case Instruction::DOUBLE_TO_LONG:
- return GenConversionPortable(cu, opcode, rl_dest, rl_src);
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2l), rl_dest, rl_src);
default:
return true;
}
diff --git a/src/compiler/codegen/x86/assemble_x86.cc b/src/compiler/codegen/x86/assemble_x86.cc
index 1e04e18..2b33090 100644
--- a/src/compiler/codegen/x86/assemble_x86.cc
+++ b/src/compiler/codegen/x86/assemble_x86.cc
@@ -1417,33 +1417,4 @@
return res;
}
-/*
- * Target-dependent offset assignment.
- * independent.
- */
-int X86Codegen::AssignInsnOffsets(CompilationUnit* cu)
-{
- LIR* x86_lir;
- int offset = 0;
-
- for (x86_lir = cu->first_lir_insn; x86_lir != NULL; x86_lir = NEXT_LIR(x86_lir)) {
- x86_lir->offset = offset;
- if (x86_lir->opcode >= 0) {
- if (!x86_lir->flags.is_nop) {
- offset += x86_lir->flags.size;
- }
- } else if (x86_lir->opcode == kPseudoPseudoAlign4) {
- if (offset & 0x2) {
- offset += 2;
- x86_lir->operands[0] = 1;
- } else {
- x86_lir->operands[0] = 0;
- }
- }
- /* Pseudo opcodes don't consume space */
- }
-
- return offset;
-}
-
} // namespace art
diff --git a/src/compiler/codegen/x86/codegen_x86.h b/src/compiler/codegen/x86/codegen_x86.h
index 2a01d9a..dba4953 100644
--- a/src/compiler/codegen/x86/codegen_x86.h
+++ b/src/compiler/codegen/x86/codegen_x86.h
@@ -83,7 +83,6 @@
virtual void SetupTargetResourceMasks(CompilationUnit* cu, LIR* lir);
virtual const char* GetTargetInstFmt(int opcode);
virtual const char* GetTargetInstName(int opcode);
- virtual int AssignInsnOffsets(CompilationUnit* cu);
virtual std::string BuildInsnString(const char* fmt, LIR* lir, unsigned char* base_addr);
virtual uint64_t GetPCUseDefEncoding();
virtual uint64_t GetTargetInstFlags(int opcode);
diff --git a/src/compiler/codegen/x86/fp_x86.cc b/src/compiler/codegen/x86/fp_x86.cc
index 14f8b92..78c737d 100644
--- a/src/compiler/codegen/x86/fp_x86.cc
+++ b/src/compiler/codegen/x86/fp_x86.cc
@@ -47,10 +47,16 @@
case Instruction::MUL_FLOAT:
op = kX86MulssRR;
break;
- case Instruction::NEG_FLOAT:
case Instruction::REM_FLOAT_2ADDR:
case Instruction::REM_FLOAT:
- return GenArithOpFloatPortable(cu, opcode, rl_dest, rl_src1, rl_src2);
+ FlushAllRegs(cu); // Send everything to home location
+ CallRuntimeHelperRegLocationRegLocation(cu, ENTRYPOINT_OFFSET(pFmodf), rl_src1, rl_src2, false);
+ rl_result = GetReturn(cu, true);
+ StoreValue(cu, rl_dest, rl_result);
+ return false;
+ case Instruction::NEG_FLOAT:
+ GenNegFloat(cu, rl_dest, rl_src1);
+ return false;
default:
return true;
}
@@ -93,10 +99,16 @@
case Instruction::MUL_DOUBLE:
op = kX86MulsdRR;
break;
- case Instruction::NEG_DOUBLE:
case Instruction::REM_DOUBLE_2ADDR:
case Instruction::REM_DOUBLE:
- return GenArithOpDoublePortable(cu, opcode, rl_dest, rl_src1, rl_src2);
+ FlushAllRegs(cu); // Send everything to home location
+ CallRuntimeHelperRegLocationRegLocation(cu, ENTRYPOINT_OFFSET(pFmod), rl_src1, rl_src2, false);
+ rl_result = GetReturnWide(cu, true);
+ StoreValueWide(cu, rl_dest, rl_result);
+ return false;
+ case Instruction::NEG_DOUBLE:
+ GenNegDouble(cu, rl_dest, rl_src1);
+ return false;
default:
return true;
}
@@ -186,11 +198,14 @@
return false;
}
case Instruction::LONG_TO_DOUBLE:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2d), rl_dest, rl_src);
case Instruction::LONG_TO_FLOAT:
// TODO: inline by using memory as a 64-bit source. Be careful about promoted registers.
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pL2f), rl_dest, rl_src);
case Instruction::FLOAT_TO_LONG:
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pF2l), rl_dest, rl_src);
case Instruction::DOUBLE_TO_LONG:
- return GenConversionPortable(cu, opcode, rl_dest, rl_src);
+ return GenConversionCall(cu, ENTRYPOINT_OFFSET(pD2l), rl_dest, rl_src);
default:
return true;
}