Added a mechanism to test pointers as soon as possible

This commit is contained in:
ceriel 1988-04-11 18:32:47 +00:00
parent 287ff14a1f
commit 54bfaff625
5 changed files with 38 additions and 22 deletions

View file

@ -414,7 +414,7 @@ CodeParameters(param, arg)
case Arrsel:
case Arrow:
case Def:
CodeDAddress(left);
CodeDAddress(left, IsVarParam(param));
break;
default:{
arith tmp, TmpSpace();
@ -429,7 +429,7 @@ CodeParameters(param, arg)
return;
}
if (IsVarParam(param)) {
CodeDAddress(left);
CodeDAddress(left, 1);
return;
}
if (left_type->tp_fund == T_STRING) {
@ -462,7 +462,7 @@ subu(sz)
if (options['R']) C_sbu(sz);
else {
C_cal(sz == word_size ? "subu" : "subul");
C_asp(sz);
c_asp((int)sz);
}
}
@ -473,7 +473,7 @@ addu(sz)
if (options['R']) C_adu(sz);
else {
C_cal(sz == word_size ? "addu" : "addul");
C_asp(sz);
c_asp((int)sz);
}
}
@ -507,7 +507,7 @@ CodeStd(nd)
if (tp->tp_size == float_size) C_cal("absf");
else C_cal("absd");
}
C_asp(tp->tp_size);
c_asp((int)(tp->tp_size));
C_lfr(tp->tp_size);
break;
@ -545,7 +545,7 @@ CodeStd(nd)
break;
case S_ADR:
CodeDAddress(left);
CodeDAddress(left, 1);
break;
case S_DEC:
@ -739,7 +739,7 @@ CodeOper(expr, true_label, false_label)
C_cal(tp->tp_size <= word_size ?
"mulu" :
"mulul");
C_asp(tp->tp_size);
c_asp((int)(tp->tp_size));
}
break;
case T_REAL:
@ -830,7 +830,7 @@ CodeOper(expr, true_label, false_label)
if (expr->nd_symb == GREATEREQUAL) {
/* A >= B is the same as A equals A + B
*/
C_dup(2*tp->tp_size);
C_dup(tp->tp_size << 1);
C_asp(tp->tp_size);
C_ior(tp->tp_size);
expr->nd_symb = '=';
@ -1027,7 +1027,7 @@ CodeEl(nd, tp)
else C_loc((arith) (eltype->enm_ncst - 1));
Operands(nd);
C_cal("LtoUset"); /* library routine to fill set */
C_asp(5 * word_size);
c_asp(5 * (int)word_size);
}
else {
CodePExpr(nd);
@ -1051,7 +1051,7 @@ CodePExpr(nd)
free_desig(designator);
}
CodeDAddress(nd)
CodeDAddress(nd, chk_controlvar)
t_node *nd;
{
/* Generate code to push the address of the designator "nd"
@ -1059,12 +1059,22 @@ CodeDAddress(nd)
*/
register t_desig *designator = new_desig();
int chkptr;
/* ChkForFOR(nd); ??? not quite: wrong for value conformant arrays,
where the parameter is the for-loop control variable
*/
if (chk_controlvar) ChkForFOR(nd);
CodeDesig(nd, designator);
chkptr = designator->dsg_kind==DSG_PLOADED ||
designator->dsg_kind==DSG_PFIXED;
CodeAddress(designator);
/* Generate dummy use of pointer, to get possible error message
as soon as possible
*/
if (chkptr && ! options['R']) {
C_dup(pointer_size);
C_loi((arith) 1);
c_asp((int)word_size);
}
free_desig(designator);
}
@ -1118,4 +1128,9 @@ c_lae_dlb(l)
{
C_lae_dlb(l, (arith) 0);
}
c_asp(n)
{
C_asp((arith) n);
}
#endif

View file

@ -236,7 +236,7 @@ CodeValue(ds, tp)
CodeAddress(ds);
CodeConst(tp->tp_size, (int) pointer_size);
C_cal("load");
C_asp(pointer_size + pointer_size);
c_asp((int)pointer_size + (int)pointer_size);
break;
}
break;
@ -368,7 +368,7 @@ CodeMove(rhs, left, rtp)
C_loc(rtp->tp_size);
C_loc(tp->tp_size);
C_cal("StringAssign");
C_asp(pointer_size + pointer_size + dword_size);
c_asp((int)pointer_size + (int)pointer_size + (int)dword_size);
break;
}
CodeStore(lhs, tp);
@ -436,7 +436,7 @@ CodeMove(rhs, left, rtp)
case USE_LOI_STI:
CodeConst(tp->tp_size, (int) pointer_size);
C_cal("blockmove");
C_asp(3 * pointer_size);
c_asp(3 * (int)pointer_size);
break;
}
break;

View file

@ -447,7 +447,7 @@ genrck(tp)
else {
C_cal(btp->tp_fund == T_INTEGER ? "rckil" : "rckul");
}
C_asp(pointer_size);
c_asp((int)pointer_size);
}
getbounds(tp, plo, phi)

View file

@ -86,7 +86,7 @@ DoPriority()
tmpprio = NewInt();
C_loc(priority->nd_INT);
C_cal("stackprio");
C_asp(word_size);
c_asp((int)word_size);
C_lfr(word_size);
C_stl(tmpprio);
}
@ -98,7 +98,7 @@ EndPriority()
if (priority) {
C_lol(tmpprio);
C_cal("unstackprio");
C_asp(word_size);
c_asp((int)word_size);
FreeInt(tmpprio);
}
}
@ -304,7 +304,7 @@ WalkProcedure(procedure)
/* First compute new stackpointer */
C_lal(param->par_def->var_off);
C_cal("new_stackptr");
C_asp(pointer_size);
c_asp((int)pointer_size);
C_lfr(pointer_size);
C_str((arith) 1);
/* adjusted stack pointer */
@ -312,7 +312,7 @@ WalkProcedure(procedure)
/* push source address */
C_cal("copy_array");
/* copy */
C_asp(pointer_size);
c_asp((int)pointer_size);
}
}
}
@ -407,7 +407,7 @@ MkCalls(df)
if (df->df_kind == D_MODULE) {
C_lxl((arith) 0);
C_cal(df->mod_vis->sc_scope->sc_name);
C_asp(pointer_size);
c_asp((int)pointer_size);
}
}

View file

@ -22,6 +22,7 @@ extern label data_label;
#include "squeeze.h"
#ifndef SQUEEZE
#define c_asp(x) C_asp((arith) (x))
#define c_loc(x) C_loc((arith) (x))
#define c_lae_dlb(x) C_lae_dlb(x,(arith) 0)
#endif