Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

c.h File Reference

#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include "config.h"
#include "token.h"

Include dependency graph for c.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  binding
struct  code
struct  coord
struct  Events
struct  field
struct  interface
struct  list
struct  metrics
struct  node
struct  swtch
struct  symbol
struct  tree
struct  type
struct  value
struct  Xtype

Defines

#define BUFSIZE   4096
#define extend(x, ty)   ((x)&(1<<(8*(ty)->size-1)) ? (x)|((~0UL)<<(8*(ty)->size-1)) : (x)&ones(8*(ty)->size))
#define fieldleft(p)
#define fieldmask(p)   (~(~(unsigned)0<<fieldsize(p)))
#define fieldright(p)   ((p)->lsb - 1)
#define fieldsize(p)   (p)->bitsize
#define generic(op)   ((op)&0x3F0)
#define gop(name, value)   name=value<<4,
#define isaddrop(op)
#define isarith(t)   (unqual(t)->op <= UNSIGNED)
#define isarray(t)   (unqual(t)->op == ARRAY)
#define ischar(t)   ((t)->size == 1 && isint(t))
#define isconst(t)
#define isenum(t)   (unqual(t)->op == ENUM)
#define isfloat(t)   (unqual(t)->op == FLOAT)
#define isfunc(t)   (unqual(t)->op == FUNCTION)
#define isint(t)
#define isptr(t)   (unqual(t)->op == POINTER)
#define isqual(t)   ((t)->op >= CONST)
#define isscalar(t)
#define isstruct(t)
#define istypename(t, tsym)
#define isunion(t)   (unqual(t)->op == UNION)
#define isunsigned(t)   (unqual(t)->op == UNSIGNED)
#define isvolatile(t)
#define MAXLINE   512
#define mkop(op, ty)   (specific((op) + ttob(ty)))
#define NELEMS(a)   ((int)(sizeof (a)/sizeof ((a)[0])))
#define NEW(p, a)   ((p) = allocate(sizeof *(p), (a)))
#define NEW0(p, a)   memset(NEW((p),(a)), 0, sizeof *(p))
#define ones(n)   ((n)>=8*sizeof (unsigned long) ? ~0UL : ~((~0UL)<<(n)))
#define op(name, type, sizes)
#define opindex(op)   (((op)>>4)&0x3F)
#define opkind(op)   ((op)&~0x3F0)
#define opsize(op)   ((op)>>10)
#define optype(op)   ((op)&0xF)
#define roundup(x, n)   (((x)+((n)-1))&(~((n)-1)))
#define sizeop(n)   ((n)<<10)
#define specific(op)   ((op)&0x3FF)
#define unqual(t)   (isqual(t) ? (t)->type : (t))
#define xx(a, b, c, d, e, f, g)   a=b,
#define yy(a, b, c, d, e, f, g)

Typedefs

typedef void(* Apply )(void *, void *, void *)
typedef binding Binding
typedef codeCode
typedef coord Coordinate
typedef fieldField
typedef interface Interface
typedef listList
typedef metrics Metrics
typedef nodeNode
typedef swtchSwtch
typedef symbolSymbol
typedef tableTable
typedef treeTree
typedef typeType
typedef value Value

Enumerations

