C:/Users/Dennis/src/lang/russell.orig/src/RIC_to_C/Omain.c File Reference

#include <fcntl.h>
#include <stdio.h>
#include "strings.h"
#include "op_codes.h"
#include "../parm.h"
#include "../pass5d/codegen.h"
#include "tables.h"

Go to the source code of this file.

Defines

#define GCC
#define STDOUT_FD   1
#define DELAB   strcat(RROOT, "/src/delab/delab")
#define CC   "/bin/cc"
#define STANDARD_PREFIX
#define PCR_STANDARD_PREFIX
#define SAFE   0x40000000
#define NONE   ((-1) | SAFE)
#define MEMORY   ((-2) & ~SAFE)
#define ONS_MAX   50
#define WORD_PTR   1
#define WORD   2
#define CHAR_PTR   3
#define FLOAT   4
#define add_modified_vr(result, expr, safe)

Functions

char * C_name ()
void finish_idt ()
void add_idt (char *lbl, long item)
char * C_name (char *s)
char * coerce (char *expr, int coercion)
void flush_slm ()
void binary_op (long result, boolean is_float, long op1, int coercion1, long op2, int coercion2, char *prefix, char *infix, char *suffix, boolean safe)
void unary_op (long result, boolean is_float, long op, int coercion, char *prefix, char *suffix, boolean safe)
void nilary_op (long result, boolean is_float, char *rhs, boolean safe)
void emit (char *s)
 main (int argc, char **argv)

Variables

FILE * in_file
boolean profile = FALSE
long lm = NONE
char * lm_expr
char * slm_ph
long slm = NONE
char * store_code
char * code = ""
char * extern_decls = ""
char * fn_name
int n_params = 0
int n_args = 0
boolean is_simple
boolean gf_refd = FALSE
boolean ar_refd = FALSE
boolean saw_ons = FALSE
int ons_depth
char * global_ar_name
boolean ons_stack [ONS_MAX]
boolean suppress = FALSE
int extern_type = NONE
boolean idt_in_progress
char * lbr_label = CS_NIL
char * lba_label = CS_NIL
char label_buf [MAXLABELSZ+1]


Define Documentation

#define add_modified_vr ( result,
expr,
safe   ) 

Value:

if ((slm & ~SAFE) != ((result) & ~SAFE)) {     \
          rem_vr_def(lm & ~SAFE);  \
        }  \
        lm = (result);  lm_expr = (expr); \
        if (safe) { \
          lm |= SAFE;   \
        }

Definition at line 348 of file Omain.c.

#define CC   "/bin/cc"

Definition at line 45 of file Omain.c.

#define CHAR_PTR   3

Definition at line 273 of file Omain.c.

#define DELAB   strcat(RROOT, "/src/delab/delab")

Definition at line 41 of file Omain.c.

#define FLOAT   4

Definition at line 274 of file Omain.c.

#define GCC

Definition at line 36 of file Omain.c.

#define MEMORY   ((-2) & ~SAFE)

Definition at line 121 of file Omain.c.

#define NONE   ((-1) | SAFE)

Definition at line 94 of file Omain.c.

#define ONS_MAX   50

Definition at line 157 of file Omain.c.

#define PCR_STANDARD_PREFIX

Value:

concat("typedef long word;\n",  \
concat("typedef word (*word_func_ptr)();\n",    \
concat("extern word * GC_malloc();\n",   \
concat("extern word * GC_malloc_atomic();\n",   \
concat("#define alloc(sz,result) *(word **)(&result) = GC_malloc((sz)<<2)\n", \
concat("#define alloc_nc(sz,result) result = GC_malloc((sz)<<2)\n", \
concat("#define alloc_cw(sz,result) result = (word)GC_malloc((sz)<<2)\n", \
concat("#define alloc_a(sz,result) *(word **)(&result) = GC_malloc_atomic((sz)<<2)\n", \
concat("#define alloc_a_nc(sz,result) result = GC_malloc_atomic((sz)<<2)\n", \
concat("#define alloc_a_cw(sz,result) result = (word)GC_malloc_atomic((sz)<<2)\n", \
concat("#define rfree(p)  GC_free(p)\n", \
concat("#define abs(x) ((x) > 0? (x) : -(x))\n",    \
"#define shift(x, n) ((n) < 0? (x) >> (-(n)) : (x) << (n))\n"    \
))))))))))))

Definition at line 69 of file Omain.c.

Referenced by main().

#define SAFE   0x40000000

Definition at line 90 of file Omain.c.

#define STANDARD_PREFIX

Value:

concat("typedef long word;\n",  \
concat("typedef word (*word_func_ptr)();\n",    \
concat("extern word * objfreelist[];\n",    \
concat("extern word * aobjfreelist[];\n",   \
concat("extern word * _allocobj();\n",   \
concat("extern word * _allocaobj();\n",   \
concat("#define alloc(sz,result) \\\n  { if (objfreelist[sz] == (word *)0) {_allocobj(sz); } \\\n  *(word **)(&result) = objfreelist[sz]; objfreelist[sz] = *(word **)result; }\n", \
concat("#define alloc_nc(sz,result) \\\n  { if (objfreelist[sz] == (word *)0) {_allocobj(sz); } \\\n  result = objfreelist[sz]; objfreelist[sz] = *(word **)result; }\n", \
concat("#define alloc_cw(sz,result) \\\n  { if (objfreelist[sz] == (word *)0) {_allocobj(sz); } \\\n  result = (word)objfreelist[sz]; objfreelist[sz] = *(word **)result; }\n", \
concat("#define alloc_a(sz,result) \\\n  { if (aobjfreelist[sz] == (word *)0) {_allocaobj(sz); } \\\n  *(word **)(&result) = aobjfreelist[sz]; aobjfreelist[sz] = *(word **)result; }\n", \
concat("#define alloc_a_nc(sz,result) \\\n  { if (aobjfreelist[sz] == (word *)0) {_allocaobj(sz); } \\\n  result = aobjfreelist[sz]; aobjfreelist[sz] = *(word **)result; }\n", \
concat("#define alloc_a_cw(sz,result) \\\n  { if (aobjfreelist[sz] == (word *)0) {_allocaobj(sz); } \\\n  result = (word)aobjfreelist[sz]; aobjfreelist[sz] = *(word **)result; }\n", \
concat("#define abs(x) ((x) > 0? (x) : -(x))\n",    \
"#define shift(x, n) ((n) < 0? (x) >> (-(n)) : (x) << (n))\n"    \
)))))))))))))

Definition at line 52 of file Omain.c.

#define STDOUT_FD   1

Definition at line 40 of file Omain.c.

#define WORD   2

Definition at line 272 of file Omain.c.

#define WORD_PTR   1

Definition at line 271 of file Omain.c.


Function Documentation

void add_idt ( char *  lbl,
long  item 
)

Definition at line 185 of file Omain.c.

References C_name(), concat(), CS_NIL, extern_decls, finish_idt(), idt_in_progress, itos(), and TRUE.

void binary_op ( long  result,
boolean  is_float,
long  op1,
int  coercion1,
long  op2,
int  coercion2,
char *  prefix,
char *  infix,
char *  suffix,
boolean  safe 
)

Definition at line 365 of file Omain.c.

References add_modified_vr, AR, code, coerce(), concat(), CS_NIL, FLOAT, flush_all_non_const(), flush_slm(), flush_vr(), get_expr(), get_name(), GF, placeholder(), SAFE, SK, slm, and slm_ph.

char* C_name ( char *  s  ) 

Definition at line 213 of file Omain.c.

References FALSE, GC_malloc_atomic(), and TRUE.

char* C_name (  ) 

char* coerce ( char *  expr,
int  coercion 
)

Definition at line 282 of file Omain.c.

References CHAR_PTR, concat(), FLOAT, NONE, WORD, and WORD_PTR.

void emit ( char *  s  ) 

Definition at line 526 of file Omain.c.

References flatten(), GC_free(), and STDOUT_FD.

void finish_idt (  ) 

Definition at line 177 of file Omain.c.

References concat(), extern_decls, FALSE, and idt_in_progress.

void flush_slm (  ) 

Definition at line 307 of file Omain.c.

References add_vr_def(), code, concat(), CS_NIL, flush_all_non_const(), flush_all_non_const_except(), flush_vr(), get_expr(), lm, lm_expr, MEMORY, NONE, rem_tmps(), SAFE, set_ph(), slm, slm_ph, and store_code.

main ( int  argc,
char **  argv 
)

Definition at line 540 of file Omain.c.

