summaryrefslogtreecommitdiffstats
path: root/vm/compiler/CompilerIR.h
diff options
context:
space:
mode:
authorBen Cheng <bccheng@android.com>2010-10-28 11:13:58 -0700
committerBen Cheng <bccheng@android.com>2010-12-13 16:49:33 -0800
commit00603079b8723b32c955513eae63a8f97898074d (patch)
tree3f7b93b0bdb9ac2d64896a9d0bbf5e5c7153cc71 /vm/compiler/CompilerIR.h
parent823a87840e570ad06c4426537477a21243474a1c (diff)
downloadandroid_dalvik-00603079b8723b32c955513eae63a8f97898074d.tar.gz
android_dalvik-00603079b8723b32c955513eae63a8f97898074d.tar.bz2
android_dalvik-00603079b8723b32c955513eae63a8f97898074d.zip
Implement method parser and SSA transformation.
Change-Id: If3fb3a36f33aaee8e5fdded4e9fa607be54f0bfb
Diffstat (limited to 'vm/compiler/CompilerIR.h')
-rw-r--r--vm/compiler/CompilerIR.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/vm/compiler/CompilerIR.h b/vm/compiler/CompilerIR.h
index 712ca4ce8..95a75b828 100644
--- a/vm/compiler/CompilerIR.h
+++ b/vm/compiler/CompilerIR.h
@@ -61,6 +61,7 @@ typedef enum BBType {
kMethodExitBlock,
kPCReconstruction,
kExceptionHandling,
+ kCatchEntry,
} BBType;
typedef struct ChainCellCounts {
@@ -133,20 +134,47 @@ typedef struct MIR {
struct BasicBlockDataFlow;
+/* FIXME - debugging prupose only */
+typedef enum BlockAttributes {
+ kEndsWithThrow = 0,
+ kCatchBlock,
+} BlockAttributes;
+
+/* For successorBlockList */
+typedef enum BlockListType {
+ kNotUsed = 0,
+ kCatch,
+ kPackedSwitch,
+ kSparseSwitch,
+} BlockListType;
+
+#define BA_ENDS_WITH_THROW (1 << kEndsWithThrow)
+#define BA_CATCH_BLOCK (1 << kCatchBlock)
+
typedef struct BasicBlock {
int id;
- int visited;
+ bool visited;
unsigned int startOffset;
const Method *containingMethod; // For blocks from the callee
BBType blockType;
bool needFallThroughBranch; // For blocks ended due to length limit
bool isFallThroughFromInvoke; // True means the block needs alignment
+ u4 blockAttributes; // FIXME - debugging purpose only
+ u4 exceptionTypeIdx; // FIXME - will be put elsewhere
MIR *firstMIRInsn;
MIR *lastMIRInsn;
struct BasicBlock *fallThrough;
struct BasicBlock *taken;
- struct BasicBlock *next; // Serial link for book keeping purposes
+ struct BasicBlock *iDom; // Immediate dominator
struct BasicBlockDataFlow *dataFlowInfo;
+ BitVector *predecessors;
+ BitVector *dominators;
+ BitVector *iDominated; // Set nodes being immediately dominated
+ BitVector *domFrontier; // Dominance frontier
+ struct { // For one-to-many successors like
+ BlockListType blockListType; // switch and exception handling
+ GrowableList blocks;
+ } successorBlockList;
} BasicBlock;
struct LoopAnalysis;
@@ -161,7 +189,7 @@ typedef enum AssemblerStatus {
typedef struct CompilationUnit {
int numInsts;
int numBlocks;
- BasicBlock **blockList;
+ GrowableList blockList;
const Method *method;
const JitTraceDescription *traceDesc;
LIR *firstLIRInsn;
@@ -213,6 +241,20 @@ typedef struct CompilationUnit {
* MAX_CHAINED_SWITCH_CASES cases.
*/
const u2 *switchOverflowPad;
+
+ /* New fields only for method-based compilation */
+ int numReachableBlocks;
+ int numDalvikRegisters; // method->registersSize + inlined
+ BasicBlock *entryBlock;
+ BasicBlock *exitBlock;
+ GrowableList dfsOrder;
+ GrowableList domPostOrderTraversal;
+ BitVector *tryBlockAddr;
+ BitVector **defBlockMatrix; // numDalvikRegister x numBlocks
+ BitVector *tempBlockV;
+ BitVector *tempDalvikRegisterV;
+ BitVector *tempSSARegisterV; // numSSARegs
+ bool printSSANames;
} CompilationUnit;
#if defined(WITH_SELF_VERIFICATION)
@@ -221,7 +263,7 @@ typedef struct CompilationUnit {
#define HEAP_ACCESS_SHADOW(_state)
#endif
-BasicBlock *dvmCompilerNewBB(BBType blockType);
+BasicBlock *dvmCompilerNewBB(BBType blockType, int blockId);
void dvmCompilerAppendMIR(BasicBlock *bb, MIR *mir);