enum  {
  a, b, c, d,
  e, f, a, b,
  c, d, e, f,
  yy, FLOAT, CHAR, DOUBLE,
  CHAR, CHAR, CHAR, SHORT,
  CHAR, INT, CHAR, UNSIGNED,
  CHAR, POINTER, VOID, CHAR,
  STRUCT, CHAR, UNION, CHAR,
  FUNCTION, ARRAY, ENUM, CHAR,
  LONG, CHAR, CONST, CHAR,
  VOLATILE, CHAR, yy, yy,
  yy, yy, yy, yy,
  yy, yy, yy, yy,
  yy, yy, yy, yy,
  yy, ID, ID, yy,
  ID, FCON, ID, ICON,
  ID, SCON, ID, yy,
  MOD, bittree, yy, BAND,
  bittree, ID, INCR, ADD,
  addtree, ID, yy, ID,
  yy, yy, MUL, multree,
  ID, yy, ADD, addtree,
  ID, yy, yy, SUB,
  subtree, ID, yy, yy,
  DIV, multree, DECR, SUB,
  subtree, ID, DEREF, DEREF,
  ANDAND, AND = 38<<4, andtree, ANDAND,
  OROR, OR = 40<<4, andtree, OROR,
  LEQ, LE, cmptree, LEQ,
  yy, LT, cmptree, yy,
  ASGN, asgntree
}
enum  {
  F = FLOAT, I = INT, U = UNSIGNED, P = POINTER,
  V = VOID, B = STRUCT
}
enum  {
  CNST, CNST, F = FLOAT, CNST,
  I = INT, CNST, P = POINTER, CNST,
  U = UNSIGNED, ARG, ARG, B = STRUCT,
  ARG, F = FLOAT, ARG, I = INT,
  ARG, P = POINTER, ARG, U = UNSIGNED,
  ASGN, ASGN, B = STRUCT, ASGN,
  F = FLOAT, ASGN, I = INT, ASGN,
  P = POINTER, ASGN, U = UNSIGNED, INDIR,
  INDIR, B = STRUCT, INDIR, F = FLOAT,
  INDIR, I = INT, INDIR, P = POINTER,
  INDIR, U = UNSIGNED, CVF, CVF,
  F = FLOAT, CVF, I = INT, CVI,
  CVI, F = FLOAT, CVI, I = INT,
  CVI, U = UNSIGNED, CVP, CVP,
  U = UNSIGNED, CVU, CVU, I = INT,
  CVU, P = POINTER, CVU, U = UNSIGNED,
  NEG, NEG, F = FLOAT, NEG,
  I = INT, CALL, CALL, B = STRUCT,
  CALL, F = FLOAT, CALL, I = INT,
  CALL, P = POINTER, CALL, U = UNSIGNED,
  CALL, V = VOID, RET, RET,
  F = FLOAT, RET, I = INT, RET,
  P = POINTER, RET, U = UNSIGNED, RET,
  V = VOID, ADDRG, ADDRG, P = POINTER,
  ADDRF, ADDRF, P = POINTER, ADDRL,
  ADDRL, P = POINTER, ADD, ADD,
  F = FLOAT, ADD, I = INT, ADD,
  P = POINTER, ADD, U = UNSIGNED, SUB,
  SUB, F = FLOAT, SUB, I = INT,
  SUB, P = POINTER, SUB, U = UNSIGNED,
  LSH, LSH, I = INT, LSH,
  U = UNSIGNED, MOD, MOD, I = INT,
  MOD, U = UNSIGNED, RSH, RSH,
  I = INT, RSH, U = UNSIGNED, BAND,
  BAND, I = INT, BAND, U = UNSIGNED,
  BCOM, BCOM, I = INT, BCOM,
  U = UNSIGNED, BOR, BOR, I = INT,
  BOR, U = UNSIGNED, BXOR, BXOR,
  I = INT, BXOR, U = UNSIGNED, DIV,
  DIV, F = FLOAT, DIV, I = INT,
  DIV, U = UNSIGNED, MUL, MUL,
  F = FLOAT, MUL, I = INT, MUL,
  U = UNSIGNED, EQ, EQ, F = FLOAT,
  EQ, I = INT, EQ, U = UNSIGNED,
  GE, GE, F = FLOAT, GE,
  I = INT, GE, U = UNSIGNED, GT,
  GT, F = FLOAT, GT, I = INT,
  GT, U = UNSIGNED, LE, LE,
  F = FLOAT, LE, I = INT, LE,
  U = UNSIGNED, LT, LT, F = FLOAT,
  LT, I = INT, LT, U = UNSIGNED,
  NE, NE, F = FLOAT, NE,
  I = INT, NE, U = UNSIGNED, JUMP,
  JUMP, V = VOID, LABEL, LABEL,
  V = VOID, LOAD, LOAD, B = STRUCT,
  LOAD, F = FLOAT, LOAD, I = INT,
  LOAD, P = POINTER, LOAD, U = UNSIGNED,
  LASTOP
}
enum  { CODE = 1, BSS, DATA, LIT }
enum  { PERM = 0, FUNC, STMT }
enum  {
  CONSTANTS = 1, LABELS, GLOBAL, PARAM,
  LOCAL
}
enum  {
  AND = 38<<4, NOT = 39<<4, OR = 40<<4, COND = 41<<4,
  RIGHT = 42<<4, FIELD = 43<<4
}