References ABI, add_idt(), add_undef_vr, add_vr_def(), ADF, ADI, ADP, ADT, AL, ALA, ALH, ALS, AND, AR, ar_refd, ARG, ARG_FLAG, arg_list(), ARGLOC, BFN, binary_op(), BR, BRF, BRT, BSF, C_name(), CC, CHAR_PTR, CLC, CLI, CLL, code, coerce(), concat(), CS_NIL, DCL, DCL_ADDR, DCL_DBL_FLOAT, DCL_FLOAT, DCL_INT, DDT, DEA, DEAD, DELAB, DVF, DVI, emit(), EQI, ERR, ET, EXF, EXT, extern_decls, extern_type, FALSE, FDT, finish_idt(), flatten(), FLS, flush_all_except(), flush_all_exprs(), flush_all_non_const(), flush_slm(), flush_vr(), fn, fn_name, GAR, GC_init(), GC_malloc_atomic(), GEI, get_expr(), GET_FIRST, get_name(), GF, gf_refd, GFU, global_ar_name, GTI, HINT, IDT, in_file, init_tmps(), is_const(), is_empty, is_param, is_simple, itos(), label_buf, LBA, lba_label, LBL, LBR, lbr_label, LDC, LDI, LDL, LDN, LDS, LEI, LIVE, lm, lm_expr, LTI, MAX_LABEL_OP, max_tmp, MAXLABELSZ, MEMORY, MLF, MLI, MOV, n_args, N_OP_CODES, n_params, NEI, NGF, NGI, nilary_op(), NONE, NOT, NP, NSC, Oflag, ONS, ons_depth, ONS_MAX, ons_stack, OPT, OR, par_name(), par_names(), PCR_STANDARD_PREFIX, placeholder(), PRO, profile, PSH, PT, rem_tmps(), rem_vr(), rem_vr_def(), reset_tmps(), RL, rmcntrl(), RTN, SAFE, saw_ons, SBF, SBI, set_ph(), SHI, SK, slm, slm_ph, STANDARD_PREFIX, STDOUT_FD, STI, store_code, STSZ, suppress, TAR, TFB, TFE, TL, tmp_decls(), TRU, TRUE, UDC, unary_op(), WORD, WORD_PTR, and xflag.

void nilary_op ( long  result,
boolean  is_float,
char *  rhs,
boolean  safe 
)

Definition at line 495 of file Omain.c.

References add_modified_vr, AR, code, coerce(), concat(), CS_NIL, FLOAT, flush_all_non_const(), flush_slm(), flush_vr(), get_name(), GF, SK, and slm_ph.

void unary_op ( long  result,
boolean  is_float,
long  op,
int  coercion,
char *  prefix,
char *  suffix,
boolean  safe 
)

Definition at line 440 of file Omain.c.

References add_modified_vr, AR, code, coerce(), concat(), CS_NIL, FLOAT, flush_all_non_const(), flush_slm(), flush_vr(), get_expr(), get_name(), GF, is_empty, placeholder(), SAFE, SK, slm, and slm_ph.


Variable Documentation

boolean ar_refd = FALSE

Definition at line 148 of file Omain.c.

char* code = ""

Definition at line 133 of file Omain.c.

char* extern_decls = ""

Definition at line 135 of file Omain.c.

int extern_type = NONE

Definition at line 168 of file Omain.c.

char* fn_name

Definition at line 138 of file Omain.c.

boolean gf_refd = FALSE

Definition at line 146 of file Omain.c.

char* global_ar_name

Definition at line 155 of file Omain.c.

boolean idt_in_progress

Definition at line 170 of file Omain.c.

FILE* in_file

Definition at line 50 of file Omain.c.

boolean is_simple

Definition at line 144 of file Omain.c.

char label_buf[MAXLABELSZ+1]

Definition at line 268 of file Omain.c.

char* lba_label = CS_NIL

Definition at line 266 of file Omain.c.

char* lbr_label = CS_NIL

Definition at line 265 of file Omain.c.

long lm = NONE

Definition at line 96 of file Omain.c.

char* lm_expr

Definition at line 97 of file Omain.c.

int n_args = 0

Definition at line 142 of file Omain.c.

int n_params = 0

Definition at line 140 of file Omain.c.

int ons_depth

Definition at line 153 of file Omain.c.

boolean ons_stack[ONS_MAX]

Definition at line 159 of file Omain.c.

boolean profile = FALSE

Definition at line 86 of file Omain.c.

boolean saw_ons = FALSE

Definition at line 151 of file Omain.c.

long slm = NONE

Definition at line 114 of file Omain.c.

char* slm_ph

Definition at line 102 of file Omain.c.

char* store_code

Definition at line 130 of file Omain.c.

boolean suppress = FALSE

Definition at line 163 of file Omain.c.


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