/* * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include #include #include #include "assert.h" #include "param.h" #include "set.h" #include "expr.h" #include "lookup.h" #include "token.h" #include "property.h" #include "iocc.h" #include "error.h" #include "subr.h" #include #include "regvar.h" #include "extern.h" extern set_t l_sets[]; int narexpr; expr_t arexp[MAXATT]; expr_t iextoaddr(expr_t e); iocc_t subr_iocc(int tokarg, int subreg) { inst_t insta; iocc_t result; int i; insta.in_which = IN_COPY; insta.in_info[0] = tokarg; insta.in_info[1] = subreg; result.in_index = instalookup(insta,2); if (tokarg < 1) tokarg = 1; if (subreg==0) for (i=0;isy_value.syv_regno; result.in_index = instalookup(insta,1); BIS(result.in_set,sy_p->sy_value.syv_regno); return(result); } iocc_t all_iocc(int all_no, int subreg) { iocc_t result; inst_t insta; int i; set_t localset; short *sp; sp = l_props[allreg[all_no]].pr_regset; for (i=0;isy_value.syv_tokno]; BIS(result.in_set,sy_p->sy_value.syv_tokno+nregs); insta.in_which = IN_DESCR; if (rvused&SL_REGVAR && strcmp(ident,"LOCAL")==0) insta.in_which = IN_S_DESCR; else if (rvused&DL_REGVAR && strcmp(ident,"DLOCAL")==0) insta.in_which = IN_D_DESCR; insta.in_info[0] = sy_p->sy_value.syv_tokno; for (i=0;itk_att[i].ta_type == -3) { if (narexpr>i) error("token %s initialized with too many attributes",ident); break; } if (i>= narexpr) { error("token %s initialized with too few attributes", ident); break; } typerr = 0; switch(arexp[i].ex_typ) { default: assert(0); case TYPINT: if (tp->tk_att[i].ta_type != -1) { if (tp->tk_att[i].ta_type == -2) { arexp[i] = iextoaddr(arexp[i]); } else { typerr++; } } break; case TYPBOOL: typerr++; break; case TYPADDR: if (tp->tk_att[i].ta_type != -2) typerr++; break; case TYPREG: if (tp->tk_att[i].ta_type<0) typerr++; else if (!subset(arexp[i].ex_regset, l_props[tp->tk_att[i].ta_type].pr_regset, SZOFSET(MAXREGS))) typerr++; break; } if (typerr) error("Attribute %s.%s given wrong type of value", ident,tp->tk_att[i].ta_name); insta.in_info[i+1] = arexp[i].ex_index; } result.in_index = instalookup(insta,i+1); return(result); } /* low level instance package */ int ninstances=1; inst_t l_instances[MAXINSTANCES]; int instalookup(inst_t insta, int filled) { int i,j; for (j=filled;j<=MAXATT;j++) insta.in_info[j] = 0; for (i=0;i