changed stackheight computation to top element size computation

This commit is contained in:
eck 1990-09-04 17:16:00 +00:00
parent ee652e6908
commit 5badcb4296
6 changed files with 26 additions and 28 deletions

View file

@ -858,7 +858,7 @@ normalfailed: if (stackpad!=tokpatlen) {
level--;
#endif
return(totalcost);
#ifdef USE_SHC
#ifdef USE_TES
case DO_LABDEF: {
int index;

View file

@ -11,8 +11,7 @@ static char rcsid[] = "$Header$";
#include "result.h"
#include "glosym.h"
#include "extern.h"
#ifdef USE_SHC
#include <stdio.h>
#ifdef USE_TES
#include "label.h"
#endif
@ -76,8 +75,8 @@ char opdesc[] = {
LLDEF|RLDEF, /* EX_XOR */
LLDEF|RLDEF, /* EX_AND */
0, /* EX_ISROM */
#ifdef USE_SHC
0, /* EX_STACKHEIGHT */
#ifdef USE_TES
0, /* EX_TOPELTSIZE */
0, /* EX_FALLTHROUGH */
#endif
};
@ -384,12 +383,12 @@ result_t compute(node) register node_p node; {
assert(leaf1.e_typ == EV_INT);
result.e_v.e_con = -leaf1.e_v.e_con;
return(result);
#ifdef USE_SHC
case EX_STACKHEIGHT: /* Hans, new */
#ifdef USE_TES
case EX_TOPELTSIZE: /* Hans, new */
{ register label_p lbl;
lbl = get_label(saveemp[node->ex_lnode].em_u.em_ioper);
if (lbl != NULL) {
if (lbl != (label_p)0) {
result.e_v.e_con = lbl->lb_height;
} else {
result.e_v.e_con = 0;
@ -400,7 +399,7 @@ result_t compute(node) register node_p node; {
{ register label_p lbl;
lbl = get_label(saveemp[node->ex_lnode].em_u.em_ioper);
if (lbl != NULL) {
if (lbl != (label_p)0) {
result.e_v.e_con = lbl->lb_fallthrough;
} else result.e_v.e_con = 0;
return(result);

View file

@ -128,7 +128,7 @@ fillemlines() {
error("unknown instruction byte");
case sp_ilb1:
case sp_ilb2:
#ifdef USE_SHC
#ifdef USE_TES
lp->em_instr = op_lab;
lp->em_optyp = OPSYMBOL;
lp->em_soper = strarg(t);
@ -177,7 +177,7 @@ fillemlines() {
continue;
case PAR_B:
t = sp_ilb2;
#ifdef USE_SHC
#ifdef USE_TES
lp->em_optyp = OPSYMBOL;
lp->em_u.em_loper = argval;
lp->em_soper = strarg(t);
@ -214,7 +214,7 @@ dopseudo() {
error("No table entry for %d",emlines[0].em_instr);
nextispseu=0;
switch(savetab1) {
#ifndef USE_SHC
#ifndef USE_TES
case sp_ilb1:
case sp_ilb2:
swtxt();
@ -311,15 +311,15 @@ dopseudo() {
fatal("bad pointer size");
if ( getarg(any_ptyp)!=sp_cend )
fatal("too many parameters");
#ifdef USE_SHC
} else if (argval == ms_sth) {
int lbl, height, flthr;
#ifdef USE_TES
} else if (argval == ms_tes) {
int lbl, size, flthr;
getarg(ptyp(sp_cst2)); lbl = argval;
getarg(ptyp(sp_cst2)); height = argval;
getarg(ptyp(sp_cst2)); size = argval;
getarg(ptyp(sp_cst2)); flthr = argval;
if ( getarg(any_ptyp)!=sp_cend )
fatal("too many parameters");
add_label(lbl,height, flthr);
add_label(lbl,size, flthr);
#endif
#ifdef REGVARS
} else if (argval == ms_gto) {
@ -390,7 +390,7 @@ dopseudo() {
break;
case ps_end:
getarg(cst_ptyp | ptyp(sp_cend));
#ifdef USE_SHC
#ifdef USE_TES
kill_labels();
#endif
cleanregs();

View file

@ -11,7 +11,7 @@ static char rcsid[] = "$Header$";
#include "data.h"
#include "result.h"
#include "extern.h"
#ifdef USE_SHC
#ifdef USE_TES
#include "mach.h"
#endif
@ -143,7 +143,7 @@ prtoken(tp,leadingchar) token_p tp; {
}
}
#ifdef USE_SHC
#ifdef USE_TES
printlabel(labnum)
int labnum;
{

View file

@ -1,16 +1,15 @@
#include "tables.h"
#ifdef USE_SHC
#include <stdio.h>
#ifdef USE_TES
#include "types.h"
#include "param.h"
#include "label.h"
static label_p label_list = NULL;
static label_p label_list = (label_p)0;
extern char *myalloc();
add_label(num, height, flth)
{
register label_p lbl = NULL;
register label_p lbl = (label_p)0;
if (height <= 0) return;
if (flth != TRUE && flth != FALSE)
@ -29,18 +28,18 @@ register word num;
{
register label_p tmp = label_list;
while (tmp != NULL) {
while (tmp != (label_p)0) {
if (tmp->lb_number == num) return tmp;
tmp = tmp->lb_next;
}
return NULL;
return (label_p)0;
}
kill_labels()
{
label_p tmp;
while((tmp = label_list) != NULL) {
while((tmp = label_list) != (label_p)0) {
label_list = label_list->lb_next;
myfree((char *)tmp);
}

View file

@ -64,7 +64,7 @@ byte *trypat(bp,len) register byte *bp; {
if (Debug) {
fprintf(stderr,"Matched:");
for (i=0;i<patlen;i++) {
#ifdef USE_SHC
#ifdef USE_TES
if (emp[i].em_instr == op_lab)
fprintf(stderr," lab");
else