Stop passing proc around, and use a global instead --- much cleaner.
This commit is contained in:
parent
7aa60a6451
commit
a8ee82d197
|
@ -18,26 +18,26 @@ static bool collect_outputs_cb(struct ir* ir, void* user)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_block_pointers_from_ir(struct procedure* proc)
|
static void update_block_pointers_from_ir(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = current_proc->blocks.item[i];
|
||||||
bb->prevs.count = bb->nexts.count = 0;
|
bb->prevs.count = bb->nexts.count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = current_proc->blocks.item[i];
|
||||||
for (j=0; j<bb->irs.count; j++)
|
for (j=0; j<bb->irs.count; j++)
|
||||||
ir_walk(bb->irs.item[j], collect_outputs_cb, bb);
|
ir_walk(bb->irs.item[j], collect_outputs_cb, bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = current_proc->blocks.item[i];
|
||||||
|
|
||||||
for (j=0; j<bb->nexts.count; j++)
|
for (j=0; j<bb->nexts.count; j++)
|
||||||
{
|
{
|
||||||
|
@ -189,15 +189,15 @@ static void walk_dominance_graph(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_graph_data(struct procedure* proc)
|
void update_graph_data(void)
|
||||||
{
|
{
|
||||||
cfg.entry = proc->blocks.item[0];
|
cfg.entry = current_proc->blocks.item[0];
|
||||||
cfg.graph.count = 0;
|
cfg.graph.count = 0;
|
||||||
update_block_pointers_from_ir(proc);
|
update_block_pointers_from_ir();
|
||||||
|
|
||||||
walk_cfg_graph();
|
walk_cfg_graph();
|
||||||
assert(cfg.postorder.count == proc->blocks.count);
|
assert(cfg.postorder.count == current_proc->blocks.count);
|
||||||
assert(cfg.preorder.count == proc->blocks.count);
|
assert(cfg.preorder.count == current_proc->blocks.count);
|
||||||
|
|
||||||
calculate_dominance_graph();
|
calculate_dominance_graph();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ struct dominance_data
|
||||||
extern struct graph_data cfg;
|
extern struct graph_data cfg;
|
||||||
extern struct dominance_data dominance;
|
extern struct dominance_data dominance;
|
||||||
|
|
||||||
extern void update_graph_data(struct procedure* proc);
|
extern void update_graph_data(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -99,28 +99,28 @@ extern void data_bss(arith size, int init);
|
||||||
|
|
||||||
extern void tb_filestart(void);
|
extern void tb_filestart(void);
|
||||||
extern void tb_fileend(void);
|
extern void tb_fileend(void);
|
||||||
extern void tb_procedure(struct procedure* proc);
|
extern void tb_procedure(void);
|
||||||
extern void tb_regvar(struct procedure* proc, arith offset, int size, int type, int priority);
|
extern void tb_regvar(struct procedure* proc, arith offset, int size, int type, int priority);
|
||||||
|
|
||||||
extern void pass_convert_locals_to_ssa(struct procedure* proc);
|
extern void pass_convert_locals_to_ssa(void);
|
||||||
extern void pass_convert_stack_ops(struct procedure* proc);
|
extern void pass_convert_stack_ops(void);
|
||||||
extern void pass_eliminate_trivial_blocks(struct procedure* proc);
|
extern void pass_eliminate_trivial_blocks(void);
|
||||||
extern void pass_find_phi_congruence_groups(void);
|
extern void pass_find_phi_congruence_groups(void);
|
||||||
extern void pass_group_irs(struct procedure* proc);
|
extern void pass_group_irs(void);
|
||||||
extern void pass_insert_moves(void);
|
extern void pass_insert_moves(void);
|
||||||
extern void pass_instruction_selector(void);
|
extern void pass_instruction_selector(void);
|
||||||
extern void pass_live_vreg_analysis(void);
|
extern void pass_live_vreg_analysis(void);
|
||||||
extern void pass_add_prologue_epilogue(struct procedure* proc);
|
extern void pass_add_prologue_epilogue(void);
|
||||||
extern void pass_promote_float_ops(struct procedure* proc);
|
extern void pass_promote_float_ops(void);
|
||||||
extern void pass_register_allocator(struct procedure* proc);
|
extern void pass_register_allocator(void);
|
||||||
extern void pass_remove_dead_blocks(struct procedure* proc);
|
extern void pass_remove_dead_blocks(void);
|
||||||
extern void pass_remove_dead_phis(void);
|
extern void pass_remove_dead_phis(void);
|
||||||
extern void pass_split_critical_edges(struct procedure* proc);
|
extern void pass_split_critical_edges(void);
|
||||||
|
|
||||||
extern struct hop* platform_prologue(struct procedure* proc);
|
extern void platform_calculate_offsets(void);
|
||||||
extern struct hop* platform_epilogue(struct procedure* proc);
|
extern struct hop* platform_prologue(void);
|
||||||
|
extern struct hop* platform_epilogue(void);
|
||||||
extern struct hop* platform_move(struct basicblock* bb, struct hreg* src, struct hreg* dest);
|
extern struct hop* platform_move(struct basicblock* bb, struct hreg* src, struct hreg* dest);
|
||||||
extern void platform_calculate_offsets(struct procedure* proc);
|
|
||||||
|
|
||||||
extern FILE* outputfile;
|
extern FILE* outputfile;
|
||||||
extern FILE* dominance_dot_file;
|
extern FILE* dominance_dot_file;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "mcg.h"
|
#include "mcg.h"
|
||||||
|
|
||||||
static struct e_instr em;
|
static struct e_instr em;
|
||||||
static struct procedure* current_proc;
|
|
||||||
static struct basicblock* code_bb;
|
static struct basicblock* code_bb;
|
||||||
static struct basicblock* data_bb;
|
static struct basicblock* data_bb;
|
||||||
|
|
||||||
|
@ -321,7 +320,7 @@ static void parse_pseu(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
case ps_end: /* procedure end */
|
case ps_end: /* procedure end */
|
||||||
tb_procedure(current_proc);
|
tb_procedure();
|
||||||
|
|
||||||
current_proc = NULL;
|
current_proc = NULL;
|
||||||
code_bb = NULL;
|
code_bb = NULL;
|
||||||
|
|
|
@ -40,7 +40,7 @@ static struct ir* get_first_pop(struct basicblock* bb)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convert_block(struct procedure* proc, struct basicblock* bb)
|
static void convert_block(struct basicblock* bb)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
struct ir* ir;
|
struct ir* ir;
|
||||||
|
@ -108,12 +108,12 @@ static void convert_block(struct procedure* proc, struct basicblock* bb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_convert_stack_ops(struct procedure* proc)
|
void pass_convert_stack_ops(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<cfg.preorder.count; i++)
|
||||||
convert_block(proc, proc->blocks.item[i]);
|
convert_block(cfg.preorder.item[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set sw=4 ts=4 expandtab : */
|
/* vim: set sw=4 ts=4 expandtab : */
|
||||||
|
|
|
@ -28,13 +28,13 @@ static void rewrite_jumps(struct basicblock* bb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_eliminate_trivial_blocks(struct procedure* proc)
|
void pass_eliminate_trivial_blocks(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = current_proc->blocks.item[i];
|
||||||
rewrite_jumps(bb);
|
rewrite_jumps(bb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,14 @@ static void addall(struct ir* ir)
|
||||||
addall(ir->right);
|
addall(ir->right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void collect_irs(struct procedure* proc)
|
static void collect_irs(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
allirs.count = rootirs.count = 0;
|
allirs.count = rootirs.count = 0;
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = current_proc->blocks.item[i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j=0; j<bb->irs.count; j++)
|
for (j=0; j<bb->irs.count; j++)
|
||||||
|
@ -82,9 +82,9 @@ static void find_non_roots(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_group_irs(struct procedure* proc)
|
void pass_group_irs(void)
|
||||||
{
|
{
|
||||||
collect_irs(proc);
|
collect_irs();
|
||||||
clear_roots();
|
clear_roots();
|
||||||
find_roots();
|
find_roots();
|
||||||
find_non_roots();
|
find_non_roots();
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
#include "mcg.h"
|
#include "mcg.h"
|
||||||
|
|
||||||
void pass_add_prologue_epilogue(struct procedure* proc)
|
void pass_add_prologue_epilogue(void)
|
||||||
{
|
{
|
||||||
struct hop* prologue = platform_prologue(proc);
|
platform_calculate_offsets();
|
||||||
array_insert(&proc->entry->hops, prologue, 0);
|
|
||||||
|
|
||||||
if (proc->exit)
|
array_insert(¤t_proc->entry->hops, platform_prologue(), 0);
|
||||||
|
|
||||||
|
if (current_proc->exit)
|
||||||
{
|
{
|
||||||
struct hop* epilogue = platform_epilogue(proc);
|
current_proc->exit->hops.count = 0;
|
||||||
|
array_append(¤t_proc->exit->hops, platform_epilogue());
|
||||||
proc->exit->hops.count = 0;
|
|
||||||
array_append(&proc->exit->hops, epilogue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set sw=4 ts=4 expandtab : */
|
/* vim: set sw=4 ts=4 expandtab : */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,15 @@ static void addall(struct ir* ir)
|
||||||
addall(ir->right);
|
addall(ir->right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void collect_irs(struct procedure* proc)
|
static void collect_irs(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pending.count = 0;
|
pending.count = 0;
|
||||||
promotable.count = 0;
|
promotable.count = 0;
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<cfg.preorder.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = cfg.preorder.item[i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j=0; j<bb->irs.count; j++)
|
for (j=0; j<bb->irs.count; j++)
|
||||||
|
@ -87,9 +87,9 @@ static void modify_promotable_irs(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_promote_float_ops(struct procedure* proc)
|
void pass_promote_float_ops(void)
|
||||||
{
|
{
|
||||||
collect_irs(proc);
|
collect_irs();
|
||||||
search_for_promotable_irs();
|
search_for_promotable_irs();
|
||||||
modify_promotable_irs();
|
modify_promotable_irs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ struct assignment
|
||||||
struct vreg* out;
|
struct vreg* out;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct procedure* current_proc;
|
|
||||||
|
|
||||||
static ARRAYOF(struct hreg) hregs;
|
static ARRAYOF(struct hreg) hregs;
|
||||||
|
|
||||||
static PMAPOF(struct vreg, struct hreg) evicted;
|
static PMAPOF(struct vreg, struct hreg) evicted;
|
||||||
|
@ -705,10 +703,8 @@ static void layout_stack_frame(void)
|
||||||
current_proc->spills_size = stacksize;
|
current_proc->spills_size = stacksize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_register_allocator(struct procedure* proc)
|
void pass_register_allocator(void)
|
||||||
{
|
{
|
||||||
current_proc = proc;
|
|
||||||
|
|
||||||
populate_hregs();
|
populate_hregs();
|
||||||
wire_up_blocks_ins_outs();
|
wire_up_blocks_ins_outs();
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,16 @@ static void walk_blocks(struct basicblock* bb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_remove_dead_blocks(struct procedure* proc)
|
void pass_remove_dead_blocks(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
used.count = 0;
|
used.count = 0;
|
||||||
walk_blocks(proc->blocks.item[0]);
|
walk_blocks(current_proc->blocks.item[0]);
|
||||||
|
|
||||||
proc->blocks.count = 0;
|
current_proc->blocks.count = 0;
|
||||||
for (i=0; i<used.count; i++)
|
for (i=0; i<used.count; i++)
|
||||||
array_append(&proc->blocks, used.item[i]);
|
array_append(¤t_proc->blocks, used.item[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set sw=4 ts=4 expandtab : */
|
/* vim: set sw=4 ts=4 expandtab : */
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.749
|
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.749
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct procedure* current_proc;
|
|
||||||
|
|
||||||
struct rewrite_params
|
struct rewrite_params
|
||||||
{
|
{
|
||||||
struct basicblock* find;
|
struct basicblock* find;
|
||||||
|
@ -85,19 +83,17 @@ static bool consider_edges_leading_from(struct basicblock* bb)
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_split_critical_edges(struct procedure* proc)
|
void pass_split_critical_edges(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool changed;
|
bool changed;
|
||||||
|
|
||||||
current_proc = proc;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
changed = false;
|
changed = false;
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
changed |= consider_edges_leading_from(proc->blocks.item[i]);
|
changed |= consider_edges_leading_from(current_proc->blocks.item[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
while (changed);
|
while (changed);
|
||||||
|
|
|
@ -213,15 +213,15 @@ static void ssa_convert(void)
|
||||||
recursively_rewrite_tree(cfg.entry);
|
recursively_rewrite_tree(cfg.entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_convert_locals_to_ssa(struct procedure* proc)
|
void pass_convert_locals_to_ssa(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
calculate_dominance_frontier_graph();
|
calculate_dominance_frontier_graph();
|
||||||
|
|
||||||
for (i=0; i<proc->locals.count; i++)
|
for (i=0; i<current_proc->locals.count; i++)
|
||||||
{
|
{
|
||||||
current_local = proc->locals.item[i].right;
|
current_local = current_proc->locals.item[i].right;
|
||||||
if (current_local->is_register)
|
if (current_local->is_register)
|
||||||
ssa_convert();
|
ssa_convert();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,29 +14,29 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void platform_calculate_offsets(struct procedure* proc)
|
void platform_calculate_offsets(void)
|
||||||
{
|
{
|
||||||
proc->fp_to_st = proc->spills_size;
|
current_proc->fp_to_st = current_proc->spills_size;
|
||||||
proc->fp_to_ap = proc->fp_to_st + proc->saved_size + 8;
|
current_proc->fp_to_ap = current_proc->fp_to_st + current_proc->saved_size + 8;
|
||||||
proc->fp_to_lb = 0;
|
current_proc->fp_to_lb = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct hop* platform_prologue(struct procedure* proc)
|
struct hop* platform_prologue(void)
|
||||||
{
|
{
|
||||||
struct hop* hop = new_hop(proc->entry, NULL);
|
struct hop* hop = new_hop(current_proc->entry, NULL);
|
||||||
|
|
||||||
hop_add_insel(hop, "addi sp, sp, %d", proc->fp_to_ap + proc->locals_size);
|
hop_add_insel(hop, "addi sp, sp, %d", current_proc->fp_to_ap + current_proc->locals_size);
|
||||||
hop_add_insel(hop, "mfspr 0, lr");
|
hop_add_insel(hop, "mfspr 0, lr");
|
||||||
hop_add_insel(hop, "stw fp, %d(sp)", proc->fp_to_st + proc->locals_size);
|
hop_add_insel(hop, "stw fp, %d(sp)", current_proc->fp_to_st + current_proc->locals_size);
|
||||||
hop_add_insel(hop, "stw 0, %d(sp)", proc->fp_to_st + proc->locals_size + 4);
|
hop_add_insel(hop, "stw 0, %d(sp)", current_proc->fp_to_st + current_proc->locals_size + 4);
|
||||||
hop_add_insel(hop, "addi fp, sp, %d", proc->locals_size);
|
hop_add_insel(hop, "addi fp, sp, %d", current_proc->locals_size);
|
||||||
|
|
||||||
return hop;
|
return hop;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct hop* platform_epilogue(struct procedure* proc)
|
struct hop* platform_epilogue(void)
|
||||||
{
|
{
|
||||||
struct hop* hop = new_hop(proc->exit, NULL);
|
struct hop* hop = new_hop(current_proc->exit, NULL);
|
||||||
|
|
||||||
hop_add_insel(hop, "b .ret");
|
hop_add_insel(hop, "b .ret");
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#include "mcg.h"
|
#include "mcg.h"
|
||||||
|
|
||||||
extern struct procedure* current_proc;
|
struct procedure* current_proc;
|
||||||
|
|
||||||
static void print_blocks(char k, struct procedure* proc)
|
static void print_blocks(char k)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tracef(k, "%c: procedure %s\n", k, proc->name);
|
tracef(k, "%c: procedure %s\n", k, current_proc->name);
|
||||||
for (int i=0; i<proc->blocks.count; i++)
|
for (int i=0; i<current_proc->blocks.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = proc->blocks.item[i];
|
struct basicblock* bb = current_proc->blocks.item[i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
tracef(k, "%c:\n", k);
|
tracef(k, "%c:\n", k);
|
||||||
|
@ -38,11 +38,11 @@ static void print_blocks(char k, struct procedure* proc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_hops(char k, struct procedure* proc)
|
static void print_hops(char k)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tracef(k, "%c: procedure %s\n", k, proc->name);
|
tracef(k, "%c: procedure %s\n", k, current_proc->name);
|
||||||
for (int i=0; i<dominance.preorder.count; i++)
|
for (int i=0; i<dominance.preorder.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = dominance.preorder.item[i];
|
struct basicblock* bb = dominance.preorder.item[i];
|
||||||
|
@ -159,41 +159,42 @@ static void write_dominance_graph(const char* name)
|
||||||
|
|
||||||
void procedure_compile(struct procedure* proc)
|
void procedure_compile(struct procedure* proc)
|
||||||
{
|
{
|
||||||
pass_group_irs(proc);
|
current_proc = proc;
|
||||||
print_blocks('1', proc);
|
|
||||||
|
pass_group_irs();
|
||||||
|
print_blocks('1');
|
||||||
|
|
||||||
/* Passes from here on must preserve IR grouping */
|
/* Passes from here on must preserve IR grouping */
|
||||||
|
|
||||||
pass_eliminate_trivial_blocks(proc);
|
pass_eliminate_trivial_blocks();
|
||||||
pass_remove_dead_blocks(proc);
|
pass_remove_dead_blocks();
|
||||||
|
|
||||||
print_blocks('2', proc);
|
print_blocks('2');
|
||||||
update_graph_data(proc);
|
update_graph_data();
|
||||||
pass_split_critical_edges(proc);
|
pass_split_critical_edges();
|
||||||
update_graph_data(proc);
|
update_graph_data();
|
||||||
|
|
||||||
/* Passes from here on can't alter the BB graph without also updating prevs
|
/* Passes from here on can't alter the BB graph without also updating prevs
|
||||||
* and nexts (and then calling update_graph_data()). */
|
* and nexts (and then calling update_graph_data()). */
|
||||||
|
|
||||||
print_blocks('3', proc);
|
print_blocks('3');
|
||||||
pass_convert_stack_ops(proc);
|
pass_convert_stack_ops();
|
||||||
print_blocks('4', proc);
|
print_blocks('4');
|
||||||
pass_convert_locals_to_ssa(proc);
|
pass_convert_locals_to_ssa();
|
||||||
print_blocks('5', proc);
|
print_blocks('5');
|
||||||
pass_remove_dead_phis();
|
pass_remove_dead_phis();
|
||||||
pass_promote_float_ops(proc);
|
pass_promote_float_ops();
|
||||||
print_blocks('6', proc);
|
print_blocks('6');
|
||||||
|
|
||||||
pass_instruction_selector();
|
pass_instruction_selector();
|
||||||
print_hops('7', proc);
|
print_hops('7');
|
||||||
pass_find_phi_congruence_groups();
|
pass_find_phi_congruence_groups();
|
||||||
pass_live_vreg_analysis();
|
pass_live_vreg_analysis();
|
||||||
print_hops('8', proc);
|
print_hops('8');
|
||||||
pass_register_allocator(proc);
|
pass_register_allocator();
|
||||||
pass_add_prologue_epilogue(proc);
|
pass_add_prologue_epilogue();
|
||||||
print_hops('9', proc);
|
print_hops('9');
|
||||||
|
|
||||||
platform_calculate_offsets(proc);
|
|
||||||
emit_procedure(proc);
|
emit_procedure(proc);
|
||||||
|
|
||||||
if (cfg_dot_file)
|
if (cfg_dot_file)
|
||||||
|
|
|
@ -26,6 +26,8 @@ struct procedure
|
||||||
extern void procedure_compile(struct procedure* proc);
|
extern void procedure_compile(struct procedure* proc);
|
||||||
extern void procedure_update_bb_graph(struct procedure* proc);
|
extern void procedure_update_bb_graph(struct procedure* proc);
|
||||||
|
|
||||||
|
extern struct procedure* current_proc;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* vim: set sw=4 ts=4 expandtab : */
|
/* vim: set sw=4 ts=4 expandtab : */
|
||||||
|
|
|
@ -74,6 +74,7 @@ REGISTERS
|
||||||
cr0 "cr0" cr!;
|
cr0 "cr0" cr!;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DECLARATIONS
|
DECLARATIONS
|
||||||
|
|
||||||
cr;
|
cr;
|
||||||
|
@ -85,6 +86,7 @@ DECLARATIONS
|
||||||
address fragment;
|
address fragment;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PATTERNS
|
PATTERNS
|
||||||
|
|
||||||
/* Special */
|
/* Special */
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "mcg.h"
|
#include "mcg.h"
|
||||||
|
|
||||||
static struct procedure* current_proc;
|
|
||||||
static struct basicblock* current_bb;
|
static struct basicblock* current_bb;
|
||||||
|
|
||||||
static int stackptr;
|
static int stackptr;
|
||||||
|
@ -989,11 +988,10 @@ static void generate_tree(struct basicblock* bb)
|
||||||
assert(stackptr == 0);
|
assert(stackptr == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tb_procedure(struct procedure* proc)
|
void tb_procedure(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
current_proc = proc;
|
|
||||||
for (i=0; i<current_proc->blocks.count; i++)
|
for (i=0; i<current_proc->blocks.count; i++)
|
||||||
generate_tree(current_proc->blocks.item[i]);
|
generate_tree(current_proc->blocks.item[i]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue