More void, fewer clang warnings in util/ego
Most warnings are for functions implicitly returning int. Change most
of these functions to return void. (Traditional K&R C had no void
type, but C89 has it.)
Add prototypes to most function declarations in headers. This is
easy, because ego declares most of its extern functions, and the
comments listed most parameters. There were a few outdated or missing
declarations, and a few .c files that failed to include an .h with the
declarations.
Add prototypes to a few function definitions in .c files. Most
functions still have traditional K&R definitions. Most STATIC
functions still don't have prototypes, because they have no earlier
declaration where I would have added the prototype.
Change some prototypes in util/ego/share/alloc.h. Functions newmap()
and oldmap() handle an array of pointers to something; change the
array's type from `short **` to `void **`. Callers use casts to go
between `void **` and the correct type, like `line_p *`. Function
oldtable() takes a `short *`, not a `short **`; I added the wrong type
in 5bbbaf4
.
Make a few other changes to silence warnings. There are a few places
where clang wants extra parentheses in the code.
Edit util/ego/ra/build.lua to add the missing dependency on ra*.h; I
needed this to prevent crashes from ra.
This commit is contained in:
parent
be1662dd15
commit
17bc9cdef7
|
@ -62,9 +62,7 @@ STATIC int Sbo; /* #optimizations found */
|
|||
|
||||
|
||||
|
||||
STATIC line_p last_code(lines,skip_pseu)
|
||||
line_p lines;
|
||||
bool skip_pseu;
|
||||
STATIC line_p last_code(line_p lines, bool skip_pseu)
|
||||
{
|
||||
/* Determine the last line of a list */
|
||||
|
||||
|
@ -82,12 +80,11 @@ STATIC short cc_tab[12] =
|
|||
op_zne,op_bne,op_zgt,op_bgt,op_zge,op_bge};
|
||||
|
||||
|
||||
STATIC short rev_cond(cond)
|
||||
short cond;
|
||||
STATIC short rev_cond(short cond)
|
||||
{
|
||||
register i;
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
for (i = 0; i < 12; i++) {
|
||||
if (cond == cc_tab[i]) return cc_tab[11-i];
|
||||
}
|
||||
return op_nop;
|
||||
|
@ -100,7 +97,7 @@ STATIC bool is_bcc(l)
|
|||
}
|
||||
|
||||
|
||||
STATIC bo_optloop(p,b,x,bra,bcc)
|
||||
STATIC void bo_optloop(p,b,x,bra,bcc)
|
||||
proc_p p;
|
||||
bblock_p b,x;
|
||||
line_p bra,bcc;
|
||||
|
@ -180,7 +177,7 @@ OUTVERBOSE("branch optimization proc %d block %d\n", curproc->p_id,x->b_id);
|
|||
|
||||
|
||||
|
||||
STATIC bo_loops(p)
|
||||
STATIC void bo_loops(p)
|
||||
proc_p p;
|
||||
{
|
||||
Lindex i;
|
||||
|
@ -192,7 +189,7 @@ STATIC bo_loops(p)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC mv_code(b1,b2)
|
||||
STATIC void mv_code(b1,b2)
|
||||
bblock_p b1,b2;
|
||||
{
|
||||
line_p l,x;
|
||||
|
@ -207,8 +204,7 @@ STATIC mv_code(b1,b2)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
bo_switch(b)
|
||||
STATIC void bo_switch(b)
|
||||
bblock_p b;
|
||||
{
|
||||
bblock_p s,x;
|
||||
|
@ -256,7 +252,7 @@ OUTVERBOSE("branch optimization in proc %d, block %d",curproc->p_id,b->b_id);
|
|||
}
|
||||
}
|
||||
|
||||
STATIC bo_extproc(p)
|
||||
STATIC void bo_extproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
@ -272,7 +268,7 @@ STATIC bo_extproc(p)
|
|||
}
|
||||
|
||||
|
||||
STATIC loop_blocks(p)
|
||||
STATIC void loop_blocks(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Compute the LP_BLOCKS sets for all loops of p */
|
||||
|
@ -288,7 +284,7 @@ STATIC loop_blocks(p)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC bo_cleanproc(p)
|
||||
STATIC void bo_cleanproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
@ -321,7 +317,7 @@ void bo_optimize(void *vp)
|
|||
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <em_mes.h>
|
||||
#include "../share/types.h"
|
||||
#include "ca.h"
|
||||
#include "ca_put.h"
|
||||
#include "../share/debug.h"
|
||||
#include "../share/def.h"
|
||||
#include "../share/map.h"
|
||||
|
@ -22,18 +23,18 @@ FILE *outfile;
|
|||
|
||||
STATIC proc_p thispro;
|
||||
|
||||
STATIC outinst(m) {
|
||||
STATIC void outinst(int m) {
|
||||
|
||||
outbyte( (byte) m );
|
||||
}
|
||||
|
||||
STATIC coutshort(i) short i; {
|
||||
STATIC void coutshort(short i) {
|
||||
|
||||
outbyte( (byte) (i&BMASK) );
|
||||
outbyte( (byte) (i>>8) );
|
||||
}
|
||||
|
||||
STATIC coutint(i) short i; {
|
||||
STATIC void coutint(short i) {
|
||||
|
||||
if (i>= -sp_zcst0 && i< sp_ncst0-sp_zcst0)
|
||||
outbyte( (byte) (i+sp_zcst0+sp_fcst0) );
|
||||
|
@ -43,7 +44,7 @@ STATIC coutint(i) short i; {
|
|||
}
|
||||
}
|
||||
|
||||
STATIC coutoff(off) offset off; {
|
||||
STATIC void coutoff(offset off) {
|
||||
|
||||
if ((short) off == off)
|
||||
coutint((short) off);
|
||||
|
@ -55,9 +56,7 @@ STATIC coutoff(off) offset off; {
|
|||
}
|
||||
|
||||
|
||||
STATIC outsym(s,t)
|
||||
char *s;
|
||||
int t;
|
||||
STATIC void outsym(const char *s, int t)
|
||||
{
|
||||
register byte *p;
|
||||
register unsigned num;
|
||||
|
@ -85,21 +84,19 @@ STATIC outsym(s,t)
|
|||
}
|
||||
|
||||
|
||||
STATIC outdsym(dbl)
|
||||
dblock_p dbl;
|
||||
STATIC void outdsym(dblock_p dbl)
|
||||
{
|
||||
if (dnames[dbl->d_id]) outsym(dnames[dbl->d_id],sp_dnam);
|
||||
}
|
||||
|
||||
|
||||
STATIC outpsym(p)
|
||||
proc_p p;
|
||||
STATIC void outpsym(proc_p p)
|
||||
{
|
||||
outsym(pnames[p->p_id],sp_pnam);
|
||||
}
|
||||
|
||||
|
||||
STATIC outddef(id) short id; {
|
||||
STATIC void outddef(short id) {
|
||||
|
||||
dblock_p dbl;
|
||||
|
||||
|
@ -111,7 +108,7 @@ STATIC outddef(id) short id; {
|
|||
}
|
||||
}
|
||||
|
||||
STATIC outpdef(p) proc_p p; {
|
||||
STATIC void outpdef(proc_p p) {
|
||||
p->p_flags2 |= PF_SYMOUT;
|
||||
if (p->p_flags1 & PF_EXTERNAL) {
|
||||
outinst(ps_exp);
|
||||
|
@ -120,7 +117,7 @@ STATIC outpdef(p) proc_p p; {
|
|||
}
|
||||
|
||||
|
||||
STATIC outdocc(obj) obj_p obj; {
|
||||
STATIC void outdocc(obj_p obj) {
|
||||
dblock_p dbl;
|
||||
|
||||
dbl = obj->o_dblock;
|
||||
|
@ -135,7 +132,7 @@ STATIC outdocc(obj) obj_p obj; {
|
|||
}
|
||||
|
||||
|
||||
STATIC outpocc(p) proc_p p; {
|
||||
STATIC void outpocc(proc_p p) {
|
||||
if ((p->p_flags2 & PF_SYMOUT) == 0) {
|
||||
p->p_flags2 |= PF_SYMOUT;
|
||||
if ((p->p_flags1 & PF_EXTERNAL) == 0) {
|
||||
|
@ -146,8 +143,7 @@ STATIC outpocc(p) proc_p p; {
|
|||
}
|
||||
|
||||
|
||||
STATIC coutobject(obj)
|
||||
obj_p obj;
|
||||
STATIC void coutobject(obj_p obj)
|
||||
{
|
||||
/* In general, an object is defined by a global data
|
||||
* label and an offset. There are two special cases:
|
||||
|
@ -169,7 +165,7 @@ STATIC coutobject(obj)
|
|||
}
|
||||
|
||||
|
||||
STATIC cputstr(abp) register argb_p abp; {
|
||||
STATIC void cputstr(argb_p abp) {
|
||||
register argb_p tbp;
|
||||
register length;
|
||||
|
||||
|
@ -188,8 +184,7 @@ STATIC cputstr(abp) register argb_p abp; {
|
|||
}
|
||||
|
||||
|
||||
STATIC outnum(n)
|
||||
int n;
|
||||
STATIC void outnum(int n)
|
||||
{
|
||||
if (n < 256) {
|
||||
outbyte((byte) sp_ilb1);
|
||||
|
@ -201,8 +196,7 @@ STATIC outnum(n)
|
|||
}
|
||||
|
||||
|
||||
STATIC numlab(n)
|
||||
int n;
|
||||
STATIC void numlab(int n)
|
||||
{
|
||||
if (n < sp_nilb0) {
|
||||
outbyte((byte) (n + sp_filb0));
|
||||
|
@ -212,8 +206,7 @@ STATIC numlab(n)
|
|||
}
|
||||
|
||||
|
||||
STATIC cputargs(lnp)
|
||||
line_p lnp;
|
||||
STATIC void cputargs(line_p lnp)
|
||||
{
|
||||
register arg_p ap;
|
||||
int cnt = 0;
|
||||
|
@ -264,8 +257,7 @@ STATIC cputargs(lnp)
|
|||
|
||||
|
||||
|
||||
STATIC outoperand(lnp)
|
||||
line_p lnp;
|
||||
STATIC void outoperand(line_p lnp)
|
||||
{
|
||||
/* Output the operand of instruction lnp */
|
||||
|
||||
|
@ -320,8 +312,7 @@ STATIC outoperand(lnp)
|
|||
}
|
||||
|
||||
|
||||
STATIC outvisibility(lnp)
|
||||
line_p lnp;
|
||||
STATIC void outvisibility(line_p lnp)
|
||||
{
|
||||
/* In EM names of datalabels and procedures can be made
|
||||
* externally visible, so they can be used in other files.
|
||||
|
@ -377,9 +368,7 @@ STATIC outvisibility(lnp)
|
|||
}
|
||||
|
||||
|
||||
cputlines(l,lf)
|
||||
line_p l;
|
||||
FILE *lf;
|
||||
void cputlines(line_p l, FILE *lf)
|
||||
{
|
||||
/* Output the lines in Campact assembly language
|
||||
* format.
|
||||
|
@ -405,13 +394,12 @@ cputlines(l,lf)
|
|||
oldline(lnp);
|
||||
}
|
||||
if (lmap != (line_p *) 0) {
|
||||
oldmap(lmap,llength);
|
||||
oldmap((void **) lmap,llength);
|
||||
lmap = (line_p *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
cputmagic(lf)
|
||||
FILE *lf;
|
||||
void cputmagic(FILE *lf)
|
||||
{
|
||||
/* write the magic number */
|
||||
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
*/
|
||||
|
||||
|
||||
extern cputlines();
|
||||
extern cputmagic();
|
||||
void cputlines(line_p, FILE *);
|
||||
void cputmagic(FILE *);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../share/get.h"
|
||||
#include "../share/put.h"
|
||||
#include "../share/def.h"
|
||||
#include "../share/utils.h"
|
||||
#include "cf.h"
|
||||
#include "cf_succ.h"
|
||||
#include "cf_idom.h"
|
||||
|
@ -75,7 +76,7 @@ STATIC short state; /* We use a finite state machine with the
|
|||
* INIT: initial state
|
||||
*/
|
||||
|
||||
STATIC nextblock()
|
||||
STATIC void nextblock()
|
||||
{
|
||||
/* allocate a new basic block structure and
|
||||
* set b, bp and lp.
|
||||
|
@ -138,12 +139,9 @@ STATIC line_p doread_line(p_out)
|
|||
return lnp;
|
||||
}
|
||||
|
||||
STATIC bool getbblocks(fp, kind_out, n_out, g_out, l_out)
|
||||
FILE* fp;
|
||||
short* kind_out;
|
||||
short* n_out;
|
||||
bblock_p* g_out;
|
||||
line_p* l_out;
|
||||
STATIC bool
|
||||
getbblocks(FILE *fp, short *kind_out, short *n_out, bblock_p *g_out,
|
||||
line_p *l_out)
|
||||
{
|
||||
bblock_p head = (bblock_p)0;
|
||||
line_p headl = (line_p)0;
|
||||
|
@ -252,7 +250,7 @@ line_p* l_out;
|
|||
}
|
||||
}
|
||||
|
||||
STATIC interproc_analysis(p)
|
||||
STATIC void interproc_analysis(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Interprocedural analysis of a procedure p determines:
|
||||
|
@ -362,7 +360,7 @@ STATIC interproc_analysis(p)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC cf_cleanproc(p)
|
||||
STATIC void cf_cleanproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Remove the extended data structures of p */
|
||||
|
@ -477,7 +475,7 @@ STATIC bool add_info(q, p)
|
|||
return diff;
|
||||
}
|
||||
|
||||
STATIC trans_clos(head)
|
||||
STATIC void trans_clos(head)
|
||||
proc_p head;
|
||||
{
|
||||
/* Compute the transitive closure of the used/changed
|
||||
|
@ -508,7 +506,7 @@ STATIC trans_clos(head)
|
|||
}
|
||||
}
|
||||
|
||||
indir_calls()
|
||||
STATIC void indir_calls()
|
||||
{
|
||||
Cindex i;
|
||||
proc_p p;
|
||||
|
@ -522,7 +520,7 @@ indir_calls()
|
|||
Cdeleteset(cai_set);
|
||||
}
|
||||
|
||||
main(argc, argv) int argc;
|
||||
int main(argc, argv) int argc;
|
||||
char* argv[];
|
||||
{
|
||||
FILE* f, *f2, *gf2; /* The EM input, EM output, basic block output */
|
||||
|
|
|
@ -34,7 +34,7 @@ short dfs_nr;
|
|||
bblock_p *vertex; /* dynamically allocated array */
|
||||
|
||||
|
||||
STATIC dfs(v)
|
||||
STATIC void dfs(v)
|
||||
bblock_p v;
|
||||
{
|
||||
/* Depth First Search */
|
||||
|
@ -56,7 +56,7 @@ STATIC dfs(v)
|
|||
|
||||
|
||||
|
||||
STATIC compress(v)
|
||||
STATIC void compress(v)
|
||||
bblock_p v;
|
||||
{
|
||||
if (v->B_ANCESTOR->B_ANCESTOR != (bblock_p) 0) {
|
||||
|
@ -83,7 +83,7 @@ STATIC bblock_p eval(v)
|
|||
|
||||
|
||||
|
||||
STATIC linkblocks(v,w)
|
||||
STATIC void linkblocks(v,w)
|
||||
bblock_p v,w;
|
||||
{
|
||||
w->B_ANCESTOR = v;
|
||||
|
@ -91,9 +91,7 @@ STATIC linkblocks(v,w)
|
|||
|
||||
|
||||
|
||||
dominators(r,n)
|
||||
bblock_p r;
|
||||
short n;
|
||||
void dominators(bblock_p r, short n)
|
||||
{
|
||||
/* Compute the immediate dominator of every basic
|
||||
* block in the control flow graph rooted by r.
|
||||
|
@ -139,5 +137,6 @@ dominators(r,n)
|
|||
}
|
||||
}
|
||||
r->b_idom = (bblock_p) 0;
|
||||
oldmap(vertex,n); /* release memory for dynamic array vertex */
|
||||
/* release memory for dynamic array vertex */
|
||||
oldmap((void **) vertex,n);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
|
||||
|
||||
extern dominator(); /* (bblock_p head, short n)
|
||||
void dominators(bblock_p head, short n);
|
||||
/*
|
||||
* Compute for every basic block its immediate
|
||||
* dominator. The dominator relation is hence
|
||||
* recorded as a tree in which every node contains
|
||||
|
|
|
@ -83,7 +83,7 @@ STATIC bool inner_loop(l1,l2)
|
|||
|
||||
|
||||
|
||||
STATIC insrt(b,lpb,s_p)
|
||||
STATIC void insrt(b,lpb,s_p)
|
||||
bblock_p b;
|
||||
lset *lpb;
|
||||
lset *s_p;
|
||||
|
@ -162,7 +162,7 @@ STATIC loop_p org_loop(lp,loops)
|
|||
|
||||
|
||||
|
||||
STATIC collapse_loops(loops_p)
|
||||
STATIC void collapse_loops(loops_p)
|
||||
lset *loops_p;
|
||||
{
|
||||
register Lindex li1, li2;
|
||||
|
@ -187,7 +187,7 @@ STATIC collapse_loops(loops_p)
|
|||
}
|
||||
|
||||
|
||||
STATIC loop_per_block(lp)
|
||||
STATIC void loop_per_block(lp)
|
||||
loop_p lp;
|
||||
{
|
||||
bblock_p b;
|
||||
|
@ -205,7 +205,7 @@ STATIC loop_per_block(lp)
|
|||
|
||||
|
||||
|
||||
STATIC loop_attrib(loops)
|
||||
STATIC void loop_attrib(loops)
|
||||
lset loops;
|
||||
{
|
||||
/* Compute several attributes */
|
||||
|
@ -223,7 +223,7 @@ STATIC loop_attrib(loops)
|
|||
|
||||
|
||||
|
||||
STATIC nest_levels(loops)
|
||||
STATIC void nest_levels(loops)
|
||||
lset loops;
|
||||
{
|
||||
/* Compute the nesting levels of all loops of
|
||||
|
@ -250,7 +250,7 @@ STATIC nest_levels(loops)
|
|||
}
|
||||
|
||||
|
||||
STATIC cleanup(loops)
|
||||
STATIC void cleanup(loops)
|
||||
lset loops;
|
||||
{
|
||||
/* Throw away the LP_BLOCKS sets */
|
||||
|
@ -280,7 +280,7 @@ STATIC bool does_exit(b,lp)
|
|||
}
|
||||
|
||||
|
||||
STATIC mark_succ(b,lp)
|
||||
STATIC void mark_succ(b,lp)
|
||||
bblock_p b;
|
||||
loop_p lp;
|
||||
{
|
||||
|
@ -339,7 +339,7 @@ STATIC void mark_blocks(lp)
|
|||
|
||||
|
||||
|
||||
STATIC mark_loopblocks(loops)
|
||||
STATIC void mark_loopblocks(loops)
|
||||
lset loops;
|
||||
{
|
||||
/* Determine for all loops which basic blocks
|
||||
|
@ -360,7 +360,7 @@ STATIC mark_loopblocks(loops)
|
|||
|
||||
|
||||
|
||||
loop_detection(p)
|
||||
void loop_detection(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Find all natural loops of procedure p. Every loop is
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* L O O P D E T E C T I O N
|
||||
*/
|
||||
|
||||
extern loop_detection(); /* (proc_p p)
|
||||
void loop_detection(proc_p p); /*
|
||||
* Detect all loops of procedure p.
|
||||
* Every basic block of p is assigned
|
||||
* a set of all loops it is part of.
|
||||
|
|
|
@ -21,12 +21,13 @@
|
|||
#include "../share/lset.h"
|
||||
#include "../share/cset.h"
|
||||
#include "cf.h"
|
||||
#include "cf_succ.h"
|
||||
#include "../share/map.h"
|
||||
|
||||
extern char em_flag[];
|
||||
|
||||
|
||||
STATIC succeeds(succ,pred)
|
||||
STATIC void succeeds(succ,pred)
|
||||
bblock_p succ, pred;
|
||||
{
|
||||
assert(pred != (bblock_p) 0);
|
||||
|
@ -75,7 +76,7 @@ STATIC arg_p use_label(arg,b)
|
|||
|
||||
|
||||
|
||||
STATIC case_flow(instr,desc,b)
|
||||
STATIC void case_flow(instr,desc,b)
|
||||
short instr;
|
||||
line_p desc;
|
||||
bblock_p b;
|
||||
|
@ -176,7 +177,7 @@ STATIC line_p case_descr(lnp)
|
|||
|
||||
|
||||
|
||||
STATIC last2_instrs(b,last_out,prev_out)
|
||||
STATIC void last2_instrs(b,last_out,prev_out)
|
||||
bblock_p b;
|
||||
line_p *last_out,*prev_out;
|
||||
{
|
||||
|
@ -205,7 +206,7 @@ STATIC last2_instrs(b,last_out,prev_out)
|
|||
|
||||
|
||||
|
||||
control_flow(head)
|
||||
void control_flow(head)
|
||||
bblock_p head;
|
||||
{
|
||||
/* compute the successor and predecessor relation
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
* S U C C E S S O R / P R E D E C E S S O R R E L A T I O N S
|
||||
*/
|
||||
|
||||
extern control_flow(); /* (bblock_p head)
|
||||
void control_flow(bblock_p head);
|
||||
/*
|
||||
* Compute for every basic block
|
||||
* its successors and predecessors
|
||||
* in the control flow graph.
|
||||
|
|
|
@ -134,7 +134,7 @@ STATIC bool is_desirable(text)
|
|||
}
|
||||
|
||||
|
||||
STATIC cp_loops(b1,b2)
|
||||
STATIC void cp_loops(b1,b2)
|
||||
bblock_p b1,b2;
|
||||
{
|
||||
/* Copy the loopset of b2 to b1 */
|
||||
|
@ -149,7 +149,7 @@ STATIC cp_loops(b1,b2)
|
|||
}
|
||||
|
||||
|
||||
STATIC jump_cross(l1,l2,b1,b2)
|
||||
STATIC void jump_cross(l1,l2,b1,b2)
|
||||
line_p l1,l2;
|
||||
bblock_p b1,b2;
|
||||
{
|
||||
|
@ -317,7 +317,7 @@ void cj_optimize(void *vp)
|
|||
}
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
|
|
@ -56,11 +56,11 @@ STATIC bool same_avail(byte kind, avail_p avp1, avail_p avp2)
|
|||
case BINAIR_OP:
|
||||
case REMAINDER:
|
||||
if (commutative(avp1->av_instr & BMASK))
|
||||
return avp1->av_oleft == avp2->av_oleft &&
|
||||
avp1->av_oright == avp2->av_oright
|
||||
return (avp1->av_oleft == avp2->av_oleft &&
|
||||
avp1->av_oright == avp2->av_oright)
|
||||
||
|
||||
avp1->av_oleft == avp2->av_oright &&
|
||||
avp1->av_oright == avp2->av_oleft
|
||||
(avp1->av_oleft == avp2->av_oright &&
|
||||
avp1->av_oright == avp2->av_oleft)
|
||||
;
|
||||
else
|
||||
return avp1->av_oleft == avp2->av_oleft &&
|
||||
|
@ -98,7 +98,8 @@ STATIC entity_p result_local(offset size, line_p l)
|
|||
if (l == (line_p) 0)
|
||||
return (entity_p) 0;
|
||||
|
||||
if (INSTR(l)==op_stl && size==ws || INSTR(l)==op_sdl && size==2*ws) {
|
||||
if ((INSTR(l)==op_stl && size==ws) ||
|
||||
(INSTR(l)==op_sdl && size==2*ws)) {
|
||||
enp = getentity(l, &dummy);
|
||||
if (is_regvar(enp->en_loc)) {
|
||||
OUTTRACE("save local found, %ld(LB)", enp->en_loc);
|
||||
|
|
|
@ -52,12 +52,12 @@ lab_id lastlid = 0;
|
|||
offset mespar = UNKNOWN_SIZE;
|
||||
/* argumument of ps_par message of current procedure */
|
||||
|
||||
extern process_lines();
|
||||
extern int readline();
|
||||
extern line_p readoperand();
|
||||
extern line_p inpseudo();
|
||||
STATIC void process_lines(FILE *);
|
||||
STATIC int readline(short *, line_p *);
|
||||
STATIC line_p readoperand(short);
|
||||
STATIC line_p inpseudo(short);
|
||||
|
||||
main(argc, argv) int argc;
|
||||
int main(argc, argv) int argc;
|
||||
char* argv[];
|
||||
{
|
||||
/* The input files must be legal EM Compact
|
||||
|
@ -133,7 +133,7 @@ char* argv[];
|
|||
#define END_INSTR 4
|
||||
#define DELETED_INSTR 5
|
||||
|
||||
STATIC add_end()
|
||||
STATIC void add_end()
|
||||
{
|
||||
/* Add an end-pseudo to the current instruction list */
|
||||
|
||||
|
@ -142,7 +142,7 @@ STATIC add_end()
|
|||
lastline->l_instr = ps_end;
|
||||
}
|
||||
|
||||
process_lines(fout)
|
||||
STATIC void process_lines(fout)
|
||||
FILE* fout;
|
||||
{
|
||||
line_p lnp;
|
||||
|
@ -235,8 +235,7 @@ process_lines(fout)
|
|||
}
|
||||
}
|
||||
|
||||
int readline(instr_out, lnp_out) short* instr_out;
|
||||
line_p* lnp_out;
|
||||
STATIC int readline(short *instr_out, line_p *lnp_out)
|
||||
{
|
||||
register line_p lnp;
|
||||
short n;
|
||||
|
@ -310,7 +309,7 @@ line_p* lnp_out;
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
line_p readoperand(instr) short instr;
|
||||
STATIC line_p readoperand(short instr)
|
||||
{
|
||||
/* Read the operand of the given instruction.
|
||||
* Create a line struct and return a pointer to it.
|
||||
|
@ -432,7 +431,7 @@ static char* hol_label()
|
|||
return lastname;
|
||||
}
|
||||
|
||||
line_p inpseudo(n) short n;
|
||||
STATIC line_p inpseudo(short n)
|
||||
{
|
||||
int m;
|
||||
line_p lnp;
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
/* opr_size */
|
||||
|
||||
offset opr_size(instr)
|
||||
short instr;
|
||||
offset opr_size(short instr)
|
||||
{
|
||||
switch(instr) {
|
||||
case op_loe:
|
||||
|
@ -96,9 +95,7 @@ STATIC offset argsize(arg)
|
|||
}
|
||||
|
||||
|
||||
STATIC offset blocksize(pseudo,args)
|
||||
byte pseudo;
|
||||
arg_p args;
|
||||
STATIC offset blocksize(byte pseudo, arg_p args)
|
||||
{
|
||||
/* Determine the number of bytes of a datablock */
|
||||
|
||||
|
@ -167,7 +164,7 @@ STATIC arg_p copy_rom(args)
|
|||
|
||||
|
||||
|
||||
dblockdef(db,n,lnp)
|
||||
void dblockdef(db,n,lnp)
|
||||
dblock_p db;
|
||||
int n;
|
||||
line_p lnp;
|
||||
|
@ -206,10 +203,7 @@ dblockdef(db,n,lnp)
|
|||
|
||||
/* combine */
|
||||
|
||||
combine(db,l1,l2,pseu)
|
||||
dblock_p db;
|
||||
line_p l1,l2;
|
||||
byte pseu;
|
||||
void combine(dblock_p db, line_p l1, line_p l2, byte pseu)
|
||||
{
|
||||
/* Combine two successive ROMs/CONs (without a data label
|
||||
* in between into a single ROM. E.g.:
|
||||
|
@ -258,7 +252,7 @@ combine(db,l1,l2,pseu)
|
|||
|
||||
/* arglist */
|
||||
|
||||
STATIC arg_string(length,abp)
|
||||
STATIC void arg_string(length,abp)
|
||||
offset length;
|
||||
register argb_p abp;
|
||||
{
|
||||
|
@ -447,10 +441,7 @@ STATIC obj_p make_object(dbl,off,size)
|
|||
|
||||
|
||||
|
||||
obj_p object(ident,off,size)
|
||||
char *ident;
|
||||
offset off;
|
||||
offset size;
|
||||
obj_p object(char *ident, offset off, offset size)
|
||||
{
|
||||
dblock_p dbl;
|
||||
|
||||
|
|
|
@ -10,35 +10,38 @@
|
|||
|
||||
|
||||
|
||||
extern offset opr_size(); /* ( short instr )
|
||||
offset opr_size(short instr); /*
|
||||
* size of operand of given instruction.
|
||||
* The operand is an object , so the
|
||||
* instruction can be loe, zre etc..
|
||||
*/
|
||||
extern dblockdef(); /* (dblock_p db, int n, line_p lnp)
|
||||
void dblockdef(dblock_p db, int n, line_p lnp);
|
||||
/*
|
||||
* Fill in d_pseudo, d_size and
|
||||
* d_values fields of db.
|
||||
*/
|
||||
extern combine(); /* (dblock_p db;line_p l1,l2;byte pseu)
|
||||
void combine(dblock_p db, line_p l1, line_p l2, byte pseu);
|
||||
/*
|
||||
* Combine two successive ROMs or CONs
|
||||
* (with no data label in between)
|
||||
* into one ROM or CON.
|
||||
*/
|
||||
extern line_p arglist(); /* ( int m)
|
||||
line_p arglist(int m); /*
|
||||
* Read a list of m arguments. If m
|
||||
* is 0, then the list is of
|
||||
* undetermined length; it is
|
||||
* then terminated by a cend symbol.
|
||||
*/
|
||||
extern bool is_datalabel(); /* ( line_p l)
|
||||
bool is_datalabel(line_p l); /*
|
||||
* TRUE if l is a data label defining
|
||||
* occurrence (i.e. its l_instr
|
||||
* field is ps_sym).
|
||||
*/
|
||||
extern dblock_p block_of_lab(); /* (char *ident)
|
||||
dblock_p block_of_lab(char *ident); /*
|
||||
* Find the datablock with
|
||||
* the given name.
|
||||
*/
|
||||
extern obj_p object(); /* (char *ident,offset off,short size)
|
||||
obj_p object(char *ident, offset off, offset size);
|
||||
/*
|
||||
* Create an object struct.
|
||||
*/
|
||||
|
|
|
@ -95,15 +95,15 @@ offset get_off() {
|
|||
}
|
||||
}
|
||||
|
||||
STATIC make_string(n) int n; {
|
||||
STATIC void make_string(n) int n; {
|
||||
|
||||
sprintf(string,".%u",n);
|
||||
}
|
||||
|
||||
STATIC inident() {
|
||||
register n;
|
||||
STATIC void inident() {
|
||||
register int n;
|
||||
register char *p = string;
|
||||
register c;
|
||||
register int c;
|
||||
|
||||
n = get_int();
|
||||
while (n--) {
|
||||
|
@ -140,7 +140,7 @@ int table3(n) int n; {
|
|||
}
|
||||
|
||||
int table1() {
|
||||
register n;
|
||||
register int n;
|
||||
|
||||
n = readbyte();
|
||||
if (n == EOF)
|
||||
|
@ -161,7 +161,7 @@ int table1() {
|
|||
}
|
||||
|
||||
int table2() {
|
||||
register n;
|
||||
register int n;
|
||||
|
||||
n = readbyte();
|
||||
if ((n < sp_fcst0 + sp_ncst0) && (n >= sp_fcst0)) {
|
||||
|
@ -174,10 +174,7 @@ int table2() {
|
|||
|
||||
|
||||
|
||||
file_init(f,state,length)
|
||||
FILE *f;
|
||||
short state;
|
||||
long length;
|
||||
void file_init(FILE *f, short state, long length)
|
||||
{
|
||||
short n;
|
||||
|
||||
|
@ -193,7 +190,7 @@ file_init(f,state,length)
|
|||
|
||||
|
||||
|
||||
arch_init(arch)
|
||||
void arch_init(arch)
|
||||
FILE *arch;
|
||||
{
|
||||
short n;
|
||||
|
|
|
@ -8,22 +8,24 @@
|
|||
* L O W L E V E L I / O R O U T I N E S
|
||||
*/
|
||||
|
||||
#include <stdio.h> /* FILE */
|
||||
|
||||
extern int table1(); /* ( )
|
||||
int table1(void); /*
|
||||
* Read an instruction from the
|
||||
* Compact Assembly Language input
|
||||
* file (in 'neutral state').
|
||||
*/
|
||||
extern int table2(); /* ( )
|
||||
int table2(void); /*
|
||||
* Read an instruction argument.
|
||||
*/
|
||||
extern int table3(); /* ( int )
|
||||
int table3(int); /*
|
||||
* Read 'Common Table' item.
|
||||
*/
|
||||
extern short get_int(); /* ( ) */
|
||||
extern offset get_off(); /* ( ) */
|
||||
extern char readchar(); /* ( ) */
|
||||
extern file_init(); /* (FILE *f, short state, long length)
|
||||
short get_int(void);
|
||||
offset get_off(void);
|
||||
char readchar(void);
|
||||
void file_init(FILE *f, short state, long length);
|
||||
/*
|
||||
* Input file initialization. All
|
||||
* following read operations will read
|
||||
* from the given file f. Also checks
|
||||
|
@ -32,7 +34,7 @@ extern file_init(); /* (FILE *f, short state, long length)
|
|||
* If the state is ARCHIVE, length
|
||||
* specifies the length of the module.
|
||||
*/
|
||||
extern arch_init(); /* (FILE *arch)
|
||||
void arch_init(FILE *arch); /*
|
||||
* Same as file_init,but opens an
|
||||
* archive file. So it checks the
|
||||
* magic number for archives.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../share/files.h"
|
||||
#include "ic_lib.h"
|
||||
|
||||
STATIC skip_string(n)
|
||||
STATIC void skip_string(n)
|
||||
offset n;
|
||||
{
|
||||
/* Read a string of length n and void it */
|
||||
|
@ -60,7 +60,7 @@ STATIC void skip_arguments()
|
|||
}
|
||||
}
|
||||
|
||||
STATIC bool proc_wanted(name) char* name;
|
||||
STATIC bool proc_wanted(const char *name)
|
||||
{
|
||||
/* See if 'name' is the name of an external procedure
|
||||
* that has been used before, but for which no body
|
||||
|
@ -79,7 +79,7 @@ STATIC bool proc_wanted(name) char* name;
|
|||
}
|
||||
}
|
||||
|
||||
STATIC bool data_wanted(name) char* name;
|
||||
STATIC bool data_wanted(const char *name)
|
||||
{
|
||||
/* See if 'name' is the name of an externally visible
|
||||
* data block that has been used before, but for which
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
|
||||
|
||||
extern FILE *next_file(); /* (int argc, char *argv[])
|
||||
FILE *next_file(int argc, char *argv[]);
|
||||
/*
|
||||
* See if there are any more EM input files.
|
||||
* 'argv' contains the names of the files
|
||||
* that are passed as arguments to ic.
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../share/debug.h"
|
||||
#include "../share/map.h"
|
||||
#include "ic.h"
|
||||
#include "ic_io.h"
|
||||
#include "ic_lookup.h"
|
||||
#include "../share/alloc.h"
|
||||
|
||||
|
@ -43,8 +44,7 @@ char *lastname;
|
|||
|
||||
|
||||
|
||||
lab_id instr_lab(number)
|
||||
short number;
|
||||
lab_id instr_lab(short number)
|
||||
{
|
||||
register num_p *npp, np;
|
||||
|
||||
|
@ -82,7 +82,7 @@ lab_id instr_lab(number)
|
|||
|
||||
/* symlookup */
|
||||
|
||||
STATIC unsigned hash(string) char *string; {
|
||||
STATIC unsigned hash(const char *string) {
|
||||
register char *p;
|
||||
register unsigned i,sum;
|
||||
|
||||
|
@ -91,9 +91,7 @@ STATIC unsigned hash(string) char *string; {
|
|||
return(sum);
|
||||
}
|
||||
|
||||
dblock_p symlookup(name, status)
|
||||
char *name;
|
||||
int status;
|
||||
dblock_p symlookup(const char *name, int status)
|
||||
{
|
||||
/* Look up the name of a data block. The name can appear
|
||||
* in either a defining or applied occurrence (status is
|
||||
|
@ -206,9 +204,7 @@ proc_p getproc(status)
|
|||
|
||||
/* proclookup */
|
||||
|
||||
proc_p proclookup(name, status)
|
||||
char *name;
|
||||
int status;
|
||||
proc_p proclookup(const char *name, int status)
|
||||
{
|
||||
register prc_p *ppp, pp;
|
||||
register proc_p dp;
|
||||
|
@ -271,7 +267,7 @@ proc_p proclookup(name, status)
|
|||
|
||||
/* cleaninstrlabs */
|
||||
|
||||
cleaninstrlabs()
|
||||
void cleaninstrlabs()
|
||||
{
|
||||
register num_p *npp, np, next;
|
||||
|
||||
|
@ -290,7 +286,7 @@ cleaninstrlabs()
|
|||
|
||||
/* dump_procnames */
|
||||
|
||||
dump_procnames(hash,n,f)
|
||||
void dump_procnames(hash,n,f)
|
||||
prc_p hash[];
|
||||
int n;
|
||||
FILE *f;
|
||||
|
@ -328,7 +324,7 @@ dump_procnames(hash,n,f)
|
|||
|
||||
/* cleanprocs */
|
||||
|
||||
cleanprocs(hash,n,mask)
|
||||
void cleanprocs(hash,n,mask)
|
||||
prc_p hash[];
|
||||
int n,mask;
|
||||
{
|
||||
|
@ -372,7 +368,7 @@ cleanprocs(hash,n,mask)
|
|||
|
||||
/* dump_dblocknames */
|
||||
|
||||
dump_dblocknames(hash,n,f)
|
||||
void dump_dblocknames(hash,n,f)
|
||||
sym_p hash[];
|
||||
int n;
|
||||
FILE *f;
|
||||
|
@ -404,7 +400,7 @@ dump_dblocknames(hash,n,f)
|
|||
|
||||
/* cleandblocks */
|
||||
|
||||
cleandblocks(hash,n,mask)
|
||||
void cleandblocks(hash,n,mask)
|
||||
sym_p hash[];
|
||||
int n,mask;
|
||||
{
|
||||
|
|
|
@ -35,42 +35,52 @@ extern sym_p symhash[];
|
|||
extern prc_p prochash[];
|
||||
extern num_p numhash[];
|
||||
|
||||
extern lab_id instr_lab(); /* ( short number)
|
||||
lab_id instr_lab(short number); /*
|
||||
* Maps EM labels to sequential
|
||||
* integers.
|
||||
*/
|
||||
extern dblock_p symlookup(); /* (char *ident, int status)
|
||||
dblock_p symlookup(const char *ident, int status);
|
||||
/*
|
||||
* Look up the data block with
|
||||
* the given name.
|
||||
*/
|
||||
extern dblock_p getsym(); /* ( int status)
|
||||
dblock_p getsym(int status); /*
|
||||
* Read and look up a symbol.
|
||||
* If this is the first occurrence
|
||||
* of it, then make it external
|
||||
* (if status=OCCURRING) or
|
||||
* internal (if DEFINING).
|
||||
*/
|
||||
extern proc_p getproc(); /* (int status)
|
||||
proc_p getproc(int status); /*
|
||||
* Same as getsym, but for procedure
|
||||
* names.
|
||||
*/
|
||||
extern proc_p proclookup(); /* ( char *ident, int status)
|
||||
proc_p proclookup(const char *ident, int status);
|
||||
/*
|
||||
* Find (in the hashtable) the
|
||||
* procedure with the given name.
|
||||
*/
|
||||
extern cleaninstrlabs(); /* ( )
|
||||
void cleaninstrlabs(void); /*
|
||||
* Forget about all instruction labels.
|
||||
*/
|
||||
extern dump_procnames(); /* (prc_p hash[], int n, FILE *f)
|
||||
void dump_procnames(prc_p hash[], int n, FILE *f);
|
||||
/*
|
||||
* Save the names of the procedures
|
||||
* in file f; hash is the hashtable
|
||||
* used and n is its length.
|
||||
*/
|
||||
extern cleanprocs(); /* (prc_p hash[], int n,mask)
|
||||
void cleanprocs(prc_p hash[], int n, int mask);
|
||||
/*
|
||||
* Make the names of all procedures
|
||||
* for which p_flags1&mask = 0 invisible
|
||||
*/
|
||||
extern cleandblocks(); /* (sym_p hash[], int n)
|
||||
void dump_dblocknames(sym_p hash[], int n, FILE *f);
|
||||
/*
|
||||
* Save the names of the EM data
|
||||
* blocks in FILE f.
|
||||
*/
|
||||
void cleandblocks(sym_p hash[], int n, int mask);
|
||||
/*
|
||||
* Make the names of all data blocks
|
||||
* for which d_flags1&mask = 0 invisible
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <em_path.h>
|
||||
#include <em_mnem.h>
|
||||
#include <em_pseu.h>
|
||||
|
@ -21,7 +22,9 @@
|
|||
#include "../share/map.h"
|
||||
#include "il_aux.h"
|
||||
#include "il1_anal.h"
|
||||
#include "il1_aux.h"
|
||||
#include "il2_aux.h"
|
||||
#include "il3_change.h"
|
||||
#include "il3_subst.h"
|
||||
#include "../share/get.h"
|
||||
#include "../share/put.h"
|
||||
|
@ -56,7 +59,7 @@ int Sbig_caller, Sdispensable, Schangedcallee, Sbigcallee, Sspace, Szeroratio;
|
|||
* The call descriptors are put in a file (calfile).
|
||||
*/
|
||||
|
||||
pass1(lnam, bnam, cnam) char* lnam, *bnam, *cnam;
|
||||
STATIC void pass1(const char *lnam, const char *bnam, const char *cnam)
|
||||
{
|
||||
FILE* f, *gf, *cf, *ccf; /* The EM input, the basic block graph,
|
||||
* the call-list file and the calcnt file.
|
||||
|
@ -124,8 +127,7 @@ pass1(lnam, bnam, cnam) char* lnam, *bnam, *cnam;
|
|||
|
||||
STATIC char cname2[128] = TMP_DIR;
|
||||
|
||||
pass2(cnam, space) char* cnam;
|
||||
long space;
|
||||
STATIC void pass2(const char *cnam, long space)
|
||||
{
|
||||
FILE* cf, *cf2, *ccf;
|
||||
call_p c, a;
|
||||
|
@ -176,7 +178,7 @@ long space;
|
|||
* EM textfile.
|
||||
*/
|
||||
|
||||
pass3(lnam, lnam2) char* lnam, *lnam2;
|
||||
void pass3(const char *lnam, const char *lnam2)
|
||||
{
|
||||
bool verbose = TRUE;
|
||||
FILE* lfile, *lfilerand, *lfile2, *sfile;
|
||||
|
@ -244,7 +246,7 @@ pass3(lnam, lnam2) char* lnam, *lnam2;
|
|||
}
|
||||
}
|
||||
|
||||
STATIC il_extptab(ptab)
|
||||
STATIC void il_extptab(ptab)
|
||||
proc_p ptab;
|
||||
{
|
||||
/* Allocate space for extension of proctable entries.
|
||||
|
@ -261,7 +263,7 @@ STATIC il_extptab(ptab)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC il_cleanptab(ptab)
|
||||
STATIC void il_cleanptab(ptab)
|
||||
proc_p ptab;
|
||||
{
|
||||
/* De-allocate space for extensions */
|
||||
|
@ -275,7 +277,7 @@ STATIC il_cleanptab(ptab)
|
|||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
Sdiagnostics()
|
||||
STATIC void Sdiagnostics()
|
||||
{
|
||||
/* print statictical information */
|
||||
|
||||
|
@ -324,7 +326,7 @@ void il_flags(void *vp)
|
|||
}
|
||||
}
|
||||
|
||||
main(argc, argv) int argc;
|
||||
int main(argc, argv) int argc;
|
||||
char* argv[];
|
||||
{
|
||||
struct files* files = findfiles(argc, argv);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "il.h"
|
||||
#include "../share/debug.h"
|
||||
#include "../share/alloc.h"
|
||||
#include "../share/cset.h"
|
||||
#include "../share/global.h"
|
||||
#include "../share/lset.h"
|
||||
#include "../share/utils.h"
|
||||
|
@ -38,7 +39,7 @@
|
|||
|
||||
|
||||
|
||||
apriori(proctab)
|
||||
void apriori(proctab)
|
||||
proc_p proctab;
|
||||
{
|
||||
/* For every procedure, see if we can determine
|
||||
|
@ -68,7 +69,7 @@ apriori(proctab)
|
|||
}
|
||||
|
||||
|
||||
STATIC check_labels(p,arglist)
|
||||
STATIC void check_labels(p,arglist)
|
||||
proc_p p;
|
||||
arg_p arglist;
|
||||
{
|
||||
|
@ -91,7 +92,7 @@ STATIC check_labels(p,arglist)
|
|||
|
||||
|
||||
|
||||
STATIC anal_instr(p,b,cf)
|
||||
STATIC void anal_instr(p,b,cf)
|
||||
proc_p p;
|
||||
bblock_p b;
|
||||
FILE *cf;
|
||||
|
@ -152,7 +153,7 @@ STATIC anal_instr(p,b,cf)
|
|||
|
||||
|
||||
|
||||
anal_proc(p,cf,ccf)
|
||||
void anal_proc(p,cf,ccf)
|
||||
proc_p p;
|
||||
FILE *cf,*ccf;
|
||||
{
|
||||
|
|
|
@ -8,14 +8,16 @@
|
|||
* I L 1 _ A N A L . H
|
||||
*/
|
||||
|
||||
extern apriori(); /* (proc_p proctab)
|
||||
void apriori(proc_p proctab);
|
||||
/*
|
||||
* For every procedure, see if we can determine
|
||||
* from the information provided by the previous
|
||||
* phases of the optimizer that it cannot or should not
|
||||
* be expanded in line. This will reduce the length
|
||||
* of the call list.
|
||||
*/
|
||||
extern anal_proc(); /* (proc_p p, FILE *cf, *cff)
|
||||
void anal_proc(proc_p p, FILE *cf, FILE *cff);
|
||||
/*
|
||||
* Analyse a procedure. See which formal parameters
|
||||
* it uses and which procedures it calls.
|
||||
* cf and ccf are the call-file and the call-count file.
|
||||
|
|
|
@ -57,7 +57,7 @@ STATIC bool is_reg(off,s)
|
|||
}
|
||||
|
||||
|
||||
rem_actuals(acts)
|
||||
void rem_actuals(acts)
|
||||
actual_p acts;
|
||||
{
|
||||
/* remove the actual-list */
|
||||
|
@ -73,7 +73,7 @@ rem_actuals(acts)
|
|||
|
||||
|
||||
|
||||
remov_formals(p)
|
||||
void remov_formals(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Remove the list of formals of p */
|
||||
|
|
|
@ -8,34 +8,36 @@
|
|||
* I L 1 _ A U X . H
|
||||
*/
|
||||
|
||||
extern bool same_size(); /* (int t1,t2)
|
||||
bool same_size(int t1, int t2); /*
|
||||
* See if the two types t1 and t2 have
|
||||
* the same size.
|
||||
*/
|
||||
extern rem_actuals(); /* (actual_p atcs)
|
||||
void rem_actuals(actual_p acts);/*
|
||||
* remove an actual-list from core.
|
||||
*/
|
||||
extern remov_formals(); /* (proc_p p)
|
||||
void remov_formals(proc_p p); /*
|
||||
* Remove the formals-list of p from core.
|
||||
*/
|
||||
extern void rem_indir_acc(); /* (proc_p p)
|
||||
void rem_indir_acc(proc_p p); /*
|
||||
* Remove formal that may be accessed
|
||||
* indirectly from formal lists of p
|
||||
*/
|
||||
extern bool par_overlap(); /* (offset off1, int t1, offset off2, int t2)
|
||||
bool par_overlap(offset off1, int t1, offset off2, int t2);
|
||||
/*
|
||||
* See if the formal at offset off1 and type t1
|
||||
* overlaps the formal at offset off2
|
||||
* and type t2.
|
||||
*/
|
||||
extern short looplevel(); /* (bblock_p b)
|
||||
short looplevel(bblock_p b); /*
|
||||
* Determine the loop nesting level of b.
|
||||
*/
|
||||
extern int proclength(); /* (proc_p p)
|
||||
int proclength(proc_p p); /*
|
||||
* Determine the number of EM instructions
|
||||
* in p. Do not count pseudos.
|
||||
*/
|
||||
|
||||
extern line_p copy_code(); /* (line_p l1,l2)
|
||||
line_p copy_code(line_p l1, line_p l2);
|
||||
/*
|
||||
* copy the code between l1 and l2.
|
||||
* Pseudos may not be contained in
|
||||
* the list of instructions. If l1==l2
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <em_mnem.h>
|
||||
#include "../share/types.h"
|
||||
#include "il.h"
|
||||
#include "il_aux.h"
|
||||
#include "il1_cal.h"
|
||||
#include "../share/debug.h"
|
||||
#include "../share/alloc.h"
|
||||
|
@ -91,7 +92,7 @@ STATIC void inc_count(caller,callee)
|
|||
|
||||
|
||||
|
||||
anal_cal(p,call,b,cf)
|
||||
void anal_cal(p,call,b,cf)
|
||||
proc_p p;
|
||||
line_p call;
|
||||
bblock_p b;
|
||||
|
|
|
@ -29,7 +29,8 @@ extern struct class classtab[];
|
|||
#define CLASS9 9
|
||||
|
||||
|
||||
extern anal_cal(); /* (line_p call, bblock_p b)
|
||||
void anal_cal(proc_p p, line_p call, bblock_p b, FILE *cf);
|
||||
/*
|
||||
* analyze a call instruction;
|
||||
* try to recognize the actual parameter
|
||||
* expressions.
|
||||
|
|
|
@ -70,7 +70,7 @@ formal_p find_formal(p,type,off)
|
|||
|
||||
|
||||
|
||||
STATIC no_inl_pars(p)
|
||||
STATIC void no_inl_pars(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* p may not have any in line parameters */
|
||||
|
@ -81,7 +81,7 @@ STATIC no_inl_pars(p)
|
|||
|
||||
|
||||
|
||||
STATIC inc_use(f,b)
|
||||
STATIC void inc_use(f,b)
|
||||
formal_p f;
|
||||
bblock_p b;
|
||||
{
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
* I L 1 _ F O R M A L . C
|
||||
*/
|
||||
|
||||
extern void formal(); /* (proc_p p; bblock_p b; offset off;
|
||||
* int type, usage)
|
||||
void formal(proc_p p, bblock_p b, offset off, int type, int usage);
|
||||
/*
|
||||
* Analyze a reference to a parameter of p.
|
||||
* The type denotes its size (single,double,
|
||||
* pointer).
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../share/debug.h"
|
||||
#include "../share/alloc.h"
|
||||
#include "../share/global.h"
|
||||
#include "../share/cset.h"
|
||||
#include "../share/lset.h"
|
||||
#include "il_aux.h"
|
||||
#include "il2_aux.h"
|
||||
|
@ -34,6 +35,9 @@
|
|||
#define CHANGED(p) p->p_flags2 |= PF_CHANGED
|
||||
#define IS_CHANGED(p) (p->p_flags2 & PF_CHANGED)
|
||||
|
||||
#ifdef VERBOSE
|
||||
STATIC void Sstat(proc_p proclist, long space);
|
||||
#endif
|
||||
|
||||
|
||||
STATIC bool match_pars(fm,act)
|
||||
|
@ -220,7 +224,7 @@ STATIC short param_score(c)
|
|||
|
||||
|
||||
|
||||
assign_ratio(c)
|
||||
void assign_ratio(c)
|
||||
call_p c;
|
||||
{
|
||||
/* This routine is one of the most important ones
|
||||
|
@ -289,7 +293,7 @@ call_p abstract(c)
|
|||
|
||||
|
||||
|
||||
STATIC adjust_counts(callee,ccf)
|
||||
STATIC void adjust_counts(callee,ccf)
|
||||
proc_p callee;
|
||||
FILE *ccf;
|
||||
{
|
||||
|
@ -389,7 +393,7 @@ STATIC call_p find_origin(c)
|
|||
|
||||
|
||||
|
||||
STATIC selected(a)
|
||||
STATIC void selected(a)
|
||||
call_p a;
|
||||
{
|
||||
/* The call a is selected for in line expansion.
|
||||
|
@ -406,7 +410,7 @@ STATIC selected(a)
|
|||
|
||||
|
||||
|
||||
STATIC compare(x,best,space)
|
||||
STATIC void compare(x,best,space)
|
||||
call_p x, *best;
|
||||
long space;
|
||||
{
|
||||
|
@ -450,7 +454,7 @@ STATIC call_p best_one(list,space)
|
|||
|
||||
|
||||
|
||||
STATIC singles(cals)
|
||||
STATIC void singles(cals)
|
||||
call_p cals;
|
||||
{
|
||||
/* If a procedure is only called once, this call
|
||||
|
@ -486,7 +490,7 @@ STATIC singles(cals)
|
|||
|
||||
|
||||
|
||||
STATIC single_calls(proclist)
|
||||
STATIC void single_calls(proclist)
|
||||
proc_p proclist;
|
||||
{
|
||||
proc_p p;
|
||||
|
@ -505,7 +509,7 @@ STATIC single_calls(proclist)
|
|||
|
||||
|
||||
|
||||
select_calls(proclist,ccf,space)
|
||||
void select_calls(proclist,ccf,space)
|
||||
proc_p proclist;
|
||||
FILE *ccf;
|
||||
long space ;
|
||||
|
@ -549,7 +553,7 @@ select_calls(proclist,ccf,space)
|
|||
|
||||
|
||||
|
||||
STATIC nonnested_calls(cfile)
|
||||
STATIC void nonnested_calls(cfile)
|
||||
FILE *cfile;
|
||||
{
|
||||
register call_p c,a;
|
||||
|
@ -569,7 +573,7 @@ STATIC nonnested_calls(cfile)
|
|||
|
||||
|
||||
|
||||
STATIC copy_pars(src,dest)
|
||||
STATIC void copy_pars(src,dest)
|
||||
call_p src, dest;
|
||||
{
|
||||
/* Copy the actual parameters of src to dest. */
|
||||
|
@ -589,7 +593,7 @@ STATIC copy_pars(src,dest)
|
|||
|
||||
|
||||
|
||||
STATIC nest_pars(cals)
|
||||
STATIC void nest_pars(cals)
|
||||
call_p cals;
|
||||
{
|
||||
/* Recursive auxiliary procedure of add_actuals. */
|
||||
|
@ -607,7 +611,7 @@ STATIC nest_pars(cals)
|
|||
|
||||
|
||||
|
||||
add_actuals(proclist,cfile)
|
||||
void add_actuals(proclist,cfile)
|
||||
proc_p proclist;
|
||||
FILE *cfile;
|
||||
{
|
||||
|
@ -633,7 +637,7 @@ add_actuals(proclist,cfile)
|
|||
|
||||
|
||||
|
||||
STATIC clean(cals)
|
||||
STATIC void clean(cals)
|
||||
call_p *cals;
|
||||
{
|
||||
call_p c,next,*cpp;
|
||||
|
@ -655,7 +659,7 @@ STATIC clean(cals)
|
|||
}
|
||||
|
||||
|
||||
cleancals(proclist)
|
||||
void cleancals(proclist)
|
||||
proc_p proclist;
|
||||
{
|
||||
/* Remove all calls in the P_CALS list of p
|
||||
|
@ -672,7 +676,7 @@ cleancals(proclist)
|
|||
|
||||
|
||||
|
||||
append_abstract(a,p)
|
||||
void append_abstract(a,p)
|
||||
call_p a;
|
||||
proc_p p;
|
||||
{
|
||||
|
@ -698,7 +702,7 @@ append_abstract(a,p)
|
|||
*/
|
||||
|
||||
|
||||
Sstatist(list,space)
|
||||
STATIC void Sstatist(list,space)
|
||||
call_p list;
|
||||
long space;
|
||||
{
|
||||
|
@ -717,7 +721,7 @@ Sstatist(list,space)
|
|||
}
|
||||
}
|
||||
|
||||
Sstat(proclist,space)
|
||||
STATIC void Sstat(proclist,space)
|
||||
proc_p proclist;
|
||||
long space;
|
||||
{
|
||||
|
|
|
@ -3,22 +3,23 @@
|
|||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
extern bool anal_params(); /* (call_p c)
|
||||
bool anal_params(call_p c); /*
|
||||
* See which parameters of the call
|
||||
* may be expanded in line.
|
||||
* If the formals and actuals do not
|
||||
* match, return FALSE
|
||||
*/
|
||||
extern assign_ratio(); /* (call_p c)
|
||||
void assign_ratio(call_p c); /*
|
||||
* Assigna ratio number to the call,
|
||||
* indicating how desirable it is to
|
||||
* expand the call in line.
|
||||
*/
|
||||
extern call_p abstract(); /* (call_p c)
|
||||
call_p abstract(call_p c); /*
|
||||
* Abstract essential information from
|
||||
* the call.
|
||||
*/
|
||||
extern select_calls(); /* (call_p alist; FILE *ccf;short space)
|
||||
void select_calls(proc_p proclist, FILE *ccf, long space);
|
||||
/*
|
||||
* Select the best calls to be expanded.
|
||||
* Every procedure gets a list of
|
||||
* selected calls appearing in it.
|
||||
|
@ -26,10 +27,11 @@ extern select_calls(); /* (call_p alist; FILE *ccf;short space)
|
|||
* program is allowed to grow
|
||||
* (expressed in number of EM instructions).
|
||||
*/
|
||||
extern cleancals(); /* (proc_p plist)
|
||||
void cleancals(proc_p alist); /*
|
||||
* Remove all calls that were not selected.
|
||||
*/
|
||||
extern add_actuals(); /* (proc_p plist; FILE *cfile)
|
||||
void add_actuals(proc_p plist, FILE *cfile);
|
||||
/*
|
||||
* Add the actual parameters to the descriptor abstracts
|
||||
* of the selected calls.
|
||||
* the calfile contains the full descriptors of all
|
||||
|
@ -37,7 +39,8 @@ extern add_actuals(); /* (proc_p plist; FILE *cfile)
|
|||
* These two are combined to yield a file of full
|
||||
* descriptors of the selected calls.
|
||||
*/
|
||||
extern append_abstract(); /* (call_p a; proc_p p)
|
||||
void append_abstract(call_p a, proc_p p);
|
||||
/*
|
||||
* Put the call-descriptor abstract in the p_cals
|
||||
* list of p.
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../share/debug.h"
|
||||
#include "../share/alloc.h"
|
||||
#include "../share/global.h"
|
||||
#include "il_aux.h"
|
||||
#include "il3_aux.h"
|
||||
|
||||
|
||||
|
@ -33,7 +32,7 @@ line_p last_line(lines)
|
|||
|
||||
|
||||
|
||||
app_list(list,l)
|
||||
void app_list(list,l)
|
||||
line_p list,l;
|
||||
{
|
||||
/* Append the list after line l */
|
||||
|
@ -53,7 +52,7 @@ app_list(list,l)
|
|||
|
||||
|
||||
|
||||
rem_line(l)
|
||||
void rem_line(l)
|
||||
line_p l;
|
||||
{
|
||||
/* Remove a line from the list */
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
* I L 3 _ A U X . H
|
||||
*/
|
||||
|
||||
extern line_p last_line(); /* (line_p list)
|
||||
line_p last_line(line_p list); /*
|
||||
* Find the last line of a list.
|
||||
*/
|
||||
extern app_list(); /* (line_p list,l)
|
||||
void app_list(line_p list, line_p l);
|
||||
/*
|
||||
* Put list after l
|
||||
*/
|
||||
extern rem_line(); /* (line_p l)
|
||||
void rem_line(line_p l); /*
|
||||
* Remove a line from a (doubly linked)
|
||||
* list.
|
||||
*/
|
||||
|
|
|
@ -54,7 +54,7 @@ STATIC line_p par_expr(l,expr)
|
|||
|
||||
|
||||
|
||||
STATIC rem_text(l1,l2)
|
||||
STATIC void rem_text(l1,l2)
|
||||
line_p l1,l2;
|
||||
{
|
||||
/* Remove the lines from l1 to l2 (inclusive) */
|
||||
|
@ -69,7 +69,7 @@ STATIC rem_text(l1,l2)
|
|||
|
||||
|
||||
|
||||
STATIC store_tmp(p,l,size)
|
||||
STATIC void store_tmp(p,l,size)
|
||||
proc_p p;
|
||||
line_p l;
|
||||
offset size;
|
||||
|
@ -103,7 +103,7 @@ STATIC store_tmp(p,l,size)
|
|||
|
||||
|
||||
|
||||
STATIC chg_actuals(c,cal)
|
||||
STATIC void chg_actuals(c,cal)
|
||||
call_p c;
|
||||
line_p cal;
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ STATIC chg_actuals(c,cal)
|
|||
|
||||
|
||||
|
||||
STATIC rm_callpart(c,cal)
|
||||
STATIC void rm_callpart(c,cal)
|
||||
call_p c;
|
||||
line_p cal;
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ STATIC rm_callpart(c,cal)
|
|||
|
||||
|
||||
|
||||
chg_callseq(c,cal,l_out)
|
||||
void chg_callseq(c,cal,l_out)
|
||||
call_p c;
|
||||
line_p cal,*l_out;
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ STATIC void act_info(off,acts,ab_off,act_out,off_out)
|
|||
|
||||
|
||||
|
||||
STATIC store_off(off,l)
|
||||
STATIC void store_off(off,l)
|
||||
offset off;
|
||||
line_p l;
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ STATIC store_off(off,l)
|
|||
|
||||
|
||||
|
||||
STATIC inl_actual(l,expr)
|
||||
STATIC void inl_actual(l,expr)
|
||||
line_p l, expr;
|
||||
{
|
||||
/* Expand an actual parameter in line.
|
||||
|
@ -281,7 +281,7 @@ STATIC inl_actual(l,expr)
|
|||
|
||||
|
||||
|
||||
STATIC localref(l,c,ab_off,lb_off)
|
||||
STATIC void localref(l,c,ab_off,lb_off)
|
||||
line_p l;
|
||||
call_p c;
|
||||
offset ab_off, lb_off;
|
||||
|
@ -311,7 +311,7 @@ STATIC localref(l,c,ab_off,lb_off)
|
|||
|
||||
|
||||
|
||||
STATIC chg_mes(l,c,ab_off,lb_off)
|
||||
STATIC void chg_mes(l,c,ab_off,lb_off)
|
||||
line_p l;
|
||||
call_p c;
|
||||
offset ab_off, lb_off;
|
||||
|
@ -355,7 +355,7 @@ STATIC chg_mes(l,c,ab_off,lb_off)
|
|||
|
||||
|
||||
|
||||
STATIC chg_ret(l,c,lab)
|
||||
STATIC void chg_ret(l,c,lab)
|
||||
line_p l,lab;
|
||||
call_p c;
|
||||
{
|
||||
|
@ -379,7 +379,7 @@ STATIC chg_ret(l,c,lab)
|
|||
|
||||
|
||||
|
||||
STATIC mod_instr(l,c,lab,ab_off,lb_off,lab_off)
|
||||
STATIC void mod_instr(l,c,lab,ab_off,lb_off,lab_off)
|
||||
line_p l,lab;
|
||||
call_p c;
|
||||
offset ab_off,lb_off;
|
||||
|
@ -421,7 +421,7 @@ STATIC mod_instr(l,c,lab,ab_off,lb_off,lab_off)
|
|||
}
|
||||
|
||||
|
||||
modify(text,c,lab,ab_off,lb_off,lab_off)
|
||||
void modify(text,c,lab,ab_off,lb_off,lab_off)
|
||||
line_p text,lab;
|
||||
call_p c;
|
||||
offset ab_off,lb_off;
|
||||
|
@ -453,7 +453,7 @@ modify(text,c,lab,ab_off,lb_off,lab_off)
|
|||
|
||||
|
||||
|
||||
mod_actuals(nc,c,lab,ab_off,lb_off,lab_off)
|
||||
void mod_actuals(nc,c,lab,ab_off,lb_off,lab_off)
|
||||
call_p nc,c;
|
||||
line_p lab;
|
||||
offset ab_off,lb_off;
|
||||
|
@ -534,7 +534,7 @@ insert(text,l,firstline)
|
|||
|
||||
|
||||
|
||||
liquidate(p,text)
|
||||
void liquidate(p,text)
|
||||
proc_p p;
|
||||
line_p text;
|
||||
{
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
|
||||
|
||||
extern chg_callseq(); /* (call_p c; line_p cal, *l_out)
|
||||
void chg_callseq(call_p c, line_p cal, line_p *l_out);
|
||||
/*
|
||||
* Change the calling sequence of
|
||||
* the call c. The parameters are
|
||||
* changed and the sequence
|
||||
|
@ -19,28 +20,33 @@ extern chg_callseq(); /* (call_p c; line_p cal, *l_out)
|
|||
* text of the called routine must
|
||||
* be put.
|
||||
*/
|
||||
extern line_p make_label(); /* (line_p l; proc_p p)
|
||||
line_p make_label(line_p l, proc_p p);
|
||||
/*
|
||||
* Make sure that the instruction after
|
||||
* l contains a label. If this is not
|
||||
* already the case, create a new label.
|
||||
*/
|
||||
extern modify(); /* (line_p text; call_p c; line_p lab;
|
||||
* offset ab_off, lb_off; int lab_off)
|
||||
void modify(line_p text, call_p c, line_p lab, offset ab_off,
|
||||
offset lb_off, int lab_off);
|
||||
/*
|
||||
* Modify the EM text of the called
|
||||
* procedure.
|
||||
*/
|
||||
extern mod_actuals(); /* (call_p nc,c; line_p lab;
|
||||
* offset ab_off, lb_off; int lab_off)
|
||||
void mod_actuals(call_p nc, call_p c, line_p lab, offset ab_off,
|
||||
offset lb_off, int lab_off);
|
||||
/*
|
||||
* Modify the actual parameters of the
|
||||
* call nc the same way as the text of
|
||||
* call c would be modified.
|
||||
*/
|
||||
extern void insert(); /* (line_p text,l,firstline)
|
||||
void insert(line_p text, line_p l, line_p firstline);
|
||||
/*
|
||||
* Insert the modified EM text.
|
||||
* Pseudos are put after the pseudos
|
||||
* of the caller.
|
||||
*/
|
||||
extern liquidate(); /* (proc_p p; line_p text)
|
||||
void liquidate(proc_p p, line_p text);
|
||||
/*
|
||||
* All calls to p were expanded in line,
|
||||
* so p is no longer needed.
|
||||
*/
|
||||
|
|
|
@ -47,9 +47,7 @@ STATIC line_p fetch_text(lf,c)
|
|||
|
||||
|
||||
|
||||
line_p scan_to_cal(lines,n)
|
||||
line_p lines;
|
||||
short n;
|
||||
line_p scan_to_cal(line_p lines, short n)
|
||||
{
|
||||
/* Find the n-th CAL instruction */
|
||||
|
||||
|
@ -65,7 +63,7 @@ line_p scan_to_cal(lines,n)
|
|||
|
||||
|
||||
|
||||
substitute(lf,c,cal,firstline)
|
||||
void substitute(lf,c,cal,firstline)
|
||||
FILE *lf;
|
||||
call_p c;
|
||||
line_p cal,firstline;
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
* I L 3 _ S U B S T . H
|
||||
*/
|
||||
|
||||
extern line_p scan_to_cal(); /* (line_p lines; short n)
|
||||
line_p scan_to_cal(line_p lines, short n);
|
||||
/*
|
||||
* Find the n-th cal instruction.
|
||||
*/
|
||||
extern substitute(); /* (FILE *lf;call_p c; line_ pcal,firstline)
|
||||
void substitute(FILE *lf, call_p c, line_p cal, line_p firstline);
|
||||
/*
|
||||
* Perform in line substitution of the call described
|
||||
* by c. The EM text of the called routine is fetched
|
||||
* and modified, the calling sequence is changed,
|
||||
|
|
|
@ -106,7 +106,7 @@ line_p copy_expr(l1)
|
|||
|
||||
|
||||
|
||||
rem_call(c)
|
||||
void rem_call(c)
|
||||
call_p c;
|
||||
{
|
||||
actual_p act, nexta;
|
||||
|
@ -132,7 +132,7 @@ rem_call(c)
|
|||
|
||||
|
||||
|
||||
/* rem_graph */
|
||||
/* remunit */
|
||||
|
||||
STATIC short remlines(l)
|
||||
line_p l;
|
||||
|
@ -149,11 +149,7 @@ STATIC short remlines(l)
|
|||
|
||||
|
||||
|
||||
void
|
||||
remunit(kind,p,l)
|
||||
short kind;
|
||||
proc_p p;
|
||||
line_p l;
|
||||
void remunit(short kind, proc_p p, line_p l)
|
||||
{
|
||||
register bblock_p b;
|
||||
bblock_p next;
|
||||
|
@ -176,12 +172,13 @@ remunit(kind,p,l)
|
|||
oldloop(Lelem(pi));
|
||||
}
|
||||
Ldeleteset(p->p_loops);
|
||||
oldmap(lmap,llength);
|
||||
oldmap(lbmap,llength);
|
||||
oldmap(bmap,blength);
|
||||
oldmap(lpmap,lplength);
|
||||
oldmap((void **) lmap,llength);
|
||||
oldmap((void **) lbmap,llength);
|
||||
oldmap((void **) bmap,blength);
|
||||
oldmap((void **) lpmap,lplength);
|
||||
}
|
||||
remcc(head)
|
||||
|
||||
void remcc(head)
|
||||
calcnt_p head;
|
||||
{
|
||||
calcnt_p cc, next;
|
||||
|
@ -271,8 +268,8 @@ line_p get_text(lf,p_out)
|
|||
* and labels to basic blocks are not used.
|
||||
*/
|
||||
if (*p_out != (proc_p) 0) {
|
||||
oldmap(lmap,llength);
|
||||
oldmap(lbmap,llength);
|
||||
oldmap((void **) lmap,llength);
|
||||
oldmap((void **) lbmap,llength);
|
||||
lmap = oldlmap;
|
||||
lpmap = oldlpmap;
|
||||
}
|
||||
|
@ -309,7 +306,7 @@ calcnt_p getcc(ccf,p)
|
|||
/* The following routines are only used by the Inline Substitution phase */
|
||||
|
||||
|
||||
STATIC putactuals(alist,cfile)
|
||||
STATIC void putactuals(alist,cfile)
|
||||
actual_p alist;
|
||||
FILE *cfile;
|
||||
{
|
||||
|
@ -336,10 +333,7 @@ STATIC putactuals(alist,cfile)
|
|||
|
||||
|
||||
|
||||
putcall(c,cfile,level)
|
||||
call_p c;
|
||||
FILE *cfile;
|
||||
short level;
|
||||
void putcall(call_p c, FILE *cfile, short level)
|
||||
{
|
||||
/* output a call */
|
||||
|
||||
|
|
|
@ -9,50 +9,57 @@
|
|||
* I L _ A U X . H
|
||||
*/
|
||||
|
||||
extern int tsize(); /* (int type)
|
||||
#include <stdio.h> /* FILE */
|
||||
|
||||
int tsize(int type); /*
|
||||
* Determine the size of a variable of
|
||||
* the given type.
|
||||
*/
|
||||
extern line_p duplicate(); /* (line_p lnp)
|
||||
line_p duplicate(line_p lnp); /*
|
||||
* Make a duplicate of the given EM
|
||||
* instruction. Pseudos may not be
|
||||
* passed as argumnets.
|
||||
*/
|
||||
extern line_p copy_expr(); /* (line_p l1)
|
||||
line_p copy_expr(line_p l1); /*
|
||||
* copy the expression l1.
|
||||
* Pseudos may not be contained in
|
||||
* the list of instructions.
|
||||
*/
|
||||
extern rem_call(); /* (call_p c)
|
||||
void rem_call(call_p c); /*
|
||||
* Remove a call from main memory.
|
||||
*/
|
||||
extern rem_graph(); /* (proc_p p)
|
||||
void remunit(short kind, proc_p p, line_p l);
|
||||
/*
|
||||
* Remove the CFG and EM text of
|
||||
* a procedure from core.
|
||||
*/
|
||||
extern remcc(); /* (calcnt_p head)
|
||||
void remcc(calcnt_p head); /*
|
||||
* Remove call-count info from core.
|
||||
*/
|
||||
extern call_p getcall(); /* (FILE *cf)
|
||||
call_p getcall(FILE *cf); /*
|
||||
* Read a call from the call-file
|
||||
*/
|
||||
extern line_p get_text(); /* (FILE *lf; proc_p *p_out)
|
||||
line_p get_text(FILE *lf, proc_p *p_out);
|
||||
/*
|
||||
* Read the EM text of one procedure.
|
||||
* The procedure read is returned via
|
||||
* p_out.
|
||||
*/
|
||||
extern calcnt_p getcc(); /* (FILE *ccf; proc_p p)
|
||||
calcnt_p getcc(FILE *ccf, proc_p p);
|
||||
/*
|
||||
* Read the call-count information
|
||||
* of procedure p.
|
||||
*/
|
||||
extern putcall(); /* (call_p call; FILE *cfile; short level)
|
||||
void putcall(call_p call, FILE *cfile, short level);
|
||||
/*
|
||||
* Write the call
|
||||
* with the given id to the given file.
|
||||
* The level is the nesting level, used by
|
||||
* putcall when it calls itself recurively.
|
||||
* It should be 0 on outer levels.
|
||||
*/
|
||||
extern long putcc(); /* (calcnt_p head; FILE *ccf)
|
||||
long putcc(calcnt_p head, FILE *ccf);
|
||||
/*
|
||||
* Write call-count information to
|
||||
* file ccf.
|
||||
*/
|
||||
|
|
|
@ -41,16 +41,16 @@ short nrvars;
|
|||
STATIC int Slv;
|
||||
STATIC bool mesgflag = FALSE; /* Suppress generation of live/dead info */
|
||||
|
||||
STATIC app_block();
|
||||
STATIC void app_block();
|
||||
|
||||
STATIC clean_up()
|
||||
STATIC void clean_up()
|
||||
{
|
||||
local_p *p;
|
||||
|
||||
for (p = &locals[1]; p <= &locals[nrlocals]; p++) {
|
||||
oldlocal(*p);
|
||||
}
|
||||
oldmap(locals,nrlocals);
|
||||
oldmap((void **) locals,nrlocals);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ STATIC bool is_def(l)
|
|||
}
|
||||
|
||||
|
||||
STATIC def_use(p)
|
||||
STATIC void def_use(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Compute DEF(b) and USE(b), for every basic block b
|
||||
|
@ -200,7 +200,7 @@ STATIC def_use(p)
|
|||
|
||||
|
||||
|
||||
STATIC unite_ins(bbset,setp)
|
||||
STATIC void unite_ins(bbset,setp)
|
||||
lset bbset;
|
||||
cset *setp;
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ STATIC unite_ins(bbset,setp)
|
|||
|
||||
|
||||
|
||||
STATIC solve_lv(p)
|
||||
STATIC void solve_lv(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Solve the data flow equations for Live Variables,
|
||||
|
@ -254,7 +254,7 @@ STATIC solve_lv(p)
|
|||
}
|
||||
|
||||
|
||||
STATIC live_variables_analysis(p)
|
||||
STATIC void live_variables_analysis(p)
|
||||
proc_p p;
|
||||
{
|
||||
make_localtab(p);
|
||||
|
@ -264,7 +264,7 @@ STATIC live_variables_analysis(p)
|
|||
}
|
||||
|
||||
|
||||
STATIC init_live_dead(b)
|
||||
STATIC void init_live_dead(b)
|
||||
bblock_p b;
|
||||
{
|
||||
/* For every register variable, see if it is
|
||||
|
@ -313,7 +313,7 @@ STATIC line_p make_mesg(mesg,loc)
|
|||
|
||||
|
||||
|
||||
STATIC block_entry(b,prev)
|
||||
STATIC void block_entry(b,prev)
|
||||
bblock_p b,prev;
|
||||
{
|
||||
short v,vn;
|
||||
|
@ -345,7 +345,7 @@ STATIC block_entry(b,prev)
|
|||
|
||||
|
||||
|
||||
STATIC app_block(l,b)
|
||||
STATIC void app_block(l,b)
|
||||
line_p l;
|
||||
bblock_p b;
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ STATIC app_block(l,b)
|
|||
|
||||
|
||||
|
||||
STATIC definition(l,useless_out,v_out,mesgflag)
|
||||
STATIC void definition(l,useless_out,v_out,mesgflag)
|
||||
line_p l;
|
||||
bool *useless_out;
|
||||
short *v_out;
|
||||
|
@ -420,7 +420,7 @@ STATIC definition(l,useless_out,v_out,mesgflag)
|
|||
|
||||
|
||||
|
||||
STATIC use(l,mesgflag)
|
||||
STATIC void use(l,mesgflag)
|
||||
line_p l;
|
||||
bool mesgflag;
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ STATIC use(l,mesgflag)
|
|||
STATIC void nothing(line_p l1, line_p l2, offset size)
|
||||
{ } /* No action to be undertaken at level 0 of parser */
|
||||
|
||||
STATIC rem_code(l1,l2,b)
|
||||
STATIC void rem_code(l1,l2,b)
|
||||
line_p l1,l2;
|
||||
bblock_p b;
|
||||
{
|
||||
|
@ -481,9 +481,7 @@ STATIC rem_code(l1,l2,b)
|
|||
|
||||
|
||||
|
||||
lv_mesg(p,mesgflag)
|
||||
proc_p p;
|
||||
bool mesgflag;
|
||||
STATIC void lv_mesg(proc_p p, bool mesgflag)
|
||||
{
|
||||
/* Create live/dead messages for every possible register
|
||||
* variable of p. A dead-message is put after a "use" of
|
||||
|
@ -553,8 +551,7 @@ OUTVERBOSE("useless assignment ,proc %d,local %d", curproc->p_id,
|
|||
}
|
||||
|
||||
|
||||
STATIC lv_extend(p)
|
||||
proc_p p;
|
||||
STATIC void lv_extend(proc_p p)
|
||||
{
|
||||
/* Allocate extended data structures for Use Definition analysis */
|
||||
|
||||
|
@ -566,8 +563,7 @@ STATIC lv_extend(p)
|
|||
}
|
||||
|
||||
|
||||
STATIC lv_cleanup(p)
|
||||
proc_p p;
|
||||
STATIC void lv_cleanup(proc_p p)
|
||||
{
|
||||
/* Deallocate extended data structures for Use Definition analysis */
|
||||
|
||||
|
@ -610,7 +606,7 @@ void lv_optimize(void *vp)
|
|||
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ cprogram {
|
|||
"modules/src/em_data+lib",
|
||||
"h+emheaders",
|
||||
"+itemtab_h",
|
||||
"./ra*.h",
|
||||
},
|
||||
vars = {
|
||||
["+cflags"] = {"-DVERBOSE", "-DNOTCOMPACT"}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "../share/files.h"
|
||||
#include "../share/get.h"
|
||||
#include "../share/put.h"
|
||||
#include "../share/cset.h"
|
||||
#include "../share/lset.h"
|
||||
#include "../share/map.h"
|
||||
#include "../share/alloc.h"
|
||||
|
@ -25,6 +26,7 @@
|
|||
#include "ra.h"
|
||||
#include "ra_items.h"
|
||||
#include "ra_allocl.h"
|
||||
#include "ra_lifet.h"
|
||||
#include "ra_profits.h"
|
||||
#include "ra_pack.h"
|
||||
#include "ra_xform.h"
|
||||
|
@ -35,6 +37,8 @@
|
|||
#define oldrabx(x) oldstruct(bext_ra,x)
|
||||
#define oldralpx(x) oldstruct(lpext_ra,x)
|
||||
|
||||
STATIC void stat_regusage(alloc_p list);
|
||||
|
||||
short alloc_id;
|
||||
static item_p items[NRITEMTYPES];
|
||||
int nrinstrs;
|
||||
|
@ -72,7 +76,7 @@ STATIC cond_p getcondtab(f)
|
|||
return tab;
|
||||
}
|
||||
|
||||
get_atab(f,tab)
|
||||
STATIC void get_atab(f,tab)
|
||||
FILE *f;
|
||||
cond_p tab[NRREGTYPES][NRREGTYPES];
|
||||
{
|
||||
|
@ -88,7 +92,7 @@ get_atab(f,tab)
|
|||
}
|
||||
|
||||
|
||||
get_otab(f,tab)
|
||||
STATIC void get_otab(f,tab)
|
||||
FILE *f;
|
||||
cond_p tab[NRREGTYPES];
|
||||
{
|
||||
|
@ -155,7 +159,7 @@ STATIC bblock_p header(lp)
|
|||
}
|
||||
|
||||
|
||||
STATIC ra_extproc(p)
|
||||
STATIC void ra_extproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
@ -178,7 +182,7 @@ STATIC ra_extproc(p)
|
|||
|
||||
|
||||
|
||||
STATIC ra_cleanproc(p)
|
||||
STATIC void ra_cleanproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
@ -199,7 +203,7 @@ STATIC ra_cleanproc(p)
|
|||
|
||||
|
||||
|
||||
STATIC loop_blocks(p)
|
||||
STATIC void loop_blocks(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Compute the LP_BLOCKS sets for all loops of p */
|
||||
|
@ -218,7 +222,7 @@ STATIC loop_blocks(p)
|
|||
|
||||
|
||||
|
||||
STATIC make_instrmap(p,map)
|
||||
STATIC void make_instrmap(p,map)
|
||||
proc_p p;
|
||||
line_p map[];
|
||||
{
|
||||
|
@ -253,7 +257,7 @@ STATIC bool useful_item(item)
|
|||
}
|
||||
|
||||
|
||||
STATIC cleantimeset(s)
|
||||
STATIC void cleantimeset(s)
|
||||
lset s;
|
||||
{
|
||||
register Lindex i;
|
||||
|
@ -300,7 +304,7 @@ STATIC item_p cat_items(items)
|
|||
|
||||
|
||||
|
||||
STATIC clean_interval(list)
|
||||
STATIC void clean_interval(list)
|
||||
interv_p list;
|
||||
{
|
||||
register interv_p x,next;
|
||||
|
@ -313,7 +317,7 @@ STATIC clean_interval(list)
|
|||
|
||||
|
||||
|
||||
STATIC clean_allocs(list)
|
||||
STATIC void clean_allocs(list)
|
||||
alloc_p list;
|
||||
{
|
||||
register alloc_p x,next;
|
||||
|
@ -331,7 +335,7 @@ STATIC clean_allocs(list)
|
|||
|
||||
|
||||
|
||||
STATIC cleanitems(list)
|
||||
STATIC void cleanitems(list)
|
||||
item_p list;
|
||||
{
|
||||
register item_p x,next;
|
||||
|
@ -390,13 +394,13 @@ void ra_optimize(void *vp)
|
|||
clean_allocs(unpacked);
|
||||
clean_allocs(packed);
|
||||
cleanitems(itemlist);
|
||||
oldmap(instrmap,nrinstrs-1);
|
||||
oldmap((void **) instrmap,nrinstrs-1);
|
||||
ra_cleanproc(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
@ -430,6 +434,10 @@ char *str_regtypes[] = {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* All calls to print_items() and print_allocs() are in comments!
|
||||
*/
|
||||
#if 0
|
||||
print_items(items,p)
|
||||
item_p items[];
|
||||
proc_p p;
|
||||
|
@ -510,10 +518,11 @@ print_allocs(list)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
short regs_needed[4];
|
||||
stat_regusage(list)
|
||||
STATIC short regs_needed[4];
|
||||
STATIC void stat_regusage(list)
|
||||
alloc_p list;
|
||||
{
|
||||
int i;
|
||||
|
@ -531,6 +540,10 @@ stat_regusage(list)
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* All calls to statistics() are in comments!
|
||||
*/
|
||||
#if 0
|
||||
int cnt_regtypes[reg_float+1];
|
||||
|
||||
statistics(items)
|
||||
|
@ -557,3 +570,4 @@ statistics(items)
|
|||
fprintf(stderr, "#%s = %d\n",str_regtypes[r],cnt_regtypes[r]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "ra_allocl.h"
|
||||
#include "ra_interv.h"
|
||||
|
||||
STATIC count_usage(p,item,nrloops,sloopcnt,dloopcnt)
|
||||
STATIC void count_usage(p,item,nrloops,sloopcnt,dloopcnt)
|
||||
proc_p p;
|
||||
item_p item;
|
||||
short nrloops, sloopcnt[], dloopcnt[];
|
||||
|
@ -92,7 +92,7 @@ STATIC alloc_p cons_alloc(item,timespan,stat_usecount,
|
|||
}
|
||||
|
||||
|
||||
STATIC insert_alloc(alloc,list_p)
|
||||
STATIC void insert_alloc(alloc,list_p)
|
||||
alloc_p alloc, *list_p;
|
||||
{
|
||||
alloc->al_next = *list_p;
|
||||
|
@ -157,7 +157,7 @@ STATIC bblock_p init_point(item)
|
|||
}
|
||||
|
||||
|
||||
STATIC add_blocks(b,s,span)
|
||||
STATIC void add_blocks(b,s,span)
|
||||
bblock_p b;
|
||||
cset *s;
|
||||
interv_p *span;
|
||||
|
@ -176,7 +176,7 @@ STATIC add_blocks(b,s,span)
|
|||
|
||||
|
||||
|
||||
STATIC whole_lifetime(item,ini_out,span_out)
|
||||
STATIC void whole_lifetime(item,ini_out,span_out)
|
||||
item_p item;
|
||||
bblock_p *ini_out;
|
||||
interv_p *span_out;
|
||||
|
@ -267,12 +267,10 @@ STATIC short countuses(usage,b)
|
|||
|
||||
|
||||
|
||||
STATIC allocs_of_item(p,item,loops,sloopcnt,dloopcnt,alloc_list_p)
|
||||
proc_p p;
|
||||
item_p item;
|
||||
lset loops;
|
||||
short *sloopcnt,*dloopcnt; /* dynamic arrays */
|
||||
alloc_p *alloc_list_p;
|
||||
STATIC void
|
||||
allocs_of_item(proc_p p, item_p item, lset loops,
|
||||
short *sloopcnt, short *dloopcnt, /* dynamic arrays */
|
||||
alloc_p *alloc_list_p)
|
||||
{
|
||||
register Lindex li;
|
||||
loop_p lp;
|
||||
|
@ -328,10 +326,7 @@ STATIC allocs_of_item(p,item,loops,sloopcnt,dloopcnt,alloc_list_p)
|
|||
|
||||
|
||||
|
||||
alloc_p build_alloc_list(p,nrloops,itemlist)
|
||||
proc_p p;
|
||||
short nrloops;
|
||||
item_p itemlist;
|
||||
alloc_p build_alloc_list(proc_p p, short nrloops, item_p itemlist)
|
||||
{
|
||||
short *sloopcnt,*dloopcnt; /* dynamic arrays */
|
||||
register item_p item;
|
||||
|
@ -351,7 +346,7 @@ alloc_p build_alloc_list(p,nrloops,itemlist)
|
|||
|
||||
|
||||
|
||||
build_rivals_graph(alloclist)
|
||||
void build_rivals_graph(alloclist)
|
||||
alloc_p alloclist;
|
||||
{
|
||||
/* See which allocations in the list are rivals of each other,
|
||||
|
|
|
@ -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)
|
||||
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)
|
||||
void 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
|
||||
|
|
|
@ -38,8 +38,7 @@ time_p cons_time(l,b)
|
|||
|
||||
|
||||
|
||||
short loop_scale(lev)
|
||||
short lev;
|
||||
short loop_scale(short lev)
|
||||
{
|
||||
return (lev == 0 ? 1 : (lev > 3 ? 32 : 8 * lev));
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* register message of the local with
|
||||
* the given offset.
|
||||
*/
|
||||
extern time_p cons_time(); /* (line_p l; bblock_p b)
|
||||
time_p cons_time(line_p l, bblock_p b); /*
|
||||
* Construct a 'time' record with
|
||||
* fields 'l' and 'b'.
|
||||
*/
|
||||
extern short loop_scale(); /* (short lev)
|
||||
short loop_scale(short lev); /*
|
||||
* Estimate how many times an item
|
||||
* appearing in a loop of nesting
|
||||
* level 'lev' will be used dynamically.
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#include "ra.h"
|
||||
#include "ra_interv.h"
|
||||
|
||||
interv_p cons_interval(t_start,t_stop)
|
||||
short t_start,t_stop;
|
||||
interv_p cons_interval(short t_start, short t_stop)
|
||||
{
|
||||
interv_p x;
|
||||
|
||||
|
@ -32,9 +31,7 @@ interv_p cons_interval(t_start,t_stop)
|
|||
|
||||
|
||||
|
||||
add_interval(t1,t2,list)
|
||||
short t1,t2;
|
||||
interv_p *list;
|
||||
void add_interval(short t1, short t2, interv_p *list)
|
||||
{
|
||||
/* Add interval (t1,t2) to the list of intervals (which is
|
||||
* an in-out parameter!). The list is sorted in 'chronological'
|
||||
|
@ -116,7 +113,7 @@ interv_p proc_lifetime(p)
|
|||
|
||||
|
||||
|
||||
STATIC set_min_max(iv1,iv2)
|
||||
STATIC void set_min_max(iv1,iv2)
|
||||
interv_p *iv1,*iv2;
|
||||
{
|
||||
/* Auxiliary routine of intersect */
|
||||
|
@ -201,9 +198,7 @@ bool not_disjoint(list1,list2)
|
|||
|
||||
|
||||
|
||||
bool contains(t,timespan)
|
||||
short t;
|
||||
interv_p timespan;
|
||||
bool contains(short t, interv_p timespan)
|
||||
{
|
||||
register interv_p iv;
|
||||
|
||||
|
|
|
@ -10,31 +10,39 @@
|
|||
*/
|
||||
|
||||
|
||||
extern interv_p cons_interval();/* (short t_start,t_stop)
|
||||
interv_p cons_interval(short t_start, short t_stop);
|
||||
/*
|
||||
* construct an interval
|
||||
*/
|
||||
extern add_interval(); /* (short t1,t2; interv_p *list)
|
||||
void add_interval(short t1, short t2, interv_p *list);
|
||||
/*
|
||||
* Add interval (t1,t2) to the list of
|
||||
* intervals (which is an in-out parameter!).
|
||||
*/
|
||||
extern interv_p loop_lifetime();/* (loop_p lp)
|
||||
interv_p loop_lifetime(loop_p lp);
|
||||
/*
|
||||
* Determine the timespan of the loop,
|
||||
* expressed as a list of intervals.
|
||||
*/
|
||||
extern interv_p proc_lifetime();/* (proc_p p)
|
||||
interv_p proc_lifetime(proc_p p);
|
||||
/*
|
||||
* Determine the timespan of a procedure,
|
||||
* expressed as an interval.
|
||||
*/
|
||||
extern interv_p intersect(); /* (interv_p list1,list2)
|
||||
interv_p intersect(interv_p list1, interv_p list2);
|
||||
/*
|
||||
* Intersect two lifetimes, each denoted
|
||||
* by a list of intervals.
|
||||
*/
|
||||
extern bool not_disjoint(); /* (interv_p list1,list2)
|
||||
bool not_disjoint(interv_p list1, interv_p list2);
|
||||
/*
|
||||
* See if list1 and list2 do overlap somewhere.
|
||||
*/
|
||||
extern bool contains(); /* (short t;interv_p timespan)
|
||||
bool contains(short t, interv_p timespan);
|
||||
/*
|
||||
* See if t is part of the timespan.
|
||||
*/
|
||||
extern interv_p copy_timespan();/* (interv_p list)
|
||||
interv_p copy_timespan(interv_p list);
|
||||
/*
|
||||
* Make a copy of the timespan.
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
/* prevent small constants from being put in a register */
|
||||
|
||||
|
||||
clean_tab(items)
|
||||
void clean_tab(items)
|
||||
item_p items[];
|
||||
{
|
||||
int t;
|
||||
|
@ -85,7 +85,7 @@ item_p item_of(off,items)
|
|||
|
||||
|
||||
|
||||
fill_item(item,l)
|
||||
void fill_item(item,l)
|
||||
item_p item;
|
||||
line_p l;
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ STATIC short item_size(item)
|
|||
|
||||
|
||||
|
||||
STATIC init_item(a,b)
|
||||
STATIC void init_item(a,b)
|
||||
item_p a,b;
|
||||
{
|
||||
a->it_type = b->it_type;
|
||||
|
@ -296,7 +296,7 @@ STATIC void add_item(item,t,items)
|
|||
|
||||
|
||||
|
||||
STATIC add_usage(l,b,items)
|
||||
STATIC void add_usage(l,b,items)
|
||||
line_p l;
|
||||
bblock_p b;
|
||||
item_p items[];
|
||||
|
@ -323,7 +323,7 @@ STATIC add_usage(l,b,items)
|
|||
|
||||
|
||||
|
||||
build_itemlist(p,items,nrinstr_out)
|
||||
void build_itemlist(p,items,nrinstr_out)
|
||||
proc_p p;
|
||||
item_p items[];
|
||||
int *nrinstr_out;
|
||||
|
@ -336,7 +336,7 @@ build_itemlist(p,items,nrinstr_out)
|
|||
|
||||
register line_p l;
|
||||
register bblock_p b;
|
||||
register cnt= 0;
|
||||
register int cnt= 0;
|
||||
|
||||
clean_tab(items);
|
||||
for (b = p->p_start; b != (bblock_p) 0; b = b->b_next) {
|
||||
|
|
|
@ -8,26 +8,30 @@
|
|||
* R A _ I T E M S . H
|
||||
*/
|
||||
|
||||
extern short item_type(); /* (line_p l)
|
||||
short item_type(line_p l); /*
|
||||
* Determine the type of item (constant,local
|
||||
* variable etc.) accessed by l.
|
||||
*/
|
||||
extern bool is_item(); /* (line_p l)
|
||||
bool is_item(line_p l); /*
|
||||
* See if l accesses an item
|
||||
*/
|
||||
extern item_p item_of(); /* (offset off;item_p items)
|
||||
item_p item_of(offset off, item_p items[]);
|
||||
/*
|
||||
* Determine the descriptor of the item
|
||||
* accessed by l; return 0 if not found
|
||||
*/
|
||||
extern fill_item(); /* (item_p item;line_p l)
|
||||
void fill_item(item_p item, line_p l);
|
||||
/*
|
||||
* Compute the type and obj/off attributes
|
||||
* of the item accessed by l and put them
|
||||
* in the given item descriptor.
|
||||
*/
|
||||
extern bool same_item(); /* (item_p a,b)
|
||||
bool same_item(item_p a, item_p b);
|
||||
/*
|
||||
* See if a and b are the same items.
|
||||
*/
|
||||
extern build_itemlist(); /* (proc_p p;item_p items[]; int *nrinstr_out)
|
||||
void build_itemlist(proc_p p, item_p items[], int *nrinstr_out);
|
||||
/*
|
||||
* Determine all items accessed by procedure p
|
||||
* and put them in the items lists. All items
|
||||
* of type T must be put in list items[T].
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "../share/alloc.h"
|
||||
#include "ra.h"
|
||||
#include "ra_aux.h"
|
||||
#include "ra_interv.h"
|
||||
#include "ra_items.h"
|
||||
#include "ra_lifet.h"
|
||||
|
||||
|
@ -33,7 +34,7 @@
|
|||
#define is_deadmsg(l) (INSTR(l) == ps_mes && aoff(ARG(l),0) == ms_ego && \
|
||||
aoff(ARG(l),1) == ego_dead)
|
||||
|
||||
build_lifetimes(items)
|
||||
void build_lifetimes(items)
|
||||
item_p items[];
|
||||
{
|
||||
/* compute the it_lives attribute of every item; this is
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
|
||||
|
||||
extern build_lifetimes(); /* item_p items[];
|
||||
void build_lifetimes(item_p items[]);
|
||||
/*
|
||||
* compute the it_lives attribute of every
|
||||
* item; this is a list of intervals
|
||||
* during which the item is live,
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "ra.h"
|
||||
#include "ra_aux.h"
|
||||
#include "ra_interv.h"
|
||||
#include "ra_pack.h"
|
||||
#include "ra_profits.h"
|
||||
|
||||
|
||||
short regs_occupied[NRREGTYPES]; /* #occupied registers for reg_pointer,
|
||||
|
@ -28,7 +30,7 @@ short regs_occupied[NRREGTYPES]; /* #occupied registers for reg_pointer,
|
|||
*/
|
||||
#define reg_available(t) (regs_available[t] > regs_occupied[t])
|
||||
|
||||
STATIC initregcount()
|
||||
STATIC void initregcount()
|
||||
{
|
||||
int t;
|
||||
|
||||
|
@ -47,9 +49,7 @@ STATIC alloc_p make_dummy()
|
|||
}
|
||||
|
||||
|
||||
STATIC bool fits_in(a,b,cont_item)
|
||||
alloc_p a,b;
|
||||
bool *cont_item;
|
||||
STATIC bool fits_in(alloc_p a, alloc_p b, bool *cont_item)
|
||||
{
|
||||
/* See if allocation a can be assigned the same register as b.
|
||||
* Both allocations should be of the same register-type.
|
||||
|
@ -152,7 +152,7 @@ STATIC alloc_p choose_location(alloc,packed,p)
|
|||
|
||||
|
||||
|
||||
STATIC update_lists(alloc,unpacked,packed,fit)
|
||||
STATIC void update_lists(alloc,unpacked,packed,fit)
|
||||
alloc_p alloc,unpacked,packed,fit;
|
||||
{
|
||||
/* 'alloc' has been granted a register; move it from the 'unpacked'
|
||||
|
@ -237,7 +237,7 @@ STATIC alloc_p best_cumprofits(list,x_out,prev_out)
|
|||
|
||||
|
||||
|
||||
STATIC account_regsave(packed,unpacked)
|
||||
STATIC void account_regsave(packed,unpacked)
|
||||
alloc_p packed,unpacked;
|
||||
{
|
||||
/* After all packing has been done, we check for every allocated
|
||||
|
@ -327,7 +327,7 @@ STATIC alloc_p find_prev(alloc,list)
|
|||
* account_regsave from rejecting it.
|
||||
*/
|
||||
|
||||
STATIC repl_allocs(new,old,packed)
|
||||
STATIC void repl_allocs(new,old,packed)
|
||||
alloc_p new,old,packed;
|
||||
{
|
||||
alloc_p x,next,prev,*p;
|
||||
|
@ -356,7 +356,7 @@ STATIC repl_allocs(new,old,packed)
|
|||
|
||||
|
||||
|
||||
STATIC assemble_allocs(packed)
|
||||
STATIC void assemble_allocs(packed)
|
||||
alloc_p packed;
|
||||
{
|
||||
register alloc_p x,m,next;
|
||||
|
@ -377,10 +377,8 @@ STATIC assemble_allocs(packed)
|
|||
}
|
||||
}
|
||||
|
||||
pack(alloclist,time_opt,packed_out,not_packed_out,p)
|
||||
alloc_p alloclist, *packed_out,*not_packed_out;
|
||||
bool time_opt;
|
||||
proc_p p;
|
||||
void pack(alloc_p alloclist, bool time_opt, alloc_p *packed_out,
|
||||
alloc_p *not_packed_out, proc_p p)
|
||||
{
|
||||
/* This is the packing system. It decides which allations
|
||||
* to grant a register.
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
* R A _ P A C K . H
|
||||
*/
|
||||
|
||||
extern pack(); /* ( alloc_p alloclist, *packed_out,*not_packed_out;
|
||||
* bool time_opt; proc_p p)
|
||||
void pack(alloc_p alloclist, bool time_opt, alloc_p *packed_out,
|
||||
alloc_p *not_packed_out, proc_p p);
|
||||
/*
|
||||
* This is the packing system. It decides which
|
||||
* allations to grant a register.
|
||||
*/
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
#include "ra_aux.h"
|
||||
#include "ra_profits.h"
|
||||
|
||||
STATIC bool test_cond(cond,val)
|
||||
short cond;
|
||||
offset val;
|
||||
STATIC bool test_cond(short cond, offset val)
|
||||
{
|
||||
switch(cond) {
|
||||
case DEFAULT:
|
||||
|
@ -34,10 +32,7 @@ STATIC bool test_cond(cond,val)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC short map_value(tab,val,time)
|
||||
struct cond_tab tab[];
|
||||
offset val;
|
||||
bool time;
|
||||
STATIC short map_value(struct cond_tab tab[], offset val, bool time)
|
||||
{
|
||||
cond_p p;
|
||||
|
||||
|
@ -49,10 +44,7 @@ STATIC short map_value(tab,val,time)
|
|||
}
|
||||
|
||||
|
||||
STATIC short index_value(tab,n,time)
|
||||
struct cond_tab tab[];
|
||||
short n;
|
||||
bool time;
|
||||
STATIC short index_value(struct cond_tab tab[], short n, bool time)
|
||||
{
|
||||
cond_p p;
|
||||
|
||||
|
@ -61,16 +53,15 @@ STATIC short index_value(tab,n,time)
|
|||
}
|
||||
|
||||
|
||||
allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out)
|
||||
short itemtyp, localtyp,totyp,size;
|
||||
offset off;
|
||||
short *time_out, *space_out;
|
||||
STATIC void
|
||||
allocscore(short itemtyp, short localtyp, short size, offset off,
|
||||
short totyp, short *time_out, short *space_out)
|
||||
{
|
||||
cond_p m = (cond_p) 0;
|
||||
|
||||
if (localtyp == reg_loop) localtyp = reg_any;
|
||||
if (size == ws || size == ps && totyp == reg_pointer ||
|
||||
size == 2 * ws && totyp == reg_float) {
|
||||
if (size == ws || (size == ps && totyp == reg_pointer) ||
|
||||
(size == 2 * ws && totyp == reg_float)) {
|
||||
switch(itemtyp) {
|
||||
case LOCALVAR:
|
||||
m = alocaltab[localtyp][totyp];
|
||||
|
@ -103,10 +94,9 @@ allocscore(itemtyp,localtyp,size,off,totyp,time_out,space_out)
|
|||
*/
|
||||
}
|
||||
|
||||
opening_cost(itemtyp,localtyp,off,time_out,space_out)
|
||||
short itemtyp, localtyp;
|
||||
offset off;
|
||||
short *time_out, *space_out;
|
||||
STATIC void
|
||||
opening_cost(short itemtyp, short localtyp, offset off,
|
||||
short *time_out, short *space_out)
|
||||
{
|
||||
cond_p m;
|
||||
|
||||
|
@ -142,8 +132,7 @@ opening_cost(itemtyp,localtyp,off,time_out,space_out)
|
|||
|
||||
|
||||
|
||||
regsave_cost(regs,time_out,space_out)
|
||||
short regs[], *time_out, *space_out;
|
||||
void regsave_cost(short regs[], short *time_out, short *space_out)
|
||||
{
|
||||
/* Estimate the costs of saving and restoring the registers
|
||||
* The array regs contains the number of registers of every
|
||||
|
@ -178,9 +167,7 @@ STATIC short dyn_inits(inits)
|
|||
|
||||
|
||||
|
||||
compute_profits(alloclist,time_opt)
|
||||
alloc_p alloclist;
|
||||
bool time_opt;
|
||||
void compute_profits(alloc_p alloclist, bool time_opt)
|
||||
{
|
||||
/* Compute the profits attribute of every allocation.
|
||||
* If the item of an allocation may be put in several types
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
* R A _ P R O F I T S . H
|
||||
*/
|
||||
|
||||
extern compute_profits();/* (alloc_p alloclist)
|
||||
void compute_profits(alloc_p alloclist, bool time_opt);
|
||||
/*
|
||||
* Compute the profits attribute of every allocation.
|
||||
*/
|
||||
extern regsave_cost(); /* (short regs[], *time_out, *space_out)
|
||||
*/
|
||||
void regsave_cost(short regs[], short *time_out, short *space_out);
|
||||
|
|
|
@ -77,8 +77,7 @@ struct repl repl_tab[NRREPLACEMENTS][REPL_LENGTH] = {
|
|||
|
||||
|
||||
|
||||
init_replacements(psize,wsize)
|
||||
short psize,wsize;
|
||||
void init_replacements(short psize, short wsize)
|
||||
{
|
||||
/* The replacement code to be generated depends on the
|
||||
* wordsize and pointer size of the target machine.
|
||||
|
@ -137,9 +136,7 @@ STATIC int repl_index(l)
|
|||
|
||||
|
||||
|
||||
STATIC bool is_current(alloc,t)
|
||||
alloc_p alloc;
|
||||
short t;
|
||||
STATIC bool is_current(alloc_p alloc, short t)
|
||||
{
|
||||
/* Is time t part of alloc's timespan? */
|
||||
|
||||
|
@ -147,7 +144,7 @@ STATIC bool is_current(alloc,t)
|
|||
}
|
||||
|
||||
|
||||
STATIC match_item(item,l)
|
||||
STATIC bool match_item(item,l)
|
||||
item_p item;
|
||||
line_p l;
|
||||
{
|
||||
|
@ -188,7 +185,7 @@ STATIC alloc_p find_alloc(alloclist,l,t)
|
|||
}
|
||||
|
||||
|
||||
STATIC replace_line(l,b,list)
|
||||
STATIC void replace_line(l,b,list)
|
||||
line_p l,list;
|
||||
bblock_p b;
|
||||
{
|
||||
|
@ -245,7 +242,7 @@ STATIC line_p repl_code(lnp,regnr)
|
|||
|
||||
|
||||
|
||||
STATIC apply_alloc(b,l,alloc)
|
||||
STATIC void apply_alloc(b,l,alloc)
|
||||
bblock_p b;
|
||||
line_p l;
|
||||
alloc_p alloc;
|
||||
|
@ -355,7 +352,7 @@ STATIC line_p init_place(b)
|
|||
|
||||
|
||||
|
||||
STATIC append_code(l1,l2,b)
|
||||
STATIC void append_code(l1,l2,b)
|
||||
line_p l1,l2;
|
||||
bblock_p b;
|
||||
{
|
||||
|
@ -380,7 +377,7 @@ STATIC append_code(l1,l2,b)
|
|||
|
||||
|
||||
|
||||
STATIC emit_init_code(list)
|
||||
STATIC void emit_init_code(list)
|
||||
alloc_p list;
|
||||
{
|
||||
/* Emit initialization code for all packed allocations.
|
||||
|
@ -409,7 +406,7 @@ STATIC emit_init_code(list)
|
|||
|
||||
|
||||
|
||||
STATIC emit_mesregs(p,alloclist)
|
||||
STATIC void emit_mesregs(p,alloclist)
|
||||
proc_p p;
|
||||
alloc_p alloclist;
|
||||
{
|
||||
|
@ -432,7 +429,7 @@ STATIC emit_mesregs(p,alloclist)
|
|||
|
||||
|
||||
|
||||
rem_mes(p)
|
||||
STATIC void rem_mes(p)
|
||||
proc_p p;
|
||||
{
|
||||
register bblock_p b;
|
||||
|
@ -455,11 +452,8 @@ rem_mes(p)
|
|||
|
||||
|
||||
|
||||
xform_proc(p,alloclist,nrinstrs,instrmap)
|
||||
proc_p p;
|
||||
alloc_p alloclist;
|
||||
short nrinstrs;
|
||||
line_p instrmap[];
|
||||
void
|
||||
xform_proc(proc_p p, alloc_p alloclist, short nrinstrs, line_p instrmap[])
|
||||
{
|
||||
/* Transform every instruction of procedure p that uses an item
|
||||
* at a point where the item is kept in a register.
|
||||
|
@ -498,10 +492,7 @@ xform_proc(p,alloclist,nrinstrs,instrmap)
|
|||
|
||||
|
||||
|
||||
bool always_in_reg(off,allocs,size_out)
|
||||
offset off;
|
||||
alloc_p allocs;
|
||||
short *size_out;
|
||||
bool always_in_reg(offset off, alloc_p allocs, short *size_out)
|
||||
{
|
||||
/* See if the local variable with the given offset is stored
|
||||
* in a register during its entire lifetime. As a side effect,
|
||||
|
@ -526,7 +517,7 @@ bool always_in_reg(off,allocs,size_out)
|
|||
}
|
||||
|
||||
|
||||
rem_locals(p,allocs)
|
||||
void rem_locals(p,allocs)
|
||||
proc_p p;
|
||||
alloc_p allocs;
|
||||
{
|
||||
|
|
|
@ -9,21 +9,35 @@
|
|||
* R A _ X F O R M . H
|
||||
*/
|
||||
|
||||
extern init_replacements(); /* (short psize,wsize)
|
||||
void init_replacements(short psize, short wsize);
|
||||
/*
|
||||
* This routine must be called once, before
|
||||
* any call to xform_proc. It initializes
|
||||
* a machine dependent table.
|
||||
*/
|
||||
extern xform_proc(); /* (proc_p p; alloc_p alloclist;
|
||||
* short nrinstrs; line_p instrmap[])
|
||||
void xform_proc(proc_p p, alloc_p alloclist, short nrinstrs,
|
||||
line_p instrmap[]);
|
||||
/*
|
||||
* Transform a procedure. Alloclist must
|
||||
* contain the packed allocations (i.e. those
|
||||
* allocations that are assigned a register).
|
||||
*/
|
||||
bool always_in_reg(); /* ( offset off; alloc_p allocs;
|
||||
* short *size_out;)
|
||||
bool always_in_reg(offset off, alloc_p allocs, short *size_out);
|
||||
/*
|
||||
* See if the local variable with the given
|
||||
* offset is stored in a register during its
|
||||
* entire lifetime. As a side effect,
|
||||
* return the size of the local.
|
||||
*/
|
||||
void rem_locals(proc_p p, alloc_p allocs);
|
||||
/*
|
||||
* Try to decrease the number of locals of
|
||||
* procedure p, by looking at which locals
|
||||
* are always stored in a register.
|
||||
*/
|
||||
void rem_formals(proc_p p, alloc_p allocs);
|
||||
/*
|
||||
* Try to decrease the number of formals of
|
||||
* procedure p, by looking at which formals
|
||||
* are always stored in a register.
|
||||
*/
|
||||
|
|
|
@ -184,12 +184,12 @@ void olddblock(dblock_p dbl) {
|
|||
}
|
||||
|
||||
|
||||
short **newmap(short length) {
|
||||
return((short **) newcore((length+1) * sizeof(short *)));
|
||||
void **newmap(short length) {
|
||||
return(newcore((length+1) * sizeof(short *)));
|
||||
}
|
||||
|
||||
/*ARGSUSED1*/
|
||||
void oldmap(short **mp, short length) {
|
||||
void oldmap(void **mp, short length) {
|
||||
oldcore(mp, (length+1) * sizeof(short *));
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ short *newtable(short length) {
|
|||
}
|
||||
|
||||
/*ARGSUSED1*/
|
||||
void oldtable(short **mp, short length) {
|
||||
void oldtable(short *mp, short length) {
|
||||
oldcore(mp, (length+1) * sizeof(short));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ void *myalloc(size_t);
|
|||
|
||||
line_p newline(byte optype);
|
||||
arg_p newarg(byte argtyp);
|
||||
short **newmap(short length);
|
||||
void **newmap(short length);
|
||||
cset newbitvect(short nrbytes);
|
||||
cond_p newcondtab(int length);
|
||||
|
||||
|
@ -35,12 +35,12 @@ void oldargs(arg_p);
|
|||
void oldargb(argb_p);
|
||||
void oldobjects(obj_p);
|
||||
void olddblock(dblock_p);
|
||||
void oldmap(short **mp, short length);
|
||||
void oldmap(void **mp, short length);
|
||||
void oldbitvect(cset s, short nrbytes);
|
||||
void oldcondtab(cond_p);
|
||||
|
||||
short *newtable(short length);
|
||||
void oldtable(short **mp, short length);
|
||||
void oldtable(short *mp, short length);
|
||||
|
||||
#define newdblock() (dblock_p) newstruct(dblock)
|
||||
#define newobject() (obj_p) newstruct(obj)
|
||||
|
|
|
@ -19,7 +19,7 @@ void Cjoin(cset, cset *);
|
|||
void Cintersect(cset, cset *);
|
||||
void Cdeleteset(cset);
|
||||
bool Cis_subset(cset, cset);
|
||||
void Cclearset(cset, cset *);
|
||||
void Cclear_set(cset *);
|
||||
void Ccopy_set(cset, cset *);
|
||||
void Csubtract(cset, cset *);
|
||||
bool Cequal(cset, cset);
|
||||
|
|
|
@ -68,7 +68,7 @@ STATIC void localvar(offset off, short size, local_p *locs, bool reg,
|
|||
|
||||
|
||||
|
||||
STATIC check_message(line_p l, local_p *locs)
|
||||
STATIC void check_message(line_p l, local_p *locs)
|
||||
{
|
||||
/* See if l is a register message */
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ void putdtable(dblock_p head, FILE *df)
|
|||
}
|
||||
fclose(curoutp);
|
||||
if (omap != (obj_p *) 0) {
|
||||
oldmap((short **) omap,olength); /* release memory for omap */
|
||||
oldmap((void **) omap,olength); /* release memory for omap */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ void putptable(proc_p head, FILE *pf, bool all)
|
|||
}
|
||||
fclose(curoutp);
|
||||
if (pmap != (proc_p *) 0) {
|
||||
oldmap((short **) pmap,plength); /* release memory for pmap */
|
||||
oldmap((void **) pmap,plength); /* release memory for pmap */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,9 +416,9 @@ void putunit(short kind, proc_p p, line_p l, FILE *gf, FILE *lf)
|
|||
oldbblock(b);
|
||||
}
|
||||
/* Release the memory for the lmap, lbmap, bmap, lpmap tables */
|
||||
if (lmap != (line_p *) 0) oldmap((short **) lmap,llength);
|
||||
if (lbmap != (bblock_p *) 0) oldmap((short **) lbmap,llength);
|
||||
if (bmap != (bblock_p *) 0) oldmap((short **) bmap,blength);
|
||||
if (lpmap != (loop_p *) 0) oldmap((short **) lpmap,lplength);
|
||||
if (lmap != (line_p *) 0) oldmap((void **) lmap,llength);
|
||||
if (lbmap != (bblock_p *) 0) oldmap((void **) lbmap,llength);
|
||||
if (bmap != (bblock_p *) 0) oldmap((void **) bmap,blength);
|
||||
if (lpmap != (loop_p *) 0) oldmap((void **) lpmap,lplength);
|
||||
curoutp = lf;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "../share/utils.h"
|
||||
#include "sr_aux.h"
|
||||
#include "sr_iv.h"
|
||||
#include "sr_reduce.h"
|
||||
|
||||
/* Strength reduction tries to change expensive operators occurring
|
||||
* in a loop into cheaper operators. The expensive operators considered
|
||||
|
@ -69,7 +70,7 @@ void sr_machinit(void *vp)
|
|||
fscanf(f,"%d",&sli_threshold);
|
||||
}
|
||||
|
||||
STATIC del_ivs(ivs)
|
||||
STATIC void del_ivs(ivs)
|
||||
lset ivs;
|
||||
{
|
||||
/* Delete the set of iv structs */
|
||||
|
@ -83,7 +84,7 @@ STATIC del_ivs(ivs)
|
|||
}
|
||||
|
||||
|
||||
STATIC do_loop(loop)
|
||||
STATIC void do_loop(loop)
|
||||
loop_p loop;
|
||||
{
|
||||
lset ivs, vars;
|
||||
|
@ -111,7 +112,7 @@ STATIC do_loop(loop)
|
|||
|
||||
|
||||
|
||||
STATIC loopblocks(p)
|
||||
STATIC void loopblocks(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Compute the LP_BLOCKS sets for all loops of p */
|
||||
|
@ -129,7 +130,7 @@ STATIC loopblocks(p)
|
|||
|
||||
|
||||
|
||||
STATIC opt_proc(p)
|
||||
STATIC void opt_proc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Optimize all loops of one procedure. We first do all
|
||||
|
@ -182,7 +183,7 @@ STATIC bblock_p header(lp)
|
|||
|
||||
|
||||
|
||||
STATIC sr_extproc(p)
|
||||
STATIC void sr_extproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Allocate the extended data structures for procedure p */
|
||||
|
@ -202,7 +203,7 @@ STATIC sr_extproc(p)
|
|||
}
|
||||
|
||||
|
||||
STATIC sr_cleanproc(p)
|
||||
STATIC void sr_cleanproc(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Remove the extended data structures for procedure p */
|
||||
|
@ -232,7 +233,7 @@ void sr_optimize(void *vp)
|
|||
|
||||
|
||||
|
||||
main(argc,argv)
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
|
|
@ -107,7 +107,7 @@ int elemsize(lnp)
|
|||
|
||||
|
||||
|
||||
concatenate(list1,list2)
|
||||
void concatenate(list1,list2)
|
||||
line_p list1,list2;
|
||||
{
|
||||
/* Append list2 to the end of list1. list1 may not be empty. */
|
||||
|
|
|
@ -6,20 +6,23 @@
|
|||
/* S R _ A U X . H */
|
||||
|
||||
|
||||
extern bool is_loopconst(); /* (line_p l; lset vars)
|
||||
bool is_loopconst(line_p l, lset vars);
|
||||
/*
|
||||
* See if l is a loop-constant. vars is the
|
||||
* set of variables changed in the loop.
|
||||
*/
|
||||
extern bool is_caddress(); /* (line_p l)
|
||||
bool is_caddress(line_p l, lset vars);
|
||||
/*
|
||||
* See if l loads a loop-invariant entity of
|
||||
* size pointer-size.
|
||||
*/
|
||||
extern int elemsize(); /* (line_p l)
|
||||
int elemsize(line_p l); /*
|
||||
* l is an instruction that loads an array
|
||||
* descriptor. Try to determine the size
|
||||
* of the array elements.
|
||||
*/
|
||||
extern concatenate(); /* (line_p list1,list2)
|
||||
void concatenate(line_p list1, line_p list2);
|
||||
/*
|
||||
* Append list2 to the end of list1
|
||||
*/
|
||||
#define is_const(l) (INSTR(l) == op_loc)
|
||||
|
|
|
@ -49,7 +49,7 @@ STATIC lset cand, /* set of candidates */
|
|||
|
||||
|
||||
|
||||
STATIC un_cand(lnp)
|
||||
STATIC void un_cand(lnp)
|
||||
line_p lnp;
|
||||
{
|
||||
/* remove the variable stored into by lnp from the list of
|
||||
|
@ -84,7 +84,7 @@ STATIC bool is_cand(lnp)
|
|||
}
|
||||
|
||||
|
||||
STATIC make_cand(lnp)
|
||||
STATIC void make_cand(lnp)
|
||||
line_p lnp;
|
||||
{
|
||||
/* make the variable stored into by lnp a candidate */
|
||||
|
@ -96,14 +96,14 @@ STATIC make_cand(lnp)
|
|||
|
||||
|
||||
|
||||
STATIC do_dismiss(lnp)
|
||||
STATIC void do_dismiss(lnp)
|
||||
line_p lnp;
|
||||
{
|
||||
Ladd(lnp,&dism);
|
||||
}
|
||||
|
||||
|
||||
STATIC dismiss(lnp)
|
||||
STATIC void dismiss(lnp)
|
||||
line_p lnp;
|
||||
{
|
||||
/* The variable referenced by lnp is turned definitely into
|
||||
|
@ -151,7 +151,7 @@ STATIC void try_cand(lnp,b)
|
|||
}
|
||||
|
||||
|
||||
candidates(lp,cand_out,vars_out)
|
||||
void candidates(lp,cand_out,vars_out)
|
||||
loop_p lp;
|
||||
lset *cand_out, *vars_out;
|
||||
{
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
|
||||
|
||||
extern candidates(); /* (loop_p lp; lset *iv_cand, *vars)
|
||||
void candidates(loop_p lp, lset *iv_cand, lset *vars);
|
||||
/*
|
||||
* Find candidate induction variables,
|
||||
* i.e. local variables that are assigned
|
||||
* a value precisely once within the loop,
|
||||
|
|
|
@ -111,10 +111,9 @@ STATIC int me_kind(l,sign_in,sign_out)
|
|||
|
||||
|
||||
|
||||
STATIC bool match_expr(l,iv_allowed,lbegin,iv_seen,sign)
|
||||
line_p l,*lbegin;
|
||||
bool iv_allowed, *iv_seen;
|
||||
int sign;
|
||||
STATIC bool
|
||||
match_expr(line_p l, bool iv_allowed, line_p *lbegin, bool *iv_seen,
|
||||
int sign)
|
||||
{
|
||||
/* This routine is a top down parser for simple
|
||||
* EM expressions. It recognizes expressions that
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
extern bool is_ivexpr();/* (line_p l; lset ivs,vars; line_p *lbegin; iv_p *iv;
|
||||
* int *out_sign)
|
||||
bool is_ivexpr(line_p l, lset ivs, lset vars, line_p *lbegin, iv_p *iv,
|
||||
int *out_sign);
|
||||
/*
|
||||
* Try to recognize an expression that is a linear
|
||||
* function of presicely one induction variable.
|
||||
* It may only use loop constants (besides the
|
||||
|
|
|
@ -76,7 +76,7 @@ STATIC bool is_same(l,lnp)
|
|||
}
|
||||
|
||||
|
||||
STATIC ivar(lnp,step)
|
||||
STATIC void ivar(lnp,step)
|
||||
line_p lnp;
|
||||
int step;
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ STATIC void try_patterns(lnp)
|
|||
}
|
||||
|
||||
|
||||
induc_vars(loop,ivar_out, vars_out)
|
||||
void induc_vars(loop,ivar_out, vars_out)
|
||||
loop_p loop;
|
||||
lset *ivar_out, *vars_out;
|
||||
{
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
/* S R _ I V . H */
|
||||
|
||||
extern induc_vars(); /* (loop_p loop; lset *ivars, *vars)
|
||||
void induc_vars(loop_p loop, lset *ivars, lset *vars);
|
||||
/*
|
||||
* Find the set of induction variables
|
||||
* of the loop. Also find the set of (local)
|
||||
* variables that are changed.
|
||||
|
|
|
@ -55,7 +55,7 @@ STATIC int regtyp(code)
|
|||
}
|
||||
|
||||
|
||||
STATIC gen_regmes(tmp,score,code,p)
|
||||
STATIC void gen_regmes(tmp,score,code,p)
|
||||
offset tmp;
|
||||
int score;
|
||||
code_p code;
|
||||
|
@ -121,7 +121,7 @@ STATIC line_p newcode(code,tmp)
|
|||
|
||||
|
||||
|
||||
STATIC replcode(code,text)
|
||||
STATIC void replcode(code,text)
|
||||
code_p code;
|
||||
line_p text;
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ STATIC line_p add_code(pl, l)
|
|||
|
||||
|
||||
|
||||
STATIC init_code(code,tmp)
|
||||
STATIC void init_code(code,tmp)
|
||||
code_p code;
|
||||
offset tmp;
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ STATIC init_code(code,tmp)
|
|||
*p = l; /* new last instruction */
|
||||
}
|
||||
|
||||
STATIC incr_code(code,tmp)
|
||||
STATIC void incr_code(code,tmp)
|
||||
code_p code;
|
||||
offset tmp;
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ STATIC incr_code(code,tmp)
|
|||
}
|
||||
|
||||
|
||||
STATIC remcode(c)
|
||||
STATIC void remcode(c)
|
||||
code_p c;
|
||||
{
|
||||
line_p l, next;
|
||||
|
@ -453,7 +453,7 @@ STATIC code_p available(c,vars)
|
|||
return (code_p) 0;
|
||||
}
|
||||
|
||||
STATIC fix_header(lp)
|
||||
STATIC void fix_header(lp)
|
||||
loop_p lp;
|
||||
{
|
||||
/* Check if a header block was added, and if so, add a branch to
|
||||
|
@ -487,7 +487,7 @@ STATIC fix_header(lp)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC reduce(code,vars)
|
||||
STATIC void reduce(code,vars)
|
||||
code_p code;
|
||||
lset vars;
|
||||
{
|
||||
|
@ -711,7 +711,7 @@ STATIC void try_array(lp,ivs,vars,b,arr)
|
|||
|
||||
|
||||
|
||||
STATIC clean_avail()
|
||||
STATIC void clean_avail()
|
||||
{
|
||||
Lindex i;
|
||||
|
||||
|
@ -723,7 +723,7 @@ STATIC clean_avail()
|
|||
|
||||
|
||||
|
||||
strength_reduction(lp,ivs,vars)
|
||||
void strength_reduction(lp,ivs,vars)
|
||||
loop_p lp; /* description of the loop */
|
||||
lset ivs; /* set of induction variables of the loop */
|
||||
lset vars; /* set of local variables changed in loop */
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
/* S R _ R E D U C E . H */
|
||||
|
||||
extern strength_reduction(); /* (loop_p loop; lset ivs, vars)
|
||||
* Perform streength reduction.
|
||||
void strength_reduction(loop_p loop, lset ivs, lset vars);
|
||||
/*
|
||||
* Perform strength reduction.
|
||||
*/
|
||||
|
|
|
@ -66,7 +66,7 @@ line_p move_pointer(tmp,dir)
|
|||
|
||||
/* make_header */
|
||||
|
||||
STATIC copy_loops(b1,b2,except)
|
||||
STATIC void copy_loops(b1,b2,except)
|
||||
bblock_p b1,b2;
|
||||
loop_p except;
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ STATIC lab_id label(b)
|
|||
}
|
||||
|
||||
|
||||
STATIC adjust_jump(newtarg,oldtarg,c)
|
||||
STATIC void adjust_jump(newtarg,oldtarg,c)
|
||||
bblock_p newtarg,oldtarg,c;
|
||||
{
|
||||
/* If the last instruction of c is a jump to the
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
|
||||
|
||||
extern line_p move_pointer(); /* (offset tmp; int dir ) */
|
||||
line_p move_pointer(offset tmp, int dir);
|
||||
/* Generate EM code to load/store a pointer variable
|
||||
* onto/from the stack, depending on dir(ection).
|
||||
* We accept all kinds of pointer sizes.
|
||||
*/
|
||||
extern void make_header() ; /* (loop_p lp) */
|
||||
void make_header(loop_p lp);
|
||||
/* Make sure that the loop has a header block, i.e. a block
|
||||
* has the loop entry block as its only successor and
|
||||
* that dominates the loop entry block.
|
||||
|
|
|
@ -103,7 +103,7 @@ STATIC short map_value(tab,val,time)
|
|||
}
|
||||
|
||||
|
||||
STATIC init_root(root)
|
||||
STATIC void init_root(root)
|
||||
bblock_p root;
|
||||
{
|
||||
/* Initialise the IN OUT sets of the entry block of the
|
||||
|
@ -133,7 +133,7 @@ STATIC init_root(root)
|
|||
|
||||
|
||||
|
||||
STATIC unite_outs(bbset,setp)
|
||||
STATIC void unite_outs(bbset,setp)
|
||||
lset bbset;
|
||||
cset *setp;
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ STATIC unite_outs(bbset,setp)
|
|||
|
||||
|
||||
|
||||
STATIC solve_equations(p)
|
||||
STATIC void solve_equations(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Solve the data flow equations for reaching
|
||||
|
@ -390,7 +390,7 @@ pr_cblocks(p)
|
|||
|
||||
#endif
|
||||
|
||||
STATIC ud_analysis(p)
|
||||
STATIC void ud_analysis(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Perform use-definition analysis on procedure p */
|
||||
|
@ -415,20 +415,20 @@ STATIC ud_analysis(p)
|
|||
|
||||
|
||||
|
||||
STATIC clean_maps()
|
||||
STATIC void clean_maps()
|
||||
{
|
||||
local_p *p;
|
||||
cset *v;
|
||||
|
||||
oldmap(defs,nrexpldefs);
|
||||
oldmap((void **) defs,nrexpldefs);
|
||||
for (p = &locals[1]; p <= &locals[nrlocals]; p++) {
|
||||
oldlocal(*p);
|
||||
}
|
||||
oldmap(locals,nrlocals);
|
||||
oldmap((void **) locals,nrlocals);
|
||||
for (v = &vardefs[1]; v <= &vardefs[nrvars]; v++) {
|
||||
Cdeleteset(*v);
|
||||
}
|
||||
oldmap(vardefs,nrvars);
|
||||
oldmap((void **) vardefs,nrvars);
|
||||
}
|
||||
|
||||
|
||||
|
@ -469,7 +469,7 @@ STATIC bool try_optim(l,b)
|
|||
|
||||
|
||||
|
||||
value_propagation(p)
|
||||
STATIC void value_propagation(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Apply value propagation to procedure p */
|
||||
|
@ -484,7 +484,7 @@ value_propagation(p)
|
|||
* e.g. the value of A might be statically known too now.
|
||||
*/
|
||||
|
||||
while (changes) {
|
||||
while (changes) {
|
||||
changes = FALSE;
|
||||
for (b = p->p_start; b != (bblock_p) 0; b = b->b_next) {
|
||||
for (l = b->b_start; l != (line_p) 0; l = next) {
|
||||
|
@ -495,12 +495,12 @@ value_propagation(p)
|
|||
}
|
||||
}
|
||||
}
|
||||
oldmap(copies,nrcopies);
|
||||
oldmap((void **) copies,nrcopies);
|
||||
oldtable(def_to_copynr,nrdefs);
|
||||
}
|
||||
|
||||
|
||||
STATIC ud_extend(p)
|
||||
STATIC void ud_extend(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Allocate extended data structures for Use Definition analysis */
|
||||
|
@ -513,7 +513,7 @@ STATIC ud_extend(p)
|
|||
}
|
||||
|
||||
|
||||
STATIC ud_cleanup(p)
|
||||
STATIC void ud_cleanup(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Deallocate extended data structures for Use Definition analysis */
|
||||
|
@ -553,7 +553,7 @@ void ud_optimize(void *vp)
|
|||
clean_maps();
|
||||
}
|
||||
|
||||
main(argc,argv)
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "../share/utils.h"
|
||||
#include "ud_defs.h"
|
||||
|
||||
repl_line(old,new,b)
|
||||
void repl_line(old,new,b)
|
||||
line_p old,new;
|
||||
bblock_p b;
|
||||
{
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
*/
|
||||
|
||||
|
||||
extern repl_line(); /* (line_p old,new; bblock_p b)
|
||||
void repl_line(line_p old, line_p new, bblock_p b);
|
||||
/*
|
||||
* Replace EM instruction 'old' by a
|
||||
* copy of 'new'. Update doubly-linked
|
||||
* list.
|
||||
*/
|
||||
extern bool same_var(); /* (line_p use,def)
|
||||
bool same_var(line_p use, line_p def);
|
||||
/*
|
||||
* 'use' is an instruction that uses a variable
|
||||
* for which we maintain ud-info (e.g. a LOL).
|
||||
* See if 'def' references the same variable.
|
||||
|
|
|
@ -109,9 +109,7 @@ bool value_known(def,val_out)
|
|||
|
||||
|
||||
|
||||
bool affected(use,v,l)
|
||||
line_p use,l;
|
||||
short v;
|
||||
bool affected(line_p use, short v, line_p l)
|
||||
{
|
||||
/* See if the variable referenced by 'use' may be
|
||||
* changed by instruction l, which is either a cal, cai or
|
||||
|
@ -223,7 +221,7 @@ line_p unique_def(use,b,defnr_out)
|
|||
|
||||
|
||||
|
||||
fold_const(l,b,val)
|
||||
void fold_const(l,b,val)
|
||||
line_p l;
|
||||
bblock_p b;
|
||||
offset val;
|
||||
|
|
|
@ -6,23 +6,27 @@
|
|||
|
||||
/* C O N S T A N T P R O P A G A T I O N */
|
||||
|
||||
extern line_p unique_def(); /* ( line_p use; bblock_p b; short *defnr_out;)
|
||||
line_p unique_def(line_p use, bblock_p b, short *defnr_out);
|
||||
/*
|
||||
* See if there is a unique explicit definition
|
||||
* of the variable used by 'use' that
|
||||
* reaches 'use'.
|
||||
*/
|
||||
extern bool value_known(); /* (line_p def; offset *val_out)
|
||||
bool value_known(line_p def, offset *val_out);
|
||||
/*
|
||||
* See if the value stored by definition 'def'
|
||||
* is known statically (i.e. is a constant).
|
||||
*/
|
||||
extern fold_const(); /* (line_p l; bblock_p b; offset val)
|
||||
void fold_const(line_p l, bblock_p b, offset val);
|
||||
/*
|
||||
* Perform the substitutions required for
|
||||
* constant folding.
|
||||
*/
|
||||
extern bool is_use(); /* (line_p l)
|
||||
bool is_use(line_p l); /*
|
||||
* See if 'l' is a use of a variable.
|
||||
*/
|
||||
extern bool affected(); /* (line_p use,l; short v)
|
||||
bool affected(line_p use, short v, line_p l);
|
||||
/*
|
||||
* See if the variable referenced by 'use' may
|
||||
* be changed by instruction l, which is
|
||||
* either a cal, cai or an indirect assignment.
|
||||
|
|
|
@ -83,7 +83,7 @@ STATIC void traverse_defs(p,action)
|
|||
|
||||
|
||||
|
||||
STATIC make_copytab(p)
|
||||
STATIC void make_copytab(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Make a table of all copies appearing in procedure p.
|
||||
|
@ -165,7 +165,7 @@ STATIC void gen_kill_copies(p)
|
|||
|
||||
|
||||
|
||||
STATIC intersect_outs(bbset,setp,full_set)
|
||||
STATIC void intersect_outs(bbset,setp,full_set)
|
||||
lset bbset;
|
||||
cset *setp,full_set;
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ STATIC intersect_outs(bbset,setp,full_set)
|
|||
|
||||
|
||||
|
||||
STATIC init_cin(p,full_set)
|
||||
STATIC void init_cin(p,full_set)
|
||||
proc_p p;
|
||||
cset full_set;
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ STATIC init_cin(p,full_set)
|
|||
|
||||
|
||||
|
||||
STATIC solve_cin(p)
|
||||
STATIC void solve_cin(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Solve the data flow equations for reaching
|
||||
|
@ -267,7 +267,7 @@ STATIC solve_cin(p)
|
|||
|
||||
|
||||
|
||||
copy_analysis(p)
|
||||
void copy_analysis(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Determine which copies procedure p has. Compute C_IN(b),
|
||||
|
@ -311,7 +311,7 @@ bool is_copy(def)
|
|||
|
||||
|
||||
|
||||
fold_var(old,new,b)
|
||||
void fold_var(old,new,b)
|
||||
line_p old, new;
|
||||
bblock_p b;
|
||||
{
|
||||
|
@ -369,10 +369,7 @@ END DEBUG */
|
|||
|
||||
|
||||
|
||||
bool value_retained(copy,defnr,use,b)
|
||||
line_p copy,use;
|
||||
short defnr;
|
||||
bblock_p b;
|
||||
bool value_retained(line_p copy, short defnr, line_p use, bblock_p b)
|
||||
{
|
||||
/* See if the right hand side variable of the
|
||||
* copy still has the same value at 'use'.
|
||||
|
|
|
@ -16,23 +16,24 @@ extern short nrcopies; /* number of copies in the current procedure
|
|||
* (length of copies-table)
|
||||
*/
|
||||
|
||||
extern copy_analysis(); /* (proc_p p)
|
||||
void copy_analysis(proc_p p); /*
|
||||
* Determine which copies procedure p has.
|
||||
* Compute C_IN(b), for every basic block b.
|
||||
*/
|
||||
extern bool is_copy(); /* (line_p def)
|
||||
bool is_copy(line_p def); /*
|
||||
* See if the definition def is also a 'copy',
|
||||
* i.e. an statement of the form
|
||||
* 'A := B' (or, in EM terminology:
|
||||
* a sequence 'Load Variable; Store Variable').
|
||||
*/
|
||||
extern fold_var(); /* (line_p old,new; bblock_p b)
|
||||
void fold_var(line_p old, line_p new, bblock_p b);
|
||||
/*
|
||||
* The variable referenced by the
|
||||
* EM instruction 'old' must be replaced
|
||||
* by the variable referenced by 'new'.
|
||||
*/
|
||||
extern bool value_retained(); /* (line_p copy; short defnr; line_p use;
|
||||
* bblock_p b)
|
||||
bool value_retained(line_p copy, short defnr, line_p use, bblock_p b);
|
||||
/*
|
||||
* See if the right hand side variable of the
|
||||
* copy still has the same value at 'use'.
|
||||
* If the copy and the use are in the same
|
||||
|
|
|
@ -80,7 +80,7 @@ bool does_impl_def(l)
|
|||
}
|
||||
|
||||
|
||||
make_defs(p)
|
||||
void make_defs(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Make a map of all explicit definitions
|
||||
|
@ -134,7 +134,7 @@ make_defs(p)
|
|||
|
||||
|
||||
|
||||
STATIC init_gen(nrdefs)
|
||||
STATIC void init_gen(nrdefs)
|
||||
short nrdefs;
|
||||
{
|
||||
/* Initializing routine of gen_sets. Compute the set
|
||||
|
@ -161,7 +161,7 @@ STATIC init_gen(nrdefs)
|
|||
|
||||
|
||||
|
||||
STATIC clean_gen()
|
||||
STATIC void clean_gen()
|
||||
{
|
||||
Cdeleteset(all_globl_defs);
|
||||
Cdeleteset(all_indir_defs);
|
||||
|
@ -200,7 +200,7 @@ STATIC bool same_target(l,defnr)
|
|||
|
||||
|
||||
|
||||
STATIC rem_prev_defs(l,gen_p)
|
||||
STATIC void rem_prev_defs(l,gen_p)
|
||||
line_p l;
|
||||
cset *gen_p;
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ STATIC rem_prev_defs(l,gen_p)
|
|||
|
||||
|
||||
|
||||
STATIC impl_globl_defs(p,gen_p)
|
||||
STATIC void impl_globl_defs(p,gen_p)
|
||||
proc_p p;
|
||||
cset *gen_p;
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ STATIC void impl_gen_defs(l,gen_p)
|
|||
|
||||
|
||||
|
||||
gen_sets(p)
|
||||
void gen_sets(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* Compute for every basic block b of p the
|
||||
|
@ -329,9 +329,7 @@ gen_sets(p)
|
|||
|
||||
|
||||
|
||||
STATIC killed_defs(v,b)
|
||||
short v;
|
||||
bblock_p b;
|
||||
STATIC void killed_defs(short v, bblock_p b)
|
||||
{
|
||||
/* Put all definitions of v occurring outside b
|
||||
* in KILL(b). In fact, we also put explicit
|
||||
|
@ -355,7 +353,7 @@ STATIC killed_defs(v,b)
|
|||
|
||||
|
||||
|
||||
kill_sets(p)
|
||||
void kill_sets(p)
|
||||
proc_p p;
|
||||
{
|
||||
/* For every basic block b of p compute the set
|
||||
|
|
|
@ -13,21 +13,21 @@ extern short nrexpldefs; /* number of explicit definitions */
|
|||
extern line_p *defs; /* map of explicit definitions */
|
||||
extern cset *vardefs; /* set of explicit defs. of all variables */
|
||||
|
||||
extern make_defs(); /* (proc_p p)
|
||||
void make_defs(proc_p p); /*
|
||||
* Compute defs[], vardefs[]
|
||||
* and CHGVARS(b) (for every b).
|
||||
*/
|
||||
extern gen_sets(); /* (proc_p p)
|
||||
void gen_sets(proc_p p); /*
|
||||
* Compute GEN(b) (for every b).
|
||||
*/
|
||||
extern kill_sets(); /* (proc_p p)
|
||||
*Compute KILL(b) (for every b).
|
||||
void kill_sets(proc_p p); /*
|
||||
* Compute KILL(b) (for every b).
|
||||
*/
|
||||
extern bool does_expl_def(); /* (line_p l)
|
||||
bool does_expl_def(line_p l); /*
|
||||
* See if instruction l does an explicit
|
||||
* definition (e.g. a STL).
|
||||
*/
|
||||
extern bool does_impl_def(); /* (line_p l)
|
||||
bool does_impl_def(line_p l); /*
|
||||
* See if instruction l does an implicit
|
||||
* definition (e.g. a CAL).
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue