From d267037189d529b93e4190ef904e5ae912240a68 Mon Sep 17 00:00:00 2001 From: sater Date: Mon, 17 Dec 1984 15:13:39 +0000 Subject: [PATCH] *** empty log message *** --- util/ncgg/assert.h | 7 +++++++ util/ncgg/cost.h | 8 ++++++++ util/ncgg/expr.h | 16 ++++++++++++++++ util/ncgg/extern.h | 30 ++++++++++++++++++++++++++++++ util/ncgg/instruct.h | 37 +++++++++++++++++++++++++++++++++++++ util/ncgg/iocc.h | 6 ++++++ util/ncgg/lookup.h | 29 +++++++++++++++++++++++++++++ util/ncgg/param.h | 38 ++++++++++++++++++++++++++++++++++++++ util/ncgg/property.h | 8 ++++++++ util/ncgg/pseudo.h | 8 ++++++++ util/ncgg/reg.h | 13 +++++++++++++ util/ncgg/regvar.h | 10 ++++++++++ util/ncgg/set.h | 5 +++++ util/ncgg/token.h | 19 +++++++++++++++++++ util/ncgg/varinfo.h | 13 +++++++++++++ 15 files changed, 247 insertions(+) create mode 100644 util/ncgg/assert.h create mode 100644 util/ncgg/cost.h create mode 100644 util/ncgg/expr.h create mode 100644 util/ncgg/extern.h create mode 100644 util/ncgg/instruct.h create mode 100644 util/ncgg/iocc.h create mode 100644 util/ncgg/lookup.h create mode 100644 util/ncgg/param.h create mode 100644 util/ncgg/property.h create mode 100644 util/ncgg/pseudo.h create mode 100644 util/ncgg/reg.h create mode 100644 util/ncgg/regvar.h create mode 100644 util/ncgg/set.h create mode 100644 util/ncgg/token.h create mode 100644 util/ncgg/varinfo.h diff --git a/util/ncgg/assert.h b/util/ncgg/assert.h new file mode 100644 index 000000000..6e909f088 --- /dev/null +++ b/util/ncgg/assert.h @@ -0,0 +1,7 @@ +/* $Header$ */ + +#ifndef NDEBUG +#define assert(x) if (!(x)) badassertion("x",__FILE__,__LINE__) +#else +#define assert(x) /* nothing */ +#endif diff --git a/util/ncgg/cost.h b/util/ncgg/cost.h new file mode 100644 index 000000000..e5f3f52b3 --- /dev/null +++ b/util/ncgg/cost.h @@ -0,0 +1,8 @@ +/* $Header$ */ + +#define _COST_ + +typedef struct cost { + int ct_space; + int ct_time; +} cost_t,*cost_p; diff --git a/util/ncgg/expr.h b/util/ncgg/expr.h new file mode 100644 index 000000000..fb9c3e744 --- /dev/null +++ b/util/ncgg/expr.h @@ -0,0 +1,16 @@ +/* $Header$ */ + +typedef struct expr { + int ex_typ; + short ex_regset[SZOFSET(MAXREGS)]; + int ex_index; +} expr_t,*expr_p; + +#define TYPINT 1 +#define TYPBOOL 2 +#define TYPADDR 3 +#define TYPREG 4 + +/* When the type is register the regset contains the set of + possible registers for checking purposes only. +*/ diff --git a/util/ncgg/extern.h b/util/ncgg/extern.h new file mode 100644 index 000000000..418b526d5 --- /dev/null +++ b/util/ncgg/extern.h @@ -0,0 +1,30 @@ +/* $Header$ */ + +extern int wordsize; +extern int pointersize; +extern int nregs; +extern int nprops; +extern int ntokens; +extern int nsets; +extern int ninstr; +extern int empatlen; +extern int emmnem[]; +extern int empatexpr; +extern int codeindex; +extern int tokpatlen; +extern int tokpatro[]; +extern int tokpatset[]; +extern int nallreg; +extern int allreg[]; +extern int cursetno; +extern int allsetno; +extern int inproc; +extern int callproc; +extern int procarg[2]; +extern int fc1,fc2,fc3,fc4; +extern int maxmembers; +extern int regclass; +extern int maxtokensize; + +extern char *mystrcpy(); +extern char *myalloc(); diff --git a/util/ncgg/instruct.h b/util/ncgg/instruct.h new file mode 100644 index 000000000..7faf8d189 --- /dev/null +++ b/util/ncgg/instruct.h @@ -0,0 +1,37 @@ +/* $Header$ */ + +#ifndef _COST_ +#include "cost.h" +#endif + +#define AD_RO 01 /* Read only operand */ +#define AD_WO 02 /* Write only operand */ +#define AD_RW 03 /* Read-write operand */ +#define AD_RWMASK 03 /* Mask to select these possiblities */ + +#define AD_CC 04 /* Condition codes set to this one */ + +typedef struct operand { + struct operand *o_next; + short o_setno; + short o_adorn; +} operand; + +typedef struct instruction { + char *i_name; + short i_asname; + short i_nops; + operand *i_oplist; + struct varinfo *i_erases; + cost_t i_cost; +} instr_t,*instr_p; + +extern instr_t l_instr[]; + +/* + * The read only information on the operands is not used at the moment. + * Predicted future use: + * When using :ro data it is possible to use a register in its stead + * if it contains the same information and is allowed as an operand + * in this place. Too difficult for now. + */ diff --git a/util/ncgg/iocc.h b/util/ncgg/iocc.h new file mode 100644 index 000000000..de9346879 --- /dev/null +++ b/util/ncgg/iocc.h @@ -0,0 +1,6 @@ +/* $Header$ */ + +typedef struct iocc { + short in_set[SETSIZE]; + int in_index; +} iocc_t,*iocc_p; diff --git a/util/ncgg/lookup.h b/util/ncgg/lookup.h new file mode 100644 index 000000000..396765661 --- /dev/null +++ b/util/ncgg/lookup.h @@ -0,0 +1,29 @@ +/* $Header$ */ + +typedef enum { + justlooking,mustexist,newsymbol,makeexist +} lookupstyle; + +typedef enum { + symany,symkeyw,symconst,symsconst,symprop,symreg,symtok,symset,symproc +} symtype; + +typedef struct symbol { + struct symbol *sy_next; /* pointer to hashchain */ + char *sy_name; /* symbol */ + symtype sy_type; /* type */ + union { + long syv_cstval; + int syv_stringno; + int syv_keywno; + int syv_propno; + int syv_regno; + int syv_tokno; + int syv_setno; + int syv_procoff; + } sy_value; +} symbol; + +#define NSYMHASH 61 +extern symbol *symhash[NSYMHASH]; /* chained hashtable */ +extern symbol *lookup(); diff --git a/util/ncgg/param.h b/util/ncgg/param.h new file mode 100644 index 000000000..1d82c1b53 --- /dev/null +++ b/util/ncgg/param.h @@ -0,0 +1,38 @@ +/* $Header$ */ + +/* + * Miscellaneous sizes, tunable + */ + +#define MAXREGS 40 +#define MAXPROPS 30 +#define MAXTOKENS 60 +#define MAXATT 3 +#define MAXSETS 100 +#define MAXINSTR 100 +#define MAXSTRINGS 250 +#define MAXNODES 300 +#define EMPATMAX 20 +#define MAXPATTERNS 20 +#define MAXALLREG 5 +#define MAXINSTANCES 300 +#define MAXMOVES 20 +#define MAXTESTS 10 +#define MAXSTACKS 30 +#define MAXCOERCS 25 +#define MAXSPLCOERC 20 +#define MAXSPLIT 2 +#define MAXPATBYTES 7000 +#define MAXREGVAR 8 +#define MAXSOURCELINES 4000 + +/* end of tunable constants */ + +#define TOKPATMAX 7 + +#define SZOFSET(n) (((n)+15)/16) + +#define SETSIZE SZOFSET(MAXREGS+MAXTOKENS) + +#define NEXT(n,max,string) (n>4] |= 1<<((n)&0xF) +#define BIC(sp,n) (sp)[(n)>>4] &= ~(1<<((n)&0xF)) +#define BIT(sp,n) (((sp)[(n)>>4]&(1<<((n)&0xF)))!=0) diff --git a/util/ncgg/token.h b/util/ncgg/token.h new file mode 100644 index 000000000..2f48de5e7 --- /dev/null +++ b/util/ncgg/token.h @@ -0,0 +1,19 @@ +/* $Header$ */ + +#ifndef _COST_ +#include "cost.h" +#endif + + +typedef struct token { + char *tk_name; + int tk_size; + cost_t tk_cost; + struct { + int ta_type; /* -1 is int, -2 is addr, >=0 is propno */ + char *ta_name; + } tk_att[MAXATT]; + int tk_format; +} token_t,*token_p; + +extern token_p l_tokens[MAXTOKENS]; diff --git a/util/ncgg/varinfo.h b/util/ncgg/varinfo.h new file mode 100644 index 000000000..3c23ff122 --- /dev/null +++ b/util/ncgg/varinfo.h @@ -0,0 +1,13 @@ +/* $Header$ */ + +#define VI_NSTR 1 +#define VI_NINT 3 + +typedef struct varinfo { + struct varinfo *vi_next; + char *vi_str[VI_NSTR]; + int vi_int[VI_NINT]; + struct varinfo *vi_vi; +} varinfo; + +#define VI_NULL (struct varinfo *) 0