summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/Ralloc.h
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-02-25 17:03:10 -0800
committer buzbee <buzbee@google.com> 2012-02-26 20:44:46 -0800
commite3acd07f28d5625062b599c2817cb5f7a53f54a9 (patch)
treed38696b0235dab5d8ef791cdb9fb311a6705e03b /src/compiler/codegen/Ralloc.h
parent55b796c6f1fdc36494463a3deeb1e248800695e9 (diff)
Multi-target support
This CL represents a step towards splitting out the target dependent and target independent portions of the compiler, and also adds in the beginning of a MIPS compiler based on the MIPS AOSP Jit submission. More polish is clearly needed, but the split is here probably pretty close. The MIPS code will not compile at this point (and there is no makefile target at present), but it's pretty close. There should be no changes in functionality of the Arm compiler in this CL - just moved stuff around. Change-Id: Ia66b2847e22644a1ec63e66bf5f2fee722f963d4
Diffstat (limited to 'src/compiler/codegen/Ralloc.h')
-rw-r--r--src/compiler/codegen/Ralloc.h49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/compiler/codegen/Ralloc.h b/src/compiler/codegen/Ralloc.h
index e72cdcbff4..c9e5308aad 100644
--- a/src/compiler/codegen/Ralloc.h
+++ b/src/compiler/codegen/Ralloc.h
@@ -24,25 +24,18 @@
#include "../CompilerUtility.h"
#include "../CompilerIR.h"
#include "../Dataflow.h"
-#include "arm/ArmLIR.h"
namespace art {
-/*
- * Return most flexible allowed register class based on size.
- * Bug: 2813841
- * Must use a core register for data types narrower than word (due
- * to possible unaligned load/store.
- */
-STATIC inline RegisterClass oatRegClassBySize(OpSize size)
-{
- return (size == kUnsignedHalf ||
- size == kSignedHalf ||
- size == kUnsignedByte ||
- size == kSignedByte ) ? kCoreReg : kAnyReg;
-}
+/* Static register use counts */
+typedef struct RefCounts {
+ int count;
+ int sReg;
+ bool doubleStart; // Starting vReg for a double
+} RefCounts;
-STATIC inline int oatS2VReg(CompilationUnit* cUnit, int sReg)
+
+inline int oatS2VReg(CompilationUnit* cUnit, int sReg)
{
DCHECK_NE(sReg, INVALID_SREG);
return DECODE_REG(oatConvertSSARegToDalvik(cUnit, sReg));
@@ -58,18 +51,18 @@ STATIC inline int oatS2VReg(CompilationUnit* cUnit, int sReg)
* identified by the dataflow pass what it's new name is.
*/
-STATIC inline int oatSRegHi(int lowSreg) {
+inline int oatSRegHi(int lowSreg) {
return (lowSreg == INVALID_SREG) ? INVALID_SREG : lowSreg + 1;
}
-STATIC inline bool oatLiveOut(CompilationUnit* cUnit, int sReg)
+inline bool oatLiveOut(CompilationUnit* cUnit, int sReg)
{
//For now.
return true;
}
-STATIC inline int oatSSASrc(MIR* mir, int num)
+inline int oatSSASrc(MIR* mir, int num)
{
DCHECK_GT(mir->ssaRep->numUses, num);
return mir->ssaRep->uses[num];
@@ -108,7 +101,7 @@ extern void oatResetDef(CompilationUnit* cUnit, int reg);
extern void oatResetDefLoc(CompilationUnit* cUnit, RegLocation rl);
/* Set up temp & preserved register pools specialized by target */
-extern void oatInitPool(RegisterInfo* regs, int* regNums, int num);
+extern void oatInitPool(struct RegisterInfo* regs, int* regNums, int num);
/*
* Mark the beginning and end LIR of a def sequence. Note that
@@ -212,6 +205,13 @@ extern void oatFlushRegWide(CompilationUnit* cUnit, int reg1, int reg2);
extern void oatFlushReg(CompilationUnit* cUnit, int reg);
+extern void oatDoPromotion(CompilationUnit* cUnit);
+extern int oatVRegOffset(CompilationUnit* cUnit, int reg);
+extern int oatSRegOffset(CompilationUnit* cUnit, int reg);
+extern void oatCountRefs(CompilationUnit*, BasicBlock*, RefCounts*, RefCounts*);
+extern int oatSortCounts(const void *val1, const void *val2);
+extern void oatDumpCounts(const RefCounts* arr, int size, const char* msg);
+
/*
* Architecture-dependent register allocation routines implemented in
* ${TARGET_ARCH}/${TARGET_ARCH_VARIANT}/Ralloc.c
@@ -222,8 +222,6 @@ extern int oatAllocTypedTempPair(CompilationUnit* cUnit,
extern int oatAllocTypedTemp(CompilationUnit* cUnit, bool fpHint,
int regClass);
-extern ArmLIR* oatRegCopy(CompilationUnit* cUnit, int rDest, int rSrc);
-
extern void oatRegCopyWide(CompilationUnit* cUnit, int destLo,
int destHi, int srcLo, int srcHi);
@@ -233,13 +231,16 @@ extern void oatFlushRegImpl(CompilationUnit* cUnit, int rBase,
extern void oatFlushRegWideImpl(CompilationUnit* cUnit, int rBase,
int displacement, int rSrcLo, int rSrcHi);
-extern void oatDoPromotion(CompilationUnit* cUnit);
-extern int oatVRegOffset(CompilationUnit* cUnit, int reg);
-extern int oatSRegOffset(CompilationUnit* cUnit, int reg);
extern void oatDumpCoreRegPool(CompilationUnit* cUint);
extern void oatDumpFPRegPool(CompilationUnit* cUint);
extern bool oatCheckCorePoolSanity(CompilationUnit* cUnit);
extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg);
+extern void oatNopLIR(LIR* lir);
+extern bool oatIsFPReg(int reg);
+extern uint32_t oatFPRegMask(void);
+extern void oatAdjustSpillMask(CompilationUnit* cUnit);
+void oatMarkPreservedSingle(CompilationUnit* cUnit, int sReg, int reg);
+void oatRegCopy(CompilationUnit* cUnit, int rDest, int rSrc);
} // namespace art