added alloction dump

shrunk some data structures
changed some ALLOCDEF's
changed setjmp to __setjmp
This commit is contained in:
eck 1990-01-10 17:33:35 +00:00
parent 776f85238f
commit 00876cd9df
34 changed files with 137 additions and 53 deletions

View file

@ -5,11 +5,11 @@
/* $Header$ */
/* L E X I C A L A N A L Y Z E R */
#include "debug.h"
#include "lint.h"
#include <alloc.h>
#include "idfsize.h"
#include "numsize.h"
#include "debug.h"
#include "strsize.h"
#include "nopp.h"
#include "input.h"

View file

@ -423,6 +423,7 @@ ch3.o: type.h
ch3bin.o: Lpars.h
ch3bin.o: arith.h
ch3bin.o: botch_free.h
ch3bin.o: debug.h
ch3bin.o: expr.h
ch3bin.o: idf.h
ch3bin.o: label.h
@ -606,10 +607,12 @@ domacro.o: idf.h
domacro.o: idfsize.h
domacro.o: ifdepth.h
domacro.o: input.h
domacro.o: macbuf.h
domacro.o: macro.h
domacro.o: nopp.h
domacro.o: nparams.h
domacro.o: parbufsize.h
domacro.o: replace.h
domacro.o: spec_arith.h
domacro.o: textsize.h
replace.o: LLlex.h
@ -677,6 +680,7 @@ type.o: Lpars.h
type.o: align.h
type.o: arith.h
type.o: botch_free.h
type.o: debug.h
type.o: decspecs.h
type.o: def.h
type.o: idf.h
@ -692,14 +696,18 @@ type.o: type.h
ch3mon.o: Lpars.h
ch3mon.o: arith.h
ch3mon.o: botch_free.h
ch3mon.o: debug.h
ch3mon.o: def.h
ch3mon.o: expr.h
ch3mon.o: idf.h
ch3mon.o: label.h
ch3mon.o: lint.h
ch3mon.o: nobitfield.h
ch3mon.o: nocross.h
ch3mon.o: nopp.h
ch3mon.o: sizes.h
ch3mon.o: spec_arith.h
ch3mon.o: target_sizes.h
ch3mon.o: type.h
label.o: Lpars.h
label.o: arith.h
@ -765,6 +773,7 @@ conversion.o: target_sizes.h
conversion.o: type.h
util.o: Lpars.h
util.o: align.h
util.o: debug.h
util.o: def.h
util.o: lint.h
util.o: nocross.h
@ -879,6 +888,7 @@ l_misc.o: LLlex.h
l_misc.o: Lpars.h
l_misc.o: arith.h
l_misc.o: code.h
l_misc.o: debug.h
l_misc.o: def.h
l_misc.o: expr.h
l_misc.o: file_info.h
@ -999,19 +1009,24 @@ expression.o: LLlex.h
expression.o: Lpars.h
expression.o: arith.h
expression.o: code.h
expression.o: debug.h
expression.o: expr.h
expression.o: file_info.h
expression.o: idf.h
expression.o: label.h
expression.o: lint.h
expression.o: nobitfield.h
expression.o: nocross.h
expression.o: nopp.h
expression.o: sizes.h
expression.o: spec_arith.h
expression.o: target_sizes.h
expression.o: type.h
program.o: LLlex.h
program.o: Lpars.h
program.o: arith.h
program.o: code.h
program.o: debug.h
program.o: declar.h
program.o: decspecs.h
program.o: def.h
@ -1052,3 +1067,4 @@ ival.o: target_sizes.h
ival.o: type.h
char.o: class.h
symbol2str.o: Lpars.h
next.o: debug.h

View file

@ -12,6 +12,7 @@
*/
#include <alloc.h>
#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"

View file

@ -5,8 +5,8 @@
/* $Header$ */
/* S E M A N T I C A N A L Y S I S -- C H A P T E R 3.3 */
#include "lint.h"
#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
#include <flt_arith.h>

View file

@ -6,6 +6,7 @@
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- BINARY OPERATORS */
#include "botch_free.h"
#include "debug.h"
#include <alloc.h>
#include "lint.h"
#include "idf.h"

View file

@ -6,6 +6,7 @@
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- MONADIC OPERATORS */
#include "botch_free.h"
#include "debug.h"
#include <alloc.h>
#include "nobitfield.h"
#include "Lpars.h"

View file

@ -6,6 +6,7 @@
/* C O D E - G E N E R A T I N G R O U T I N E S */
#include "lint.h"
#include "debug.h"
#include <em.h>
#include "botch_free.h"
#include <alloc.h>
@ -260,7 +261,7 @@ end_proc(fbytes)
- indication of the use of floating points
- indication of the number of bytes used for
formal parameters
- use of special identifiers such as "setjmp"
- use of special identifiers such as "__setjmp"
- "end" + number of bytes used for local variables
*/
arith nbytes;
@ -304,7 +305,7 @@ end_proc(fbytes)
func_name, (long) max_int);
}
C_ms_par(fbytes); /* # bytes for formals */
if (sp_occurred[SP_SETJMP]) { /* indicate use of "setjmp" */
if (sp_occurred[SP_SETJMP]) { /* indicate use of "__setjmp" */
options['n'] = 1;
C_ms_gto();
sp_occurred[SP_SETJMP] = 0;

View file

@ -17,9 +17,6 @@ struct declarator {
struct formal *dc_formal; /* params for function */
};
/* ALLOCDEF "declarator" 50 */
struct formal { /* list of formals */
struct formal *next;
struct idf *fm_idf;

View file

@ -5,6 +5,7 @@
/* $Header$ */
/* D E C L A R A T O R M A N I P U L A T I O N */
#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include <flt_arith.h>
@ -18,7 +19,6 @@
#include "label.h"
#include "expr.h"
#include "sizes.h"
#include "debug.h"
#include "level.h"
extern char options[];

View file

@ -153,25 +153,29 @@ qualifier_type(tp, typequal)
dtp->tp_align = tp->tp_align;
dtp->tp_typequal = typequal;
dtp->tp_size = tp->tp_size;
dtp->tp_pointer = tp->tp_pointer;
dtp->tp_array = tp->tp_array;
dtp->tp_function = tp->tp_function;
switch (fund) {
case ARRAY:
if (typequal) {
tp->tp_up = qualifier_type(tp->tp_up, typequal);
dtp->tp_typequal = typequal = 0;
}
goto nottagged;
case FIELD:
dtp->tp_field = tp->tp_field;
/* fallthrough */
case POINTER:
case FUNCTION:
case FUNCTION: /* dont't assign tp_proto */
nottagged:
dtp->tp_up = tp->tp_up;
break;
case STRUCT:
case UNION:
case ENUM:
dtp->tp_idf = tp->tp_idf;
dtp->tp_sdef = tp->tp_sdef;
dtp->tp_up = tp->tp_up;
dtp->tp_field = tp->tp_field;
dtp->tp_pointer = tp->tp_pointer;
dtp->tp_array = tp->tp_array;
dtp->tp_function = tp->tp_function;
break;
default:
break;

View file

@ -5,10 +5,10 @@
/* $Header$ */
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
#include "debug.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"
#include "debug.h"
#include "idf.h"
#include "input.h"
#include "nopp.h"

View file

@ -9,10 +9,10 @@
#include <system.h>
#include <em.h>
#include "debug.h"
#include "lint.h"
#include "nopp.h"
#include "errout.h"
#include "debug.h"
#include "tokenname.h"
#include <flt_arith.h>

View file

@ -6,6 +6,7 @@
/* EXPRESSION TREE HANDLING */
#include "lint.h"
#include "debug.h"
#include "assert.h"
#include "botch_free.h"
#include <alloc.h>

View file

@ -50,7 +50,6 @@ struct oper {
#define Type 4 /* only its type is relevant */
struct expr {
struct expr *next;
char *ex_file; /* the file it (probably) comes from */
unsigned int ex_line; /* the line it (probably) comes from */
struct type *ex_type;

View file

@ -8,6 +8,7 @@
{
#include <alloc.h>
#include "lint.h"
#include "debug.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"

View file

@ -6,11 +6,10 @@
/* FIELD DESCRIPTOR */
struct field { /* for field specifiers */
struct field *next;
arith fd_mask;
int fd_shift;
int fd_width;
struct sdef *fd_sdef; /* upward pointer */
};
/* ALLOCDEF "field" 50 */
/* ALLOCDEF "field" 10 */

View file

@ -77,7 +77,7 @@ idf_hashed(tg, size, hc)
break;
if (cmp == 0) {
/* suppose that special identifiers, as
"setjmp", are already inserted
"__setjmp", are already inserted
*/
sp_occurred[notch->id_special] = 1;
return notch;

View file

@ -10,6 +10,7 @@
#ifdef LINT
#include <alloc.h> /* for st_free */
#include "debug.h"
#include "interface.h"
#include <flt_arith.h>
#include "arith.h" /* definition arith */

View file

@ -10,6 +10,7 @@
#ifdef LINT
#include <alloc.h>
#include "debug.h"
#include "interface.h"
#include <flt_arith.h>
#include "arith.h"

View file

@ -10,9 +10,9 @@
#ifdef LINT
#include <alloc.h> /* for st_free */
#include "debug.h"
#include "interface.h"
#include "assert.h"
#include "debug.h"
#include <flt_arith.h>
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */

View file

@ -33,15 +33,6 @@ struct macro {
/* ALLOCDEF "macro" 20 */
struct mlist {
struct mlist *next;
struct macro *m_mac;
char *m_repl;
char m_unstack;
};
/* ALLOCDEF "mlist" 20 */
/* `token' numbers of keywords of command-line processor
*/
#define K_UNKNOWN 0

View file

@ -7,9 +7,9 @@
#include "lint.h"
#include <system.h>
#include "debug.h"
#include "nopp.h"
#include "target_sizes.h"
#include "debug.h"
#include "use_tmp.h"
#include "inputtype.h"
#include "input.h"
@ -42,7 +42,7 @@ extern char *getwdir();
#endif NOPP
struct sp_id special_ids[] = {
{"setjmp", SP_SETJMP}, /* non-local goto's are registered */
{"__setjmp", SP_SETJMP}, /* non-local goto's are registered */
{0, 0}
};
@ -116,6 +116,7 @@ main(argc, argv)
#ifdef DEBUG
hash_stat();
if (options['m']) Info();
#endif DEBUG
sys_stop(err_occurred ? S_EXIT : S_END);
@ -382,6 +383,37 @@ preprocess()
}
}
#endif NOPP
Info()
{
extern int cnt_string_cst, cnt_formal,
cnt_decl_unary, cnt_def, cnt_expr, cnt_field,
cnt_e_stack, cnt_localvar, cnt_proto, cnt_repl,
cnt_args, cnt_idf, cnt_macro, cnt_stack_level,
cnt_stack_entry, cnt_stmt_block, cnt_sdef, cnt_tag,
cnt_switch_hdr, cnt_case_entry, cnt_type, cnt_brace,
cnt_lint_stack_entry, cnt_state, cnt_auto_def,
cnt_expr_state, cnt_argument;
print("\
%6d string_cst\n%6d formal\n\
%6d decl_unary\n%6d def\n%6d expr\n%6d field\n\
%6d e_stack\n%6d localvar\n%6d proto\n%6d repl\n\
%6d args\n%6d idf\n%6d macro\n%6d stack_level\n\
%6d stack_entry\n%6d stmt_block\n%6d sdef\n%6d tag\n\
%6d switch_hdr\n%6d case_entry\n%6d type\n%6d brace\n\
%6d lint_stack_entry\n%6d state\n%6d auto_def\n\
%6d expr_state\n%6d argument\n",
cnt_string_cst, cnt_formal,
cnt_decl_unary, cnt_def, cnt_expr, cnt_field,
cnt_e_stack, cnt_localvar, cnt_proto, cnt_repl,
cnt_args, cnt_idf, cnt_macro, cnt_stack_level,
cnt_stack_entry, cnt_stmt_block, cnt_sdef, cnt_tag,
cnt_switch_hdr, cnt_case_entry, cnt_type, cnt_brace,
cnt_lint_stack_entry, cnt_state, cnt_auto_def,
cnt_expr_state, cnt_argument);
}
#endif DEBUG
No_Mem() /* called by alloc package */

View file

@ -3,6 +3,12 @@ s:^.*[ ]ALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\
/* allocation definitions of struct \1 */\
extern char *st_alloc();\
extern struct \1 *h_\1;\
#ifdef DEBUG\
extern int cnt_\1;\
extern char *std_alloc();\
#define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&cnt_\1))\
#else\
#define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\
#endif\
#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\
:'

View file

@ -1,3 +1,7 @@
echo '#include "debug.h"'
sed -n '
s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;:p
s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;\
#ifdef DEBUG\
int cnt_\1 = 0;\
#endif:p
' $*

View file

@ -5,10 +5,10 @@
/* $Header$ */
/* PREPROCESSOR: PRAGMA INTERPRETER */
#include "debug.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"
#include "debug.h"
#include "idf.h"
#include "input.h"
#include "ifdepth.h"

View file

@ -47,6 +47,7 @@
{
#include "lint.h"
#include "nopp.h"
#include "debug.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"

View file

@ -278,7 +278,7 @@ update_proto(tp, otp)
return;
}
while (tp && tp->tp_fund != FUNCTION) {
while (tp->tp_fund != FUNCTION) {
tp = tp->tp_up;
otp = otp->tp_up;
if (!tp) return;
@ -463,10 +463,10 @@ call_proto(expp)
any2parameter(estack[ecnt]);
}
if (pcnt >= 0 && !(pstack[0]->pl_flag & PL_ELLIPSIS))
expr_error(*expp, "less parameters than specified in prototype");
expr_error(*expp, "fewer parameters than specified in prototype");
} else {
if (pl && !(pl->pl_flag & PL_VOID))
expr_error(*expp, "less parameters than specified in prototype");
expr_error(*expp, "fewer parameters than specified in prototype");
}
}

View file

@ -19,4 +19,4 @@ struct proto {
#define PL_ELLIPSIS 0x04
#define PL_ERRGIVEN 0x08
/* ALLOCDEF "proto" 10 */
/* ALLOCDEF "proto" 20 */

View file

@ -1,3 +1,10 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
/* DEFINITIONS FOR THE MACRO REPLACEMENT ROUTINES */
struct repl {
struct repl *next;
struct idf *r_idf; /* name of the macro */
@ -22,7 +29,7 @@ struct repl {
#define ABCD 2
#define g(x, y) x ## y + h(x)
g(ABC, D);
g(ABC, D); // gives: 2 + h(f())
In this case we need two copies: one raw copy for the pasting
operator, and an expanded one as argument for h().

View file

@ -27,7 +27,7 @@ struct stack_entry {
struct idf *se_idf;
};
/* ALLOCDEF "stack_entry" 5 */
/* ALLOCDEF "stack_entry" 50 */
extern struct stack_level *local_level;
extern struct stack_level *stack_level_of();

View file

@ -25,6 +25,6 @@ struct tag { /* for struct-, union- and enum tags */
};
/* ALLOCDEF "tag" 50 */
/* ALLOCDEF "tag" 10 */
struct sdef *idf2sdef();

View file

@ -6,6 +6,7 @@
/* T Y P E D E F I N I T I O N M E C H A N I S M */
#include "nobitfield.h"
#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include "Lpars.h"

View file

@ -8,24 +8,42 @@
#include "nobitfield.h"
struct type {
struct type *next; /* used only with ARRAY */
struct type *next; /* used for ARRAY and for qualifiers */
short tp_fund; /* fundamental type */
short tp_unsigned;
int tp_align;
int tp_typequal; /* type qualifier */
arith tp_size; /* -1 if declared but not defined */
struct idf *tp_idf; /* name of STRUCT, UNION or ENUM */
struct sdef *tp_sdef; /* to first selector */
struct type *tp_up; /* from FIELD, POINTER, ARRAY
or FUNCTION to fund. */
struct field *tp_field; /* field descriptor if fund == FIELD */
struct type *tp_pointer;/* to POINTER */
struct type *tp_array; /* to ARRAY */
struct proto *tp_proto; /* prototype list */
struct proto *tp_pseudoproto; /* pseudo prototype list */
struct type *tp_function;/* to FUNCTION */
struct type *tp_pointer; /* to POINTER */
struct type *tp_array; /* to ARRAY */
struct type *tp_function; /* to FUNCTION */
union {
struct {
struct idf *tp__idf; /* name of STRUCT, UNION or ENUM */
struct sdef *tp__sdef; /* to first selector */
} tp_istagged; /* used with STRUCT, UNION & ENUM */
struct {
/* tp__up: from FIELD, POINTER, ARRAY or FUNCTION to fund. */
struct type *tp__up;
union {
/* tp__field: field descriptor if fund == FIELD */
struct field *tp__field;
struct {
/* prototype list (pseudoproto for old_style def) */
struct proto *tp__proto;
struct proto *tp__pseudoproto;
} tp_isfunc;
} tp_f; /* FIELD or FUNCTION */
} tp_nottagged; /* used with POINTER, FIELD, ARRAY & FUNCTION */
} tp_union;
};
#define tp_idf tp_union.tp_istagged.tp__idf
#define tp_sdef tp_union.tp_istagged.tp__sdef
#define tp_up tp_union.tp_nottagged.tp__up
#define tp_field tp_union.tp_nottagged.tp_f.tp__field
#define tp_proto tp_union.tp_nottagged.tp_f.tp_isfunc.tp__proto
#define tp_pseudoproto tp_union.tp_nottagged.tp_f.tp_isfunc.tp__pseudoproto
/* Type qualifiers. Note: TQ_VOLATILE and TQ_CONST can be
'ored' to specify: extern const volatile int a;
@ -55,4 +73,4 @@ extern struct type *pa_type; /* type.c */
extern arith size_of_type(), align();
/* ALLOCDEF "type" 20 */
/* ALLOCDEF "type" 50 */

View file

@ -17,6 +17,7 @@
#include <em_mes.h>
#include "lint.h"
#include "debug.h"
#include "util.h"
#include "use_tmp.h"
#include "regcount.h"