Added a mechanism to test pointers as soon as possible
This commit is contained in:
parent
287ff14a1f
commit
54bfaff625
5 changed files with 38 additions and 22 deletions
|
@ -414,7 +414,7 @@ CodeParameters(param, arg)
|
||||||
case Arrsel:
|
case Arrsel:
|
||||||
case Arrow:
|
case Arrow:
|
||||||
case Def:
|
case Def:
|
||||||
CodeDAddress(left);
|
CodeDAddress(left, IsVarParam(param));
|
||||||
break;
|
break;
|
||||||
default:{
|
default:{
|
||||||
arith tmp, TmpSpace();
|
arith tmp, TmpSpace();
|
||||||
|
@ -429,7 +429,7 @@ CodeParameters(param, arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsVarParam(param)) {
|
if (IsVarParam(param)) {
|
||||||
CodeDAddress(left);
|
CodeDAddress(left, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (left_type->tp_fund == T_STRING) {
|
if (left_type->tp_fund == T_STRING) {
|
||||||
|
@ -462,7 +462,7 @@ subu(sz)
|
||||||
if (options['R']) C_sbu(sz);
|
if (options['R']) C_sbu(sz);
|
||||||
else {
|
else {
|
||||||
C_cal(sz == word_size ? "subu" : "subul");
|
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);
|
if (options['R']) C_adu(sz);
|
||||||
else {
|
else {
|
||||||
C_cal(sz == word_size ? "addu" : "addul");
|
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");
|
if (tp->tp_size == float_size) C_cal("absf");
|
||||||
else C_cal("absd");
|
else C_cal("absd");
|
||||||
}
|
}
|
||||||
C_asp(tp->tp_size);
|
c_asp((int)(tp->tp_size));
|
||||||
C_lfr(tp->tp_size);
|
C_lfr(tp->tp_size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ CodeStd(nd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_ADR:
|
case S_ADR:
|
||||||
CodeDAddress(left);
|
CodeDAddress(left, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_DEC:
|
case S_DEC:
|
||||||
|
@ -739,7 +739,7 @@ CodeOper(expr, true_label, false_label)
|
||||||
C_cal(tp->tp_size <= word_size ?
|
C_cal(tp->tp_size <= word_size ?
|
||||||
"mulu" :
|
"mulu" :
|
||||||
"mulul");
|
"mulul");
|
||||||
C_asp(tp->tp_size);
|
c_asp((int)(tp->tp_size));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_REAL:
|
case T_REAL:
|
||||||
|
@ -830,7 +830,7 @@ CodeOper(expr, true_label, false_label)
|
||||||
if (expr->nd_symb == GREATEREQUAL) {
|
if (expr->nd_symb == GREATEREQUAL) {
|
||||||
/* A >= B is the same as A equals A + B
|
/* 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_asp(tp->tp_size);
|
||||||
C_ior(tp->tp_size);
|
C_ior(tp->tp_size);
|
||||||
expr->nd_symb = '=';
|
expr->nd_symb = '=';
|
||||||
|
@ -1027,7 +1027,7 @@ CodeEl(nd, tp)
|
||||||
else C_loc((arith) (eltype->enm_ncst - 1));
|
else C_loc((arith) (eltype->enm_ncst - 1));
|
||||||
Operands(nd);
|
Operands(nd);
|
||||||
C_cal("LtoUset"); /* library routine to fill set */
|
C_cal("LtoUset"); /* library routine to fill set */
|
||||||
C_asp(5 * word_size);
|
c_asp(5 * (int)word_size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CodePExpr(nd);
|
CodePExpr(nd);
|
||||||
|
@ -1051,7 +1051,7 @@ CodePExpr(nd)
|
||||||
free_desig(designator);
|
free_desig(designator);
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeDAddress(nd)
|
CodeDAddress(nd, chk_controlvar)
|
||||||
t_node *nd;
|
t_node *nd;
|
||||||
{
|
{
|
||||||
/* Generate code to push the address of the designator "nd"
|
/* Generate code to push the address of the designator "nd"
|
||||||
|
@ -1059,12 +1059,22 @@ CodeDAddress(nd)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
register t_desig *designator = new_desig();
|
register t_desig *designator = new_desig();
|
||||||
|
int chkptr;
|
||||||
|
|
||||||
/* ChkForFOR(nd); ??? not quite: wrong for value conformant arrays,
|
if (chk_controlvar) ChkForFOR(nd);
|
||||||
where the parameter is the for-loop control variable
|
|
||||||
*/
|
|
||||||
CodeDesig(nd, designator);
|
CodeDesig(nd, designator);
|
||||||
|
chkptr = designator->dsg_kind==DSG_PLOADED ||
|
||||||
|
designator->dsg_kind==DSG_PFIXED;
|
||||||
CodeAddress(designator);
|
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);
|
free_desig(designator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,4 +1128,9 @@ c_lae_dlb(l)
|
||||||
{
|
{
|
||||||
C_lae_dlb(l, (arith) 0);
|
C_lae_dlb(l, (arith) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c_asp(n)
|
||||||
|
{
|
||||||
|
C_asp((arith) n);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -236,7 +236,7 @@ CodeValue(ds, tp)
|
||||||
CodeAddress(ds);
|
CodeAddress(ds);
|
||||||
CodeConst(tp->tp_size, (int) pointer_size);
|
CodeConst(tp->tp_size, (int) pointer_size);
|
||||||
C_cal("load");
|
C_cal("load");
|
||||||
C_asp(pointer_size + pointer_size);
|
c_asp((int)pointer_size + (int)pointer_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -368,7 +368,7 @@ CodeMove(rhs, left, rtp)
|
||||||
C_loc(rtp->tp_size);
|
C_loc(rtp->tp_size);
|
||||||
C_loc(tp->tp_size);
|
C_loc(tp->tp_size);
|
||||||
C_cal("StringAssign");
|
C_cal("StringAssign");
|
||||||
C_asp(pointer_size + pointer_size + dword_size);
|
c_asp((int)pointer_size + (int)pointer_size + (int)dword_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CodeStore(lhs, tp);
|
CodeStore(lhs, tp);
|
||||||
|
@ -436,7 +436,7 @@ CodeMove(rhs, left, rtp)
|
||||||
case USE_LOI_STI:
|
case USE_LOI_STI:
|
||||||
CodeConst(tp->tp_size, (int) pointer_size);
|
CodeConst(tp->tp_size, (int) pointer_size);
|
||||||
C_cal("blockmove");
|
C_cal("blockmove");
|
||||||
C_asp(3 * pointer_size);
|
c_asp(3 * (int)pointer_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -447,7 +447,7 @@ genrck(tp)
|
||||||
else {
|
else {
|
||||||
C_cal(btp->tp_fund == T_INTEGER ? "rckil" : "rckul");
|
C_cal(btp->tp_fund == T_INTEGER ? "rckil" : "rckul");
|
||||||
}
|
}
|
||||||
C_asp(pointer_size);
|
c_asp((int)pointer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
getbounds(tp, plo, phi)
|
getbounds(tp, plo, phi)
|
||||||
|
|
|
@ -86,7 +86,7 @@ DoPriority()
|
||||||
tmpprio = NewInt();
|
tmpprio = NewInt();
|
||||||
C_loc(priority->nd_INT);
|
C_loc(priority->nd_INT);
|
||||||
C_cal("stackprio");
|
C_cal("stackprio");
|
||||||
C_asp(word_size);
|
c_asp((int)word_size);
|
||||||
C_lfr(word_size);
|
C_lfr(word_size);
|
||||||
C_stl(tmpprio);
|
C_stl(tmpprio);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ EndPriority()
|
||||||
if (priority) {
|
if (priority) {
|
||||||
C_lol(tmpprio);
|
C_lol(tmpprio);
|
||||||
C_cal("unstackprio");
|
C_cal("unstackprio");
|
||||||
C_asp(word_size);
|
c_asp((int)word_size);
|
||||||
FreeInt(tmpprio);
|
FreeInt(tmpprio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ WalkProcedure(procedure)
|
||||||
/* First compute new stackpointer */
|
/* First compute new stackpointer */
|
||||||
C_lal(param->par_def->var_off);
|
C_lal(param->par_def->var_off);
|
||||||
C_cal("new_stackptr");
|
C_cal("new_stackptr");
|
||||||
C_asp(pointer_size);
|
c_asp((int)pointer_size);
|
||||||
C_lfr(pointer_size);
|
C_lfr(pointer_size);
|
||||||
C_str((arith) 1);
|
C_str((arith) 1);
|
||||||
/* adjusted stack pointer */
|
/* adjusted stack pointer */
|
||||||
|
@ -312,7 +312,7 @@ WalkProcedure(procedure)
|
||||||
/* push source address */
|
/* push source address */
|
||||||
C_cal("copy_array");
|
C_cal("copy_array");
|
||||||
/* copy */
|
/* copy */
|
||||||
C_asp(pointer_size);
|
c_asp((int)pointer_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ MkCalls(df)
|
||||||
if (df->df_kind == D_MODULE) {
|
if (df->df_kind == D_MODULE) {
|
||||||
C_lxl((arith) 0);
|
C_lxl((arith) 0);
|
||||||
C_cal(df->mod_vis->sc_scope->sc_name);
|
C_cal(df->mod_vis->sc_scope->sc_name);
|
||||||
C_asp(pointer_size);
|
c_asp((int)pointer_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ extern label data_label;
|
||||||
#include "squeeze.h"
|
#include "squeeze.h"
|
||||||
|
|
||||||
#ifndef SQUEEZE
|
#ifndef SQUEEZE
|
||||||
|
#define c_asp(x) C_asp((arith) (x))
|
||||||
#define c_loc(x) C_loc((arith) (x))
|
#define c_loc(x) C_loc((arith) (x))
|
||||||
#define c_lae_dlb(x) C_lae_dlb(x,(arith) 0)
|
#define c_lae_dlb(x) C_lae_dlb(x,(arith) 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue