ack/util/ego/ud/ud_defs.h
George Koehler 17bc9cdef7 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.
2019-11-01 15:27:16 -04:00

57 lines
1.8 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".
*/
/* U S E - D E F I N I T I O N A N A L Y S I S
*
* U D _ D E F S . H
*/
extern short nrdefs; /* total number of definitions */
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 */
void make_defs(proc_p p); /*
* Compute defs[], vardefs[]
* and CHGVARS(b) (for every b).
*/
void gen_sets(proc_p p); /*
* Compute GEN(b) (for every b).
*/
void kill_sets(proc_p p); /*
* Compute KILL(b) (for every b).
*/
bool does_expl_def(line_p l); /*
* See if instruction l does an explicit
* definition (e.g. a STL).
*/
bool does_impl_def(line_p l); /*
* See if instruction l does an implicit
* definition (e.g. a CAL).
*/
/* Two kinds of definitions exist:
* - an explicit definition is an assignment to a single
* variable (e.g. a STL, STE, INE).
* - an implicit definition is an assignment to a variable
* performed via a subroutine call or an
* indirect assignment (through a pointer).
* Every explicit definition has an 'explicit definition number',
* which is its index in the 'defs' table.
* Every implicit definition has an 'implicit definition number',
* which is the 'variable number' of the changed variable.
* Every such definition also has a 'definition number'.
* Conversions exist between these numbers.
*/
#define TO_EXPLICIT(defnr) (defnr - nrvars)
#define TO_IMPLICIT(defnr) (defnr)
#define EXPL_TO_DEFNR(explnr) (explnr + nrvars)
#define IMPL_TO_DEFNR(implnr) (implnr)
#define IMPLICIT_DEF(v) (v)
#define IMPL_VAR(defnr) (defnr)
#define IS_IMPL_DEF(defnr) (defnr <= nrvars)