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

ops.c File Reference

#include "c.h"

Include dependency graph for ops.c:

Include dependency graph

Go to the source code of this file.

Defines

#define gop(x, n)
#define op(x, t, s)   count += doop(x,t,#s,#x #t);

Functions

int doop (int op, int type, const char *sz, const char *opname)
int main (int argc, char *argv[])

Variables

char list [] = { 'c', 's', 'i', 'l', 'h', 'f', 'd', 'x', 'p', 0 }
int sizes [] = { 1, 2, 4, 4, 8, 4, 8, 16, 8 }


Define Documentation

#define gop x,
n   ) 
 

Referenced by main().

#define op x,
t,
 )     count += doop(x,t,#s,#x #t);
 

Referenced by btot(), builtin(), calltree(), cmp(), condtree(), do_node(), do_op(), doop(), eval(), evalop(), foldcond(), listnodes(), logAccum(), main(), mayrecalc(), newnode(), newstruct(), node(), opname(), qglAccum(), qual(), S_Update_(), simplify(), structdcl(), visit(), VM_Compile(), VM_PrepareInterpreter(), and xxinit().


Function Documentation

int doop int  op,
int  type,
const char *  sz,
const char *  opname
[static]
 

Definition at line 11 of file ops.c.

References B, count, i, list, n, op, opname(), printf(), s, sizeop, sizes, strchr(), and type.

00011                                                                       {
00012     int count = 0;
00013     static int last;
00014 
00015     if (op == LOAD)
00016         return 0;
00017     if (last != 0 && last != op)
00018         printf("\n");
00019     last = op;
00020     if (type == B || type == V) {
00021         printf(" %s=%d", opname, op + type);
00022         count++;
00023     } else {
00024         int i, done = 0;
00025         const char *s;
00026         for (i = 0; sz[i] != '\0' && (s = strchr(list, sz[i])) != NULL; i++) {
00027             int n = sizes[s-list];
00028             if ((done&(1<<n)) == 0) {
00029                 printf(" %s%d=%d", opname, n, op + type + sizeop(n));
00030                 count++;
00031             }
00032             done |= 1<<n;
00033         }
00034     }
00035     printf("\n");
00036     return count;
00037 }

Here is the call graph for this function:

int main int  argc,
char *  argv[]
 

Definition at line 39 of file ops.c.

References ADD, ADDRF, ADDRG, ADDRL, ARG, argv, ASGN, B, BAND, BCOM, BOR, BXOR, c, CALL, CNST, count, CVF, CVI, CVP, CVU, DIV, EQ, exit(), EXIT_FAILURE, F, fprintf(), GE, gop, GT, I, i, INDIR, JUMP, LABEL, LE, list, LOAD, LSH, LT, MOD, MUL, n, NE, NEG, op, p, P, RET, RSH, s, sizes, sscanf(), stderr, strchr(), SUB, U, and V.

00039                                  {
00040     int i, count = 0;
00041 
00042     for (i = 1; i < argc; i++) {
00043         char c, *s;
00044         int n;
00045         if (sscanf(argv[i], "%c=%d", &c, &n) == 2
00046         && n > 0 && (s = strchr(list, c)) != NULL)
00047             sizes[s-list] = n;
00048         else {
00049             fprintf(stderr, "usage: %s [ {csilhfdxp}=n ]...\n", argv[0]);
00050             exit(EXIT_FAILURE);
00051         }
00052     }
00053 #define gop(x,n)
00054 #define op(x,t,s) count += doop(x,t,#s,#x #t);
00055 gop(CNST,1)
00056     op(CNST,F,fdx)
00057     op(CNST,I,csilh)
00058     op(CNST,P,p)
00059     op(CNST,U,csilh)
00060 gop(ARG,2)
00061     op(ARG,B,-)
00062     op(ARG,F,fdx)
00063     op(ARG,I,ilh)
00064     op(ARG,P,p)
00065     op(ARG,U,ilh)
00066 gop(ASGN,3)
00067     op(ASGN,B,-)
00068     op(ASGN,F,fdx)
00069     op(ASGN,I,csilh)
00070     op(ASGN,P,p)
00071     op(ASGN,U,csilh)
00072 gop(INDIR,4)
00073     op(INDIR,B,-)
00074     op(INDIR,F,fdx)
00075     op(INDIR,I,csilh)
00076     op(INDIR,P,p)
00077     op(INDIR,U,csilh)
00078 gop(CVF,7)
00079     op(CVF,F,fdx)
00080     op(CVF,I,ilh)
00081 gop(CVI,8)
00082     op(CVI,F,fdx)
00083     op(CVI,I,csilh)
00084     op(CVI,U,csilhp)
00085 gop(CVP,9)
00086     op(CVP,U,p)
00087 gop(CVU,11)
00088     op(CVU,I,csilh)
00089     op(CVU,P,p)
00090     op(CVU,U,csilh)
00091 gop(NEG,12)
00092     op(NEG,F,fdx)
00093     op(NEG,I,ilh)
00094 gop(CALL,13)
00095     op(CALL,B,-)
00096     op(CALL,F,fdx)
00097     op(CALL,I,ilh)
00098     op(CALL,P,p)
00099     op(CALL,U,ilh)
00100     op(CALL,V,-)
00101 gop(RET,15)
00102     op(RET,F,fdx)
00103     op(RET,I,ilh)
00104     op(RET,P,p)
00105     op(RET,U,ilh)
00106     op(RET,V,-)
00107 gop(ADDRG,16)
00108     op(ADDRG,P,p)
00109 gop(ADDRF,17)
00110     op(ADDRF,P,p)
00111 gop(ADDRL,18)
00112     op(ADDRL,P,p)
00113 gop(ADD,19)
00114     op(ADD,F,fdx)
00115     op(ADD,I,ilh)
00116     op(ADD,P,p)
00117     op(ADD,U,ilhp)
00118 gop(SUB,20)
00119     op(SUB,F,fdx)
00120     op(SUB,I,ilh)
00121     op(SUB,P,p)
00122     op(SUB,U,ilhp)
00123 gop(LSH,21)
00124     op(LSH,I,ilh)
00125     op(LSH,U,ilh)
00126 gop(MOD,22)
00127     op(MOD,I,ilh)
00128     op(MOD,U,ilh)
00129 gop(RSH,23)
00130     op(RSH,I,ilh)
00131     op(RSH,U,ilh)
00132 gop(BAND,24)
00133     op(BAND,I,ilh)
00134     op(BAND,U,ilh)
00135 gop(BCOM,25)
00136     op(BCOM,I,ilh)
00137     op(BCOM,U,ilh)
00138 gop(BOR,26)
00139     op(BOR,I,ilh)
00140     op(BOR,U,ilh)
00141 gop(BXOR,27)
00142     op(BXOR,I,ilh)
00143     op(BXOR,U,ilh)
00144 gop(DIV,28)
00145     op(DIV,F,fdx)
00146     op(DIV,I,ilh)
00147     op(DIV,U,ilh)
00148 gop(MUL,29)
00149     op(MUL,F,fdx)
00150     op(MUL,I,ilh)
00151     op(MUL,U,ilh)
00152 gop(EQ,30)
00153     op(EQ,F,fdx)
00154     op(EQ,I,ilh)
00155     op(EQ,U,ilhp)
00156 gop(GE,31)
00157     op(GE,F,fdx)
00158     op(GE,I,ilh)
00159     op(GE,U,ilhp)
00160 gop(GT,32)
00161     op(GT,F,fdx)
00162     op(GT,I,ilh)
00163     op(GT,U,ilhp)
00164 gop(LE,33)
00165     op(LE,F,fdx)
00166     op(LE,I,ilh)
00167     op(LE,U,ilhp)
00168 gop(LT,34)
00169     op(LT,F,fdx)
00170     op(LT,I,ilh)
00171     op(LT,U,ilhp)
00172 gop(NE,35)
00173     op(NE,F,fdx)
00174     op(NE,I,ilh)
00175     op(NE,U,ilhp)
00176 gop(JUMP,36)
00177     op(JUMP,V,-)
00178 gop(LABEL,37)
00179     op(LABEL,V,-)
00180 gop(LOAD,14)
00181     op(LOAD,B,-)
00182     op(LOAD,F,fdx)
00183     op(LOAD,I,csilh)
00184     op(LOAD,P,p)
00185     op(LOAD,U,csilhp)
00186 #undef gop
00187 #undef op
00188     fprintf(stderr, "%d operators\n", count);
00189     return EXIT_SUCCESS;
00190 }

Here is the call graph for this function:


Variable Documentation

char list[] = { 'c', 's', 'i', 'l', 'h', 'f', 'd', 'x', 'p', 0 } [static]
 

Definition at line 8 of file ops.c.

Referenced by doop(), and main().

int sizes[] = { 1, 2, 4, 4, 8, 4, 8, 16, 8 } [static]
 

Definition at line 9 of file ops.c.

Referenced by doop(), and main().


Generated on Thu Aug 25 15:48:12 2005 for Quake III Arena by  doxygen 1.3.9.1