Functions

void addlocal (Symbol)
Tree addrof (Tree)
void * allocate (unsigned long n, unsigned a)
Symbol allsymbols (Table)
List append (void *x, List list)
void apply (List event, void *arg1, void *arg2)
Type array (Type, int, int)
Tree asgn (Symbol, Tree)
Tree asgntree (int, Tree, Tree)
Type assign (Type, Tree)
Type atop (Type)
void attach (Apply, void *, List *)
Type binary (Type, Type)
Tree bittree (int, Tree, Tree)
void branch (int)
Type btot (int, int)
Tree call (Tree, Type, Coordinate)
Tree calltree (Tree, Type, Tree, Symbol)
Tree cast (Tree, Type)
void check (Node)
void checklab (Symbol p, void *cl)
Tree cnsttree (Type,...)
Code code (int)
Type compose (Type, Type)
void compound (int, Swtch, int)
Tree cond (Tree)
Tree condtree (Tree, Tree, Tree)
Symbol constant (Type, Value)
Tree constexpr (int)
Tree consttree (unsigned int, Type)
Tree cvtconst (Tree)
void deallocate (unsigned a)
void defglobal (Symbol, int)
void definelab (int)
void definept (Coordinate *)
void defpointer (Symbol)
Type deref (Type)
void emitcode (void)
void enterscope (void)
Type enumdcl (void)
Tree eqtree (int, Tree, Tree)
int eqtype (Type, Type, int)
void equatelab (Symbol, Symbol)
void error (const char *,...)
void exitscope (void)
void expect (int tok)
Tree expr (int)
Tree expr0 (int)
Tree expr1 (int)
int fatal (const char *, const char *, int)
Tree field (Tree, const char *)
Field fieldlist (Type)
Field fieldref (const char *name, Type ty)
void fillbuf (void)
void finalize (void)
int findcount (char *, int, int)
int findfunc (char *, char *)
Symbol findlabel (int)
Symbol findtype (Type)
void foreach (Table, int, void(*)(Symbol, void *), void *)
void fprint (FILE *f, const char *fmt,...)
Type freturn (Type)
Type ftype (Type, Type)
Type func (Type, Type *, int)
char * funcname (Tree)
void gencode (Symbol[], Symbol[])
Symbol genident (int, Type, int)
int genlabel (int)
int getchr (void)
int gettok (void)
int hascall (Tree p)
int hasproto (Type)
Tree idtree (Symbol)
Tree incr (int, Tree, Tree)
void init (int, char *[])
Type initializer (Type, int)
void input_init (int, char *[])
Symbol install (const char *, Table *, int, int)
Symbol intconst (int)
int intexpr (int, int)
int iscallb (Tree)
int ispow2 (unsigned long u)
Node jump (int)
int length (List list)
Node listnodes (Tree e, int tlab, int flab)
void locus (Table tp, Coordinate *cp)
Symbol lookup (const char *, Table)
void * ltov (List *list, unsigned a)
Tree lvalue (Tree)
int main (int, char *[])
void main_init (int, char *[])
Symbol mkstr (char *)
Symbol mksymbol (int, const char *, Type)
void * newarray (unsigned long m, unsigned long n, unsigned a)
Field newfield (char *, Type, Type)
Node newnode (int op, Node left, Node right, Symbol p)
Type newstruct (int, char *)
Symbol newtemp (int, int, int)
void nextline (void)
int nodeid (Tree)
Tree nullcall (Type, Symbol, Tree, Tree)
char * opname (int)
void outtype (Type, FILE *)
Tree pointer (Tree)
void print (const char *,...)
void printdag (Node, int)
void printdecl (Symbol p, Type ty)
int * printed (int)
void printproto (Symbol p, Symbol args[])
void printtree (Tree, int)
void printtype (Type, int)
int process (char *)
void program (void)
Type promote (Type)
Type ptr (Type)
Type qual (int, Type)
int reachable (int)
Symbol relocate (const char *name, Table src, Table dst)
void retcode (Tree)
Tree retype (Tree p, Type ty)
Tree rightkid (Tree p)
void rmtypes (int)
Tree root (Tree)
Tree rvalue (Tree)
Tree shtree (int, Tree, Tree)
Type signedint (Type)
Tree simplify (int, Type, Tree, Tree)
void skipto (int tok, char set[])
void statement (int, Swtch, int)
char * string (const char *str)
char * stringd (long n)
char * stringf (const char *,...)
char * stringn (const char *str, int len)
void swcode (Swtch, int *, int, int)
void swgen (Swtch)
void swtoseg (int)
Table table (Table, int)
Symbol temporary (int, Type)
void test (int tok, char set[])
Tree texpr (Tree(*)(int), int, int)
Tree tree (int, Type, Tree, Tree)
int ttob (Type)
void type_init (int, char *[])
void typeerror (int, Tree, Tree)
Type typename (void)
char * typestring (Type ty, char *id)
void use (Symbol p, Coordinate src)
Tree value (Tree)
int variadic (Type)
Tree vcall (Symbol func, Type ty,...)
void vfprint (FILE *, char *, const char *, va_list)
char * vtoa (Type, Value)
void walk (Tree e, int tlab, int flab)
void warning (const char *,...)

