renamed some EM code functions according to the 86/03/11 EMCODE definition

This commit is contained in:
erikb 1986-03-11 15:21:30 +00:00
parent 4b2ac75e94
commit 43e75cec60
6 changed files with 107 additions and 107 deletions

View file

@ -156,7 +156,7 @@ begin_proc(name, def) /* to be called when entering a procedure */
size = ATW(func_tp->tp_size); size = ATW(func_tp->tp_size);
C_pro_narg(name); C_pro_narg(name);
if (is_struct_or_union(func_tp->tp_fund)) { if (is_struct_or_union(func_tp->tp_fund)) {
C_ndlb(func_res_label = data_label()); C_df_dlb(func_res_label = data_label());
C_bss_cst(size, (arith)0, 1); C_bss_cst(size, (arith)0, 1);
} }
else else
@ -173,13 +173,13 @@ begin_proc(name, def) /* to be called when entering a procedure */
if (options['p']) { /* profiling */ if (options['p']) { /* profiling */
if (strcmp(last_fn_given, FileName) != 0) { if (strcmp(last_fn_given, FileName) != 0) {
/* previous function came from other file */ /* previous function came from other file */
C_ndlb(file_name_label = data_label()); C_df_dlb(file_name_label = data_label());
C_con_begin(); C_con_begin();
C_co_scon(last_fn_given = FileName, (arith)0); C_scon(last_fn_given = FileName, (arith)0);
C_con_end(); C_con_end();
} }
/* enable debug trace of EM source */ /* enable debug trace of EM source */
C_fil_ndlb(file_name_label, (arith)0); C_fil_dlb(file_name_label, (arith)0);
C_lin((arith)LineNumber); C_lin((arith)LineNumber);
} }
} }
@ -206,11 +206,11 @@ end_proc(fbytes, nbytes)
#endif DATAFLOW #endif DATAFLOW
C_ret((arith)0); C_ret((arith)0);
if (return_expr_occurred != 0) { if (return_expr_occurred != 0) {
C_ilb(return_label); C_df_ilb(return_label);
if (func_res_label != 0) { if (func_res_label != 0) {
C_lae_ndlb(func_res_label, (arith)0); C_lae_dlb(func_res_label, (arith)0);
store_block(func_tp->tp_size, func_tp->tp_align); store_block(func_tp->tp_size, func_tp->tp_align);
C_lae_ndlb(func_res_label, (arith)0); C_lae_dlb(func_res_label, (arith)0);
C_ret(pointer_size); C_ret(pointer_size);
} }
else else
@ -286,7 +286,7 @@ code_declaration(idf, expr, lvl, sc)
code_scope(text, def); code_scope(text, def);
#endif USE_TMP #endif USE_TMP
def->df_alloc = ALLOC_DONE; def->df_alloc = ALLOC_DONE;
C_dnam(text); C_df_dnam(text);
do_ival(&(def->df_type), expr); do_ival(&(def->df_type), expr);
} }
} }
@ -300,7 +300,7 @@ code_declaration(idf, expr, lvl, sc)
/* they are handled on the spot and get an /* they are handled on the spot and get an
integer label in EM. integer label in EM.
*/ */
C_ndlb((label)def->df_address); C_df_dlb((label)def->df_address);
if (expr) /* there is an initialisation */ if (expr) /* there is an initialisation */
do_ival(&(def->df_type), expr); do_ival(&(def->df_type), expr);
else { /* produce blank space */ else { /* produce blank space */
@ -385,7 +385,7 @@ bss(idf)
*/ */
if (options['R'] && size == 0) if (options['R'] && size == 0)
warning("actual array of size 0"); warning("actual array of size 0");
C_dnam(idf->id_text); C_df_dnam(idf->id_text);
C_bss_cst(align(size, word_align), (arith)0, 1); C_bss_cst(align(size, word_align), (arith)0, 1);
} }

View file

@ -29,20 +29,20 @@ C_dup(p) | arith p; | OP(op_dup), CST(p)
C_dvf(p) | arith p; | OP(op_dvf), CST(p) C_dvf(p) | arith p; | OP(op_dvf), CST(p)
C_dvi(p) | arith p; | OP(op_dvi), CST(p) C_dvi(p) | arith p; | OP(op_dvi), CST(p)
C_dvu(p) | arith p; | OP(op_dvu), CST(p) C_dvu(p) | arith p; | OP(op_dvu), CST(p)
C_fil_ndlb(l, o) | label l; arith o; | OP(op_fil), DOFF(l, o) C_fil_dlb(l, o) | label l; arith o; | OP(op_fil), DOFF(l, o)
C_ior(p) | arith p; | OP(op_ior), CST(p) C_ior(p) | arith p; | OP(op_ior), CST(p)
C_lae_dnam(p, o) | char *p; arith o; | OP(op_lae), NOFF(p, o) C_lae_dnam(p, o) | char *p; arith o; | OP(op_lae), NOFF(p, o)
C_lae_ndlb(l, o) | label l; arith o; | OP(op_lae), DOFF(l, o) C_lae_dlb(l, o) | label l; arith o; | OP(op_lae), DOFF(l, o)
C_lal(p) | arith p; | OP(op_lal), CST(p) C_lal(p) | arith p; | OP(op_lal), CST(p)
C_ldc(p) | arith p; | OP(op_ldc), DCST(p) C_ldc(p) | arith p; | OP(op_ldc), DCST(p)
C_lde_dnam(p, o) | char *p; arith o; | OP(op_lde), NOFF(p, o) C_lde_dnam(p, o) | char *p; arith o; | OP(op_lde), NOFF(p, o)
C_lde_ndlb(l, o) | label l; arith o; | OP(op_lde), DOFF(l, o) C_lde_dlb(l, o) | label l; arith o; | OP(op_lde), DOFF(l, o)
C_ldl(p) | arith p; | OP(op_ldl), CST(p) C_ldl(p) | arith p; | OP(op_ldl), CST(p)
C_lfr(p) | arith p; | OP(op_lfr), CST(p) C_lfr(p) | arith p; | OP(op_lfr), CST(p)
C_lin(p) | arith p; | OP(op_lin), CST(p) C_lin(p) | arith p; | OP(op_lin), CST(p)
C_loc(p) | arith p; | OP(op_loc), CST(p) C_loc(p) | arith p; | OP(op_loc), CST(p)
C_loe_dnam(p, o) | char *p; arith o; | OP(op_loe), NOFF(p, o) C_loe_dnam(p, o) | char *p; arith o; | OP(op_loe), NOFF(p, o)
C_loe_ndlb(l, o) | label l; arith o; | OP(op_loe), DOFF(l, o) C_loe_dlb(l, o) | label l; arith o; | OP(op_loe), DOFF(l, o)
C_loi(p) | arith p; | OP(op_loi), CST(p) C_loi(p) | arith p; | OP(op_loi), CST(p)
C_lol(p) | arith p; | OP(op_lol), CST(p) C_lol(p) | arith p; | OP(op_lol), CST(p)
C_lor(p) | arith p; | OP(op_lor), CST(p) C_lor(p) | arith p; | OP(op_lor), CST(p)
@ -60,14 +60,14 @@ C_sbi(p) | arith p; | OP(op_sbi), CST(p)
C_sbs(p) | arith p; | OP(op_sbs), CST(p) C_sbs(p) | arith p; | OP(op_sbs), CST(p)
C_sbu(p) | arith p; | OP(op_sbu), CST(p) C_sbu(p) | arith p; | OP(op_sbu), CST(p)
C_sde_dnam(p, o) | char *p; arith o; | OP(op_sde), NOFF(p, o) C_sde_dnam(p, o) | char *p; arith o; | OP(op_sde), NOFF(p, o)
C_sde_ndlb(l, o) | label l; arith o; | OP(op_sde), DOFF(l, o) C_sde_dlb(l, o) | label l; arith o; | OP(op_sde), DOFF(l, o)
C_sdl(p) | arith p; | OP(op_sdl), CST(p) C_sdl(p) | arith p; | OP(op_sdl), CST(p)
C_sli(p) | arith p; | OP(op_sli), CST(p) C_sli(p) | arith p; | OP(op_sli), CST(p)
C_slu(p) | arith p; | OP(op_slu), CST(p) C_slu(p) | arith p; | OP(op_slu), CST(p)
C_sri(p) | arith p; | OP(op_sri), CST(p) C_sri(p) | arith p; | OP(op_sri), CST(p)
C_sru(p) | arith p; | OP(op_sru), CST(p) C_sru(p) | arith p; | OP(op_sru), CST(p)
C_ste_dnam(p, o) | char *p; arith o; | OP(op_ste), NOFF(p, o) C_ste_dnam(p, o) | char *p; arith o; | OP(op_ste), NOFF(p, o)
C_ste_ndlb(l, o) | label l; arith o; | OP(op_ste), DOFF(l, o) C_ste_dlb(l, o) | label l; arith o; | OP(op_ste), DOFF(l, o)
C_sti(p) | arith p; | OP(op_sti), CST(p) C_sti(p) | arith p; | OP(op_sti), CST(p)
C_stl(p) | arith p; | OP(op_stl), CST(p) C_stl(p) | arith p; | OP(op_stl), CST(p)
C_xor(p) | arith p; | OP(op_xor), CST(p) C_xor(p) | arith p; | OP(op_xor), CST(p)
@ -78,9 +78,9 @@ C_zle(l) | label l; | OP(op_zle), CST((arith)l)
C_zlt(l) | label l; | OP(op_zlt), CST((arith)l) C_zlt(l) | label l; | OP(op_zlt), CST((arith)l)
C_zne(l) | label l; | OP(op_zne), CST((arith)l) C_zne(l) | label l; | OP(op_zne), CST((arith)l)
% %
C_ndlb(l) | label l; | DLB(l) C_df_dlb(l) | label l; | DLB(l)
C_dnam(s) | char *s; | DNAM(s) C_df_dnam(s) | char *s; | DNAM(s)
C_ilb(l) | label l; | ILB(l) C_df_ilb(l) | label l; | ILB(l)
% %
C_bss_cst(n, w, i) | arith n, w; int i; | C_bss_cst(n, w, i) | arith n, w; int i; |
PS(ps_bss), DCST(n), CST(w), CST((arith)i) PS(ps_bss), DCST(n), CST(w), CST((arith)i)
@ -89,18 +89,18 @@ C_con_begin() | | DC_start(ps_con), PS(ps_con)
C_con_end() | | CEND() C_con_end() | | CEND()
C_rom_begin() | | DC_start(ps_rom), PS(ps_rom) C_rom_begin() | | DC_start(ps_rom), PS(ps_rom)
C_rom_end() | | CEND() C_rom_end() | | CEND()
C_co_cst(l) | arith l; | DC_check(), CST(l) C_cst(l) | arith l; | DC_check(), CST(l)
C_co_icon(val, siz) | char *val; arith siz; | C_icon(val, siz) | char *val; arith siz; |
DC_check(), WCON(sp_icon, val, siz) DC_check(), WCON(sp_icon, val, siz)
C_co_ucon(val, siz) | char *val; arith siz; | C_ucon(val, siz) | char *val; arith siz; |
DC_check(), WCON(sp_ucon, val, siz) DC_check(), WCON(sp_ucon, val, siz)
C_co_fcon(val, siz) | char *val; arith siz; | C_fcon(val, siz) | char *val; arith siz; |
DC_check(), WCON(sp_fcon, val, siz) DC_check(), WCON(sp_fcon, val, siz)
C_co_scon(str, siz) | char *str; arith siz; | DC_check(), CSTR(str) C_scon(str, siz) | char *str; arith siz; | DC_check(), CSTR(str)
C_co_dnam(str, val) | char *str; arith val; | DC_check(), NOFF(str, val) C_dnam(str, val) | char *str; arith val; | DC_check(), NOFF(str, val)
C_co_ndlb(l, val) | label l; arith val; | DC_check(), DOFF(l, val) C_dlb(l, val) | label l; arith val; | DC_check(), DOFF(l, val)
C_co_pnam(str) | char *str; | DC_check(), PNAM(str) C_pnam(str) | char *str; | DC_check(), PNAM(str)
C_co_ilb(l) | label l; | DC_check(), ILB(l) C_ilb(l) | label l; | DC_check(), ILB(l)
% %
C_pro_narg(p1) | char *p1; | PS(ps_pro), PNAM(p1), CEND() C_pro_narg(p1) | char *p1; | PS(ps_pro), PNAM(p1), CEND()
C_end(l) | arith l; | PS(ps_end), CST(l) C_end(l) | arith l; | PS(ps_end), CST(l)

View file

@ -87,11 +87,11 @@ EVAL(expr, val, code, true_label, false_label)
if (gencode) { if (gencode) {
label datlab = data_label(); label datlab = data_label();
C_ndlb(datlab); C_df_dlb(datlab);
C_con_begin(); C_con_begin();
C_co_scon(expr->SG_VALUE, (arith)0); C_scon(expr->SG_VALUE, (arith)0);
C_con_end(); C_con_end();
C_lae_ndlb(datlab, (arith)0); C_lae_dlb(datlab, (arith)0);
} }
break; break;
@ -99,11 +99,11 @@ EVAL(expr, val, code, true_label, false_label)
if (gencode) { if (gencode) {
label datlab = data_label(); label datlab = data_label();
C_ndlb(datlab); C_df_dlb(datlab);
C_rom_begin(); C_rom_begin();
C_co_fcon(expr->FL_VALUE, expr->ex_type->tp_size); C_fcon(expr->FL_VALUE, expr->ex_type->tp_size);
C_rom_end(); C_rom_end();
C_lae_ndlb(datlab, (arith)0); C_lae_dlb(datlab, (arith)0);
C_loi(expr->ex_type->tp_size); C_loi(expr->ex_type->tp_size);
} }
break; break;
@ -315,9 +315,9 @@ EVAL(expr, val, code, true_label, false_label)
compare(oper, l_true); compare(oper, l_true);
C_loc((arith)0); C_loc((arith)0);
C_bra(l_end); C_bra(l_end);
C_ilb(l_true); C_df_ilb(l_true);
C_loc((arith)1); C_loc((arith)1);
C_ilb(l_end); C_df_ilb(l_end);
} }
} }
break; break;
@ -540,12 +540,12 @@ EVAL(expr, val, code, true_label, false_label)
label l_end = text_label(); label l_end = text_label();
EVAL(leftop, RVAL, TRUE, l_true, l_false); EVAL(leftop, RVAL, TRUE, l_true, l_false);
C_ilb(l_true); C_df_ilb(l_true);
EVAL(rightop->OP_LEFT, RVAL, code, NO_LABEL, NO_LABEL); EVAL(rightop->OP_LEFT, RVAL, code, NO_LABEL, NO_LABEL);
C_bra(l_end); C_bra(l_end);
C_ilb(l_false); C_df_ilb(l_false);
EVAL(rightop->OP_RIGHT, RVAL, code, NO_LABEL, NO_LABEL); EVAL(rightop->OP_RIGHT, RVAL, code, NO_LABEL, NO_LABEL);
C_ilb(l_end); C_df_ilb(l_end);
break; break;
} }
case AND: case AND:
@ -556,28 +556,28 @@ EVAL(expr, val, code, true_label, false_label)
label l_end = text_label(); label l_end = text_label();
EVAL(leftop, RVAL, TRUE, l_maybe, l_false); EVAL(leftop, RVAL, TRUE, l_maybe, l_false);
C_ilb(l_maybe); C_df_ilb(l_maybe);
if (gencode) { if (gencode) {
EVAL(rightop, RVAL, TRUE, EVAL(rightop, RVAL, TRUE,
l_true, l_false); l_true, l_false);
C_ilb(l_true); C_df_ilb(l_true);
C_loc((arith)1); C_loc((arith)1);
C_bra(l_end); C_bra(l_end);
C_ilb(l_false); C_df_ilb(l_false);
C_loc((arith)0); C_loc((arith)0);
C_ilb(l_end); C_df_ilb(l_end);
} }
else { else {
EVAL(rightop, RVAL, FALSE, l_false, EVAL(rightop, RVAL, FALSE, l_false,
l_false); l_false);
C_ilb(l_false); C_df_ilb(l_false);
} }
} }
else { else {
label l_maybe = text_label(); label l_maybe = text_label();
EVAL(leftop, RVAL, TRUE, l_maybe, false_label); EVAL(leftop, RVAL, TRUE, l_maybe, false_label);
C_ilb(l_maybe); C_df_ilb(l_maybe);
EVAL(rightop, RVAL, code, true_label, EVAL(rightop, RVAL, code, true_label,
false_label); false_label);
} }
@ -590,28 +590,28 @@ EVAL(expr, val, code, true_label, false_label)
label l_end = text_label(); label l_end = text_label();
EVAL(leftop, RVAL, TRUE, l_true, l_maybe); EVAL(leftop, RVAL, TRUE, l_true, l_maybe);
C_ilb(l_maybe); C_df_ilb(l_maybe);
if (gencode) { if (gencode) {
EVAL(rightop, RVAL, TRUE, EVAL(rightop, RVAL, TRUE,
l_true, l_false); l_true, l_false);
C_ilb(l_false); C_df_ilb(l_false);
C_loc((arith)0); C_loc((arith)0);
C_bra(l_end); C_bra(l_end);
C_ilb(l_true); C_df_ilb(l_true);
C_loc((arith)1); C_loc((arith)1);
C_ilb(l_end); C_df_ilb(l_end);
} }
else { else {
EVAL(rightop, RVAL, FALSE, l_true, EVAL(rightop, RVAL, FALSE, l_true,
l_true); l_true);
C_ilb(l_true); C_df_ilb(l_true);
} }
} }
else { else {
label l_maybe = text_label(); label l_maybe = text_label();
EVAL(leftop, RVAL, TRUE, true_label, l_maybe); EVAL(leftop, RVAL, TRUE, true_label, l_maybe);
C_ilb(l_maybe); C_df_ilb(l_maybe);
EVAL(rightop, RVAL, code, true_label, EVAL(rightop, RVAL, code, true_label,
false_label); false_label);
} }
@ -625,12 +625,12 @@ EVAL(expr, val, code, true_label, false_label)
EVAL(rightop, RVAL, TRUE, EVAL(rightop, RVAL, TRUE,
l_false, l_true); l_false, l_true);
C_ilb(l_false); C_df_ilb(l_false);
C_loc((arith)0); C_loc((arith)0);
C_bra(l_end); C_bra(l_end);
C_ilb(l_true); C_df_ilb(l_true);
C_loc((arith)1); C_loc((arith)1);
C_ilb(l_end); C_df_ilb(l_end);
} }
else else
EVAL(rightop, RVAL, FALSE, EVAL(rightop, RVAL, FALSE,
@ -867,12 +867,12 @@ store_val(id, tp, offs)
else else
if (df->df_sc == STATIC) { if (df->df_sc == STATIC) {
if (inword) if (inword)
C_ste_ndlb((label)df->df_address, offs); C_ste_dlb((label)df->df_address, offs);
else else
if (indword) if (indword)
C_sde_ndlb((label)df->df_address, offs); C_sde_dlb((label)df->df_address, offs);
else { else {
C_lae_ndlb((label)df->df_address, offs); C_lae_dlb((label)df->df_address, offs);
store_block(size, tpalign); store_block(size, tpalign);
} }
} }
@ -960,18 +960,18 @@ load_val(expr, val)
if (df->df_sc == STATIC) { if (df->df_sc == STATIC) {
if (rvalue) { if (rvalue) {
if (size == word_size && al_on_word) if (size == word_size && al_on_word)
C_loe_ndlb((label)df->df_address, exval); C_loe_dlb((label)df->df_address, exval);
else else
if (size == dword_size && al_on_word) if (size == dword_size && al_on_word)
C_lde_ndlb((label)df->df_address, exval); C_lde_dlb((label)df->df_address, exval);
else { else {
C_lae_ndlb((label)df->df_address, exval); C_lae_dlb((label)df->df_address, exval);
load_block(size, tpalign); load_block(size, tpalign);
} }
} }
else { else {
C_lae_ndlb((label)df->df_address, (arith)0); C_lae_dlb((label)df->df_address, (arith)0);
C_adp(exval); C_adp(exval);
} }
} }
@ -1018,11 +1018,11 @@ load_cst(val, siz)
else { else {
label datlab; label datlab;
C_ndlb(datlab = data_label()); C_df_dlb(datlab = data_label());
C_rom_begin(); C_rom_begin();
C_co_icon(itos(val), siz); C_icon(itos(val), siz);
C_rom_end(); C_rom_end();
C_lae_ndlb(datlab, (arith)0); C_lae_dlb(datlab, (arith)0);
C_loi(siz); C_loi(siz);
} }
} }

