diff --git a/mach/proto/ncg/compute.c b/mach/proto/ncg/compute.c index 7761976f8..926ffeb3c 100644 --- a/mach/proto/ncg/compute.c +++ b/mach/proto/ncg/compute.c @@ -385,7 +385,7 @@ compute(node, presult) register node_p node; register result_t *presult; { return; case EX_REGVAR: assert(leaf1.e_typ == EV_INT); - i = isregvar((long) leaf1.e_v.e_con); + i = isregvar_size((long) leaf1.e_v.e_con, node->ex_rnode); if (i<=0) { presult->e_typ = EV_UNDEF; return; @@ -393,7 +393,7 @@ compute(node, presult) register node_p node; register result_t *presult; { presult->e_typ = EV_REG; presult->e_v.e_reg=i; return; -#endif +#endif /* REGVARS */ case EX_UMINUS: assert(leaf1.e_typ == EV_INT); presult->e_v.e_con = -leaf1.e_v.e_con; diff --git a/mach/proto/ncg/subr.c b/mach/proto/ncg/subr.c index 0ce937ecb..4540d8b00 100644 --- a/mach/proto/ncg/subr.c +++ b/mach/proto/ncg/subr.c @@ -211,7 +211,9 @@ cinstance(instno,token,tp,regno) register token_p token,tp; { compute(&enodes[inp->in_info[1]], &result); curtoken = ct; assert(result.e_typ==EV_INT); - if ((regno=isregvar(result.e_v.e_con)) > 0) { + regno = isregvar_size(result.e_v.e_con, + tokens[inp->in_info[0]].t_size); + if (regno > 0) { token->t_token = -1; token->t_att[0].ar = regno; for (i=TOKENSIZE-1;i>0;i--) diff --git a/util/ncgg/cgg.y b/util/ncgg/cgg.y index 4f9cbb00c..d2f1532b3 100644 --- a/util/ncgg/cgg.y +++ b/util/ncgg/cgg.y @@ -78,7 +78,8 @@ iocc_t iops[20]; %token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING %token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM %token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP -%token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER +%token INREG REGVAR REGVAR_W REGVAR_D +%token REG_ANY REG_FLOAT REG_LOOP REG_POINTER %token ADORNACCESS %token ADORNCC %token INT @@ -1086,7 +1087,11 @@ expr regvarexpr : REGVAR '(' expr optregvartype ')' - { $$ = regvar_expr($3,$4); } + { $$ = regvar_expr($3,$4,-1); } + | REGVAR_W '(' expr optregvartype ')' + { $$ = regvar_expr($3,$4,wordsize); } + | REGVAR_D '(' expr optregvartype ')' + { $$ = regvar_expr($3,$4,2*wordsize); } ; optregvartype diff --git a/util/ncgg/expr.c b/util/ncgg/expr.c index 0a6351590..788f0fd5d 100644 --- a/util/ncgg/expr.c +++ b/util/ncgg/expr.c @@ -274,22 +274,36 @@ expr_t iextoaddr(e) expr_t e; { return(result); } -expr_t regvar_expr(e,regtyp) expr_t e; { +expr_t regvar_expr(e,regtyp,regsiz) expr_t e; { expr_t result; - register i; + int i, regno, s, two_sizes; - result = make_expr(TYPREG,EX_REGVAR,i_expr(e),0); + two_sizes = (regtyp == reg_float && reglap != 0); + if (regsiz == -1) { + /* reglap: Can't guess between 2 sizes of reg_float. */ + if (two_sizes && regsiz == -1) + error("Must use regvar_w() or regvar_d()"); + else + regsiz = rvsize[regtyp]; + } + + result = make_expr(TYPREG,EX_REGVAR,i_expr(e),regsiz); for(i=0;iin_info[1],0); + if (insta->in_which == IN_S_DESCR) + temp = wordsize; + else + temp = 2 * wordsize; + temp=ex_lookup(EX_REGVAR,insta->in_info[1],temp); vi->vi_next = generase(temp); vi = vi->vi_next; vi->vi_next = genremove(temp); diff --git a/util/ncgg/keywords b/util/ncgg/keywords index 606f7c839..c6895df57 100644 --- a/util/ncgg/keywords +++ b/util/ncgg/keywords @@ -38,6 +38,8 @@ reg_float REG_FLOAT reg_loop REG_LOOP reg_pointer REG_POINTER regvar REGVAR +regvar_d REGVAR_D +regvar_w REGVAR_W return RETURN reusing REUSING rom ROM