put heavily used pointer variables in registers

This commit is contained in:
erikb 1986-09-24 13:53:16 +00:00
parent bfad7d30f0
commit c967d1ab3a
29 changed files with 275 additions and 280 deletions

View file

@ -1,12 +1,12 @@
/* $Header$ */
/* L E X I C A L A N A L Y Z E R */
#include "nofloat.h"
#include "idfsize.h"
#include "numsize.h"
#include "debug.h"
#include "strsize.h"
#include "nopp.h"
#include "input.h"
#include "alloc.h"
#include "arith.h"

View file

@ -6,6 +6,8 @@
to it.
*/
#include "nofloat.h"
/* the structure of a token: */
struct token {
int tok_symb; /* the token itself */

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* PARSER ERROR ADMINISTRATION */
#include "nofloat.h"
#include "idf.h"
#include "alloc.h"
#include "arith.h"

View file

@ -75,7 +75,7 @@ GSRC = char.c symbol2str.c next.c \
# .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE!
GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \
idepth.h idfsize.h ifdepth.h inputtype.h inumlength.h lapbuf.h \
maxincl.h myalloc.h nobitfield.h nopp.h \
maxincl.h myalloc.h nobitfield.h nofloat.h nopp.h \
nparams.h numsize.h parbufsize.h pathlength.h predefine.h \
strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h
@ -205,47 +205,47 @@ sim: cfiles
$(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC)
#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
main.o: LLlex.h Lpars.h alloc.h arith.h debug.h declar.h idf.h input.h inputtype.h level.h maxincl.h myalloc.h nobitfield.h nopp.h spec_arith.h specials.h target_sizes.h tokenname.h type.h use_tmp.h
idf.o: LLlex.h Lpars.h align.h alloc.h arith.h assert.h botch_free.h debug.h declar.h decspecs.h def.h idf.h idfsize.h label.h level.h nobitfield.h nopp.h sizes.h spec_arith.h specials.h stack.h storage.h struct.h type.h
declarator.o: Lpars.h alloc.h arith.h botch_free.h declar.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h
decspecs.o: Lpars.h arith.h decspecs.h def.h level.h nobitfield.h spec_arith.h type.h
struct.o: LLlex.h Lpars.h align.h arith.h assert.h botch_free.h debug.h def.h field.h idf.h level.h nobitfield.h nopp.h sizes.h spec_arith.h stack.h storage.h struct.h type.h
expr.o: LLlex.h Lpars.h alloc.h arith.h botch_free.h declar.h decspecs.h def.h expr.h idf.h label.h level.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h
ch7.o: Lpars.h arith.h assert.h debug.h def.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h struct.h type.h
ch7bin.o: Lpars.h arith.h botch_free.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h storage.h struct.h type.h
cstoper.o: Lpars.h arith.h assert.h debug.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h target_sizes.h type.h
arith.o: Lpars.h alloc.h arith.h botch_free.h expr.h field.h idf.h label.h mes.h nobitfield.h nopp.h spec_arith.h storage.h type.h
alloc.o: alloc.h assert.h debug.h myalloc.h
code.o: LLlex.h Lpars.h alloc.h arith.h assert.h atw.h botch_free.h code.h dataflow.h debug.h declar.h decspecs.h def.h expr.h idf.h label.h level.h mes.h nobitfield.h nopp.h sizes.h spec_arith.h specials.h stack.h stmt.h storage.h type.h use_tmp.h
dumpidf.o: Lpars.h arith.h debug.h def.h expr.h field.h idf.h label.h nobitfield.h nopp.h spec_arith.h stack.h static.h struct.h type.h
error.o: LLlex.h arith.h debug.h errout.h expr.h label.h nopp.h spec_arith.h tokenname.h use_tmp.h
field.o: Lpars.h arith.h assert.h code.h debug.h expr.h field.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h type.h
tokenname.o: LLlex.h Lpars.h arith.h idf.h nopp.h spec_arith.h tokenname.h
LLlex.o: LLlex.h Lpars.h alloc.h arith.h assert.h class.h debug.h def.h idf.h idfsize.h input.h nopp.h numsize.h sizes.h spec_arith.h strsize.h
LLmessage.o: LLlex.h Lpars.h alloc.h arith.h idf.h nopp.h spec_arith.h
input.o: LLlex.h alloc.h arith.h assert.h debug.h idepth.h input.h inputtype.h interface.h nopp.h pathlength.h spec_arith.h static.h
domacro.o: LLlex.h Lpars.h alloc.h arith.h assert.h botch_free.h class.h debug.h idf.h idfsize.h ifdepth.h input.h interface.h macro.h nopp.h nparams.h parbufsize.h spec_arith.h storage.h textsize.h
replace.o: LLlex.h alloc.h arith.h assert.h class.h debug.h idf.h input.h interface.h macro.h nopp.h pathlength.h spec_arith.h static.h strsize.h
init.o: alloc.h class.h idf.h interface.h macro.h nopp.h predefine.h
options.o: align.h arith.h class.h idf.h idfsize.h macro.h maxincl.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h use_tmp.h
scan.o: class.h idf.h input.h interface.h lapbuf.h macro.h nopp.h nparams.h
skip.o: LLlex.h arith.h class.h input.h interface.h nopp.h spec_arith.h
stack.o: Lpars.h alloc.h arith.h botch_free.h debug.h def.h idf.h level.h mes.h nobitfield.h nopp.h spec_arith.h stack.h storage.h struct.h type.h use_tmp.h
type.o: Lpars.h align.h alloc.h arith.h def.h idf.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h
ch7mon.o: Lpars.h arith.h botch_free.h def.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h storage.h type.h
label.o: Lpars.h arith.h def.h idf.h label.h level.h nobitfield.h nopp.h spec_arith.h type.h
eval.o: Lpars.h align.h arith.h assert.h atw.h code.h dataflow.h debug.h def.h expr.h idf.h label.h level.h mes.h nobitfield.h nopp.h sizes.h spec_arith.h stack.h type.h
switch.o: Lpars.h arith.h assert.h botch_free.h code.h debug.h density.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h storage.h switch.h type.h
storage.o: alloc.h assert.h botch_free.h debug.h storage.h
ival.o: Lpars.h align.h arith.h assert.h class.h debug.h def.h expr.h field.h idf.h label.h level.h nobitfield.h nopp.h sizes.h spec_arith.h struct.h type.h
conversion.o: Lpars.h arith.h nobitfield.h sizes.h spec_arith.h type.h
blocks.o: arith.h atw.h sizes.h spec_arith.h
dataflow.o: dataflow.h
tokenfile.o: Lpars.h
declar.o: LLlex.h Lpars.h arith.h debug.h declar.h decspecs.h def.h expr.h field.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h struct.h type.h
statement.o: LLlex.h Lpars.h arith.h botch_free.h code.h debug.h def.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h stack.h storage.h type.h
expression.o: LLlex.h Lpars.h arith.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h type.h
program.o: LLlex.h Lpars.h alloc.h arith.h code.h declar.h decspecs.h def.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h type.h
LLlex.o: LLlex.h Lpars.h alloc.h arith.h assert.h class.h debug.h def.h idf.h idfsize.h input.h nofloat.h nopp.h numsize.h sizes.h spec_arith.h strsize.h
LLmessage.o: LLlex.h Lpars.h alloc.h arith.h idf.h nofloat.h nopp.h spec_arith.h
Lpars.o: Lpars.h
alloc.o: alloc.h assert.h debug.h myalloc.h
arith.o: Lpars.h alloc.h arith.h botch_free.h expr.h field.h idf.h label.h mes.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h type.h
blocks.o: arith.h atw.h nofloat.h sizes.h spec_arith.h
ch7.o: Lpars.h arith.h assert.h debug.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h struct.h type.h
ch7bin.o: Lpars.h arith.h botch_free.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h struct.h type.h
ch7mon.o: Lpars.h arith.h botch_free.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h type.h
char.o: class.h
code.o: LLlex.h Lpars.h alloc.h arith.h assert.h atw.h botch_free.h code.h dataflow.h debug.h declar.h decspecs.h def.h expr.h idf.h label.h level.h mes.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h specials.h stack.h stmt.h storage.h type.h use_tmp.h
conversion.o: Lpars.h arith.h nobitfield.h nofloat.h sizes.h spec_arith.h type.h
cstoper.o: Lpars.h arith.h assert.h debug.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h target_sizes.h type.h
dataflow.o: dataflow.h
declar.o: LLlex.h Lpars.h arith.h debug.h declar.h decspecs.h def.h expr.h field.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h struct.h type.h
declarator.o: Lpars.h alloc.h arith.h botch_free.h declar.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h type.h
decspecs.o: Lpars.h arith.h decspecs.h def.h level.h nobitfield.h nofloat.h spec_arith.h type.h
domacro.o: LLlex.h Lpars.h alloc.h arith.h assert.h botch_free.h class.h debug.h idf.h idfsize.h ifdepth.h input.h interface.h macro.h nofloat.h nopp.h nparams.h parbufsize.h spec_arith.h storage.h textsize.h
dumpidf.o: Lpars.h arith.h debug.h def.h expr.h field.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h static.h struct.h type.h
error.o: LLlex.h arith.h debug.h errout.h expr.h label.h nofloat.h nopp.h spec_arith.h tokenname.h use_tmp.h
eval.o: Lpars.h align.h arith.h assert.h atw.h code.h dataflow.h debug.h def.h expr.h idf.h label.h level.h mes.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h stack.h type.h
expr.o: LLlex.h Lpars.h alloc.h arith.h botch_free.h declar.h decspecs.h def.h expr.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h type.h
expression.o: LLlex.h Lpars.h arith.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h
field.o: Lpars.h arith.h assert.h code.h debug.h expr.h field.h idf.h label.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h type.h
idf.o: LLlex.h Lpars.h align.h alloc.h arith.h assert.h botch_free.h debug.h declar.h decspecs.h def.h idf.h idfsize.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h specials.h stack.h storage.h struct.h type.h
init.o: alloc.h class.h idf.h interface.h macro.h nopp.h predefine.h
input.o: LLlex.h alloc.h arith.h assert.h debug.h idepth.h input.h inputtype.h interface.h nofloat.h nopp.h pathlength.h spec_arith.h static.h
ival.o: Lpars.h align.h arith.h assert.h class.h debug.h def.h expr.h field.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h struct.h type.h
label.o: Lpars.h arith.h def.h idf.h label.h level.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h
main.o: LLlex.h Lpars.h alloc.h arith.h debug.h declar.h idf.h input.h inputtype.h level.h maxincl.h myalloc.h nobitfield.h nofloat.h nopp.h spec_arith.h specials.h target_sizes.h tokenname.h type.h use_tmp.h
options.o: align.h arith.h class.h idf.h idfsize.h macro.h maxincl.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h use_tmp.h
program.o: LLlex.h Lpars.h alloc.h arith.h code.h declar.h decspecs.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h type.h
replace.o: LLlex.h alloc.h arith.h assert.h class.h debug.h idf.h input.h interface.h macro.h nofloat.h nopp.h pathlength.h spec_arith.h static.h strsize.h
scan.o: class.h idf.h input.h interface.h lapbuf.h macro.h nopp.h nparams.h
skip.o: LLlex.h arith.h class.h input.h interface.h nofloat.h nopp.h spec_arith.h
stack.o: Lpars.h alloc.h arith.h botch_free.h debug.h def.h idf.h level.h mes.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h storage.h struct.h type.h use_tmp.h
statement.o: LLlex.h Lpars.h arith.h botch_free.h code.h debug.h def.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h stack.h storage.h type.h
storage.o: alloc.h assert.h botch_free.h debug.h storage.h
struct.o: LLlex.h Lpars.h align.h arith.h assert.h botch_free.h debug.h def.h field.h idf.h level.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h stack.h storage.h struct.h type.h
switch.o: Lpars.h arith.h assert.h botch_free.h code.h debug.h density.h expr.h idf.h label.h nobitfield.h nofloat.h nopp.h spec_arith.h storage.h switch.h type.h
symbol2str.o: Lpars.h
tokenfile.o: Lpars.h
tokenname.o: LLlex.h Lpars.h arith.h idf.h nofloat.h nopp.h spec_arith.h tokenname.h
type.o: Lpars.h align.h alloc.h arith.h def.h idf.h nobitfield.h nofloat.h nopp.h sizes.h spec_arith.h storage.h type.h

View file

@ -133,3 +133,8 @@
!File: static.h
#define GSTATIC /* for large global "static" arrays */
!File: nofloat.h
#undef NOFLOAT /* floats implemented by default */

View file

@ -1,6 +1,8 @@
/* $Header$ */
/* A L I G N M E N T D E F I N I T I O N S */
#include "nofloat.h"
extern int
short_align, word_align, int_align, long_align,
#ifndef NOFLOAT

View file

@ -7,6 +7,7 @@
semantics of C is a mess.
*/
#include "nofloat.h"
#include "botch_free.h"
#include "nobitfield.h"
#include "alloc.h"
@ -25,7 +26,8 @@ extern char options[];
int
arithbalance(e1p, oper, e2p) /* RM 6.6 */
struct expr **e1p, **e2p;
register struct expr **e1p, **e2p;
int oper;
{
/* The expressions *e1p and *e2p are balanced to be operands
of the arithmetic operator oper.
@ -127,9 +129,9 @@ any2arith(expp, oper)
/* Turns any expression into int_type, long_type or
double_type.
*/
int fund = (*expp)->ex_type->tp_fund;
int fund;
switch (fund) {
switch (fund = (*expp)->ex_type->tp_fund) {
case CHAR:
case SHORT:
int2int(expp,
@ -174,7 +176,7 @@ any2arith(expp, oper)
}
erroneous2int(expp)
struct expr **expp;
register struct expr **expp;
{
/* the (erroneous) expression *expp is replaced by an
int expression
@ -190,7 +192,7 @@ struct expr *
arith2arith(tp, oper, expr)
struct type *tp;
int oper;
struct expr *expr;
register struct expr *expr;
{
/* arith2arith constructs a new expression containing a
run-time conversion between some arithmetic types.
@ -280,7 +282,7 @@ array2pointer(expp)
}
function2pointer(expp)
struct expr **expp;
register struct expr **expp;
{
/* The expression, which must be a function, is converted
to a pointer to the function.
@ -295,7 +297,7 @@ string2pointer(expp)
/* The expression, which must be a string constant, is converted
to a pointer to the string-containing area.
*/
struct expr *ex = *expp;
register struct expr *ex = *expp;
label lbl = data_label();
code_string(ex->SG_VALUE, ex->SG_LEN, lbl);
@ -306,7 +308,7 @@ string2pointer(expp)
}
opnd2integral(expp, oper)
struct expr **expp;
register struct expr **expp;
int oper;
{
register int fund = (*expp)->ex_type->tp_fund;
@ -320,7 +322,7 @@ opnd2integral(expp, oper)
}
opnd2logical(expp, oper)
struct expr **expp;
register struct expr **expp;
int oper;
{
register int fund;
@ -332,11 +334,7 @@ opnd2logical(expp, oper)
if ((*expp)->ex_type->tp_fund == FIELD)
field2arith(expp);
#endif NOBITFIELD
fund = (*expp)->ex_type->tp_fund;
switch (fund) {
switch (fund = (*expp)->ex_type->tp_fund) {
case CHAR:
case SHORT:
case INT:
@ -358,7 +356,7 @@ opnd2logical(expp, oper)
}
opnd2test(expp, oper)
struct expr **expp;
register struct expr **expp;
{
opnd2logical(expp, oper);
if ((*expp)->ex_class == Oper && is_test_op((*expp)->OP_OPER))
@ -429,7 +427,7 @@ is_asgn_op(oper)
}
any2opnd(expp, oper)
struct expr **expp;
register struct expr **expp;
{
if (!*expp)
return;

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* S E M A N T I C A N A L Y S I S -- C H A P T E R 7 RM */
#include "nofloat.h"
#include "debug.h"
#include "nobitfield.h"
#include "idf.h"

View file

@ -1,7 +1,8 @@
/* $Header$ */
/* SEMANTIC ANALYSIS (CHAPTER 7RM) -- BINARY OPERATORS */
#include "botch_free.h" /* UF */
#include "nofloat.h"
#include "botch_free.h"
#include "idf.h"
#include "arith.h"
#include "type.h"

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* SEMANTIC ANALYSIS (CHAPTER 7RM) -- MONADIC OPERATORS */
#include "nofloat.h"
#include "nobitfield.h"
#include "botch_free.h"
#include "Lpars.h"

View file

@ -1,12 +1,11 @@
/* $Header$ */
/* C O D E - G E N E R A T I N G R O U T I N E S */
#include "nofloat.h"
#include <em.h>
#include "dataflow.h"
#include "use_tmp.h"
#include "botch_free.h"
#include "arith.h"
#include "type.h"
#include "idf.h"
@ -67,7 +66,7 @@ code_string(val, len, dlb)
int len;
label dlb;
{
struct string_cst *sc = new_string_cst();
register struct string_cst *sc = new_string_cst();
C_ina_dlb(dlb);
sc->next = str_list;
@ -107,14 +106,14 @@ prepend_scopes(dst_file)
and generates those exa's, exp's, ina's and inp's
that superior hindsight has provided, on the file dst_file.
*/
struct stack_entry *se = local_level->sl_entry;
register struct stack_entry *se = local_level->sl_entry;
if (C_open(dst_file) == 0)
fatal("cannot create %s", dst_file ? dst_file : "stdout");
famous_first_words();
while (se != 0) {
struct idf *idf = se->se_idf;
struct def *def = idf->id_def;
register struct idf *idf = se->se_idf;
register struct def *def = idf->id_def;
if (def &&
( def->df_initialized ||
@ -131,7 +130,7 @@ prepend_scopes(dst_file)
code_scope(text, def)
char *text;
struct def *def;
register struct def *def;
{
/* generates code for one name, text, of the storage class
as given by def, if meaningful.
@ -165,7 +164,7 @@ static label file_name_label;
begin_proc(name, def) /* to be called when entering a procedure */
char *name;
struct def *def;
register struct def *def;
{
/* begin_proc() is called at the entrance of a new function
and performs the necessary code generation:
@ -291,7 +290,7 @@ do_return_expr(expr)
}
code_declaration(idf, expr, lvl, sc)
struct idf *idf; /* idf to be declared */
register struct idf *idf; /* idf to be declared */
struct expr *expr; /* initialisation; NULL if absent */
int lvl; /* declaration level */
int sc; /* storage class, as in the declaration */
@ -319,7 +318,7 @@ code_declaration(idf, expr, lvl, sc)
extern int a = 5;
*/
char *text = idf->id_text;
struct def *def = idf->id_def;
register struct def *def = idf->id_def;
arith size = def->df_type->tp_size;
int def_sc = def->df_sc;
@ -437,7 +436,7 @@ loc_init(expr, id)
}
bss(idf)
struct idf *idf;
register struct idf *idf;
{
/* bss() allocates bss space for the global idf.
*/
@ -456,21 +455,21 @@ bss(idf)
C_bss_cst(align(size, word_align), (arith)0, 1);
}
formal_cvt(def)
struct def *def;
formal_cvt(df)
register struct def *df;
{
/* formal_cvt() converts a formal parameter of type char or
short from int to that type.
*/
register struct type* tp = def->df_type;
register struct type *tp = df->df_type;
if (tp->tp_size != int_size)
if (tp->tp_fund == CHAR || tp->tp_fund == SHORT) {
C_lol(def->df_address);
conversion(int_type, def->df_type);
C_lal(def->df_address);
C_lol(df->df_address);
conversion(int_type, df->df_type);
C_lal(df->df_address);
C_sti(tp->tp_size);
def->df_register = REG_NONE;
df->df_register = REG_NONE;
}
}

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* C O N V E R S I O N - C O D E G E N E R A T O R */
#include "nofloat.h"
#include <em.h>
#include "arith.h"
#include "type.h"
@ -29,30 +30,23 @@ conversion(from_type, to_type)
arith from_size;
arith to_size;
if (from_type == to_type) { /* a little optimisation */
if (from_type == to_type) /* a little optimisation */
return;
}
from_size = from_type->tp_size;
to_size = to_type->tp_size;
switch (fundamental(from_type)) {
case T_SIGNED:
switch (fundamental(to_type)) {
case T_SIGNED:
C_loc(from_size);
C_loc(to_size < word_size ? word_size : to_size);
C_cii();
break;
case T_UNSIGNED:
C_loc(from_size < word_size ? word_size : from_size);
C_loc(to_size < word_size ? word_size : to_size);
C_ciu();
break;
#ifndef NOFLOAT
case T_FLOATING:
C_loc(from_size < word_size ? word_size : from_size);
@ -62,21 +56,16 @@ conversion(from_type, to_type)
#endif NOFLOAT
}
break;
case T_UNSIGNED:
C_loc(from_size < word_size ? word_size : from_size);
C_loc(to_size < word_size ? word_size : to_size);
switch (fundamental(to_type)) {
case T_SIGNED:
C_cui();
break;
case T_UNSIGNED:
C_cuu();
break;
#ifndef NOFLOAT
case T_FLOATING:
C_cuf();
@ -84,22 +73,17 @@ conversion(from_type, to_type)
#endif NOFLOAT
}
break;
#ifndef NOFLOAT
case T_FLOATING:
C_loc(from_size < word_size ? word_size : from_size);
C_loc(to_size < word_size ? word_size : to_size);
switch (fundamental(to_type)) {
case T_SIGNED:
C_cfi();
break;
case T_UNSIGNED:
C_cfu();
break;
case T_FLOATING:
C_cff();
break;
@ -116,10 +100,9 @@ conversion(from_type, to_type)
*/
int
fundamental(tp)
struct type *tp;
register struct type *tp;
{
switch (tp->tp_fund) {
case CHAR:
case SHORT:
case INT:
@ -127,13 +110,11 @@ fundamental(tp)
case LONG:
case ENUM:
return tp->tp_unsigned ? T_UNSIGNED : T_SIGNED;
#ifndef NOFLOAT
case FLOAT:
case DOUBLE:
return T_FLOATING;
#endif NOFLOAT
case POINTER: /* pointer : signed / unsigned ??? */
return T_SIGNED;
}

View file

@ -1,8 +1,7 @@
/* $Header$ */
/* C O N S T A N T E X P R E S S I O N H A N D L I N G */
#include "target_sizes.h" /* UF */
#include "target_sizes.h"
#include "idf.h"
#include "arith.h"
#include "type.h"
@ -19,14 +18,14 @@ arith max_int; /* maximum integer on target machine */
arith max_unsigned; /* maximum unsigned on target machine */
cstbin(expp, oper, expr)
struct expr **expp, *expr;
register struct expr **expp, *expr;
{
/* The operation oper is performed on the constant
expressions *expp(ld) and expr(ct), and the result restored in
*expp.
*/
arith o1 = (*expp)->VL_VALUE;
arith o2 = expr->VL_VALUE;
register arith o1 = (*expp)->VL_VALUE;
register arith o2 = expr->VL_VALUE;
int uns = (*expp)->ex_type->tp_unsigned;
ASSERT(is_ld_cst(*expp) && is_cp_cst(expr));
@ -184,7 +183,7 @@ cstbin(expp, oper, expr)
}
cut_size(expr)
struct expr *expr;
register struct expr *expr;
{
/* The constant value of the expression expr is made to
conform to the size of the type of the expression.
@ -214,8 +213,8 @@ cut_size(expr)
init_cst()
{
int i = 0;
arith bt = (arith)0;
register int i = 0;
register arith bt = (arith)0;
while (!(bt < 0)) {
bt = (bt << 8) + 0377, i++;
@ -227,8 +226,6 @@ init_cst()
mach_long_sign = 1 << (mach_long_size * 8 - 1);
if (long_size < mach_long_size)
fatal("sizeof (long) insufficient on this machine");
max_int = full_mask[int_size] & ~(1 << (int_size * 8 - 1));
max_unsigned = full_mask[int_size];
}

View file

@ -33,7 +33,7 @@ declare_type(tp, dc)
}
add_decl_unary(dc, fund, count, fm)
struct declarator *dc;
register struct declarator *dc;
arith count;
struct formal *fm;
{
@ -77,7 +77,7 @@ remove_declarator(dc)
}
reject_params(dc)
struct declarator *dc;
register struct declarator *dc;
{
/* The declarator is checked to have no parameters, if it
is a function.
@ -90,7 +90,7 @@ reject_params(dc)
}
array_subscript(expr)
struct expr *expr;
register struct expr *expr;
{
arith size = expr->VL_VALUE;

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* D E C L A R A T I O N S P E C I F I E R C H E C K I N G */
#include "nofloat.h"
#include "Lpars.h"
#include "decspecs.h"
#include "arith.h"
@ -15,12 +16,12 @@ extern char *symbol2str();
struct decspecs null_decspecs;
do_decspecs(ds)
struct decspecs *ds;
register struct decspecs *ds;
{
/* The provisional decspecs ds as obtained from the program
is turned into a legal consistent decspecs.
*/
struct type *tp = ds->ds_type;
register struct type *tp = ds->ds_type;
if (level == L_FORMAL1)
crash("do_decspecs");

View file

@ -4,6 +4,7 @@
#include "debug.h"
#ifdef DEBUG
#include "nofloat.h"
#include "nopp.h"
#include "nobitfield.h"
#include "arith.h"
@ -41,7 +42,7 @@ static int dumplevel;
static
newline() {
int dl = dumplevel;
register int dl = dumplevel;
print("\n");
while (dl >= 2) {
@ -66,7 +67,7 @@ dumpidftab(msg, opt)
print(">>> DUMPIDF, %s (start)", msg);
dumpstack();
for (i = 0; i < HASHSIZE; i++) {
struct idf *notch = idf_hashtable[i];
register struct idf *notch = idf_hashtable[i];
while (notch) {
dumpidf(notch, opt);
@ -77,13 +78,14 @@ dumpidftab(msg, opt)
print(">>> DUMPIDF, %s (end)\n", msg);
}
dumpstack() {
dumpstack()
{
/* Dumps the identifier stack, starting at the top.
*/
struct stack_level *stl = local_level;
register struct stack_level *stl = local_level;
while (stl) {
struct stack_entry *se = stl->sl_entry;
register struct stack_entry *se = stl->sl_entry;
newline();
print("%3d: ", stl->sl_level);
@ -97,7 +99,7 @@ dumpstack() {
}
dumpidf(idf, opt)
struct idf *idf;
register struct idf *idf;
{
/* All information about the identifier idf is divulged in a
hopefully readable format.
@ -174,7 +176,7 @@ dumpdefs(def, opt)
}
dumptags(tag)
struct tag *tag;
register struct tag *tag;
{
dumplevel++;
while (tag) {
@ -202,7 +204,7 @@ dumptags(tag)
}
dumpsdefs(sdef, sdk)
struct sdef *sdef;
register struct sdef *sdef;
enum sdef_kind sdk;
{
/* Since sdef's are members of two chains, there are actually
@ -235,7 +237,7 @@ dumpsdefs(sdef, sdk)
char *
type2str(tp)
struct type *tp;
register struct type *tp;
{
/* Yields a pointer to a one-line description of the type tp.
*/
@ -312,7 +314,7 @@ print_expr(msg, expr)
}
p1_expr(lvl, expr)
struct expr *expr;
register struct expr *expr;
{
extern char *type2str(), *symbol2str();
@ -389,7 +391,9 @@ p1_expr(lvl, expr)
}
}
p1_indent(lvl) {
p1_indent(lvl)
register int lvl;
{
while (lvl--)
print(" ");
}

View file

@ -12,11 +12,10 @@
compare()
*/
#include "nofloat.h"
#include <em.h>
#include "debug.h"
#include "nobitfield.h"
#include "dataflow.h"
#include "arith.h"
#include "type.h"
@ -71,13 +70,13 @@ arith tmp_pointer_var();
*/
EVAL(expr, val, code, true_label, false_label)
struct expr *expr; /* the expression tree itself */
register struct expr *expr; /* the expression tree itself */
int val; /* either RVAL or LVAL */
int code; /* generate explicit code or not */
label true_label;
label false_label; /* labels to jump to in logical expr's */
{
register gencode = (code == TRUE);
register int gencode = (code == TRUE);
switch (expr->ex_class) {
case Value: /* just a simple value */
@ -87,7 +86,9 @@ EVAL(expr, val, code, true_label, false_label)
case String: /* a string constant */
expr_warning(expr, "(DEBUG) value-class 'String' seen");
if (gencode) {
string2pointer(&expr);
struct expr *ex = expr;
string2pointer(&ex);
expr = ex;
C_lae_dlb(expr->VL_LBL, expr->VL_VALUE);
}
break;
@ -105,7 +106,7 @@ EVAL(expr, val, code, true_label, false_label)
#endif NOFLOAT
case Oper: /* compound expression */
{
register int oper = expr->OP_OPER;
int oper = expr->OP_OPER;
register struct expr *leftop = expr->OP_LEFT;
register struct expr *rightop = expr->OP_RIGHT;
register struct type *tp = expr->OP_TYPE;
@ -250,12 +251,11 @@ EVAL(expr, val, code, true_label, false_label)
EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
ASSERT(tp->tp_fund==INT || tp->tp_fund==LONG);
if (gencode) {
if (gencode)
if (tp->tp_unsigned)
C_rmu(tp->tp_size);
else
C_rmi(tp->tp_size);
}
break;
case LEFT:
EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
@ -429,22 +429,21 @@ EVAL(expr, val, code, true_label, false_label)
}
case '(':
{
register struct expr *expr;
register struct expr *ex;
arith ParSize = (arith)0;
if (expr = rightop) {
if ((ex = rightop) != NILEXPR) {
/* function call with parameters*/
while ( expr->ex_class == Oper &&
expr->OP_OPER == PARCOMMA
) {
EVAL(expr->OP_RIGHT, RVAL, TRUE,
while ( ex->ex_class == Oper &&
ex->OP_OPER == PARCOMMA
) {
EVAL(ex->OP_RIGHT, RVAL, TRUE,
NO_LABEL, NO_LABEL);
ParSize +=
ATW(expr->ex_type->tp_size);
expr = expr->OP_LEFT;
ParSize += ATW(ex->ex_type->tp_size);
ex = ex->OP_LEFT;
}
EVAL(expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
ParSize += ATW(expr->ex_type->tp_size);
EVAL(ex, RVAL, TRUE, NO_LABEL, NO_LABEL);
ParSize += ATW(ex->ex_type->tp_size);
}
if ( leftop->ex_class == Value
&& leftop->VL_CLASS == Name
@ -469,14 +468,14 @@ EVAL(expr, val, code, true_label, false_label)
/* remove parameters from stack */
if (ParSize > (arith)0)
C_asp(ParSize);
if (!gencode)
break;
if (is_struct_or_union(tp->tp_fund)) {
C_lfr(pointer_size);
load_block(tp->tp_size, tp->tp_align);
if (gencode) {
if (is_struct_or_union(tp->tp_fund)) {
C_lfr(pointer_size);
load_block(tp->tp_size, tp->tp_align);
}
else
C_lfr(ATW(tp->tp_size));
}
else
C_lfr(ATW(tp->tp_size));
break;
}
case '.':
@ -507,22 +506,32 @@ EVAL(expr, val, code, true_label, false_label)
{
arith old_offset, tmp;
arith esize = tp->tp_size;
int compl; /* Complexity of left operand */
#ifndef NOBITFIELD
if (leftop->ex_type->tp_fund == FIELD) {
eval_field(expr, code);
break;
}
#endif NOBITFIELD
if (leftop->ex_class != Value) {
if (leftop->ex_class == Value) {
compl = 0; /* Value */
load_val(leftop, RVAL);
}
else
if (leftop->ex_depth == 1 && leftop->OP_OPER == ARROW) {
compl = 1; /* Value->sel */
ASSERT(leftop->OP_LEFT->ex_class == Value);
EVAL(leftop, RVAL, TRUE, NO_LABEL, NO_LABEL);
}
else {
compl = 2; /* otherwise */
tmp = tmp_pointer_var(&old_offset);
EVAL(leftop, LVAL, TRUE, NO_LABEL, NO_LABEL);
C_dup(pointer_size);
C_lal(tmp);
C_sti(pointer_size);
C_loi(tp->tp_size);
C_loi(esize);
}
else
load_val(leftop, RVAL);
/* We made the choice to put this stuff here
and not to put the conversion in the expression
@ -542,17 +551,23 @@ EVAL(expr, val, code, true_label, false_label)
C_dup(esize);
if (tp->tp_size < word_size)
conversion(word_type, tp);
if (leftop->ex_class != Value) {
if (compl == 0) {
store_val(
&(leftop->ex_object.ex_value),
leftop->ex_type
);
}
else
if (compl == 1) {
EVAL(leftop, LVAL, TRUE, NO_LABEL, NO_LABEL);
C_sti(tp->tp_size);
}
else {
C_lal(tmp); /* always init'd */
C_loi(pointer_size);
C_sti(tp->tp_size);
free_tmp_var(old_offset);
}
else
store_val(
&(leftop->ex_object.ex_value),
leftop->ex_type
);
break;
}
case '?': /* must be followed by ':' */
@ -685,7 +700,6 @@ EVAL(expr, val, code, true_label, false_label)
expr->ex_type->tp_align);
break;
}
case Type:
default:
crash("(EVAL) bad expression class");
}
@ -722,13 +736,13 @@ compare(relop, lbl)
/* assop() generates the opcode of an assignment operators op= */
assop(type, oper)
struct type *type;
register struct type *type;
int oper;
{
register arith size = type->tp_size;
register arith size;
register uns = type->tp_unsigned;
if (size < word_size)
if ((size = type->tp_size) < word_size)
size = word_size;
switch (type->tp_fund) {
case CHAR:
@ -837,7 +851,7 @@ arith
tmp_pointer_var(oldoffset)
arith *oldoffset; /* previous allocated address */
{
struct stack_level *stl = local_level;
register struct stack_level *stl = local_level;
*oldoffset = stl->sl_local_offset;
stl->sl_local_offset =
@ -940,16 +954,16 @@ store_val(vl, tp)
- local variable
*/
load_val(expr, val)
struct expr *expr; /* expression containing the value */
register struct expr *expr; /* expression containing the value */
int val; /* generate either LVAL or RVAL */
{
register struct type *tp = expr->ex_type;
register int rvalue = (val == RVAL && expr->ex_lvalue != 0);
register arith size = tp->tp_size;
register int tpalign = tp->tp_align;
register int al_on_word;
int rvalue = (val == RVAL && expr->ex_lvalue != 0);
arith size = tp->tp_size;
int tpalign = tp->tp_align;
int al_on_word;
register int inword, indword;
register arith val = expr->VL_VALUE;
arith val = expr->VL_VALUE;
if (expr->VL_CLASS == Const) {
if (rvalue) { /* absolute addressing */

View file

@ -1,7 +1,8 @@
/* $Header$ */
/* EXPRESSION TREE HANDLING */
#include "botch_free.h" /* UF */
#include "nofloat.h"
#include "botch_free.h"
#include "alloc.h"
#include "idf.h"
#include "arith.h"
@ -92,7 +93,7 @@ rank_of(oper)
int
rank_of_expression(expr)
struct expr *expr;
register struct expr *expr;
{
/* Returns the rank of the top node in the expression.
*/
@ -115,7 +116,7 @@ check_conditional(expr, oper, pos_descr)
}
dot2expr(expp)
struct expr **expp;
register struct expr **expp;
{
/* The token in dot is converted into an expression, a
pointer to which is stored in *expp.
@ -146,7 +147,7 @@ dot2expr(expp)
}
idf2expr(expr)
struct expr *expr;
register struct expr *expr;
{
/* Dot contains an identifier which is turned into an
expression.
@ -205,7 +206,7 @@ idf2expr(expr)
}
string2expr(expr)
struct expr *expr;
register struct expr *expr;
{
/* Dot contains a string which is turned into an expression.
*/
@ -228,7 +229,7 @@ int2expr(expr)
#ifndef NOFLOAT
float2expr(expr)
struct expr *expr;
register struct expr *expr;
{
/* Dot contains a floating point constant which is turned
into an expression.
@ -243,11 +244,12 @@ float2expr(expr)
struct expr*
intexpr(ivalue, fund)
arith ivalue;
int fund;
{
/* The value ivalue is turned into an integer expression of
the size indicated by fund.
*/
struct expr *expr = new_expr();
register struct expr *expr = new_expr();
clear((char *)expr, sizeof(struct expr));
expr->ex_file = dot.tk_file;
@ -258,8 +260,9 @@ intexpr(ivalue, fund)
}
fill_int_expr(expr, ivalue, fund)
struct expr *expr;
register struct expr *expr;
arith ivalue;
int fund;
{
/* Details derived from ivalue and fund are put into the
constant integer expression expr.
@ -308,12 +311,12 @@ new_oper(tp, e1, oper, e2)
During the construction of the right recursive initialisation
tree it is possible for e2 to be NILEXPR.
*/
struct expr *expr = new_expr();
struct oper *op;
register struct expr *expr = new_expr();
register struct oper *op;
clear((char *)expr, sizeof(struct expr));
if (e2) {
struct expr *e = e2;
register struct expr *e = e2;
while (e->ex_class == Oper && e->OP_LEFT)
e = e->OP_LEFT;
@ -322,7 +325,7 @@ new_oper(tp, e1, oper, e2)
}
else
if (e1) {
struct expr *e = e1;
register struct expr *e = e1;
while (e->ex_class == Oper && e->OP_RIGHT)
e = e->OP_RIGHT;
@ -387,7 +390,7 @@ chk_cst_expr(expp)
register struct expr *expr = *expp;
register int fund = expr->ex_type->tp_fund;
register int flags = expr->ex_flags;
register int err = 0;
int err = 0;
#ifdef DEBUG
print_expr("constant_expression", expr);
@ -417,7 +420,7 @@ chk_cst_expr(expp)
}
init_expression(eppp, expr)
struct expr ***eppp, *expr;
register struct expr ***eppp, *expr;
{
/* The expression expr is added to the tree designated
indirectly by **eppp.
@ -468,7 +471,7 @@ is_fp_cst(expr)
#endif NOFLOAT
free_expression(expr)
struct expr *expr;
register struct expr *expr;
{
/* The expression expr is freed recursively.
*/

View file

@ -5,6 +5,8 @@
a union of various goodies, we define them first; so be patient.
*/
#include "nofloat.h"
/* classes of value */
#define Const 1
#define Name 2

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* IDENTIFIER FIDDLING & SYMBOL TABLE HANDLING */
#include "nofloat.h"
#include "debug.h"
#include "idfsize.h"
#include "botch_free.h"
@ -86,11 +87,11 @@ idf_hashed(tg, size, hc)
hash_stat()
{
if (options['h']) {
int i;
register int i;
print("Hash table tally:\n");
for (i = 0; i < HASHSIZE; i++) {
struct idf *notch = idf_hashtable[i];
register struct idf *notch = idf_hashtable[i];
int cnt = 0;
while (notch) {
@ -374,8 +375,8 @@ actual_declaration(sc, tp)
}
global_redecl(idf, new_sc, tp)
struct idf *idf;
struct type *tp;
register struct idf *idf;
register struct type *tp;
{
/* A global identifier may be declared several times,
provided the declarations do not conflict; they might
@ -386,7 +387,7 @@ global_redecl(idf, new_sc, tp)
register struct def *def = idf->id_def;
if (tp != def->df_type) {
struct type *otp = def->df_type;
register struct type *otp = def->df_type;
if ( tp->tp_fund != ARRAY || otp->tp_fund != ARRAY ||
tp->tp_up != otp->tp_up
@ -425,10 +426,8 @@ global_redecl(idf, new_sc, tp)
return; /* no new information */
switch (def->df_sc) { /* the old storage class */
case EXTERN:
switch (new_sc) { /* the new storage class */
case EXTERN:
case GLOBAL:
break;
@ -449,10 +448,8 @@ global_redecl(idf, new_sc, tp)
break;
}
break;
case GLOBAL:
switch (new_sc) { /* the new storage class */
case EXTERN:
def->df_sc = EXTERN;
break;
@ -475,10 +472,8 @@ global_redecl(idf, new_sc, tp)
break;
}
break;
case STATIC:
switch (new_sc) { /* the new storage class */
case EXTERN:
if (def->df_initialized) {
error("cannot redeclare %s to extern",
@ -501,10 +496,8 @@ global_redecl(idf, new_sc, tp)
break;
}
break;
case IMPLICIT:
switch (new_sc) { /* the new storage class */
case EXTERN:
case GLOBAL:
def->df_sc = new_sc;
@ -520,7 +513,6 @@ global_redecl(idf, new_sc, tp)
break;
}
break;
case ENUM:
case TYPEDEF:
error("illegal redeclaration of %s", idf->id_text);
@ -550,7 +542,7 @@ good_formal(def, idf)
}
declare_params(dc)
struct declarator *dc;
register struct declarator *dc;
{
/* Declares the formal parameters if they exist.
*/
@ -607,7 +599,7 @@ declare_formals(fp)
An address is assigned to each formal parameter.
The total size of the formals is returned in *fp;
*/
struct stack_entry *se = stack_level_of(L_FORMAL1)->sl_entry;
register struct stack_entry *se = stack_level_of(L_FORMAL1)->sl_entry;
arith f_offset = (arith)0;
#ifdef DEBUG
@ -615,8 +607,7 @@ declare_formals(fp)
dumpidftab("start declare_formals", 0);
#endif DEBUG
while (se) {
struct idf *idf = se->se_idf;
struct def *def = idf->id_def;
register struct def *def = se->se_idf->id_def;
def->df_address = f_offset;
@ -624,8 +615,7 @@ declare_formals(fp)
word boundaries, i.e. take care that the following
parameter starts on a new word boundary.
*/
f_offset = align(f_offset + def->df_type->tp_size,
word_align);
f_offset = align(f_offset + def->df_type->tp_size, word_align);
/* the following is absurd: any char or short formal
must be converted from integer to that type
@ -673,7 +663,7 @@ update_ahead(idf)
}
free_formals(fm)
struct formal *fm;
register struct formal *fm;
{
while (fm) {
register struct formal *tmp = fm->next;
@ -684,11 +674,12 @@ free_formals(fm)
char hmask[IDFSIZE];
init_hmask() {
init_hmask()
{
/* A simple congruence random number generator, as
described in Knuth, vol 2.
*/
int h, rnd = HASH_X;
register int h, rnd = HASH_X;
for (h = 0; h < IDFSIZE; h++) {
hmask[h] = rnd;

View file

@ -1,11 +1,10 @@
/* $Header$ */
/* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */
#include "nofloat.h"
#include <em.h>
#include "debug.h"
#include "nobitfield.h"
#include "arith.h"
#include "align.h"
#include "label.h"
@ -54,7 +53,7 @@ do_ival(tpp, ex)
struct expr *
IVAL(tpp, ex)
struct type **tpp; /* type of global variable */
struct expr *ex; /* initialiser expression */
register struct expr *ex; /* initialiser expression */
{
register struct type *tp = *tpp;
@ -116,7 +115,7 @@ IVAL(tpp, ex)
*/
struct expr *
do_array(ex, tpp)
struct expr *ex;
register struct expr *ex;
struct type **tpp;
{
register struct type *tp = *tpp;
@ -215,10 +214,10 @@ do_array(ex, tpp)
*/
struct expr *
do_struct(ex, tp)
struct expr *ex;
struct type *tp;
register struct expr *ex;
register struct type *tp;
{
struct sdef *sd = tp->tp_sdef;
register struct sdef *sd = tp->tp_sdef;
arith bytes_upto_here = (arith)0;
arith last_offset = (arith)-1;
@ -248,8 +247,7 @@ do_struct(ex, tp)
put_bf(sd->sd_type, (arith)0);
else {
/* fundamental type, not embraced */
check_ival(ex->OP_LEFT,
sd->sd_type);
check_ival(ex->OP_LEFT, sd->sd_type);
ex = ex->OP_RIGHT;
}
#endif NOBITFIELD
@ -293,11 +291,11 @@ do_struct(ex, tp)
the rest is zeroed.
*/
check_and_pad(ex, tpp)
struct expr *ex;
register struct expr *ex;
struct type **tpp;
{
/* ex is of a fundamental type */
struct type *tp = *tpp;
register struct type *tp = *tpp;
if (tp->tp_fund == ARRAY) {
if (valid_type(tp->tp_up, "array element") == 0)
@ -339,7 +337,7 @@ check_and_pad(ex, tpp)
If the element is an aggregate, pad() is called recursively.
*/
pad(tp)
struct type *tp;
register struct type *tp;
{
switch (tp->tp_fund) {
case ARRAY:
@ -408,7 +406,7 @@ pad(tp)
*/
check_ival(ex, tp)
struct expr *ex;
struct type *tp;
register struct type *tp;
{
/* The philosophy here is that ch7cast puts an explicit
conversion node in front of the expression if the types
@ -506,8 +504,8 @@ ch_array(tpp, ex)
{
register struct type *tp = *tpp;
register arith length;
char *s = ex->SG_VALUE;
arith ntopad;
register char *s = ex->SG_VALUE;
register arith ntopad;
ASSERT(ex->ex_class == String);
length = ex->SG_LEN;
@ -588,7 +586,7 @@ put_bf(tp, val)
int
zero_bytes(sd)
struct sdef *sd;
register struct sdef *sd;
{
/* fills the space between a selector of a struct
and the next selector of that struct with zero-bytes.
@ -640,7 +638,7 @@ too_many_initialisers(ex)
}
aggregate_type(tp)
struct type *tp;
register struct type *tp;
{
return tp->tp_fund == ARRAY || tp->tp_fund == STRUCT;
}

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* MAIN PROGRAM */
#include "nofloat.h"
#include <system.h>
#include "nopp.h"
#include "target_sizes.h"
@ -9,7 +10,6 @@
#include "use_tmp.h"
#include "maxincl.h"
#include "inputtype.h"
#include "input.h"
#include "level.h"
#include "idf.h"
@ -84,6 +84,7 @@ main(argc, argv)
#endif OWNALLOC
init_hmask();
#ifndef NOPP
init_pp(); /* initialise the preprocessor macros */
#endif NOPP
@ -289,7 +290,7 @@ init()
}
init_specials(si)
struct sp_id *si;
register struct sp_id *si;
{
while (si->si_identifier) {
struct idf *idf = str2idf(si->si_identifier);

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* U S E R O P T I O N - H A N D L I N G */
#include "nofloat.h"
#include "nopp.h"
#include "idfsize.h"
#include "maxincl.h"
@ -174,7 +175,6 @@ do_option(text)
align = txt2int(&text);
}
switch (c) {
case 's': /* short */
if (size != (arith)0)
short_size = size;
@ -242,11 +242,9 @@ do_option(text)
}
break;
}
case 'n':
options['n'] = 1; /* use no registers */
break;
case 'w':
options['w'] = 1; /* no warnings will be given */
break;
@ -260,8 +258,7 @@ txt2int(tp)
/* the integer pointed to by *tp is read, while increasing
*tp; the resulting value is yielded.
*/
register int val = 0;
register int ch;
register int val = 0, ch;
while (ch = **tp, ch >= '0' && ch <= '9') {
val = val * 10 + ch - '0';

View file

@ -1,6 +1,8 @@
/* $Header$ */
/* VARIOUS TARGET MACHINE SIZE DESCRIPTORS */
#include "nofloat.h"
extern arith
short_size, word_size, dword_size, int_size, long_size,
#ifndef NOFLOAT

View file

@ -1,14 +1,13 @@
/* $Header$ */
/* S T A C K / U N S T A C K R O U T I N E S */
#include "nofloat.h"
#include <system.h>
#include <em.h>
#include <em_reg.h>
#include "debug.h"
#include "use_tmp.h"
#include "botch_free.h"
#include "alloc.h"
#include "Lpars.h"
#include "arith.h"
@ -42,7 +41,7 @@ int level; /* Always equal to local_level->sl_level. */
stack_level() {
/* A new level is added on top of the identifier stack.
*/
struct stack_level *stl = new_stack_level();
register struct stack_level *stl = new_stack_level();
clear((char *)stl, sizeof(struct stack_level));
local_level->sl_next = stl;
@ -55,7 +54,7 @@ stack_level() {
stack_idf(idf, stl)
struct idf *idf;
struct stack_level *stl;
register struct stack_level *stl;
{
/* The identifier idf is inserted in the stack on level stl.
*/

View file

@ -49,9 +49,9 @@ int lcm();
*/
add_sel(stp, tp, idf, sdefpp, szp, fd) /* this is horrible */
struct type *stp; /* type of the structure */
struct type *tp; /* type of the selector */
struct idf *idf; /* idf of the selector */
register struct type *stp; /* type of the structure */
struct type *tp; /* type of the selector */
register struct idf *idf; /* idf of the selector */
struct sdef ***sdefpp; /* address of hook to selector definition */
arith *szp; /* pointer to struct size upto here */
struct field *fd;
@ -67,8 +67,8 @@ add_sel(stp, tp, idf, sdefpp, szp, fd) /* this is horrible */
extern arith add_field();
#endif NOBITFIELD
register struct tag *tg = stp->tp_idf->id_struct; /* or union */
register struct sdef *sdef = idf->id_sdef;
struct tag *tg = stp->tp_idf->id_struct; /* or union */
struct sdef *sdef = idf->id_sdef;
register struct sdef *newsdef;
int lvl = tg->tg_level;
@ -164,7 +164,7 @@ check_selector(idf, stp)
/* checks if idf occurs already as a selector in
struct or union *stp.
*/
struct sdef *sdef = stp->tp_sdef;
register struct sdef *sdef = stp->tp_sdef;
while (sdef) {
if (sdef->sd_idf == idf)
@ -174,7 +174,7 @@ check_selector(idf, stp)
}
declare_struct(fund, idf, tpp)
struct idf *idf;
register struct idf *idf;
struct type **tpp;
{
/* A struct, union or enum (depending on fund) with tag (!)
@ -251,7 +251,7 @@ declare_struct(fund, idf, tpp)
}
apply_struct(fund, idf, tpp)
struct idf *idf;
register struct idf *idf;
struct type **tpp;
{
/* The occurrence of a struct, union or enum (depending on
@ -271,7 +271,7 @@ apply_struct(fund, idf, tpp)
struct sdef *
idf2sdef(idf, tp)
struct idf *idf;
register struct idf *idf;
struct type *tp;
{
/* The identifier idf is identified as a selector, preferably
@ -280,7 +280,7 @@ idf2sdef(idf, tp)
If the attempt fails, a selector of type error_type is
created.
*/
struct sdef **sdefp = &idf->id_sdef, *sdef;
register struct sdef **sdefp = &idf->id_sdef, *sdef;
/* Follow chain from idf, to meet tp. */
while ((sdef = *sdefp)) {
@ -316,7 +316,7 @@ idf2sdef(idf, tp)
int
uniq_selector(idf_sdef)
struct sdef *idf_sdef;
register struct sdef *idf_sdef;
{
/* Returns true if idf_sdef (which is guaranteed to exist)
is unique for this level, i.e there is no other selector
@ -326,7 +326,7 @@ uniq_selector(idf_sdef)
case!
*/
struct sdef *sdef = idf_sdef->next;
register struct sdef *sdef = idf_sdef->next;
while (sdef && sdef->sd_level == idf_sdef->sd_level) {
if ( sdef->sd_type != idf_sdef->sd_type
@ -342,11 +342,11 @@ uniq_selector(idf_sdef)
#ifndef NOBITFIELD
arith
add_field(szp, fd, fdtpp, idf, stp)
arith *szp; /* size of struct upto here */
struct field *fd; /* bitfield, containing width */
struct type **fdtpp; /* type of selector */
struct idf *idf; /* name of selector */
struct type *stp; /* current struct descriptor */
arith *szp; /* size of struct upto here */
register struct field *fd; /* bitfield, containing width */
register struct type **fdtpp; /* type of selector */
struct idf *idf; /* name of selector */
register struct type *stp; /* current struct descriptor */
{
/* The address where this selector is put is returned. If the
selector with specified width does not fit in the word, or
@ -376,7 +376,6 @@ add_field(szp, fd, fdtpp, idf, stp)
}
switch ((*fdtpp)->tp_fund) {
case CHAR:
case SHORT:
case INT:
@ -419,22 +418,19 @@ add_field(szp, fd, fdtpp, idf, stp)
bits_declared = fd->fd_width;
}
else
if (fd->fd_width == 0) {
if (fd->fd_width == 0)
/* next field should be aligned on the next boundary.
This will take care that no field will fit in the
space allocated upto here.
*/
bits_declared = bits_in_type + 1;
}
else { /* the bitfield fits in the current field */
else /* the bitfield fits in the current field */
bits_declared += fd->fd_width;
}
/* Arrived here, the place where the selector is stored in the
struct is computed.
Now we need a mask to use its value in expressions.
*/
*fdtpp = construct_type(FIELD, *fdtpp, (arith)0);
(*fdtpp)->tp_field = fd;
@ -446,12 +442,10 @@ add_field(szp, fd, fdtpp, idf, stp)
*/
fd->fd_mask = (1 << fd->fd_width) - 1;
if (options['r']) { /* adjust the field at the right */
if (options['r']) /* adjust the field at the right */
fd->fd_shift = bits_declared - fd->fd_width;
}
else { /* adjust the field at the left */
else /* adjust the field at the left */
fd->fd_shift = bits_in_type - bits_declared;
}
return field_offset;
}

View file

@ -1,12 +1,11 @@
/* $Header$ */
/* S W I T C H - S T A T E M E N T A D M I N I S T R A T I O N */
#include "nofloat.h"
#include <em.h>
#include "debug.h"
#include "botch_free.h"
#include "density.h"
#include "Lpars.h"
#include "idf.h"
#include "label.h"

View file

@ -1,6 +1,7 @@
/* $Header$ */
/* T Y P E D E F I N I T I O N M E C H A N I S M */
#include "nofloat.h"
#include "nobitfield.h"
#include "alloc.h"
#include "Lpars.h"
@ -52,13 +53,13 @@ create_type(fund)
struct type *
construct_type(fund, tp, count)
struct type *tp;
register struct type *tp;
arith count; /* for fund == ARRAY only */
{
/* fund must be a type constructor: FIELD, FUNCTION, POINTER or
ARRAY. The pointer to the constructed type is returned.
*/
struct type *dtp;
register struct type *dtp;
switch (fund) {
#ifndef NOBITFIELD
@ -97,9 +98,9 @@ construct_type(fund, tp, count)
struct type *
function_of(tp)
struct type *tp;
register struct type *tp;
{
struct type *dtp = tp->tp_function;
register struct type *dtp = tp->tp_function;
if (!dtp) {
tp->tp_function = dtp = create_type(FUNCTION);
@ -112,9 +113,9 @@ function_of(tp)
struct type *
pointer_to(tp)
struct type *tp;
register struct type *tp;
{
struct type *dtp = tp->tp_pointer;
register struct type *dtp = tp->tp_pointer;
if (!dtp) {
tp->tp_pointer = dtp = create_type(POINTER);
@ -128,10 +129,10 @@ pointer_to(tp)
struct type *
array_of(tp, count)
struct type *tp;
register struct type *tp;
arith count;
{
struct type *dtp = tp->tp_array;
register struct type *dtp = tp->tp_array;
/* look for a type with the right size */
while (dtp && dtp->tp_size != count)
@ -151,9 +152,9 @@ array_of(tp, count)
#ifndef NOBITFIELD
struct type *
field_of(tp)
struct type *tp;
register struct type *tp;
{
struct type *dtp = create_type(FIELD);
register struct type *dtp = create_type(FIELD);
dtp->tp_up = tp;
dtp->tp_align = tp->tp_align;
@ -177,7 +178,7 @@ size_of_type(tp, nm)
}
idf2type(idf, tpp)
struct idf *idf;
register struct idf *idf;
struct type **tpp;
{
/* Decoding a typedef-ed identifier: if the size is yet

View file

@ -1,7 +1,8 @@
/* $Header$ */
/* TYPE DESCRIPTOR */
#include "nobitfield.h"
#include "nofloat.h"
#include "nobitfield.h"
struct type {
struct type *next; /* used only with ARRAY */