aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-05-04 22:01:38 +0800
committerTeddy <ted.sybil@gmail.com>2014-05-04 22:01:38 +0800
commite5eeded8449f55c64f6508b30fecf71b7160a953 (patch)
treec1c6c32209e1016eb816ddda48d2de58de44e58e
parentbba43394fe4c9b5d8837b797b62ae245d9bac9fd (diff)
...
-rw-r--r--ssa.c5
-rw-r--r--ssa.h4
2 files changed, 7 insertions, 2 deletions
diff --git a/ssa.c b/ssa.c
index 16fa5ed..2df04be 100644
--- a/ssa.c
+++ b/ssa.c
@@ -1942,10 +1942,13 @@ const int avail_regs[] = {8, 9, 10, 11, 12, 13, 14, 15, 24, 25};
const int MAX_AVAIL_REGS = sizeof(avail_regs) / sizeof(avail_regs[0]);
void register_alloc() {
+ /* Algorithm from the paper:
+ * Linear Scan Register Allocation
+ * in the Context of SSA Form and Register Constraints */
static int freg[32], f[32];
int dn = 0, i;
- COList_t p;
COpr_t *unhandled;
+ COList_t p;
COList_t active = NEW(COList),
inactive = NEW(COList);
active->next = active->prev = active;
diff --git a/ssa.h b/ssa.h
index aeef029..54e3f98 100644
--- a/ssa.h
+++ b/ssa.h
@@ -130,7 +130,7 @@ typedef struct CPSet {
} CPSet;
typedef CPSet *CPSet_t;
-CPSet_t cpset_create();
+CPSet_t cpset_create(void);
int cpset_insert(CPSet_t cps, long key);
int cpset_belongs(CPSet_t cps, long key);
void cpset_destroy(CPSet_t cps);
@@ -145,10 +145,12 @@ void ssa_generate(void);
COpr_t cinterv_repr(COpr_t opr);
void cinst_print(FILE *stream, CInst_t inst);
int overlap_with_beg(COpr_t i, int beg);
+
extern int gbbase;
extern CBlock_t entry;
extern COList_t defs;
extern CType_t func;
extern const int avail_regs[];
extern const int MAX_AVAIL_REGS;
+
#endif