#ifndef SUPP_H#define SUPP_H 1#include <stdlib.h>#include <stdio.h>#include <limits.h>#include <string.h>#include <stddef.h>#include <stdarg.h>#include <ctype.h>/* typenames */#define CHAR 1#define SHORT 2#define INT 3#define LONG 4#define LLONG 5#define FLOAT 6#define DOUBLE 7#define LDOUBLE 8#define VOID 9#define POINTER 10#define ARRAY 11#define STRUCT 12#define UNION 13#define ENUM 14#define FUNKT 15#define BOOL 16#define MAXINT 17 /* should not be accessible to application */#define MAX_TYPE MAXINT#define MAXVECDIM 16#define VECBOOL (MAXINT+1)#define VECCHAR (VECBOOL+MAXVECDIM)#define VECSHORT (VECCHAR+MAXVECDIM)#define VECINT (VECSHORT+MAXVECDIM)#define VECLONG (VECINT+MAXVECDIM)#define VECFLOAT (VECLONG+MAXVECDIM)#define VECLAST (VECFLOAT+MAXVECDIM)#define NQ 255 /* f&NQ gives type without any qualifiers */#define NU 511 /* f&NU gives type without any qualifiers but UNSIGNED */#define q1typ(p) ((p->code==ADDI2P||p->code==SUBIFP||p->code==CONVERT||p->code==SUBPFP)?p->typf2:p->typf)#define q2typ(p) ((p->code==SUBPFP||p->code==LSHIFT||p->code==RSHIFT)?p->typf2:p->typf)#define ztyp(p) ((p->code==ADDI2P||p->code==SUBIFP||p->code==ADDRESS)?p->typf2:p->typf)#define iclabel(p) (p->typf)#define opsize(p) (p->q2.val.vmax)#define pushsize(p) (p->z.val.vmax)#define pushedargsize(p) (p->q2.val.vmax)#define isstatic(x) ((x)==STATIC)#define isextern(x) ((x)==EXTERN)#define isauto(x) ((x)==AUTO||(x)==REGISTER)/* operations on bit-vectors */typedef unsigned int bvtype;#define BVBITS (sizeof(bvtype)*CHAR_BIT)#define BVSIZE(x) ((((x)+BVBITS-1)/BVBITS)*sizeof(bvtype))#define BSET(array,bit) (array)[(bit)/BVBITS]|=1<<((bit)%BVBITS)#define BCLR(array,bit) (array)[(bit)/BVBITS]&=~(1<<((bit)%BVBITS))#define BTST(array,bit) ((array)[(bit)/BVBITS]&(1<<((bit)%BVBITS)))/* type-qualifiers */#define UNSIGNED (NQ+1)#define CONST (UNSIGNED<<1)#define VOLATILE (CONST<<1)#define RESTRICT (VOLATILE<<1)#define UNCOMPLETE (RESTRICT<<1)#define STRINGCONST (UNCOMPLETE<<1)#define BOOLEAN (STRINGCONST<<1)#define SIGNED_CHARACTER (BOOLEAN<<1)#ifdef HAVE_ECPP/* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed */#endif#define t_min(x) (((x)&UNSIGNED)?l2zm(0L):t_min[(x)&NQ])#define t_max(x) (((x)&UNSIGNED)?tu_max[(x)&NQ]:t_max[(x)&NQ])/* macro for internal errors */#define ierror(a) error(-1,(a),__LINE__,FILE_)/* macros for target errors */#define twarning(x) error(323,x);#define terror(x) error(324,x);/* this header is provided by the code generator */#include "machine.h"#ifndef HAVE_EXT_TYPEStypedef zllong zmax;typedef zullong zumax;#endif#ifndef ISPOINTER#define ISPOINTER(x) ((x&NQ)==POINTER)#endif#ifndef ISINT#define ISINT(x) ((x&NQ)>=CHAR&&(x&NQ)<=LLONG)#endif#ifndef ISFLOAT#define ISFLOAT(x) ((x&NQ)>=FLOAT&&(x&NQ)<=LDOUBLE)#endif#ifndef ISFUNC#define ISFUNC(x) ((x&NQ)==FUNKT)#endif#ifndef ISSTRUCT#define ISSTRUCT(x) ((x&NQ)==STRUCT)#endif#ifndef ISUNION#define ISUNION(x) ((x&NQ)==UNION)#endif#ifndef ISARRAY#define ISARRAY(x) ((x&NQ)==ARRAY)#endif#ifndef ISVECTOR#define ISVECTOR(x) ((x&NQ)>=VECBOOL&&(x&NQ)<=VECLAST)#endif#ifndef VECDIM#define VECDIM(x) ((((x&NQ)-VECBOOL)&15)+1)#endif#ifndef ISSCALAR#define ISSCALAR(x) ((x&NQ)>=CHAR&&(x&NQ)<=POINTER)#endif#ifndef ISARITH#define ISARITH(x) (ISINT(x)||ISFLOAT(x))#endif#ifndef POINTER_TYPE#define POINTER_TYPE(x) POINTER#endif#ifndef MAXINT#define MAXINT LLONG#endif#ifndef HAVE_INT_SIZET#define HAVE_INT_SIZET 0#endif#ifndef PTRDIFF_T#define PTRDIFF_T(x) INT#endif#ifndef MAXADDI2P#define MAXADDI2P LLONG#endif#define RSIZE BVSIZE(MAXR+1)#define ALL_CALLS 1#define ALL_REGS 2#define ALL_USES 4#define ALL_MODS 8#define ALL_STACK 16#define ALWAYS_RETURNS 32#define NEVER_RETURNS 64#define NOSIDEFX 128#define WARNED_STACK 256#define WARNED_REGS 512#define USES_VLA 1024struct tunit{ struct Var *statics; struct tunit *next;};/* additional information for functions; used by the optimizer */struct function_info{ struct IC *first_ic; /* inline copy of function starts here */ struct IC *last_ic; /* " " " ends here */ struct IC *opt_ic; /* code after optimizing */ struct Var *vars; /* pointer to list of vars of that function */ struct Var *statics; /* static variables of translation-unit */ char *inline_asm; /* pointer to code for inline assembler */ unsigned long flags; /* misc flags, see above */ /* functions called, variables used and changed */ int call_cnt,use_cnt,change_cnt; struct varlist *call_list; struct varlist *use_list; struct varlist *change_list; zmax max_offset; /* registers used and modified by that function */ bvtype regs_modified[RSIZE/sizeof(bvtype)];#if HAVE_OSEK/* removed *//* removed *//* removed */#endif zumax stack1; zumax stack2;};/* struct for types. */struct Typ{ int flags; /* see above */ struct Typ *next; struct struct_declaration *exact; /* used for STRUCT/UNION/FUNKT */ zmax size; /* used for ARRAY */ struct Var *dsize; /* used for variable-length arrays */ char *attr; int reg;#ifdef HAVE_ECPP/* removed */#endif};#define TYPS sizeof(struct Typ)#ifndef HAVE_EXT_TYPESunion atyps{ zchar vchar; zuchar vuchar; zshort vshort; zushort vushort; zint vint; zuint vuint; zlong vlong; zulong vulong; zllong vllong; zullong vullong; zmax vmax; zumax vumax; zfloat vfloat; zdouble vdouble; zldouble vldouble;};#endif/* This struct represents objects in the intermediate code. */struct obj{ int flags; /* see below */ int reg; /* number of reg if flags® */ int dtyp; /* type of pointer for DREFOBJ */ struct Var *v; struct AddressingMode *am; union atyps val;};/* Available flags in struct obj. */ /* KONST muss immer am kleinsten sein, um beim Swappen */ /* fuer available_expressions und Konstanten nach */ /* rechts nicht in eine Endlosschleife zu kommen. */#define KONST 1 /* The object is a constant. Its value is stored in */ /* val. */#define VAR 2 /* The object is a variable (stored in v). */#define SCRATCH 8 /* The object is a temporary. */#define STACK 16 /* obsolete */#define DREFOBJ 32 /* The object must be dereferenced. */#define REG 64 /* The object is contained in a hardware register. */#define VARADR 128 /* The object is the address of a static variable. */#define DONTREGISTERIZE 256 /* Do not put this object into a register. */#define VKONST 512 /* Variable containing a constant (for reg-alloc). */struct Var{ int storage_class; /* see below */ int reg; /* Var is assigned to this hard-reg */ int priority; /* Priority to be used in simple_regs() */ long flags; /* see below */ char *identifier; /* name of the variable */ int nesting; /* can be freely used by the frontend */ int index; /* used by the optimizer */ int inr; /* counter for num_vars */ zmax offset; /* offset relative to the stack frame */ int line; /* line number of first declaration */ char *filename; /* filename of first declaration */ int dline; /* line number of definition */ char *dfilename; /* filename of definition */ struct Typ *vtyp; /* type of the variable */ struct const_list *clist; /* initialized? */ struct Var *next; /* pointer to next variable */ struct function_info *fi; /* used by the optimizer */ struct Var *inline_copy; /* used for function-inlining */ struct tunit *tunit; /* translation unit the variable belongs to */ char *vattr; /* extended variable attributes */ char *description; /* description of variable meaning */ struct obj cobj; /* used for register-allocation of constants */ int ctyp; /* ----------------- " ----------------- */#ifdef HAVE_TARGET_ATTRIBUTES unsigned long tattr; /* target-specific attributes */#endif#ifdef ALEX_REG int iRegCopyNr; int iRegCopyNrHc12V;#endif};/* available storage-classes */#define AUTO 1 /* var is allocated on the stack */#define REGISTER 2 /* basically the same as AUTO (C-only) */#define STATIC 3 /* var is static but has no external linkage */#define EXTERN 4 /* var is static and has external linkage */#define TYPEDEF 5 /* C-only *//* available flags in struct Var */#define USEDASSOURCE 1 /* the var has been read */#define USEDASDEST 2 /* the var has been written */#define DEFINED 4 /* the var has been defined (i.e. storage will be allocated in the current file) */#define USEDASADR 8 /* the address of the var has been taken */#define GENERATED 16 /* code for static vars has been generated */#define CONVPARAMETER 32#define TENTATIVE 64 /* C-only */#define USEDBEFORE 128 /* used by the optimizer */#define INLINEV 256 /* " " */#define PRINTFLIKE 512 /* C-only */#define SCANFLIKE 1024 /* C-only */#define NOTTYPESAFE 2048 /* used by the optimizer */#define DNOTTYPESAFE 4096 /* " " */#define REGPARM 8192 /* the var is a register parameter */#define DBLPUSH 16384 /* parameter is also on the stack */#define NOTINTU 32768 /* variable not (yet) defined in this translation-unit */#define REFERENCED 65536 /* variable referenced */#define INLINEFUNC (REFERENCED*2)#define INLINEEXT (INLINEFUNC*2)#define BUILTIN (INLINEFUNC*2) /* C-only */struct struct_list{ char *identifier; /* name of the struct/union-tag */ struct Typ *styp; /* type of the member/parameter */ zmax align; /* alignment of struct-member */ int bfoffset; /* bitfield-offset */ int bfsize; /* bitfield-size */ int storage_class; /* storage-class of function-parameter */ int reg; /* register to pass function-parameter */#ifdef HAVE_ECPP/* removed */#endif}; #define SLSIZE 32 /* realloc struct_lists in those steps *//* These structs are used to describe members of STRUCT/UNION or *//* parameters of FUNKT. Some of the entries in struct_list are not *//* relevant for both alternatives. */struct struct_declaration{ int count; /* number of members/parameters */ int label; /* used for debug output */ int typ; struct tunit *tunit; struct struct_declaration *next; struct struct_list (*sl)[]; char *identifier;#ifdef HAVE_ECPP/* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed *//* removed */#endif}; /* The quads in the intermediate code. */struct IC{ struct IC *prev; /* pointer to the next IC */ struct IC *next; /* pointer to the previous IC */ int code; /* see below */ int typf; /* usually type of the operands, see interface.doc */ int typf2; /* used for CONVERT,ADDI2P,SUBIFP,SUBPFP */ int defindex; /* used by optimizer */ int expindex; int copyindex; int change_cnt; int use_cnt; int call_cnt; int line; /* corresponding line in source file (or 0) */ struct varlist *change_list; /* used by optimizer */ struct varlist *use_list; struct varlist *call_list; struct obj q1; /* source 1 */ struct obj q2; /* source 2 */ struct obj z; /* target */ char *file; /* filename of the source file */ int arg_cnt; struct IC **arg_list; /* pointers to function argument ICs (only for code==CALL) */ struct IC *copy; /* for copying/inlining */ struct Typ *ityp; long flags; struct Var *savedsp; /* only for branch instructions and vlas */#ifdef HAVE_EXT_IC struct ext_ic ext;#endif#ifdef ALEX_REG int iZWebIndex; /* web for z in case z is a pointer and its value is defed*/ int iQ1WebIndex; /* web for argument q1 */ int iQ2WebIndex; /* web for argument q2 */ void *pFlow; /* flowgraph reverse lookup */#endif};#define ICS sizeof(struct IC)/* flags for ICs */#define LOOP_COND_TRUE 1 /* loop condition is true at first iteration */#define EFF_IC 2 /* do not transform IC with doubtful optimizations */#define ORDERED_PUSH_COPY 4 /* mark a copy of an ordered push */ /* Available codes for struct IC. See interface.doc. */#define KOMMA 1#define ASSIGN 2#define ASSIGNOP 3 #if 0/* obsolete */#define ASSIGNADD 3#define ASSIGNSUB 4#define ASSIGNMULT 5#define ASSIGNDIV 6#define ASSIGNMOD 7#define ASSIGNAND 8#define ASSIGNXOR 9#define ASSIGNOR 10#define ASSIGNLSHIFT 11#define ASSIGNRSHIFT 12#endif #define COND 13#define LOR 14#define LAND 15#define OR 16#define XOR 17#define AND 18#define EQUAL 19#define INEQUAL 20#define LESS 21#define LESSEQ 22#define GREATER 23#define GREATEREQ 24#define LSHIFT 25#define RSHIFT 26#define ADD 27#define SUB 28#define MULT 29#define DIV 30#define MOD 31#define NEGATION 32#define KOMPLEMENT 33#define PREINC 34#define POSTINC 35#define PREDEC 36#define POSTDEC 37#define MINUS 38#define CONTENT 39#define ADDRESS 40#define CAST 41#define CALL 42#define INDEX 43#define DPSTRUCT 44#define DSTRUCT 45#define IDENTIFIER 46#define CEXPR 47#define STRING 48#define MEMBER 49#define CONVERT 50#if 0#define CONVCHAR 50#define CONVSHORT 51#define CONVINT 52#define CONVLONG 53#define CONVFLOAT 54#define CONVDOUBLE 55#define CONVVOID 56#define CONVPOINTER 57#define CONVUCHAR 58#define CONVUSHORT 59#define CONVUINT 60#define CONVULONG 61#endif#define ADDRESSA 62#define FIRSTELEMENT 63#define PMULT 64#define ALLOCREG 65#define FREEREG 66#define PCEXPR 67#define TEST 68#define LABEL 69#define BEQ 70#define BNE 71#define BLT 72#define BGE 73#define BLE 74#define BGT 75#define BRA 76#define COMPARE 77#define PUSH 78#define POP 79#define ADDRESSS 80#define ADDI2P 81#define SUBIFP 82#define SUBPFP 83#define PUSHREG 84#define POPREG 85#define POPARGS 86#define SAVEREGS 87#define RESTOREREGS 88#define ILABEL 89#define DC 90#define ALIGN 91#define COLON 92#define GETRETURN 93#define SETRETURN 94#define MOVEFROMREG 95#define MOVETOREG 96#define NOP 97#define BITFIELD 98#define LITERAL 99#define REINTERPRET 100extern char *typname[];extern zmax sizetab[];extern char *storage_class_name[];extern char *ename[];extern int align_arguments; /* arguments correctly aligned on stack or just stackalign? */extern zmax align[],maxalign,stackalign;/* an empty string */extern char *empty;extern zchar vchar; extern zuchar vuchar;extern zshort vshort; extern zushort vushort;extern zint vint; extern zuint vuint;Lines 1–500 of 793. Load more
#ifndef SUPP_H #define SUPP_H 1 #include <stdlib.h> #include <stdio.h> #include <limits.h> #include <string.h> #include <stddef.h> #include <stdarg.h> #include <ctype.h> /* typenames */ #define CHAR 1 #define SHORT 2 #define INT 3 #define LONG 4 #define LLONG 5 #define FLOAT 6 #define DOUBLE 7 #define LDOUBLE 8 #define VOID 9 #define POINTER 10 #define ARRAY 11 #define STRUCT 12 #define UNION 13 #define ENUM 14 #define FUNKT 15 #define BOOL 16 #define MAXINT 17 /* should not be accessible to application */ #define MAX_TYPE MAXINT #define MAXVECDIM 16 #define VECBOOL (MAXINT+1) #define VECCHAR (VECBOOL+MAXVECDIM) #define VECSHORT (VECCHAR+MAXVECDIM) #define VECINT (VECSHORT+MAXVECDIM) #define VECLONG (VECINT+MAXVECDIM) #define VECFLOAT (VECLONG+MAXVECDIM) #define VECLAST (VECFLOAT+MAXVECDIM) #define NQ 255 /* f&NQ gives type without any qualifiers */ #define NU 511 /* f&NU gives type without any qualifiers but UNSIGNED */ #define q1typ(p) ((p->code==ADDI2P||p->code==SUBIFP||p->code==CONVERT||p->code==SUBPFP)?p->typf2:p->typf) #define q2typ(p) ((p->code==SUBPFP||p->code==LSHIFT||p->code==RSHIFT)?p->typf2:p->typf) #define ztyp(p) ((p->code==ADDI2P||p->code==SUBIFP||p->code==ADDRESS)?p->typf2:p->typf) #define iclabel(p) (p->typf) #define opsize(p) (p->q2.val.vmax) #define pushsize(p) (p->z.val.vmax) #define pushedargsize(p) (p->q2.val.vmax) #define isstatic(x) ((x)==STATIC) #define isextern(x) ((x)==EXTERN) #define isauto(x) ((x)==AUTO||(x)==REGISTER) /* operations on bit-vectors */ typedef unsigned int bvtype; #define BVBITS (sizeof(bvtype)*CHAR_BIT) #define BVSIZE(x) ((((x)+BVBITS-1)/BVBITS)*sizeof(bvtype)) #define BSET(array,bit) (array)[(bit)/BVBITS]|=1<<((bit)%BVBITS) #define BCLR(array,bit) (array)[(bit)/BVBITS]&=~(1<<((bit)%BVBITS)) #define BTST(array,bit) ((array)[(bit)/BVBITS]&(1<<((bit)%BVBITS))) /* type-qualifiers */ #define UNSIGNED (NQ+1) #define CONST (UNSIGNED<<1) #define VOLATILE (CONST<<1) #define RESTRICT (VOLATILE<<1) #define UNCOMPLETE (RESTRICT<<1) #define STRINGCONST (UNCOMPLETE<<1) #define BOOLEAN (STRINGCONST<<1) #define SIGNED_CHARACTER (BOOLEAN<<1) #ifdef HAVE_ECPP /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ #endif #define t_min(x) (((x)&UNSIGNED)?l2zm(0L):t_min[(x)&NQ]) #define t_max(x) (((x)&UNSIGNED)?tu_max[(x)&NQ]:t_max[(x)&NQ]) /* macro for internal errors */ #define ierror(a) error(-1,(a),__LINE__,FILE_) /* macros for target errors */ #define twarning(x) error(323,x); #define terror(x) error(324,x); /* this header is provided by the code generator */ #include "machine.h" #ifndef HAVE_EXT_TYPES typedef zllong zmax; typedef zullong zumax; #endif #ifndef ISPOINTER #define ISPOINTER(x) ((x&NQ)==POINTER) #endif #ifndef ISINT #define ISINT(x) ((x&NQ)>=CHAR&&(x&NQ)<=LLONG) #endif #ifndef ISFLOAT #define ISFLOAT(x) ((x&NQ)>=FLOAT&&(x&NQ)<=LDOUBLE) #endif #ifndef ISFUNC #define ISFUNC(x) ((x&NQ)==FUNKT) #endif #ifndef ISSTRUCT #define ISSTRUCT(x) ((x&NQ)==STRUCT) #endif #ifndef ISUNION #define ISUNION(x) ((x&NQ)==UNION) #endif #ifndef ISARRAY #define ISARRAY(x) ((x&NQ)==ARRAY) #endif #ifndef ISVECTOR #define ISVECTOR(x) ((x&NQ)>=VECBOOL&&(x&NQ)<=VECLAST) #endif #ifndef VECDIM #define VECDIM(x) ((((x&NQ)-VECBOOL)&15)+1) #endif #ifndef ISSCALAR #define ISSCALAR(x) ((x&NQ)>=CHAR&&(x&NQ)<=POINTER) #endif #ifndef ISARITH #define ISARITH(x) (ISINT(x)||ISFLOAT(x)) #endif #ifndef POINTER_TYPE #define POINTER_TYPE(x) POINTER #endif #ifndef MAXINT #define MAXINT LLONG #endif #ifndef HAVE_INT_SIZET #define HAVE_INT_SIZET 0 #endif #ifndef PTRDIFF_T #define PTRDIFF_T(x) INT #endif #ifndef MAXADDI2P #define MAXADDI2P LLONG #endif #define RSIZE BVSIZE(MAXR+1) #define ALL_CALLS 1 #define ALL_REGS 2 #define ALL_USES 4 #define ALL_MODS 8 #define ALL_STACK 16 #define ALWAYS_RETURNS 32 #define NEVER_RETURNS 64 #define NOSIDEFX 128 #define WARNED_STACK 256 #define WARNED_REGS 512 #define USES_VLA 1024 struct tunit{ struct Var *statics; struct tunit *next; }; /* additional information for functions; used by the optimizer */ struct function_info{ struct IC *first_ic; /* inline copy of function starts here */ struct IC *last_ic; /* " " " ends here */ struct IC *opt_ic; /* code after optimizing */ struct Var *vars; /* pointer to list of vars of that function */ struct Var *statics; /* static variables of translation-unit */ char *inline_asm; /* pointer to code for inline assembler */ unsigned long flags; /* misc flags, see above */ /* functions called, variables used and changed */ int call_cnt,use_cnt,change_cnt; struct varlist *call_list; struct varlist *use_list; struct varlist *change_list; zmax max_offset; /* registers used and modified by that function */ bvtype regs_modified[RSIZE/sizeof(bvtype)]; #if HAVE_OSEK /* removed */ /* removed */ /* removed */ #endif zumax stack1; zumax stack2; }; /* struct for types. */ struct Typ{ int flags; /* see above */ struct Typ *next; struct struct_declaration *exact; /* used for STRUCT/UNION/FUNKT */ zmax size; /* used for ARRAY */ struct Var *dsize; /* used for variable-length arrays */ char *attr; int reg; #ifdef HAVE_ECPP /* removed */ #endif }; #define TYPS sizeof(struct Typ) #ifndef HAVE_EXT_TYPES union atyps{ zchar vchar; zuchar vuchar; zshort vshort; zushort vushort; zint vint; zuint vuint; zlong vlong; zulong vulong; zllong vllong; zullong vullong; zmax vmax; zumax vumax; zfloat vfloat; zdouble vdouble; zldouble vldouble; }; #endif /* This struct represents objects in the intermediate code. */ struct obj{ int flags; /* see below */ int reg; /* number of reg if flags® */ int dtyp; /* type of pointer for DREFOBJ */ struct Var *v; struct AddressingMode *am; union atyps val; }; /* Available flags in struct obj. */ /* KONST muss immer am kleinsten sein, um beim Swappen */ /* fuer available_expressions und Konstanten nach */ /* rechts nicht in eine Endlosschleife zu kommen. */ #define KONST 1 /* The object is a constant. Its value is stored in */ /* val. */ #define VAR 2 /* The object is a variable (stored in v). */ #define SCRATCH 8 /* The object is a temporary. */ #define STACK 16 /* obsolete */ #define DREFOBJ 32 /* The object must be dereferenced. */ #define REG 64 /* The object is contained in a hardware register. */ #define VARADR 128 /* The object is the address of a static variable. */ #define DONTREGISTERIZE 256 /* Do not put this object into a register. */ #define VKONST 512 /* Variable containing a constant (for reg-alloc). */ struct Var{ int storage_class; /* see below */ int reg; /* Var is assigned to this hard-reg */ int priority; /* Priority to be used in simple_regs() */ long flags; /* see below */ char *identifier; /* name of the variable */ int nesting; /* can be freely used by the frontend */ int index; /* used by the optimizer */ int inr; /* counter for num_vars */ zmax offset; /* offset relative to the stack frame */ int line; /* line number of first declaration */ char *filename; /* filename of first declaration */ int dline; /* line number of definition */ char *dfilename; /* filename of definition */ struct Typ *vtyp; /* type of the variable */ struct const_list *clist; /* initialized? */ struct Var *next; /* pointer to next variable */ struct function_info *fi; /* used by the optimizer */ struct Var *inline_copy; /* used for function-inlining */ struct tunit *tunit; /* translation unit the variable belongs to */ char *vattr; /* extended variable attributes */ char *description; /* description of variable meaning */ struct obj cobj; /* used for register-allocation of constants */ int ctyp; /* ----------------- " ----------------- */ #ifdef HAVE_TARGET_ATTRIBUTES unsigned long tattr; /* target-specific attributes */ #endif #ifdef ALEX_REG int iRegCopyNr; int iRegCopyNrHc12V; #endif }; /* available storage-classes */ #define AUTO 1 /* var is allocated on the stack */ #define REGISTER 2 /* basically the same as AUTO (C-only) */ #define STATIC 3 /* var is static but has no external linkage */ #define EXTERN 4 /* var is static and has external linkage */ #define TYPEDEF 5 /* C-only */ /* available flags in struct Var */ #define USEDASSOURCE 1 /* the var has been read */ #define USEDASDEST 2 /* the var has been written */ #define DEFINED 4 /* the var has been defined (i.e. storage will be allocated in the current file) */ #define USEDASADR 8 /* the address of the var has been taken */ #define GENERATED 16 /* code for static vars has been generated */ #define CONVPARAMETER 32 #define TENTATIVE 64 /* C-only */ #define USEDBEFORE 128 /* used by the optimizer */ #define INLINEV 256 /* " " */ #define PRINTFLIKE 512 /* C-only */ #define SCANFLIKE 1024 /* C-only */ #define NOTTYPESAFE 2048 /* used by the optimizer */ #define DNOTTYPESAFE 4096 /* " " */ #define REGPARM 8192 /* the var is a register parameter */ #define DBLPUSH 16384 /* parameter is also on the stack */ #define NOTINTU 32768 /* variable not (yet) defined in this translation-unit */ #define REFERENCED 65536 /* variable referenced */ #define INLINEFUNC (REFERENCED*2) #define INLINEEXT (INLINEFUNC*2) #define BUILTIN (INLINEFUNC*2) /* C-only */ struct struct_list{ char *identifier; /* name of the struct/union-tag */ struct Typ *styp; /* type of the member/parameter */ zmax align; /* alignment of struct-member */ int bfoffset; /* bitfield-offset */ int bfsize; /* bitfield-size */ int storage_class; /* storage-class of function-parameter */ int reg; /* register to pass function-parameter */ #ifdef HAVE_ECPP /* removed */ #endif }; #define SLSIZE 32 /* realloc struct_lists in those steps */ /* These structs are used to describe members of STRUCT/UNION or */ /* parameters of FUNKT. Some of the entries in struct_list are not */ /* relevant for both alternatives. */ struct struct_declaration{ int count; /* number of members/parameters */ int label; /* used for debug output */ int typ; struct tunit *tunit; struct struct_declaration *next; struct struct_list (*sl)[]; char *identifier; #ifdef HAVE_ECPP /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ /* removed */ #endif }; /* The quads in the intermediate code. */ struct IC{ struct IC *prev; /* pointer to the next IC */ struct IC *next; /* pointer to the previous IC */ int code; /* see below */ int typf; /* usually type of the operands, see interface.doc */ int typf2; /* used for CONVERT,ADDI2P,SUBIFP,SUBPFP */ int defindex; /* used by optimizer */ int expindex; int copyindex; int change_cnt; int use_cnt; int call_cnt; int line; /* corresponding line in source file (or 0) */ struct varlist *change_list; /* used by optimizer */ struct varlist *use_list; struct varlist *call_list; struct obj q1; /* source 1 */ struct obj q2; /* source 2 */ struct obj z; /* target */ char *file; /* filename of the source file */ int arg_cnt; struct IC **arg_list; /* pointers to function argument ICs (only for code==CALL) */ struct IC *copy; /* for copying/inlining */ struct Typ *ityp; long flags; struct Var *savedsp; /* only for branch instructions and vlas */ #ifdef HAVE_EXT_IC struct ext_ic ext; #endif #ifdef ALEX_REG int iZWebIndex; /* web for z in case z is a pointer and its value is defed*/ int iQ1WebIndex; /* web for argument q1 */ int iQ2WebIndex; /* web for argument q2 */ void *pFlow; /* flowgraph reverse lookup */ #endif }; #define ICS sizeof(struct IC) /* flags for ICs */ #define LOOP_COND_TRUE 1 /* loop condition is true at first iteration */ #define EFF_IC 2 /* do not transform IC with doubtful optimizations */ #define ORDERED_PUSH_COPY 4 /* mark a copy of an ordered push */ /* Available codes for struct IC. See interface.doc. */ #define KOMMA 1 #define ASSIGN 2 #define ASSIGNOP 3 #if 0 /* obsolete */ #define ASSIGNADD 3 #define ASSIGNSUB 4 #define ASSIGNMULT 5 #define ASSIGNDIV 6 #define ASSIGNMOD 7 #define ASSIGNAND 8 #define ASSIGNXOR 9 #define ASSIGNOR 10 #define ASSIGNLSHIFT 11 #define ASSIGNRSHIFT 12 #endif #define COND 13 #define LOR 14 #define LAND 15 #define OR 16 #define XOR 17 #define AND 18 #define EQUAL 19 #define INEQUAL 20 #define LESS 21 #define LESSEQ 22 #define GREATER 23 #define GREATEREQ 24 #define LSHIFT 25 #define RSHIFT 26 #define ADD 27 #define SUB 28 #define MULT 29 #define DIV 30 #define MOD 31 #define NEGATION 32 #define KOMPLEMENT 33 #define PREINC 34 #define POSTINC 35 #define PREDEC 36 #define POSTDEC 37 #define MINUS 38 #define CONTENT 39 #define ADDRESS 40 #define CAST 41 #define CALL 42 #define INDEX 43 #define DPSTRUCT 44 #define DSTRUCT 45 #define IDENTIFIER 46 #define CEXPR 47 #define STRING 48 #define MEMBER 49 #define CONVERT 50 #if 0 #define CONVCHAR 50 #define CONVSHORT 51 #define CONVINT 52 #define CONVLONG 53 #define CONVFLOAT 54 #define CONVDOUBLE 55 #define CONVVOID 56 #define CONVPOINTER 57 #define CONVUCHAR 58 #define CONVUSHORT 59 #define CONVUINT 60 #define CONVULONG 61 #endif #define ADDRESSA 62 #define FIRSTELEMENT 63 #define PMULT 64 #define ALLOCREG 65 #define FREEREG 66 #define PCEXPR 67 #define TEST 68 #define LABEL 69 #define BEQ 70 #define BNE 71 #define BLT 72 #define BGE 73 #define BLE 74 #define BGT 75 #define BRA 76 #define COMPARE 77 #define PUSH 78 #define POP 79 #define ADDRESSS 80 #define ADDI2P 81 #define SUBIFP 82 #define SUBPFP 83 #define PUSHREG 84 #define POPREG 85 #define POPARGS 86 #define SAVEREGS 87 #define RESTOREREGS 88 #define ILABEL 89 #define DC 90 #define ALIGN 91 #define COLON 92 #define GETRETURN 93 #define SETRETURN 94 #define MOVEFROMREG 95 #define MOVETOREG 96 #define NOP 97 #define BITFIELD 98 #define LITERAL 99 #define REINTERPRET 100 extern char *typname[]; extern zmax sizetab[]; extern char *storage_class_name[]; extern char *ename[]; extern int align_arguments; /* arguments correctly aligned on stack or just stackalign? */ extern zmax align[],maxalign,stackalign; /* an empty string */ extern char *empty; extern zchar vchar; extern zuchar vuchar; extern zshort vshort; extern zushort vushort; extern zint vint; extern zuint vuint;