#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 | 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 | ) |
Value:
if ((slm & ~SAFE) != ((result) & ~SAFE)) { \ rem_vr_def(lm & ~SAFE); \ } \ lm = (result); lm_expr = (expr); \ if (safe) { \ lm |= SAFE; \ }
Definition at line 331 of file main.c.
Referenced by binary_op(), nilary_op(), and unary_op().
#define DELAB strcat(RROOT, "/src/delab/delab") |
#define FLOAT 4 |
Definition at line 257 of file main.c.
Referenced by binary_op(), coerce(), nilary_op(), and unary_op().
#define MEMORY ((-2) & ~SAFE) |
#define SAFE 0x40000000 |
Definition at line 73 of file main.c.
Referenced by binary_op(), flush_slm(), main(), and unary_op().
#define STANDARD_PREFIX |
Value:
concat("typedef long word;\n", \ concat("typedef word (*word_func_ptr)();\n", \ concat("extern word * GC_malloc();\n", \ concat("extern void GC_free();\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 abs(x) ((x) > 0? (x) : -(x))\n", \ "#define shift(x, n) ((n) < 0? (x) >> (-(n)) : (x) << (n))\n" \ ))))))))))))
Definition at line 52 of file main.c.
Referenced by main().
void add_idt | ( | char * | lbl, | |
long | item | |||
) |
Definition at line 168 of file main.c.
References C_name(), concat(), CS_NIL, extern_decls, finish_idt(), idt_in_progress, itos(), and TRUE.
Referenced by main().
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 348 of file main.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.
Referenced by main().
char* C_name | ( | char * | s | ) |
char* coerce | ( | char * | expr, | |
int | coercion | |||
) |
void emit | ( | char * | s | ) |
void finish_idt | ( | ) |
Definition at line 160 of file main.c.
References concat(), extern_decls, FALSE, and idt_in_progress.
void flush_slm | ( | ) |
Definition at line 290 of file main.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.
Referenced by binary_op(), main(), nilary_op(), and unary_op().
main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 523 of file main.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(), 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 478 of file main.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.
Referenced by main().
void unary_op | ( | long | result, | |
boolean | is_float, | |||
long | op, | |||
int | coercion, | |||
char * | prefix, | |||
char * | suffix, | |||
boolean | safe | |||
) |
Definition at line 423 of file main.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.
Referenced by main().
char* code = "" |
Definition at line 116 of file main.c.
Referenced by binary_op(), find_inline(), flush_slm(), Gexpression(), Gfind_inline(), main(), nilary_op(), and unary_op().
char* extern_decls = "" |
int extern_type = NONE |
long lm = NONE |
char* lm_expr |
int n_args = 0 |
Definition at line 125 of file main.c.
Referenced by compile_stub(), copy_RIC(), gen_special(), get_RIC(), Gfunc_body(), Gfuncconstructor(), Ggen_special(), infer_args(), main(), parse_RIC(), put_RIC(), RIC_inst_args(), RIC_inst_rs(), unindirect(), Vfuncconstructor(), and write_RIC().
int n_params = 0 |
long slm = NONE |
Definition at line 97 of file main.c.
Referenced by binary_op(), flush_slm(), main(), and unary_op().
char* slm_ph |
Definition at line 85 of file main.c.
Referenced by binary_op(), flush_slm(), main(), nilary_op(), and unary_op().
char* store_code |