Compare quadruples, triples and indirect triples.
x= (a + b) * - c / d
Represent this expression in quadruples, triples and indirect triples forms. Generate the machine code for the following instruction:
V=a+(b*c)-d.
The three address code can be using following methods:
In quadruple representation the result of the operation is stored in some temporary variable. In target code generation one can quickly access the value of temporary variable using symbol table. Whereas in triple representation, use of temporary variables is avoided. The pointers to symbol table hold the result of computation.
The quadruple representation is beneficial for optimizing compilers. The level of indirection is applied by introducing temporary variables between value of computation and its use. Whereas in triple representation references to arg1 and arg2 define value of temporary variable which is not suitable method for optimizing “compiler".
Whereas in indirect triple list of all references to computations is made separately. Thus indirect triple and quadruple representations are similar as far as their utility is concerned. But indirect triple saves amount of space as compared to quadruple.
Machine code for V = a+(b*c)-d:
What is Basic Block? List out the basic blocks and draw the flow graph for the following code:
1. |
location= -1 |
2. |
i=0 |
3. |
i<100 goto 5 |
4. |
goto 13 |
5. |
t1=4*i |
6. |
t2=A[t1] |
7. |
if t2=x goto 9 |
8. |
goto 10 |
9. |
location=i |
10. |
t3=i+1 |
11. |
i=t3 |
12. |
goto 3 |
13. |
… |
Difference between Inspections and Walkthrough
Write a C program to transpose of a matrix.
Write short notes on:
What is SRS? Write the features of SRS.
Create a Sparse Matrix in C.
Why Required of ISO 9001:2000 standard?