#define max(a,b) (((a)>(b))?(a):(b))
union tree *optim(tree1) register union tree *tree1; {
+ /*fprintf(stderr, "optim %d", tree1->t.op);
+ if ((opdope1[tree1->t.op] & LEAF) == 0)
+ fprintf(stderr, " left %d", tree1->t.tr1->t.op);
+ if (opdope1[tree1->t.op] & BINARY)
+ fprintf(stderr, " right %d", tree1->t.tr2->t.op);
+ fprintf(stderr, "\n");*/
register int op, dope;
int d1, d2;
union tree *t;
}
union tree *unoptim(tree1) register union tree *tree1; {
+ /*fprintf(stderr, "unoptim %d", tree1->t.op);
+ if ((opdope1[tree1->t.op] & LEAF) == 0)
+ fprintf(stderr, " left %d", tree1->t.tr1->t.op);
+ if (opdope1[tree1->t.op] & BINARY)
+ fprintf(stderr, " right %d", tree1->t.tr2->t.op);
+ fprintf(stderr, "\n");*/
register union tree *subtre, *p;
if (tree1==NULL)
case FSEL:
tree1->t.op = AND;
- tree1->t.tr1 = tree1->t.tr2->t.tr1;
+ /* tree1->t.tr1 = tree1->t.tr2->t.tr1;
tree1->t.tr2->t.tr1 = subtre;
tree1->t.tr2->t.op = RSHIFT;
- tree1->t.tr1->c.value = (1 << tree1->t.tr1->c.value) - 1;
+ tree1->t.tr1->c.value = (1 << tree1->t.tr1->c.value) - 1;*/
+ tree1->t.tr1 = tconst1((1 << ((struct FS *)tree1->t.tr2)->flen) - 1, INT);
+ tree1->t.tr2 = tnode1(RSHIFT, INT, subtre, tconst1(((struct FS *)tree1->t.tr2)->bitoffs, INT));
return(optim(tree1));
case FSELR:
tree1->t.op = LSHIFT;
tree1->t.type = UNSIGN;
- tree1->t.tr1 = tree1->t.tr2;
+ /* tree1->t.tr1 = tree1->t.tr2;
tree1->t.tr1->t.op = AND;
tree1->t.tr2 = tree1->t.tr2->t.tr2;
tree1->t.tr1->t.tr2 = subtre;
- tree1->t.tr1->t.tr1->c.value = (1 << tree1->t.tr1->t.tr1->c.value) -1;
+ tree1->t.tr1->t.tr1->c.value = (1 << tree1->t.tr1->t.tr1->c.value) -1;*/
+ tree1->t.tr1 = tnode1(AND, INT, tconst1((1 << ((struct FS *)tree1->t.tr2)->flen) - 1, INT), subtre);
+ tree1->t.tr2 = tconst1(((struct FS *)tree1->t.tr2)->bitoffs, INT);
return(optim(tree1));
case AMPER:
* Pure assignment is handled specially.
*/
+/* note that t->t.tr1->t.op == FSEL */
union tree *lvfield(t) register union tree *t; {
register union tree *t1, *t2;
t2->t.op = FSELA;
t2->t.type = UNSIGN;
t1 = t->t.tr1->t.tr2;
- t2->F.mask = ((1<<t1->t.tr1->c.value)-1)<<t1->t.tr2->c.value;
+ /* t1 formerly pointed to a COMMA node holding 2 constants */
+ /* now it contains its pass 0 value which is the field descriptor */
+ t2->F.mask = ((1<</*t1->t.tr1->c.value*/((struct FS *)t1)->flen)-1)<</*t1->t.tr2->c.value*/((struct FS *)t1)->bitoffs;
t2->t.tr1 = t->t.tr1;
t2->t.tr2 = t->t.tr2;
t = t2;
case INCAFT:
case DECBEF:
case DECAFT:
+ /*t=ASANDN(FSEL(mos,COMMA(flen,bitoffs)),arg)*/
t1 = t->t.tr1;
+ /*t1=FSEL(mos,COMMA(flen,bitoffs))*/
t1->t.op = FSELR;
+ /*t1=FSELR(mos,COMMA(flen,bitoffs))*/
t->t.tr1 = t1->t.tr1;
+ /*t=ASANDN(mos,arg)*/
t1->t.tr1 = t->t.tr2;
+ /*t1=FSELR(arg,COMMA(flen,bitoffs))*/
t->t.tr2 = t1;
+ /*t=ASANDN(mos,FSELR(arg,COMMA(flen,bitoffs)))*/
t1 = t1->t.tr2;
- t1 = tnode1(COMMA, INT, tconst1(t1->t.tr1->c.value, INT),
- tconst1(t1->t.tr2->c.value, INT));
+ /*t1=COMMA(flen,bitoffs)*/
+ /*t1 = tnode1(COMMA, INT, tconst1(t1->t.tr1->c.value, INT),
+ tconst1(t1->t.tr2->c.value, INT));*/
+ /*t1=COMMA(flen,bitoffs)*/
return(optim(tnode1(FSELT, UNSIGN, t, t1)));
}
--- /dev/null
+SYMDEF main
+PROG
+RLABEL main
+SAVE
+SETREG 5
+BRANCH 1
+LABEL 2
+ANAME fp -10
+*LABEL 4
+*BDATA 'h 'e 'l 'l 'o ', 32 '% 's 32 '% '. '* 's
+*BDATA 32 '% '5 '. '2 'f 10 0
+*LABEL 5
+*BDATA 'w 'o 'r 'l 'd 0
+*LABEL 6
+*BDATA 'f 'u 'n 0
+NAME EXTERN FUNC,INT printf
+NAME STATIC CHAR 4
+AMPER PTR,CHAR
+NAME STATIC CHAR 5
+AMPER PTR,CHAR
+COMMA INT
+CON INT 2
+COMMA INT
+NAME STATIC CHAR 6
+AMPER PTR,CHAR
+COMMA INT
+FCON DOUBLE 3.14159
+COMMA INT
+CALL INT
+EXPR 7
+*LABEL 7
+*BDATA 'h 'e 'l 'l 'o '. 't 'x 't 0
+*LABEL 8
+*BDATA 'w 0
+NAME AUTO PTR,STRUCT -10
+NAME EXTERN FUNC,PTR,STRUCT fopen
+NAME STATIC CHAR 7
+AMPER PTR,CHAR
+NAME STATIC CHAR 8
+AMPER PTR,CHAR
+COMMA INT
+CALL PTR,STRUCT
+ASSIGN PTR,STRUCT
+EXPR 8
+NAME AUTO PTR,STRUCT -10
+CON INT 0
+EQUAL INT
+CBRANCH 9 0 9
+*LABEL 10
+*BDATA 'h 'e 'l 'l 'o '. 't 'x 't 0
+NAME EXTERN FUNC,INT perror
+NAME STATIC CHAR 10
+AMPER PTR,CHAR
+CALL INT
+EXPR 10
+NAME EXTERN FUNC,INT exit
+CON INT 1
+CALL INT
+EXPR 11
+LABEL 9
+*LABEL 11
+*BDATA 'h 'e 'l 'l 'o ', 32 'w 'o 'r 'l 'd 10 0
+NAME EXTERN FUNC,INT fprintf
+NAME AUTO PTR,STRUCT -10
+NAME STATIC CHAR 11
+AMPER PTR,CHAR
+COMMA INT
+CALL INT
+EXPR 13
+NAME EXTERN FUNC,INT fclose
+NAME AUTO PTR,STRUCT -10
+CALL INT
+EXPR 14
+CON INT 0
+RFORCE INT
+EXPR 15
+BRANCH 3
+LABEL 3
+RETRN
+LABEL 1
+SETSTK 2
+BRANCH 2
+EOFC
+*EOFC
--- /dev/null
+.globl _main
+.text
+_main:
+~~main:
+jsr r5,csv
+jbr L1
+L2:~fp=177766
+.data
+L10000:40511;7717;100334;31562
+.text
+movf L10000,r0
+movf r0,-(sp)
+mov $L6,-(sp)
+mov $2,-(sp)
+mov $L5,-(sp)
+mov $L4,-(sp)
+jsr pc,_printf
+add $20,sp
+mov $L8,(sp)
+mov $L7,-(sp)
+jsr pc,*$_fopen
+tst (sp)+
+mov r0,-12(r5)
+tst -12(r5)
+jne L9
+mov $L10,(sp)
+jsr pc,*$_perror
+mov $1,(sp)
+jsr pc,*$_exit
+L9:mov $L11,(sp)
+mov -12(r5),-(sp)
+jsr pc,*$_fprintf
+tst (sp)+
+mov -12(r5),(sp)
+jsr pc,*$_fclose
+clr r0
+jbr L3
+L3:jmp cret
+L1:tst -(sp)
+jbr L2
+.globl fltused
+.globl
+.data
+L4:.byte 150,145,154,154,157,54,40,45,163,40,45,56,52,163
+.byte 40,45,65,56,62,146,12,0
+L5:.byte 167,157,162,154,144,0
+L6:.byte 146,165,156,0
+L7:.byte 150,145,154,154,157,56,164,170,164,0
+L8:.byte 167,0
+L10:.byte 150,145,154,154,157,56,164,170,164,0
+L11:.byte 150,145,154,154,157,54,40,167,157,162,154,144,12,0