View file

@ -23,7 +23,7 @@
extern char *symbol2str(); extern char *symbol2str();
#define con_byte(c) C_co_ucon(itos((long)(c) & 0xFF), (arith)1) #define con_byte(c) C_ucon(itos((long)(c) & 0xFF), (arith)1)
struct expr *do_array(), *do_struct(), *IVAL(); struct expr *do_array(), *do_struct(), *IVAL();
struct expr *strings = 0; /* list of string constants within initialiser */ struct expr *strings = 0; /* list of string constants within initialiser */
@ -49,9 +49,9 @@ do_ival(tpp, expr)
*/ */
C_con_end(); C_con_end();
while (strings != 0) { while (strings != 0) {
C_ndlb(strings->SG_DATLAB); C_df_dlb(strings->SG_DATLAB);
C_con_begin(); C_con_begin();
C_co_scon(strings->SG_VALUE, (arith)0); C_scon(strings->SG_VALUE, (arith)0);
C_con_end(); C_con_end();
strings = strings->next; strings = strings->next;
} }
@ -420,11 +420,11 @@ pad(tp)
case CHAR: case CHAR:
case ENUM: case ENUM:
case POINTER: case POINTER:
C_co_ucon("0", tp->tp_size); C_ucon("0", tp->tp_size);
break; break;
case FLOAT: case FLOAT:
case DOUBLE: case DOUBLE:
C_co_fcon("0", tp->tp_size); C_fcon("0", tp->tp_size);
break; break;
case UNION: case UNION:
error("initialisation of unions not allowed"); error("initialisation of unions not allowed");
@ -499,12 +499,12 @@ check_ival(expr, type)
ConStarted = 1; ConStarted = 1;
} }
if (expr->ex_class == Float) if (expr->ex_class == Float)
C_co_fcon(expr->FL_VALUE, expr->ex_type->tp_size); C_fcon(expr->FL_VALUE, expr->ex_type->tp_size);
else else
if (expr->ex_class == Oper && expr->OP_OPER == INT2FLOAT) { if (expr->ex_class == Oper && expr->OP_OPER == INT2FLOAT) {
expr = expr->OP_RIGHT; expr = expr->OP_RIGHT;
if (expr->ex_class == Value && expr->VL_IDF == 0) if (expr->ex_class == Value && expr->VL_IDF == 0)
C_co_fcon(itos(expr->VL_VALUE), type->tp_size); C_fcon(itos(expr->VL_VALUE), type->tp_size);
else else
illegal_init_cst(expr); illegal_init_cst(expr);
} }
@ -527,7 +527,7 @@ check_ival(expr, type)
ConStarted = 1; /* ??? */ ConStarted = 1; /* ??? */
C_ina_pt(datlab); C_ina_pt(datlab);
C_con_begin(); C_con_begin();
C_co_ndlb(datlab, (arith)0); C_dlb(datlab, (arith)0);
expr->SG_DATLAB = datlab; expr->SG_DATLAB = datlab;
store_string(expr); store_string(expr);
break; break;
@ -544,7 +544,7 @@ check_ival(expr, type)
} }
if (expr->ex_type->tp_up->tp_fund == FUNCTION) { if (expr->ex_type->tp_up->tp_fund == FUNCTION) {
if (idf) if (idf)
C_co_pnam(idf->id_text); C_pnam(idf->id_text);
else /* int (*func)() = 0 */ else /* int (*func)() = 0 */
con_int(expr); con_int(expr);
} }
@ -560,11 +560,11 @@ check_ival(expr, type)
expr_error(expr, expr_error(expr,
"illegal initialisation"); "illegal initialisation");
else else
C_co_ndlb((label)def->df_address, C_dlb((label)def->df_address,
vl->vl_value); vl->vl_value);
} }
else else
C_co_dnam(idf->id_text, vl->vl_value); C_dnam(idf->id_text, vl->vl_value);
} }
else else
con_int(expr); con_int(expr);
@ -767,9 +767,9 @@ con_int(expr)
register struct type *tp = expr->ex_type; register struct type *tp = expr->ex_type;
if (tp->tp_unsigned) if (tp->tp_unsigned)
C_co_ucon(itos(expr->VL_VALUE), tp->tp_size); C_ucon(itos(expr->VL_VALUE), tp->tp_size);
else else
C_co_icon(itos(expr->VL_VALUE), tp->tp_size); C_icon(itos(expr->VL_VALUE), tp->tp_size);
} }
illegal_init_cst(expr) illegal_init_cst(expr)

