89 views
For question like :-

Find minimum number of variable required to solve the expression in three address code. (not SSA)

Do we need to consider the given variable also?

Example:-

q + r/3 + s – t * 5 + u * v/w

how many variable required?

1 vote
((q +( r/3)) + s) – ((t * 5 )+( u * (v/w)))

t1 = v/w;

t1=t1*u;

t2 = t*5;

t2 = t2+t1;

t3 = r/3;

t3 = t3+q;

t3 = t3+s;

t3  = t3-t2;

so  , 3 variables needed.
0
what about q r s t u v w?

total variables are :- 10?
0
no , only three variables t1,t2 and t3 .. we will not consider q r s t u v w as in the result now we  r treating only t1 , t2 and t3 as variables nad rest other as constants

## Related questions

1 vote
1
331 views
As in Ada, suppose that each expression must have a unique type, but that from a subexpression, by itself, all we can deduce is a set of possible types. That is, the application of function $E_{1}$ to argument $E_{2}$ ... and, once the unique type of the overall expression is determined, proceeds top-down to determine attribute $unique$ for the type of each subexpression.
Assuming that function $widen$ in Fig. $6.26$ can handle any of the types in the hierarchy of Fig. $6.25(a)$, translate the expressions below. Assume that c and d are characters, $s$ and $t$ are short integers, $i$ and $j$ are integers, and $x$ is a float. $x=s+c$ $i=s+c$ $x=(s+c)\ast(t+d)$
$A$ real array $A[i, j, k]$ has index $i$ ranging from $1$ to $4$, index $j$ ranging from $0$ to $4$, and index $k$ ranging from $5$ to $10$. Reals take $8$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[3,4,5]$ $A[1,2,7]$ $A[4,3,9]$ if $A$ is stored in column-major order.
$A$ real array $A[i, j, k]$ has index $i$ ranging from $1$ to $4$, index $j$ ranging from $0$ to $4$, and index $k$ ranging from $5$ to $10$. Reals take $8$ bytes each. Suppose array $A$ is stored starting at byte $0$. Find the location of: $A[3,4,5]$ $A[1,2,7]$ $A[4,3,9]$