#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 add_modified_vr | ( | result, | |||
expr, | |||||
safe | ) |
#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 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" \ )))))))))))))
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 | ) |
char* C_name | ( | ) |
char* coerce | ( | char * | expr, | |
int | coercion | |||
) |
void emit | ( | char * | s | ) |
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.
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.
char* extern_decls = "" |
int extern_type = NONE |
char* store_code |