View file

@ -92,7 +92,7 @@ label
} }
*/ */
define_label(idf); define_label(idf);
C_ilb((label)idf->id_def->df_address); C_df_ilb((label)idf->id_def->df_address);
} }
; ;
@ -116,7 +116,7 @@ if_statement
been optimized to a 0 or 1. been optimized to a 0 or 1.
*/ */
code_expr(expr, RVAL, TRUE, l_true, l_false); code_expr(expr, RVAL, TRUE, l_true, l_false);
C_ilb(l_true); C_df_ilb(l_true);
} }
else { else {
if (expr->VL_VALUE == (arith)0) { if (expr->VL_VALUE == (arith)0) {
@ -131,14 +131,14 @@ if_statement
ELSE ELSE
{ {
C_bra(l_end); C_bra(l_end);
C_ilb(l_false); C_df_ilb(l_false);
} }
statement statement
{ C_ilb(l_end); { C_df_ilb(l_end);
} }
| |
empty empty
{ C_ilb(l_false); { C_df_ilb(l_false);
} }
] ]
; ;
@ -154,7 +154,7 @@ while_statement
WHILE WHILE
{ {
stat_stack(l_break, l_continue); stat_stack(l_break, l_continue);
C_ilb(l_continue); C_df_ilb(l_continue);
} }
'(' '('
expression(&expr) expression(&expr)
@ -162,7 +162,7 @@ while_statement
opnd2test(&expr, NOTEQUAL); opnd2test(&expr, NOTEQUAL);
if (expr->ex_class != Value) { if (expr->ex_class != Value) {
code_expr(expr, RVAL, TRUE, l_body, l_break); code_expr(expr, RVAL, TRUE, l_body, l_break);
C_ilb(l_body); C_df_ilb(l_body);
} }
else { else {
if (expr->VL_VALUE == (arith)0) { if (expr->VL_VALUE == (arith)0) {
@ -174,7 +174,7 @@ while_statement
statement statement
{ {
C_bra(l_continue); C_bra(l_continue);
C_ilb(l_break); C_df_ilb(l_break);
stat_unstack(); stat_unstack();
free_expression(expr); free_expression(expr);
} }
@ -188,13 +188,13 @@ do_statement
} }
: :
DO DO
{ C_ilb(l_body); { C_df_ilb(l_body);
stat_stack(l_break, l_continue); stat_stack(l_break, l_continue);
} }
statement statement
WHILE WHILE
'(' '('
{ C_ilb(l_continue); { C_df_ilb(l_continue);
} }
expression(&expr) expression(&expr)
{ {
@ -207,7 +207,7 @@ do_statement
C_bra(l_body); C_bra(l_body);
} }
} }
C_ilb(l_break); C_df_ilb(l_break);
} }
')' ')'
';' ';'
@ -235,7 +235,7 @@ for_statement
} }
]? ]?
';' ';'
{ C_ilb(l_test); { C_df_ilb(l_test);
} }
[ [
expression(&e_test) expression(&e_test)
@ -243,7 +243,7 @@ for_statement
opnd2test(&e_test, NOTEQUAL); opnd2test(&e_test, NOTEQUAL);
if (e_test->ex_class != Value) { if (e_test->ex_class != Value) {
code_expr(e_test, RVAL, TRUE, l_body, l_break); code_expr(e_test, RVAL, TRUE, l_body, l_break);
C_ilb(l_body); C_df_ilb(l_body);
} }
else { else {
if (e_test->VL_VALUE == (arith)0) { if (e_test->VL_VALUE == (arith)0) {
@ -257,11 +257,11 @@ for_statement
')' ')'
statement statement
{ {
C_ilb(l_continue); C_df_ilb(l_continue);
if (e_incr) if (e_incr)
code_expr(e_incr, RVAL, FALSE, NO_LABEL, NO_LABEL); code_expr(e_incr, RVAL, FALSE, NO_LABEL, NO_LABEL);
C_bra(l_test); C_bra(l_test);
C_ilb(l_break); C_df_ilb(l_break);
stat_unstack(); stat_unstack();
free_expression(e_init); free_expression(e_init);
free_expression(e_test); free_expression(e_test);

View file

@ -53,43 +53,43 @@ code_endswitch()
if (sh->sh_default == 0) /* no default occurred yet */ if (sh->sh_default == 0) /* no default occurred yet */
sh->sh_default = sh->sh_break; sh->sh_default = sh->sh_break;
C_bra(sh->sh_break); /* skip the switch table now */ C_bra(sh->sh_break); /* skip the switch table now */
C_ilb(sh->sh_table); /* switch table entry */ C_df_ilb(sh->sh_table); /* switch table entry */
tablabel = data_label(); /* the rom must have a label */ tablabel = data_label(); /* the rom must have a label */
C_ndlb(tablabel); C_df_dlb(tablabel);
C_rom_begin(); C_rom_begin();
C_co_ilb(sh->sh_default); C_ilb(sh->sh_default);
if (compact(sh->sh_nrofentries, sh->sh_lowerbd, sh->sh_upperbd)) { if (compact(sh->sh_nrofentries, sh->sh_lowerbd, sh->sh_upperbd)) {
/* CSA */ /* CSA */
register arith val; register arith val;
C_co_cst(sh->sh_lowerbd); C_cst(sh->sh_lowerbd);
C_co_cst(sh->sh_upperbd - sh->sh_lowerbd); C_cst(sh->sh_upperbd - sh->sh_lowerbd);
ce = sh->sh_entries; ce = sh->sh_entries;
for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) { for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) {
ASSERT(ce); ASSERT(ce);
if (val == ce->ce_value) { if (val == ce->ce_value) {
C_co_ilb(ce->ce_label); C_ilb(ce->ce_label);
ce = ce->next; ce = ce->next;
} }
else else
C_co_ilb(sh->sh_default); C_ilb(sh->sh_default);
} }
C_rom_end(); C_rom_end();
C_lae_ndlb(tablabel, (arith)0); /* perform the switch */ C_lae_dlb(tablabel, (arith)0); /* perform the switch */
C_csa(sh->sh_type->tp_size); C_csa(sh->sh_type->tp_size);
} }
else { /* CSB */ else { /* CSB */
C_co_cst((arith)sh->sh_nrofentries); C_cst((arith)sh->sh_nrofentries);
for (ce = sh->sh_entries; ce; ce = ce->next) { for (ce = sh->sh_entries; ce; ce = ce->next) {
/* generate the entries: value + prog.label */ /* generate the entries: value + prog.label */
C_co_cst(ce->ce_value); C_cst(ce->ce_value);
C_co_ilb(ce->ce_label); C_ilb(ce->ce_label);
} }
C_rom_end(); C_rom_end();
C_lae_ndlb(tablabel, (arith)0); /* perform the switch */ C_lae_dlb(tablabel, (arith)0); /* perform the switch */
C_csb(sh->sh_type->tp_size); C_csb(sh->sh_type->tp_size);
} }
C_ilb(sh->sh_break); C_df_ilb(sh->sh_break);
switch_stack = sh->next; /* unstack the switch descriptor */ switch_stack = sh->next; /* unstack the switch descriptor */
/* free the allocated switch structure */ /* free the allocated switch structure */
for (ce = sh->sh_entries; ce; ce = tmp) { for (ce = sh->sh_entries; ce; ce = tmp) {
@ -111,7 +111,7 @@ code_case(val)
return; return;
} }
ce = new_case_entry(); ce = new_case_entry();
C_ilb(ce->ce_label = text_label()); C_df_ilb(ce->ce_label = text_label());
ce->ce_value = val; ce->ce_value = val;
if (sh->sh_entries == 0) { if (sh->sh_entries == 0) {
/* first case entry */ /* first case entry */
@ -180,5 +180,5 @@ code_default()
error("multiple entry for default in switch"); error("multiple entry for default in switch");
return; return;
} }
C_ilb(sh->sh_default = text_label()); C_df_ilb(sh->sh_default = text_label());
} }