17bc9cdef7
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.
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
/* $Id$ */
|
|
/*
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
*/
|
|
|
|
/* C O P Y P R O P A G A T I O N */
|
|
|
|
extern line_p *copies; /* table of copies; every entry points to the
|
|
* store-instruction.
|
|
*/
|
|
extern short *def_to_copynr; /* Table that maps a 'definition'-number to a
|
|
* 'copy' number.
|
|
*/
|
|
extern short nrcopies; /* number of copies in the current procedure
|
|
* (length of copies-table)
|
|
*/
|
|
|
|
void copy_analysis(proc_p p); /*
|
|
* Determine which copies procedure p has.
|
|
* Compute C_IN(b), for every basic block b.
|
|
*/
|
|
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').
|
|
*/
|
|
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'.
|
|
*/
|
|
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
|
|
* basic block (defnr = 0), search from the
|
|
* copy to the use, to see if the rhs variable
|
|
* is changed. If the copy is in another block,
|
|
* defnr is the definition-number of the copy.
|
|
* Search from the beginning of the block to
|
|
* the use, to see if the rhs is changed;
|
|
* if not, check that the copy is in C_IN(b).
|
|
*/
|