/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)gen.c 1.2 3/8/81";
* and the rest of the file
* This array tells the type
* returned by an arithmetic
* operation. It is indexed
* by the logarithm of the
T4INT
, T4INT
, T4INT
, TDOUBLE
,
T4INT
, T4INT
, T4INT
, TDOUBLE
,
T4INT
, T4INT
, T4INT
, TDOUBLE
,
TDOUBLE
, TDOUBLE
, TDOUBLE
, TDOUBLE
T4INT
, T4INT
, T4INT
, TDOUBLE
,
T4INT
, T4INT
, T4INT
, TDOUBLE
,
T4INT
, T4INT
, T4INT
, TDOUBLE
,
TDOUBLE
, TDOUBLE
, TDOUBLE
, TDOUBLE
T4INT
, T4INT
, T4INT
, TDOUBLE
,
T4INT
, T4INT
, T4INT
, TDOUBLE
,
T4INT
, T4INT
, T4INT
, TDOUBLE
,
TDOUBLE
, TDOUBLE
, TDOUBLE
, TDOUBLE
* These array of arithmetic and set
* operators are indexed by the
* tree nodes and is highly dependent
* on their order. They thus take
* on the flavor of magic.
0, O_NEG2
, O_MOD2
, O_DIV2
, O_DVD2
, O_MUL2
, O_ADD2
, O_SUB2
,
O_REL2
, O_REL2
, O_REL2
, O_REL2
, O_REL2
, O_REL2
O_RELT
, O_RELT
, O_RELT
, O_RELT
, O_RELT
, O_RELT
,
* two reals since they are
* shoved off in a corner in
O_DVD8
, O_MUL8
, O_ADD8
, O_SUB8
,
O_REL8
, O_REL8
, O_REL8
, O_REL8
, O_REL8
, O_REL8
,
* The following arrays, which are linearizations
* of two dimensional arrays, are the offsets for
* arithmetic, relational and assignment operations
* indexed by the logarithms of the argument widths.
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD42
-O_ADD2
, O_ADD82
-O_ADD2
,
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD42
-O_ADD2
, O_ADD82
-O_ADD2
,
O_ADD24
-O_ADD2
, O_ADD24
-O_ADD2
, O_ADD4
-O_ADD2
, O_ADD84
-O_ADD2
,
O_ADD28
-O_ADD2
, O_ADD28
-O_ADD2
, O_ADD48
-O_ADD2
, -1
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD42
-O_ADD2
, O_ADD82
-O_ADD2
,
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD42
-O_ADD2
, O_ADD82
-O_ADD2
,
O_ADD24
-O_ADD2
, O_ADD24
-O_ADD2
, O_ADD4
-O_ADD2
, O_ADD84
-O_ADD2
,
O_ADD28
-O_ADD2
, O_ADD28
-O_ADD2
, O_ADD48
-O_ADD2
, -1
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD82
-O_ADD2
,
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD82
-O_ADD2
,
O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD2
-O_ADD2
, O_ADD84
-O_ADD2
,
O_ADD28
-O_ADD2
, O_ADD28
-O_ADD2
, O_ADD28
-O_ADD2
, -1
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL42
-O_REL2
, O_REL82
-O_REL2
,
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL42
-O_REL2
, O_REL82
-O_REL2
,
O_REL24
-O_REL2
, O_REL24
-O_REL2
, O_REL4
-O_REL2
, O_REL84
-O_REL2
,
O_REL28
-O_REL2
, O_REL28
-O_REL2
, O_REL48
-O_REL2
, O_REL8
-O_REL2
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL42
-O_REL2
, O_REL82
-O_REL2
,
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL42
-O_REL2
, O_REL82
-O_REL2
,
O_REL24
-O_REL2
, O_REL24
-O_REL2
, O_REL4
-O_REL2
, O_REL84
-O_REL2
,
O_REL28
-O_REL2
, O_REL28
-O_REL2
, O_REL48
-O_REL2
, O_REL8
-O_REL2
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL82
-O_REL2
,
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL82
-O_REL2
,
O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL2
-O_REL2
, O_REL82
-O_REL2
,
O_REL28
-O_REL2
, O_REL28
-O_REL2
, O_REL28
-O_REL2
, O_REL8
-O_REL2
O_AS21
-O_AS2
, O_AS21
-O_AS2
, O_AS41
-O_AS2
, -1,
O_AS2
-O_AS2
, O_AS2
-O_AS2
, O_AS42
-O_AS2
, -1,
O_AS24
-O_AS2
, O_AS24
-O_AS2
, O_AS4
-O_AS2
, -1,
O_AS28
-O_AS2
, O_AS28
-O_AS2
, O_AS48
-O_AS2
, O_AS8
-O_AS2
,
O_AS21
-O_AS2
, O_AS21
-O_AS2
, O_AS41
-O_AS2
, -1,
O_AS2
-O_AS2
, O_AS2
-O_AS2
, O_AS42
-O_AS2
, -1,
O_AS24
-O_AS2
, O_AS24
-O_AS2
, O_AS4
-O_AS2
, -1,
O_AS28
-O_AS2
, O_AS28
-O_AS2
, O_AS48
-O_AS2
, O_AS8
-O_AS2
,
O_AS21
-O_AS2
, O_AS21
-O_AS2
, O_AS21
-O_AS2
, -1,
O_AS2
-O_AS2
, O_AS2
-O_AS2
, O_AS2
-O_AS2
, -1,
O_AS2
-O_AS2
, O_AS2
-O_AS2
, O_AS2
-O_AS2
, -1,
O_AS28
-O_AS2
, O_AS28
-O_AS2
, O_AS28
-O_AS2
, O_AS4
-O_AS2
,
* Gen generates code for assignments,
* and arithmetic and string operations
* Take the log2 of the widths
* and linearize them for indexing.
do i
++; while (w1
>>= 1);
do j
++; while (w2
>>= 1);
put(1, O_AS2
+ asgntab
[i
]);
put(1, (op
+ reltab
[i
]) | (o
- T_EQ
) << 8+INDX
);
put(1, i
== 15 ? ar8op
[o
-T_DIVD
] : op
| artab
[i
]);
return (op
== O_DVD2
&& !divchk
? nl
+TDOUBLE
: nl
+arret
[i
]);
put(2, O_RELG
| (o
- T_EQ
) << 8+INDX
, w1
);
op
|= (o
- T_EQ
)<<8+INDX
;
return (o
>= T_EQ
? nl
+TBOOL
: nl
+TSET
);