Variables

int Aflag
int assignargs
Binding bindings []
Symbol cfunc
Type charptype
Type chartype
code codehead
Code codelist
Table constants
unsigned char * cp
float density
Type doubletype
int errcnt
int errlimit
Events events
int explicitCast
Table externals
char * file
char * firstfile
Type floattype
Type funcptype
int glevel
Table globals
Table identifiers
Type inttype
InterfaceIR
char kind []
Table labels
int level
unsigned char * limit
char * line
int lineno
List loci
Type longdouble
Type longlong
Type longtype
int ncalled
int needconst
int nodecount
int npoints
Tree(* optree [])(int, Tree, Tree)
int Pflag
int prunetemps
float refinc
Symbol retv
Type shorttype
Type signedchar
Type signedptr
Coordinate src
Table stmtlabs
List symbols
int t
char * token
Symbol tsym
Table types
Type unsignedchar
Type unsignedlong
Type unsignedlonglong
Type unsignedptr
Type unsignedshort
Type unsignedtype
Type voidptype
Type voidtype
int wflag
int where
Type widechar
int xref
Symbol YYcheck
Symbol YYnull


Define Documentation

#define BUFSIZE   4096
 

Definition at line 14 of file c.h.

Referenced by fillbuf().

#define extend x,
ty   )     ((x)&(1<<(8*(ty)->size-1)) ? (x)|((~0UL)<<(8*(ty)->size-1)) : (x)&ones(8*(ty)->size))
 

Definition at line 35 of file c.h.

Referenced by gettok(), simplify(), and statement().

#define fieldleft p   ) 
 

Value:

(8*(p)->type->size - \
                        fieldsize(p) - fieldright(p))

Definition at line 62 of file c.h.

Referenced by emittype(), initfields(), and listnodes().

#define fieldmask p   )     (~(~(unsigned)0<<fieldsize(p)))
 

