reshown by
384 views
0 votes
0 votes

Please Answer this question 

4. Discuss design issues in code generation. Generate target code for the following basic block.   

           t1 : = a + b

           t2 : = c + d

           t3 : = e - t2

           t4 : = t1 - t3

 


reshown by

1 Answer

0 votes
0 votes

 

 ⦁ Issues in Code Generation are:

1. Input to code generator

2. Target program

3. Memory management

4. Instruction selection

5. Register allocation

6. Choice of evaluation

7. Approaches to code generation

 

 

Generate target code for the basic block:

Statement

L

Code Generated

Register descriptor

Address descriptor

 

 

 

All Register empty

 

 t1 : = a + b

R0

MOV a, R0
ADD b, R0

R0 contains t1

T1 in R0

 t2 : = c + d

R1

MOV c, R1
ADD d, R1

R1 contains t2

T2 in R2

t3 : = e - t2

R1

SUB e, R1

R1 contains t3

T3 in R1

t4 : = t1 - t3

R0

SUB  R0, R1

R0 contains t4

T4 in R0

 

 

MOV R0, Result

 

Result in R0 and memory

 

reshown by

Related questions

133
views
0 answers
0 votes
Ebrahim asked May 5
133 views
Q4. Generate target code for the following source language statements : x = a + b + c * (d-e) 
94
views
0 answers
0 votes
Ebrahim asked May 5
94 views
Q2. Implement the statement a:= -b + c*(d-e) + f * (c*(d-e)) into following Intermediate code representation.  a) Quadrupleb) Triple c) Indirect Triple Solve the above Question like this example
269
views
1 answers
0 votes
Ebrahim asked Jan 12
269 views
Q1. For the following grammar N -> AB | BA A -> a | CAC B -> b | CBC C -> a | b Find the FIRST and FOLLOW
359
views
1 answers
0 votes
Ebrahim asked Dec 18, 2023
359 views
Like Example Above please answer this questionQ5. Implement a+b*(c+d)-e/finto: a). Quadruples.b). Triples.c). Indirect triples.