*** empty log message ***
This commit is contained in:
parent
ea8e311e5a
commit
d267037189
7
util/ncgg/assert.h
Normal file
7
util/ncgg/assert.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* $Header$ */
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define assert(x) if (!(x)) badassertion("x",__FILE__,__LINE__)
|
||||
#else
|
||||
#define assert(x) /* nothing */
|
||||
#endif
|
8
util/ncgg/cost.h
Normal file
8
util/ncgg/cost.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* $Header$ */
|
||||
|
||||
#define _COST_
|
||||
|
||||
typedef struct cost {
|
||||
int ct_space;
|
||||
int ct_time;
|
||||
} cost_t,*cost_p;
|
16
util/ncgg/expr.h
Normal file
16
util/ncgg/expr.h
Normal file
|
@ -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.
|
||||
*/
|
30
util/ncgg/extern.h
Normal file
30
util/ncgg/extern.h
Normal file
|
@ -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();
|
37
util/ncgg/instruct.h
Normal file
37
util/ncgg/instruct.h
Normal file
|
@ -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.
|
||||
*/
|
6
util/ncgg/iocc.h
Normal file
6
util/ncgg/iocc.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* $Header$ */
|
||||
|
||||
typedef struct iocc {
|
||||
short in_set[SETSIZE];
|
||||
int in_index;
|
||||
} iocc_t,*iocc_p;
|
29
util/ncgg/lookup.h
Normal file
29
util/ncgg/lookup.h
Normal file
|
@ -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();
|
38
util/ncgg/param.h
Normal file
38
util/ncgg/param.h
Normal file
|
@ -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<max? n++ : tabovf(string))
|
||||
#define NEW(x,y) x=(y*)myalloc(sizeof(*(x)))
|
8
util/ncgg/property.h
Normal file
8
util/ncgg/property.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* $Header$ */
|
||||
|
||||
typedef struct propinfo {
|
||||
int pr_size;
|
||||
short pr_regset[SZOFSET(MAXREGS)];
|
||||
} propinfo;
|
||||
|
||||
extern struct propinfo l_props[];
|
8
util/ncgg/pseudo.h
Normal file
8
util/ncgg/pseudo.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* $Header$ */
|
||||
|
||||
#define INSMOVE (-1)
|
||||
#define INSTEST (-2)
|
||||
#define INSPRETURN (-3)
|
||||
#define INSTLAB (-4)
|
||||
#define INSSETCC (-5)
|
||||
#define INSERASE (-6)
|
13
util/ncgg/reg.h
Normal file
13
util/ncgg/reg.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* $Header$ */
|
||||
|
||||
#define _REGINFO_
|
||||
typedef struct reginfo {
|
||||
char *ri_name;
|
||||
char *ri_repr;
|
||||
int ri_size;
|
||||
int ri_class;
|
||||
int ri_rregvar;
|
||||
int ri_memb[2];
|
||||
} reginfo;
|
||||
|
||||
extern struct reginfo l_regs[];
|
10
util/ncgg/regvar.h
Normal file
10
util/ncgg/regvar.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* $Header$ */
|
||||
|
||||
#define ANY_REGVAR 0x1
|
||||
#define SL_REGVAR 0x2
|
||||
#define DL_REGVAR 0x4
|
||||
|
||||
extern int rvused;
|
||||
extern int nregvar[4];
|
||||
extern int rvsize[4];
|
||||
extern int rvnumbers[4][MAXREGVAR];
|
5
util/ncgg/set.h
Normal file
5
util/ncgg/set.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* $Header$ */
|
||||
|
||||
#define BIS(sp,n) (sp)[(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)
|
19
util/ncgg/token.h
Normal file
19
util/ncgg/token.h
Normal file
|
@ -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];
|
13
util/ncgg/varinfo.h
Normal file
13
util/ncgg/varinfo.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue