Getting sync.
This commit is contained in:
parent
6093a51511
commit
bd3e7b87e6
108
util/ego/ra/ra.c
108
util/ego/ra/ra.c
@ -10,6 +10,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <em_reg.h>
|
||||
#include "../share/types.h"
|
||||
#include "../share/debug.h"
|
||||
@ -55,7 +56,7 @@ short regs_available[] = {
|
||||
|
||||
short use_any_as_pointer = 0;
|
||||
|
||||
STATIC cond_p getcondtab(f)
|
||||
static cond_p getcondtab(f)
|
||||
FILE *f;
|
||||
{
|
||||
int l,i;
|
||||
@ -71,9 +72,7 @@ STATIC cond_p getcondtab(f)
|
||||
return tab;
|
||||
}
|
||||
|
||||
get_atab(f,tab)
|
||||
FILE *f;
|
||||
cond_p tab[NRREGTYPES][NRREGTYPES];
|
||||
void get_atab(FILE *f, cond_p tab[NRREGTYPES][NRREGTYPES])
|
||||
{
|
||||
int i,cnt,totyp,regtyp;
|
||||
|
||||
@ -87,9 +86,7 @@ get_atab(f,tab)
|
||||
}
|
||||
|
||||
|
||||
get_otab(f,tab)
|
||||
FILE *f;
|
||||
cond_p tab[NRREGTYPES];
|
||||
void get_otab(FILE *f, cond_p tab[NRREGTYPES])
|
||||
{
|
||||
int i,cnt,regtyp;
|
||||
|
||||
@ -103,8 +100,7 @@ get_otab(f,tab)
|
||||
|
||||
|
||||
|
||||
STATIC ra_machinit(f)
|
||||
FILE *f;
|
||||
static void ra_machinit(FILE *f)
|
||||
{
|
||||
/* Read target machine dependent information for this phase */
|
||||
char s[100];
|
||||
@ -134,8 +130,7 @@ STATIC ra_machinit(f)
|
||||
}
|
||||
|
||||
|
||||
STATIC bblock_p header(lp)
|
||||
loop_p lp;
|
||||
static bblock_p header(loop_p lp)
|
||||
{
|
||||
/* Try to determine the 'header' block of loop lp.
|
||||
* If 'e' is the entry block of loop L, then block 'b' is
|
||||
@ -154,14 +149,13 @@ STATIC bblock_p header(lp)
|
||||
}
|
||||
|
||||
|
||||
STATIC ra_extproc(p)
|
||||
proc_p p;
|
||||
static void ra_extproc(proc_p p)
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
||||
register loop_p lp;
|
||||
register Lindex pi;
|
||||
register bblock_p b;
|
||||
loop_p lp;
|
||||
Lindex pi;
|
||||
bblock_p b;
|
||||
|
||||
for (pi = Lfirst(p->p_loops); pi != (Lindex) 0;
|
||||
pi = Lnext(pi,p->p_loops)) {
|
||||
@ -177,14 +171,13 @@ STATIC ra_extproc(p)
|
||||
|
||||
|
||||
|
||||
STATIC ra_cleanproc(p)
|
||||
proc_p p;
|
||||
static void ra_cleanproc(proc_p p)
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
||||
register loop_p lp;
|
||||
register Lindex pi;
|
||||
register bblock_p b;
|
||||
loop_p lp;
|
||||
Lindex pi;
|
||||
bblock_p b;
|
||||
|
||||
for (pi = Lfirst(p->p_loops); pi != (Lindex) 0;
|
||||
pi = Lnext(pi,p->p_loops)) {
|
||||
@ -198,13 +191,12 @@ STATIC ra_cleanproc(p)
|
||||
|
||||
|
||||
|
||||
STATIC loop_blocks(p)
|
||||
proc_p p;
|
||||
static void loop_blocks(proc_p p)
|
||||
{
|
||||
/* Compute the LP_BLOCKS sets for all loops of p */
|
||||
|
||||
register bblock_p b;
|
||||
register Lindex i;
|
||||
bblock_p b;
|
||||
Lindex i;
|
||||
|
||||
for (b = p->p_start; b != (bblock_p) 0; b = b->b_next) {
|
||||
for (i = Lfirst(b->b_loops); i != (Lindex) 0;
|
||||
@ -217,15 +209,13 @@ STATIC loop_blocks(p)
|
||||
|
||||
|
||||
|
||||
STATIC make_instrmap(p,map)
|
||||
proc_p p;
|
||||
line_p map[];
|
||||
static void make_instrmap(proc_p p, line_p map[])
|
||||
{
|
||||
/* make the instructions map of procedure p */
|
||||
|
||||
register bblock_p b;
|
||||
register line_p l;
|
||||
register int i = 0;
|
||||
bblock_p b;
|
||||
line_p l;
|
||||
int i = 0;
|
||||
|
||||
for (b = p->p_start; b != (bblock_p) 0; b = b->b_next) {
|
||||
b->B_BEGIN = i; /* number of first instruction */
|
||||
@ -238,8 +228,7 @@ STATIC make_instrmap(p,map)
|
||||
|
||||
|
||||
|
||||
STATIC bool useful_item(item)
|
||||
item_p item;
|
||||
static bool useful_item(item_p item)
|
||||
{
|
||||
/* See if it may be useful to put the item in a register.
|
||||
* A local variable may always be put in a register.
|
||||
@ -252,11 +241,10 @@ STATIC bool useful_item(item)
|
||||
}
|
||||
|
||||
|
||||
STATIC cleantimeset(s)
|
||||
lset s;
|
||||
static void cleantimeset(lset s)
|
||||
{
|
||||
register Lindex i;
|
||||
register time_p t;
|
||||
Lindex i;
|
||||
time_p t;
|
||||
|
||||
for (i = Lfirst(s); i != (Lindex) 0; i = Lnext(i,s)) {
|
||||
t = (time_p) Lelem(i);
|
||||
@ -267,14 +255,13 @@ STATIC cleantimeset(s)
|
||||
|
||||
|
||||
|
||||
STATIC item_p cat_items(items)
|
||||
item_p items[];
|
||||
static item_p cat_items(item_p items[])
|
||||
{
|
||||
/* Make one item list out of an array of itemlists.
|
||||
* Remove items that are used only once.
|
||||
*/
|
||||
|
||||
register item_p it;
|
||||
item_p it;
|
||||
item_p *ip,head,next;
|
||||
int t;
|
||||
|
||||
@ -297,12 +284,9 @@ STATIC item_p cat_items(items)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
STATIC clean_interval(list)
|
||||
interv_p list;
|
||||
static void clean_interval(interv_p list)
|
||||
{
|
||||
register interv_p x,next;
|
||||
interv_p x,next;
|
||||
|
||||
for (x = list; x != (interv_p) 0; x = next) {
|
||||
next = x->i_next;
|
||||
@ -312,10 +296,9 @@ STATIC clean_interval(list)
|
||||
|
||||
|
||||
|
||||
STATIC clean_allocs(list)
|
||||
alloc_p list;
|
||||
static void clean_allocs(alloc_p list)
|
||||
{
|
||||
register alloc_p x,next;
|
||||
alloc_p x,next;
|
||||
|
||||
for (x = list; x != (alloc_p) 0; x = next) {
|
||||
next = x->al_next;
|
||||
@ -330,10 +313,9 @@ STATIC clean_allocs(list)
|
||||
|
||||
|
||||
|
||||
STATIC cleanitems(list)
|
||||
item_p list;
|
||||
static void cleanitems(item_p list)
|
||||
{
|
||||
register item_p x,next;
|
||||
item_p x,next;
|
||||
|
||||
for (x = list; x != (item_p) 0; x = next ) {
|
||||
next = x->it_next;
|
||||
@ -343,14 +325,13 @@ STATIC cleanitems(list)
|
||||
}
|
||||
|
||||
|
||||
ra_initialize()
|
||||
void ra_initialize()
|
||||
{
|
||||
init_replacements(ps,ws);
|
||||
}
|
||||
|
||||
|
||||
ra_optimize(p)
|
||||
proc_p p;
|
||||
void ra_optimize(proc_p p)
|
||||
{
|
||||
item_p itemlist;
|
||||
alloc_p alloclist,packed,unpacked;
|
||||
@ -394,9 +375,7 @@ ra_optimize(p)
|
||||
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
go(argc,argv,ra_initialize,ra_optimize,ra_machinit,no_action);
|
||||
exit(0);
|
||||
@ -428,9 +407,7 @@ char *str_regtypes[] = {
|
||||
};
|
||||
|
||||
|
||||
print_items(items,p)
|
||||
item_p items[];
|
||||
proc_p p;
|
||||
void print_items(item_p items[], proc_p p)
|
||||
{
|
||||
int t;
|
||||
item_p item;
|
||||
@ -462,8 +439,7 @@ print_items(items,p)
|
||||
}
|
||||
|
||||
|
||||
print_allocs(list)
|
||||
alloc_p list;
|
||||
void print_allocs(alloc_p list)
|
||||
{
|
||||
alloc_p al,m;
|
||||
item_p item;
|
||||
@ -511,8 +487,7 @@ print_allocs(list)
|
||||
|
||||
|
||||
short regs_needed[4];
|
||||
stat_regusage(list)
|
||||
alloc_p list;
|
||||
void stat_regusage(alloc_p list)
|
||||
{
|
||||
int i;
|
||||
alloc_p x;
|
||||
@ -531,10 +506,9 @@ stat_regusage(list)
|
||||
|
||||
int cnt_regtypes[reg_float+1];
|
||||
|
||||
statistics(items)
|
||||
item_p items[];
|
||||
void statistics(item_p items[])
|
||||
{
|
||||
register item_p item,next;
|
||||
item_p item,next;
|
||||
int t,r;
|
||||
int cnt;
|
||||
|
||||
|
||||
@ -9,13 +9,13 @@
|
||||
* R A _ A L L O C L I S T . H
|
||||
*/
|
||||
|
||||
extern alloc_p build_alloc_list(); /* (proc_p p; short nrloops;
|
||||
* item_p itemlist)
|
||||
extern alloc_p build_alloc_list(); /* (proc_p p; short nrloops;*/
|
||||
/* item_p itemlist)
|
||||
* Build a list of possible allocations
|
||||
* for procedure p. An allocation
|
||||
* essentially is a pair (item,timespan)
|
||||
*/
|
||||
extern build_rivals_graph(); /* (alloc_p alloclist)
|
||||
extern build_rivals_graph(); /* (alloc_p alloclist)*/
|
||||
/* See which allocations in the list are
|
||||
* rivals of each other, i.e. there is
|
||||
* some point of time, falling in both
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user