Definition at line 64 of file c.h.

Referenced by cnsttree(), initfields(), and listnodes().

#define fieldright p   )     ((p)->lsb - 1)
 

Definition at line 61 of file c.h.

Referenced by emittype(), initfields(), listnodes(), printtree1(), and prtype().

#define fieldsize p   )     (p)->bitsize
 

Definition at line 60 of file c.h.

Referenced by cnsttree(), emittype(), initfields(), listnodes(), printtree1(), and prtype().

#define generic op   )     ((op)&0x3F0)
 

Definition at line 19 of file c.h.

Referenced by bbcall(), dumptree(), fixup(), foldcond(), gen(), gen02(), genconst(), initvalue(), kill(), listnodes(), localaddr(), mayrecalc(), opname(), prelabel(), printnode(), printtree1(), prune(), replace(), requate(), reuse(), root1(), simplify(), statement(), swstmt(), undag(), and visit().

#define gop name,
value   )     name=value<<4,
 

Definition at line 190 of file c.h.

#define isaddrop op   ) 
 

Value:

(specific(op)==ADDRG+P || specific(op)==ADDRL+P \
    || specific(op)==ADDRF+P)

Definition at line 10 of file c.h.

Referenced by foldcond(), kill(), listnodes(), prune(), replace(), simplify(), and swstmt().

#define isarith t   )     (unqual(t)->op <= UNSIGNED)
 

Definition at line 55 of file c.h.

Referenced by genconst().

#define isarray t   )     (unqual(t)->op == ARRAY)
 

Definition at line 45 of file c.h.

Referenced by addrtree(), array(), atop(), cvtconst(), dbxout(), dcllocal(), dclparam(), doconst(), doglobal(), func(), genconst(), initglobal(), initializer(), outtype(), qual(), tracevalue(), and typestring().

#define ischar t   )     ((t)->size == 1 && isint(t))
 

Definition at line 51 of file c.h.

Referenced by initializer(), and typestring().

#define isconst t   ) 
 

Value:

((t)->op == CONST \
                    || (t)->op == CONST+VOLATILE)

Definition at line 43 of file c.h.

Referenced by compose(), dcllocal(), emittype(), initglobal(), qual(), specifier(), and uid2type().

#define isenum t   )     (unqual(t)->op == ENUM)
 

Definition at line 59 of file c.h.

Referenced by dbxout(), decl(), deref(), eqtype(), funcdefn(), and iscallb().

#define isfloat t   )     (unqual(t)->op == FLOAT)
 

Definition at line 54 of file c.h.

Referenced by retcode().

#define isfunc t   )     (unqual(t)->op == FUNCTION)
 

Definition at line 49 of file c.h.

Referenced by array(), checkref(), conditional(), dbxout(), dclglobal(), dcllocal(), dclparam(), decl(), doglobal(), freturn(), func(), funcdefn(), listnodes(), qual(), stabsym(), typestab(), typestring(), and variadic().

#define isint t   ) 
 

Value:

(unqual(t)->op == INT \
                    || unqual(t)->op == UNSIGNED)

Definition at line 52 of file c.h.

Referenced by condtree(), funcdefn(), listnodes(), statement(), and swstmt().

#define isptr t   )     (unqual(t)->op == POINTER)
 

Definition at line 50 of file c.h.

Referenced by addrtree(), dbxout(), deref(), expr1(), funcdefn(), listnodes(), retcode(), root1(), stabsym(), tracevalue(), and typestring().

#define isqual t   )     ((t)->op >= CONST)
 

Definition at line 38 of file c.h.

Referenced by qual(), and specifier().

#define isscalar t   ) 
 

Value:

(unqual(t)->op <= POINTER \
                    || unqual(t)->op == ENUM)

Definition at line 57 of file c.h.

Referenced by askregvar(), checkref(), dcllocal(), and initializer().

#define isstruct t   ) 
 

Value:

(unqual(t)