now.
+void
conversion(oldtype,newtype)
int oldtype,newtype;
{
+void
extraconvert(oldtype,newtype,topstack)
int oldtype,newtype,topstack;
{
+void
loadarray(type)
int type;
{
+void
dcltype(s)
Symbol *s;
{
+void
warning(str)
char *str;
{
static struct token LexStack[MAX_LL_DEPTH];
static LexSP = 0;
+void skipcomment();
+
/* In PushLex() the actions are taken in order to initialise or
re-initialise the lexical scanner.
E.g. at the invocation of a sub-parser that uses LLlex(), the
}
#ifndef NOPP
+void
skipcomment()
{
/* The last character read has been the '*' of '/_*'. The
extern arith flt_flt2arith();
extern label code_string();
+void
arithbalance(e1p, oper, e2p) /* 3.1.2.5 */
register struct expr **e1p, **e2p;
int oper;
}
}
+void
opnd2test(expp, oper)
register struct expr **expp;
{
ch3bin(expp, NOTEQUAL, intexpr((arith)0, INT));
}
+void
any2opnd(expp, oper)
register struct expr **expp;
{
extern char *symbol2str();
extern struct type *qualifier_type();
+void ch3cast();
+
/* Most expression-handling routines have a pointer to a
(struct type *) as first parameter. The object under the pointer
gets updated in the process.
*/
+void
ch3sel(expp, oper, idf)
struct expr **expp;
struct idf *idf;
ch3asgn(expp, oper, intexpr((arith)1, INT));
}
+void
ch3cast(expp, oper, tp)
register struct expr **expp;
register struct type *tp;
extern char options[];
extern char *symbol2str();
+void pntminuspnt();
+
/* This chapter asks for the repeated application of code to handle
an operation that may be executed at compile time or at run time,
depending on the constancy of the operands.
#define commutative_binop(expp, oper, expr) mk_binop(expp, oper, expr, 1)
#define non_commutative_relop(expp, oper, expr) mk_binop(expp, oper, expr, 1)
+void
ch3bin(expp, oper, expr)
register struct expr **expp;
struct expr *expr;
}
}
+void
pntminuspnt(expp, oper, expr)
register struct expr **expp, *expr;
{
extern char *symbol2str();
extern char *source;
+void loc_init();
+
#ifndef LINT
init_code(dst_file)
char *dst_file;
return_expr_occurred = 1;
}
+void
code_declaration(idf, expr, lvl, sc)
register struct idf *idf; /* idf to be declared */
struct expr *expr; /* initialisation; NULL if absent */
}
}
+void
loc_init(expr, id)
struct expr *expr;
struct idf *id;
it generates a branch instruction to the continue label of the
innermost statement in which continue has a meaning.
*/
+void
code_continue()
{
register struct stmt_block *stmt_block = stmt_stack;
int nestlevel = -1;
+void macro_def();
+void do_define();
+
struct idf *
GetIdentifier(skiponerr)
int skiponerr; /* skip the rest of the line on error */
int lint_skip_comment;
#endif
+void
skip_block(to_endif)
int to_endif;
{
}
}
+void
do_define()
{
/* do_define() interprets a #define control line.
/*NOTREACHED*/
}
+void
macro_def(id, text, nformals, length, flags)
register struct idf *id;
char *text;
expression, whereas other errors use the information in the token.
*/
-static _error();
+static void _error();
#if __STDC__
/*VARARGS*/
}
#endif
-static
+static void
_error(class, fn, ln, fmt, ap)
int class;
char *fn;
#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER)
extern int err_occurred; /* error.c */
+void store_val();
+void load_val();
+
/* EVAL() is the main expression-tree evaluator, which turns
any legal expression tree into EM code. parameters.h:
labels, in case they are specified (i.e. are non-zero)
*/
+void
EVAL(expr, val, code, true_label, false_label)
register struct expr *expr;
int val, code;
- into a local static variable
- absolute addressing
*/
+void
store_val(vl, tp)
register struct value *vl;
register struct type *tp;
- static variable
- local variable
*/
+void
load_val(expr, rlval)
register struct expr *expr; /* expression containing the value */
int rlval; /* generate either LVAL or RVAL */
return expr;
}
+void
chk_cst_expr(expp)
struct expr **expp;
{
#include <idf_pkg.body>
+void global_redecl();
+
struct idf *
gen_idf()
{
}
}
+int
actual_declaration(sc, tp)
int sc;
struct type *tp;
return 1;
}
+void
global_redecl(idf, new_sc, tp)
register struct idf *idf;
struct type *tp;
}
}
+void
idf_initialized(idf)
register struct idf *idf;
{
idf->id_def->df_address = l;
}
+void
check_formals(idf, dc)
struct idf *idf;
struct declarator *dc;
struct type **gen_tphead(), **gen_tpmiddle();
struct sdef *gen_align_to_next();
struct e_stack *p_stack;
+
+void pad();
+void gen_simple_exp();
+void gen_tpcheck();
+
}
/* initial_value recursively guides the initialisation expression.
;
{
+void
gen_tpcheck(tpp)
struct type **tpp;
{
}
}
+void
gen_simple_exp(tpp, expp)
struct type **tpp;
struct expr **expp;
/* pad() fills an element of type tp with zeroes.
If the element is an aggregate, pad() is called recursively.
*/
+void
pad(tpx)
struct type *tpx;
{
{0, 0}
};
+void dependency();
+
#ifndef NOCROSS
arith
short_size = SZ_SHORT,
}
}
+void
dependency(s, source)
char *s, *source;
{
extern char options[];
+void
check_for_void(pl)
register struct proto *pl;
{
}
+void
update_proto(tp, otp)
register struct type *tp, *otp;
{
/* struct/union and enum tags can be declared inside prototypes
* remove them from the symbol-table
*/
+void
remove_proto_tag(tp)
struct type *tp;
{
}
}
+void
call_proto(expp)
register struct expr **expp;
{
struct repl *ReplaceList; /* list of currently active macros */
extern char *strcat(), *strcpy();
+void macro2buffer();
+void getactuals();
+void expand_defined();
+
int
replace(idf)
register struct idf *idf;
return 1;
}
+void
expand_defined(repl)
register struct repl *repl;
{
args->a_rawptr = args->a_rawbuf = Malloc(args->a_rawsize = ARGBUF);
}
+void
getactuals(repl, idf)
struct repl *repl;
register struct idf *idf;
}
}
+void
macro2buffer(repl, idf, args)
register struct repl *repl;
register struct idf *idf;
while (*s) addc_db_str(*s++);
}
-static
+static void
stb_type(tp)
register struct type *tp;
{
#endif /* LINT */
}
+void
stack_idf(idf, stl)
struct idf *idf;
register struct stack_level *stl;
unstack_stmt();
}
+void
code_case(expr)
struct expr *expr;
{
}
}
+void
code_default()
{
register struct switch_hdr *sh = switch_stack;
#endif
}
+void
RegisterAccount(offset, size, regtype, sc)
arith offset, size;
{
#define FLG_ESEEN 0x01 /* possibly a floating point number */
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
+void skipcomment();
+
int
LLlex()
{
/*NOTREACHED*/
}
+void
skipcomment()
{
/* The last character read has been the '*' of '/_*'. The
int nestcount;
extern int do_preprocess;
+void macro_def();
+void do_define();
+
char *
GetIdentifier(skiponerr)
int skiponerr; /* skip the rest of the line on error */
}
}
+void
skip_block(to_endif)
int to_endif;
{
}
}
+void
do_define()
{
/* do_define() interprets a #define control line.
/*NOTREACHED*/
}
+void
macro_def(id, text, nformals, length, flags)
register struct idf *id;
char *text;
extern char **inctable;
extern int inc_max, inc_total;
+void dependency();
+
main(argc, argv)
char *argv[];
{
}
}
+void
dependency(s, source)
char *s, *source;
{
char Xbuf[256];
+void
preprocess(fn)
char *fn;
{
extern int InputLevel;
struct repl *ReplaceList; /* list of currently active macros */
+void expand_defined();
+void getactuals();
+void macro2buffer();
+
int
replace(idf)
register struct idf *idf;
return 1;
}
+void
expand_defined(repl)
register struct repl *repl;
{
args->a_rawptr = args->a_rawbuf = Malloc((unsigned)(args->a_rawsize = ARGBUF));
}
+void
getactuals(repl, idf)
struct repl *repl;
register struct idf *idf;
}
}
+void
macro2buffer(repl, idf, args)
register struct repl *repl;
register struct idf *idf;
return ch;
}
+void
CheckForLineDirective()
{
register int ch = getch();
arith ce_low, ce_up; /* lower and upper bound of range */
};
+void AddCases();
+void AddOneCase();
+
/* STATICALLOCDEF "case_entry" 20 */
/* The constant DENSITY determines when CSA and when CSB instructions
free_switch_hdr(sh);
}
+void
AddCases(sh, node, lbl)
struct switch_hdr *sh;
register t_node *node;
AddOneCase(sh, node, node, lbl);
}
+void
AddOneCase(sh, lnode, rnode, lbl)
register struct switch_hdr *sh;
t_node *lnode, *rnode;
else node_error(nd, mess);
}
+void
MkCoercion(pnd, tp)
t_node **pnd;
register t_type *tp;
extern t_desig null_desig;
int fp_used;
+void RangeCheck();
+void CodeParameters();
+void CodeCall();
+
CodeConst(cst, size)
arith cst;
int size;
}
}
+void
CodeString(nd)
register t_node *nd;
{
}
}
+void
CodeCall(nd)
register t_node *nd;
{
DoLineno(nd);
}
+void
CodeParameters(param, arg)
t_param *param;
register t_node *arg;
return 0;
}
+void
RangeCheck(tpl, tpr)
register t_type *tpl, *tpr;
{
extern char options[];
+void CutSize();
+
overflow(expp)
t_node *expp;
{
#endif
}
+void
cstibin(expp)
t_node **expp;
{
CutSize(exp);
}
+void
cstubin(expp)
t_node **expp;
{
CutSize(exp);
}
+void
cstset(expp)
t_node **expp;
{
}
}
+void
CutSize(expr)
register t_node *expr;
{
}
}
+void
CodeVarDesig(df, ds)
register t_def *df;
register t_desig *ds;
STATIC t_def *DoImport();
+void
ImportEffects(idef, scope, flag)
register t_def *idef;
t_scope *scope;
}
}
+void
EnterFromImportList(idlist, FromDef, FromId)
register t_node *idlist;
register t_def *FromDef;
node, whereas other errors use the information in the token.
*/
+void _error();
+
#if __STDC__
#ifdef DEBUG
/*VARARGS*/
}
#endif
+void
_error(class, node, fmt, ap, warn_class)
int class;
t_node *node;
return nd;
}
+void
FreeNode(nd)
register t_node *nd;
{
while (*s) addc_db_str(*s++);
}
-static
+static void
stb_type(tp, assign_num)
register t_type *tp;
{
*std_type,
*error_type;
+void ArraySizes();
+
t_type *
construct_type(fund, tp)
int fund;
}
}
+void
ArraySizes(tp)
register t_type *tp;
{
static int stabdef();
#endif
static int MkCalls();
-static int UseWarnings();
+static void UseWarnings();
#define NO_EXIT_LABEL ((label) 0)
#define RETURN_LABEL ((label) 1)
#define REACH_FLAG 1
#define EXIT_FLAG 2
+void DoAssign();
+
int
LblWalkNode(lbl, nd, exit, reach)
label lbl, exit;
return 1;
}
+void
DoAssign(nd)
register t_node *nd;
{
}
}
-static
+static void
df_warning(nd, df, warning)
t_node *nd;
t_def *df;
}
}
-static
+static void
UseWarnings(df)
register t_def *df;
{
}
-STATIC
+STATIC void
SkipComment()
{
/* Skip ISO-Pascal comments (* ... *) or { ... }.
static char *s_error = "illegal line directive";
+void
CheckForLineDirective()
{
register int ch;
}
}
+void
AssertStat(expp, line)
register struct node *expp;
unsigned short line;
}
}
+void
AssignStat(left, right)
register struct node *left, *right;
{
FreeNode(right);
}
+void
ProcStat(nd)
register struct node *nd;
{
}
}
+void
ChkForStat(nd)
register struct node *nd;
{
return;
}
+void
EndForStat(nd)
register struct node *nd;
{
C_asp(int_size);
}
+void
WithStat(nd)
struct node *nd;
{
*/
#define compact(nr, low, up) (nr != 0 && (up - low) / nr <= DENSITY)
+void
CaseExpr(nd)
struct node *nd;
{
}
}
+void
CaseEnd(nd, exit_label)
struct node *nd;
label exit_label;
int fp_used;
+void Long2Int();
+void Int2Long();
+void genrck();
+void CodeCall();
+
CodeFil()
{
if ( !options['L'] )
C_loi(tp->tp_size);
}
+void
CodeCall(nd)
register struct node *nd;
{
}
}
+void
Long2Int()
{
/* convert a long to integer */
C_cii();
}
+void
Int2Long()
{
/* convert integer to long */
}
}
+void
genrck(tp)
register struct type *tp;
{
expp->nd_right = NULLNODE;
}
+void
cstbin(expp)
register struct node *expp;
{
expp->nd_left = expp->nd_right = NULLNODE;
}
+void
cstset(expp)
register struct node *expp;
{
return MkDef(id, scope, kind);
}
+void
DoDirective(directive, nd, tp, scl, function)
struct idf *directive;
struct node *nd;
struct desig InitDesig = {DSG_INIT, 0, 0, NULLDEF, 0};
struct withdesig *WithDesigs;
+void CodeValue();
STATIC int
properly(ds, size, al)
C_sti(sz);
}
+void
CodeMove(rhs, left, rtp)
register struct desig *rhs;
register struct node *left;
}
}
+void
CodeValue(ds, tp)
register struct desig *ds;
register struct type *tp;
ds->dsg_packed = df->fld_flags & F_PACKED;
}
+void
CodeVarDesig(df, ds)
register struct def *df;
register struct desig *ds;
extern char *symbol2str();
+void _error();
+
/* There are three general error-message functions:
lexerror() lexical and pre-processor error messages
error() syntactic and pre-processor messagese
}
#endif
+void
_error(class, node, fmt, ap)
int class;
struct node *node;
#include "scope.h"
#include "type.h"
+void CodeLabel();
+
DeclLabel(nd)
struct node *nd;
CodeLabel(df, 1);
}
+void
DefLabel(nd, Slevel)
register struct node *nd;
{
}
}
+void
CodeLabel(df, local)
register struct def *df;
{
return nd;
}
+void
FreeNode(nd)
register struct node *nd;
{
static int outpflag = 0; /* output mentioned in heading ? */
static label extfl_label; /* label of array of file pointers */
+void make_extfl_args();
+
set_inp()
{
inpflag = 1;
outpflag = 1;
}
+void
make_extfl()
{
if( err_occurred ) return;
make_extfl_args( GlobalScope->sc_def );
}
+void
make_extfl_args(df)
register struct def *df;
{
extern char *sprint();
+void CodeRead();
+void CodeReadln();
+void CodeWrite();
+void CodeWriteln();
+
+void
ChkRead(arg)
register struct node *arg;
{
}
}
+void
ChkReadln(arg)
register struct node *arg;
{
CodeReadln(file);
}
+void
ChkWrite(arg)
register struct node *arg;
{
}
}
+void
ChkWriteln(arg)
register struct node *arg;
{
return nd;
}
+void
CodeRead(file, arg)
register struct node *file, *arg;
{
}
}
+void
CodeReadln(file)
struct node *file;
{
C_asp(pointer_size);
}
+void
CodeWrite(file, arg)
register struct node *file, *arg;
{
}
}
+void
CodeWriteln(file)
register struct node *file;
{
while (*s) addc_db_str(*s++);
}
-static
+static void
stb_type(tp, assign_num)
register struct type *tp;
{
(arith) 0);
}
+void
stb_string(df, kind)
register struct def *df;
long kind;
*void_type,
*error_type;
+void ArraySizes();
+
CheckTypeSizes()
{
/* first, do some checking
return algn;
}
+void
ArraySizes(tp)
register struct type *tp;
{
C_rom_cst(tp->arr_elsize);
}
+void
FreeForward(for_type)
register struct forwtype *for_type;
{
}
}
+void
ea_1(param) {
if (! address_long) {
ea_1_16(param);
}
}
+void
indexed() {
if (address_long) {
mod_2 = 0;
full lbytes;
#endif
+void
prolog(nlocals) full nlocals; {
fputs("push ebp\nmov ebp,esp\n", codefile);
}
#endif /* MACH_OPTIONS */
+void
mes(type) word type ; {
int argt, a1, a2 ;
}
+void
prolog(nlocals) full nlocals; {
fprintf(codefile,"\tpush\tb\n\tlxi\th,0\n\tdad\tsp\n\tmov\tb,h\n\tmov\tc,l\n");
}
}
+void
mes(type) word type ; {
int argt ;
full lbytes;
#endif
+void
prolog(nlocals) full nlocals; {
fputs("\tpush\tbp\n\tmov\tbp,sp\n", codefile);
}
#endif /* REGVARS */
+void
mes(type) word type ; {
int argt ;
* then emitted in one go, by emit_instr().
*/
+void move_special();
+
emit_instr()
{
register instr_t *ip;
T_EMIT2((short)(words), 0, 0, 0);
}
+void
ea_1(sz, bits)
{
/* Because displacements come in three sizes (null displacement,
serror("bad operand(s)");
}
+void
shift_op(opc, sz)
{
if (mrg_1 < 010 && mrg_2 < 010) {
ea_2(SIZE_W, MEM|ALT);
}
+void
bitop(opc)
{
register bits;
ea_2(SIZE_L, (mrg_2 < 010) ? 0 : (CTR | ALT));
}
+void
add(opc, sz)
{
if ((mrg_2 & 070) == 010)
badoperand();
}
+void
and(opc, sz)
{
if (mrg_1 == 074 && mrg_2 >= 076) { /* ccr or sr */
return(1);
}
+void
cmp(sz)
{
register opc;
ea_2(sz, 0);
}
+void
move(sz)
{
register opc;
ea_2(sz, ALT);
}
+void
move_special(sz)
{
if (mrg_2 >= 076) {
return regs;
}
+void
movep(sz)
{
checksize(sz, 2|4);
badoperand();
}
+void
branch(opc, exp)
expr_t exp;
{
T_EMIT4(exp.val, exp.typ, RELPC|RELO4, relonami);
}
+void
cpbcc(opc, exp)
expr_t exp;
{
T_EMIT4(exp.val, exp.typ, RELPC|RELO4, relonami);
}
+void
ea7071(sz)
{
mrg_2 = 071;
mrg_2 = 070;
}
+void
fbranch(opc, exp)
expr_t exp;
{
fprintf(codefile, "!Local %ld into %s\n",off,s);
}
+void
prolog(n) full n; {
nlocals = n;
}
#endif /* MACH_OPTIONS */
+void
mes(type) word type ; {
int argt, a1, a2 ;
#define FL_MSB_AT_LOW_ADDRESS 1
#include <con_float>
+void
prolog(full nlocals)
{
int ss = nlocals + 8;
framesize = nlocals;
}
+void
mes(word type)
{
int argt ;
extern YYSTYPE yylval;
+void setupoutput();
+void commfinish();
+
/* ========== Machine independent C routines ========== */
void stop() {
#endif
}
+void
setupoutput()
{
register sect_t *sp;
outhead.oh_nchar = off; /* see newsymb() */
}
+void
commfinish()
{
#ifndef ASLD
extern YYSTYPE yylval;
+void putval();
+
yylex()
{
register c;
return(c);
}
+void
putval(c)
{
register valu_t v;
#include "comm1.h"
#include "y.tab.h"
+void switchsect();
+void newsymb();
+void newident();
+
newequate(ip, typ)
register item_t *ip;
register int typ;
newident(ip, typ);
}
+void
newident(ip, typ)
register item_t *ip;
{
);
}
+void
newlabel(ip)
register item_t *ip;
{
}
}
+void
switchsect(newtyp)
int newtyp;
{
}
#ifdef RELOCATION
+void
newrelo(s, n)
{
int iscomm;
return r;
}
+void
newsymb(name, type, desc, valu)
register char *name;
valu_t valu;
return(mystrcpy(buf));
}
+void
compute(node, presult) register node_p node; register result_t *presult; {
result_t leaf1,leaf2;
register token_p tp;
int regclass[NREGS];
struct perm *perms;
+void permute();
+
struct perm *
tuples(regls,nregneeded) rl_p *regls; {
int class=0;
return(perms);
}
+void
permute(index) {
register struct perm *pp;
register rl_p rlp;
extern double atof();
void prolog(full nlocals);
+void mes();
+void bss();
+void savelab();
+void dumplab();
+void part_flush();
+void xdumplab();
+void switchseg();
/* Own version of atol that continues computing on overflow.
We don't know that about the ANSI C one.
in_finish() {
}
+void
fillemlines() {
register int t,i;
register struct emline *lp;
}
}
+void
dopseudo() {
register b,t;
register full n;
return(mystrcpy(argstr));
}
+void
bss(n,t,b) full n; {
register long s = 0;
switchseg(SEGTXT);
}
+void
switchseg(s) {
if (s == curseg)
fprintf(codefile,"%s\n",segname[s]);
}
+void
savelab() {
register char *p,*q;
;
}
+void
dumplab() {
if (labstr[0] == 0)
labstr[0] = 0;
}
+void
xdumplab() {
if (labstr[0] == 0)
newdlb(labstr);
}
+void
part_flush() {
/*
putc('\n',codefile);
}
+void
prtoken(tp,leadingchar) token_p tp; {
register c;
register char *code;
static label_p label_list = (label_p)0;
extern char *myalloc();
+void
add_label(num, height, flth)
{
register label_p lbl = (label_p)0;
return(rvlp);
}
+void
tryreg(rvlp,typ) register struct regvar *rvlp; {
int score;
register i;
char *stab[MAXSTAB];
int nstab=0;
+void chkstr();
+
string myalloc(size) {
register string p;
return(1);
}
+void
garbage_collect() {
register i;
struct emline *emlp;
nstab = fillp-stab;
}
+void
chkstr(str,used) string str; char used[]; {
register low,middle,high;
extern int nstab; /* salloc.c */
+void bmove();
+
savestatus(sp) register state_p sp; {
sp->st_sh = stackheight;
popstr(sp->st_ns);
}
+void
bmove(from,to,nbytes) register short *from,*to; register nbytes; {
if (nbytes<=0)
return(result.e_v.e_con);
}
+void
instance(instno,token) register token_p token; {
register inst_p inp;
int i;
}
}
+void
cinstance(instno,token,tp,regno) register token_p token,tp; {
register inst_p inp;
int i;
char *REST; /* Opcode of first instruction not matched by current pattern */
+void labeldef();
+void set_opcode();
+
#include "gen.c"
/* Try to recognize the opcode part of an instruction */
+void
set_opcode(ip)
register instr_p ip;
{
+void
labeldef(ip)
register instr_p ip;
{
framesize = nlocals;
}
-mes(word type)
+void mes(word type)
{
int argt ;
STATIC printset();
STATIC int check();
STATIC moreverbose();
-STATIC prrule();
+STATIC void prrule(p_gram p);
STATIC cfcheck();
-STATIC resolve();
+STATIC void resolve(p_gram p);
STATIC propagate();
STATIC spaces();
}
STATIC
-prrule(p) register p_gram p; {
+void prrule(p_gram p) {
/*
* Create a verbose printout of grammar rule p
*/
}
STATIC
-resolve(p) register p_gram p; {
+void resolve(p_gram p) {
/*
* resolve conflicts, as specified by the user
*/
/* Defined in this file : */
extern do_compute();
STATIC createsets();
-STATIC walk();
+STATIC void walk();
STATIC co_trans();
STATIC int nempty();
extern empty();
STATIC first();
STATIC int nfollow();
STATIC follow();
-STATIC co_dirsymb();
+STATIC void co_dirsymb();
STATIC co_others();
STATIC do_lengthcomp();
-STATIC complength();
-STATIC add();
+STATIC void complength();
+STATIC void add();
STATIC int compare();
-STATIC setdefaults();
+STATIC void setdefaults();
STATIC do_contains();
-STATIC contains();
+STATIC void contains();
STATIC int nsafes();
STATIC int do_safes();
#ifdef NON_CORRECTING
}
}
-STATIC
+STATIC void
walk(u, p) p_set u; register p_gram p; {
/*
* Walk through the grammar rule p, allocating sets
#endif
-STATIC
+STATIC void
co_dirsymb(setp,p) p_set setp; register p_gram p; {
/*
* Walk the rule p, doing the work for alternations
free ((p_mem) length);
}
-STATIC
+STATIC void
complength(p,le) register p_gram p; p_length le; {
/*
* Walk grammar rule p, computing minimum lengths
}
}
-STATIC
+STATIC void
add(a, c, v) register p_length a; {
if (a->cnt == INFINITY || c == INFINITY) {
return a->val - b->val;
}
-STATIC
+STATIC void
setdefaults(p) register p_gram p; {
for (;;) {
switch(g_gettype(p)) {
}
}
-STATIC
+STATIC void
contains(p,set) register p_gram p; register p_set set; {
/*
* Does the real computation of the contains-sets
#endif
STATIC string genname();
STATIC generate();
-STATIC prset();
-STATIC macro();
+STATIC void prset();
+STATIC void macro();
STATIC controlline();
STATIC getparams();
STATIC getansiparams();
STATIC genprototypes();
STATIC gettok();
-STATIC rulecode();
+STATIC void rulecode();
STATIC int * dopush();
STATIC int * mk_tokenlist();
-STATIC getaction();
-STATIC alternation();
+STATIC void getaction();
+STATIC void alternation();
STATIC codeforterm();
STATIC genswhead();
STATIC gencases();
STATIC genpush();
STATIC genpop();
-STATIC genincrdecr();
+STATIC void genincrdecr();
STATIC add_cases();
STATIC int analyze_switch();
STATIC out_list();
}
}
-STATIC
+STATIC void
prset(p) p_set p; {
register int k;
register unsigned i;
/* NOTREACHED */
}
-STATIC
+STATIC void
macro(s,n) string s; p_nont n; {
int i;
}
}
-STATIC
+STATIC void
rulecode(p,safety,mustscan,mustpop) register p_gram p; {
/*
* Code for a production rule.
}
}
-STATIC
+STATIC void
alternation(pp, safety, mustscan, mustpop, lb)
p_gram pp;
{
# define max(a,b) ((a) < (b) ? (b) : (a))
-STATIC
+STATIC void
getaction(flag) {
/* Read an action from the action file.
* flag = 1 if it is an action,
genincrdecr("incr", d);
}
-STATIC
+STATIC void
genincrdecr(s, d) string s; {
if (d == NOPOP) return;
if (d >= 0) {
extern fatal();
extern comfatal();
extern copyfile();
-extern install();
+extern void install();
extern char *mktemp();
extern char *sbrk();
}
/* VARARGS1 */
+void
warning(lineno,s,t,u) string s,t,u; {
/*
* Just a warning
fclose(f);
}
+void
install(target, source) string target, source; {
/*
* Copy the temporary file generated from source to target
/* In this file the following routines are defined: */
extern co_reach();
STATIC reachable();
-STATIC reachwalk();
+STATIC void reachwalk();
co_reach() {
/*
}
}
-STATIC
+STATIC void
reachwalk(p) register p_gram p; {
/*
* Walk through rule p, looking for nonterminals.
extern p_set setalloc();
extern p_gram search();
-STATIC save_rule();
-STATIC save_set();
+STATIC void save_rule();
+STATIC void save_set();
/* t_list will contain terms to be `flattened' */
static struct t_list {
fprintf(fgram, "#define LLNNONTERMINALS %d\n", nt_highest - assval + 1);
}
-STATIC
+STATIC void
save_rule(p, tail) register p_gram p; int tail; {
/*
Walk through rule p, saving it. The non-terminal tail is
}
}
-STATIC
+STATIC void
save_set(p) p_set p; {
register int k;
register unsigned i;
extern LLmessage();
extern int input();
extern unput();
-extern skipcomment();
+extern void skipcomment();
# ifdef LINE_DIRECTIVE
STATIC linedirective();
# endif
STATIC string cpy();
STATIC string vallookup();
-STATIC copyact();
+STATIC void copyact();
static int nparams;
# line 75 "tokens.g"
static int nostartline; /* = 0 if at the start of a line */
# endif
-STATIC
+STATIC void
copyact(ch1,ch2,flag,level) char ch1,ch2; {
/*
* Copy an action to file f. Opening bracket is ch1, closing bracket
backupc = c;
}
-skipcomment(flag) {
+void skipcomment(flag) {
/*
* Skip comment. If flag != 0, the comment is inside a fragment
* of C-code, so keep it.
extern LLmessage();
extern int input();
extern unput();
-extern skipcomment();
+extern void skipcomment();
# ifdef LINE_DIRECTIVE
STATIC linedirective();
# endif
STATIC string cpy();
STATIC string vallookup();
-STATIC copyact();
+STATIC void copyact();
static int nparams;
}
static int nostartline; /* = 0 if at the start of a line */
# endif
-STATIC
+STATIC void
copyact(ch1,ch2,flag,level) char ch1,ch2; {
/*
* Copy an action to file f. Opening bracket is ch1, closing bracket
backupc = c;
}
+void
skipcomment(flag) {
/*
* Skip comment. If flag != 0, the comment is inside a fragment
}
}
+void
rmtemps() {
/* Called in case of disaster, always remove the current output file!
*/
}
}
+void
gr_throw(id) register growstring *id ; {
/* Throw the string away */
if ( id->gr_max==0 ) return ;
/* Routines used */
-extern int gr_throw() ; /* To free the core */
+extern void gr_throw() ; /* To free the core */
extern int gr_add() ; /* To add one character */
extern int gr_cat() ; /* concatenate the contents and the string */
extern int gr_init() ; /* Initialize the bookkeeping */
extern char *getenv();
+void vieuwargs();
+
main(argc,argv) char **argv ; {
register list_elem *elem ;
register char *frontend ;
/************************* flag processing ***********************/
+void
vieuwargs(argc,argv) char **argv ; {
register char *argp;
register int nextarg ;
int offset ;
+void readm();
+
main(argc,argv) char **argv ; {
register i ;
return fopen(dname,"r");
}
+void
readm() {
register int i ;
register int token ;
static char *ty_name ;
static char *bol ;
+void open_in();
static char *inname ;
static char *inptr ;
char *em_dir = EM_DIR;
+void
open_in(name) register char *name ; {
register dmach *cmac ;
static char rcs_id[] = "$Id$" ;
#endif
+void try();
+
enum f_path getpath(first) register trf **first ; {
/* Try to find a transformation path */
last_ocount= 0 ;
}
+void
try(f_scan,suffix) list_elem *f_scan; char *suffix; {
register list_elem *scan ;
register trf *trafo ;
char *headvar(),*tailvar() ;
+void condit();
+void doassign();
+void set_Rflag();
+
int transform(phase) register trf *phase ; {
int ok ;
setpvar(keeps(TAIL),tailvar) ;
}
+void
set_Rflag(argp) register char *argp ; {
register char *eos ;
register list_elem *prog ;
return result ;
}
+void
condit(line,fsuff,lsuff,tailval) growstring *line ;
list_head *fsuff, *lsuff;
char *tailval ;
return 1 ;
}
+void
doassign(line,star,length) char *line, *star ; {
growstring varval, name, temp ;
register char *ptr ;
static list_head *curargs ;
static list_head *comb_args ;
+void
addargs(string) char *string ; {
register char *temp, *repc ;
register list_elem *elem ;
# define STDOUT stderr
#endif
+void fuerror(const char* fmt, ...);
+void werror(const char* fmt, ...);
+
char *basename(string) char *string ; {
static char retval[256] ;
char *last_dot, *last_start ;
char *filename;
int narg;
+void do_file();
+
main(argc, argv)
char **argv;
{
}
}
+void
do_file(fd)
int fd;
{
extern char *mktemp();
extern char *ctime();
+void do_object();
+void write_symdef();
+void add();
+
usage()
{
error(TRUE, "usage: %s [qdprtxl][vlc] archive [file] ...\n",
close(ar_fd);
}
+void
add(name, fd, mess)
char *name;
int fd;
* then 4 bytes giving the size of the string table, followed by the string
* table itself.
*/
+void
write_symdef()
{
register struct ranlib *ran;
return !BADMAGIC(*headp) && headp->oh_nname != 0;
}
+void
do_object(f, size)
long size;
{
-STATIC bo_tryloop(p,loop)
+STATIC void bo_tryloop(p,loop)
proc_p p;
lset loop;
{
}
}
+void
bo_switch(b)
bblock_p b;
{
}
}
+void
bo_optimize(p)
proc_p p;
{
return cnt;
}
-STATIC getdnames(dumpd)
+STATIC void getdnames(dumpd)
FILE* dumpd;
{
/* Read the names of the datalabels from
}
}
-STATIC getpnames(dumpp)
+STATIC void getpnames(dumpp)
FILE* dumpp;
{
/* Read the names of the procedures from
}
-STATIC mark_blocks(lp)
+STATIC void mark_blocks(lp)
loop_p lp;
{
/* Mark the strong and firm blocks of a loop.
STATIC int Scj; /* number of optimizations found */
-STATIC showinstr();
+STATIC void showinstr();
+void
cj_optimize(p)
proc_p p;
{
extern char em_mnem[]; /* The mnemonics of the EM instructions. */
-STATIC showinstr(lnp) line_p lnp; {
+STATIC void showinstr(lnp) line_p lnp; {
/* Makes the instruction in `lnp' human readable. Only lines that
* can occur in expressions that are going to be eliminated are
start_valnum();
}
-STATIC cs_optimize(p)
+STATIC void cs_optimize(p)
proc_p p;
{
/* Optimize all basic blocks of one procedure. */
/* NOTREACHED */
}
-STATIC check_local(avp)
+STATIC void check_local(avp)
avail_p avp;
{
/* Check if the local in which the result of avp was stored,
extern char em_mnem[]; /* The mnemonics of the EM instructions. */
-STATIC showinstr(lnp)
+STATIC void showinstr(lnp)
line_p lnp;
{
/* Makes the instruction in `lnp' human readable. Only lines that
}
}
-STATIC kill_sim()
+STATIC void kill_sim()
{
/* A store is done into the ENIGNMASK. */
#define WORD_MULTIPLE(n) ((n / ws) * ws + ( n % ws ? ws : 0 ))
+void
Pop(tkp, size)
token_p tkp;
offset size;
}
}
-STATIC skip_arguments()
+STATIC void skip_arguments()
{
/* Skip the arguments of a MES pseudo. The argument
* list is terminated by a sp_cend byte.
+void
rem_indir_acc(p)
proc_p p;
{
extern remov_formals(); /* (proc_p p)
* Remove the formals-list of p from core.
*/
-extern rem_indir_acc(); /* (proc_p p)
+extern void rem_indir_acc(); /* (proc_p p)
* Remove formal that may be accessed
* indirectly from formal lists of p
*/
-STATIC inc_count(caller,callee)
+STATIC void inc_count(caller,callee)
proc_p caller, callee;
{
/* Update the call-count information.
+void
formal(p,b,off,type,usage)
proc_p p;
bblock_p b;
* I L 1 _ F O R M A L . C
*/
-extern formal(); /* (proc_p p; bblock_p b; offset off;
+extern void formal(); /* (proc_p p; bblock_p b; offset off;
* int type, usage)
* Analyze a reference to a parameter of p.
* The type denotes its size (single,double,
/* modify */
-STATIC act_info(off,acts,ab_off,act_out,off_out)
+STATIC void act_info(off,acts,ab_off,act_out,off_out)
offset off, ab_off, *off_out;
actual_p acts, *act_out;
{
+void
insert(text,l,firstline)
line_p text,l,firstline;
{
* call nc the same way as the text of
* call c would be modified.
*/
-extern insert(); /* (line_p text,l,firstline)
+extern void insert(); /* (line_p text,l,firstline)
* Insert the modified EM text.
* Pseudos are put after the pseudos
* of the caller.
+void
remunit(kind,p,l)
short kind;
proc_p p;
}
+void
lv_optimize(p)
proc_p p;
{
}
+void
ra_optimize(p)
proc_p p;
{
-STATIC add_item(item,t,items)
+STATIC void add_item(item,t,items)
item_p item;
time_p t;
item_p items[];
}
p->p_localbytes = nrlocals;
}
+
+void
rem_formals(p,allocs)
proc_p p;
alloc_p allocs;
short nrlocals;
local_p *locals; /* dynamic array */
-STATIC localvar(off,size,locs,reg,score)
+STATIC void localvar(off,size,locs,reg,score)
offset off;
short size;
local_p *locs;
-STATIC check_local_use(l,locs)
+STATIC void check_local_use(l,locs)
line_p l;
local_p *locs;
{
-find_local(off,nr_out,found_out)
+void find_local(off,nr_out,found_out)
offset off;
short *nr_out;
bool *found_out;
-var_nr(l,nr_out,found_out)
+void var_nr(l,nr_out,found_out)
line_p l;
short *nr_out;
bool *found_out;
* these variables ('locals') and count them
* ('nrlocals'). Also collect register messages.
*/
-extern var_nr(); /* (line_p l; short *nr_out;bool *found_out)
+extern void var_nr(); /* (line_p l; short *nr_out;bool *found_out)
* Compute the 'variable number' of the
* variable referenced by EM instruction l.
*/
-extern find_local(); /* (offset off; short *nr_out; bool *found_out)
+extern void find_local(); /* (offset off; short *nr_out; bool *found_out)
* Try to find the local variable at the given
* offset. Return its local-number.
*/
+void
putunit(kind,p,l,gf,lf)
short kind;
proc_p p;
* the fields computed by CF will not be
* written (used by the IC phase).
*/
-extern putunit(); /* (short kind; proc_p p; line_p l;
+extern void putunit(); /* (short kind; proc_p p; line_p l;
* FILE *gf, *lf)
* If kind = LTEXT, then write
* the control flow graph to file gf,
}
+void
sp_optimize(p)
proc_p p;
{
}
+void
sr_optimize(p)
proc_p p;
{
}
-STATIC try_cand(lnp,b)
+STATIC void try_cand(lnp,b)
line_p lnp;
bblock_p b;
{
}
-STATIC try_patterns(lnp)
+STATIC void try_patterns(lnp)
line_p lnp;
{
/* lnp is a STL x; try to recognize
-STATIC try_multiply(lp,ivs,vars,b,mul)
+STATIC void try_multiply(lp,ivs,vars,b,mul)
loop_p lp;
lset ivs,vars;
bblock_p b;
-STATIC try_leftshift(lp,ivs,vars,b,shft)
+STATIC void try_leftshift(lp,ivs,vars,b,shft)
loop_p lp;
lset ivs,vars;
bblock_p b;
}
-STATIC try_array(lp,ivs,vars,b,arr)
+STATIC void try_array(lp,ivs,vars,b,arr)
loop_p lp;
lset ivs,vars;
bblock_p b;
}
+void
make_header(lp)
loop_p lp;
{
* onto/from the stack, depending on dir(ection).
* We accept all kinds of pointer sizes.
*/
-extern make_header() ; /* (loop_p lp) */
+extern 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.
}
+void
ud_optimize(p)
proc_p p;
{
-STATIC search_backwards(use,v,found,def)
+STATIC void search_backwards(use,v,found,def)
line_p use, *def;
short v;
bool *found;
#define COUNT 0
#define MAP 1
-STATIC traverse_defs(p,action)
+STATIC void traverse_defs(p,action)
proc_p p;
int action;
{
-STATIC gen_kill_copies(p)
+STATIC void gen_kill_copies(p)
proc_p p;
{
/* Compute C_GEN and C_KILL for every basic block
-STATIC impl_gen_defs(l,gen_p)
+STATIC void impl_gen_defs(l,gen_p)
line_p l;
cset *gen_p;
{
static transfer();
extern ind_t savechar();
+
+void namerelocate();
+
/*
* Get section sizes and symboltable information from present module.
*/
* Otherwise we just add the accumulated size of all normal parts in preceding
* sections with the same size.
*/
+void
namerelocate(name)
register struct outname *name;
{
static struct outname *makename();
static pass1();
static evaluate();
-static norm_commons();
+static void norm_commons();
static complete_sections();
-static change_names();
+static void change_names();
static bool tstbit();
static second_pass();
static pass2();
static do_statistics();
#endif
+void addbase();
+
main(argc, argv)
int argc;
char **argv;
* just like "normal" names. We also count the total size of common names
* within each section to be able to compute the final size in the machine.
*/
-static
+static void
norm_commons()
{
register struct outname *name;
* For each name we add the base of its section to its value, unless
* the output has to be able to be linked again, as indicated by RFLAG.
*/
-static
+static void
change_names()
{
register int cnt;
/*
* Add the base of the section of a name to its value.
*/
+void
addbase(name)
struct outname *name;
{
* Reset index into piece of memory for modules and
* take care that the allocated pieces will not be moved.
*/
+void
freeze_core()
{
register int i;
#include "const.h"
#include "memory.h"
-static generate_section_names();
+static void generate_section_names();
extern struct outhead outhead;
extern bool incore;
* Generate names for all sections and put them after the global names.
* Section names are used for relocation.
*/
-static
+static void
generate_section_names()
{
register struct outname *name;
extern bool incore;
extern char *core_alloc();
+void
savemagic()
{
register char *p;
}
}
+void
savehdr(hdr)
struct ar_hdr *hdr;
{
* allocation, but the string of which name->on_foff is the offset may be
* destroyed, so we save that first.
*/
+void
savelocal(name)
struct outname *name;
{
move_t l_moves[MAXMOVES];
short posmoves[MAXREGS+MAXTOKENS][SETSIZE];
+void
n_move(s1,e1,s2,e2,vi) struct varinfo *vi; {
register move_p mp;
register i,j;
test_t l_tests[MAXTESTS];
short postests[SETSIZE];
+void
n_test(s,e,vi) struct varinfo *vi; {
register test_p tp;
register i;
sp[i] |= l_sets[s].set_val[i];
}
+void
checkstacking(sp) register short *sp; {
register i;
register short *chkset;
/*VARARGS5*/
+void
n_coerc(ti,be,al,ge,rp,in) struct varinfo *al,*ge,*rp; iocc_t in; {
register c3_p c3p;
register i;
outars();
}
+void
codecoco(cocono) {
if (cocono== -1)
return(result);
}
-static
+static void
checksize(s)
register set_p s;
{
l_props[propno].pr_size = size;
}
+void
prophall(n) {
register i;
short hallset[SETSIZE];
}
}
+void
freevi(vip) register struct varinfo *vip; {
register i;
*/
+void
cleanup() {
FILE *infile;
register c;
* Author: Hans van Staveren
*/
+void reach();
+
flow() {
findreach(); /* determine reachable labels */
}
}
+void
reach(lnp) register line_p lnp; {
register num_p np;
return(table3(n));
}
+void
getlines() {
register line_p lnp;
register instr;
* Author: Hans van Staveren
*/
+void
regvar(ap) register arg_p ap; {
register reg_p rp;
register i;
}
}
+void
incregusage(off) offset off; {
register reg_p rp;
}
}
+void
tes_instr(lnp, x, y)
line_p lnp, x, y;
{