C:/Users/Dennis/src/lang/russell.orig/src/pass5d/codegen.h

Go to the documentation of this file.
00001 #define MAXLABELSZ 512
00002 #define MISSING -2      /* nonexistent entry in table */
00003 
00004 /* code generation macros */
00005 #define genl(op,l)  genl_RIC(Goutfile,op,l)
00006 #define gen0(op)  gen_RIC(Goutfile,op,SK,SK,SK)
00007 #define gen1(op,a1)  gen_RIC(Goutfile,op,a1,SK,SK)
00008 #define gen2(op,a1,a2)  gen_RIC(Goutfile,op,a1,a2,SK)
00009 #define gen3(op,a1,a2,a3)  gen_RIC(Goutfile,op,a1,a2,a3)
00010 #ifdef  DEBUG
00011 #define ASSERT(a,b) { if (!(a)) {dbgmsg(b);abort();} ;}
00012 #else
00013 #define ASSERT(a,b)
00014 #endif
00015 
00016 #ifdef  DEBUG
00017 #define ASSERT2(a,b,c)  {if (!(a)) {dbgmsg(b,c);abort();};}
00018 #else
00019 #define ASSERT2(a,b,c)
00020 #endif
00021 
00022 #define Gallocate Vallocate  /* For the moment they can be the same */
00023 #define Gnewlabel Vnewlabel
00024 
00025 /* allocate function object */
00026 #define ALLOC_FO(loc) {\
00027          gen2(ALH, C3, loc); \
00028 }
00029 
00030 #define DISPLAY(dest,level) {\
00031         if (level == 0) { \
00032             dest = GF; \
00033         } else if (level == Glevel) { \
00034             dest = AR; \
00035         } else { \
00036             int i = Glevel - level;  /* number of indirections needed */ \
00037             int source = AR; \
00038 \
00039             dest = avail_loc++; \
00040             gen2(DCL, dest, DCL_ADDR); \
00041             while (i != 0) { \
00042                 gen3(LDI, source, 0, dest); \
00043                 source = dest; \
00044                 i--; \
00045             } \
00046         }\
00047 }
00048 
00049 #define UNDISPLAY(dest) {\
00050         if (dest != GF && dest != AR) {\
00051             gen2(UDC, dest, 1);\
00052         }\
00053 }
00054 
00055 /* Internal representation of intermediate code sequences */
00056 struct RIC_instr {
00057     int op_code;
00058     boolean label_arg;
00059     int n_args;
00060     int arg[3];                /* Only used if label_arg = FALSE */
00061     struct RIC_instr * next_instr;
00062     char label[1];             /* Only used if label_arg = TRUE  */
00063 } RIC_instr;
00064 
00065 # define RIC_nil ((struct RIC_instr *)0)
00066 
00067 #define ARG_BIT 0x40000000  /* This location is an argument placeholder */
00068 
00069 struct RIC_instr * copy_RIC();
00070 
00071 struct RIC_instr * unindirect();
00072 
00073 struct RIC_instr * cat_RIC();
00074 
00075 struct RIC_instr * RIC_inst_args();
00076 
00077 struct RIC_instr * RIC_inst_rs();
00078 
00079 char * Gnewlabel();

Generated on Fri Jan 25 10:39:45 2008 for russell by  doxygen 1.5.4