search
Log In

Recent questions tagged target-code-generation

0 votes
0 answers
1
Generate code for the following three-address statements assuming stack allocation where register SP points to the top of the stack x = 1 x=a x = a + 1 x = a+b The two statements x = b * c y = a + x
asked Apr 1, 2019 in Compiler Design aditi19 282 views
1 vote
1 answer
2
Many compilers are divided into two largely independent parsers: a front- end, responsible for analyzing the source code, and a back -end, responsible for generating the target code. What is the most important motivation for this division into passes? 1It aids in ... division of labor when a compiler is build by a large team of programmers. 4.To minimize memory requirements on modern machines.
asked Dec 27, 2018 in Compiler Design Prince Sindhiya 132 views
0 votes
1 answer
4
0 votes
2 answers
6
14 votes
2 answers
7
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment. c = a + b; d ... this code segment without any spill to memory? Do not apply any optimization other than optimizing register allocation. 3 4 5 6
asked Apr 21, 2016 in Compiler Design jothee 2.5k views
3 votes
0 answers
8
32 votes
3 answers
9
Consider the grammar rule $E \rightarrow E1 - E2$ for arith­metic expressions. The code generated is targeted to a CPU having a single user register. The sub­traction operation requires the first operand to be in the register. If $E1$ and $E2$ do not have any com­mon ... first Evaluation of $E1$ and $E2$ should necessarily be interleaved Order of evaluation of $E1$ and $E2$ is of no consequence
asked Nov 12, 2014 in Compiler Design Vikrant Singh 4.9k views
40 votes
7 answers
10
The program below uses six temporary variables $a, b, c, d, e, f$. a = 1 b = 10 c = 20 d = a + b e = c + d f = c + e b = c + e e = b + f d = 5 + e return d + f Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute this program without spilling? $2$ $3$ $4$ $6$
asked Sep 30, 2014 in Compiler Design jothee 7.7k views
19 votes
2 answers
11
The expression $( a * b) * c \; op \dots$ where ‘op’ is one of ‘$+$’, ‘$*$’ and ‘$\uparrow$’ (exponentiation) can be evaluated on a CPU with single register without storing the value of ($a * b$) if $\text{‘op’}$ is ‘$+$’ or ‘$*$’ $\text{‘op’}$ is ‘$\uparrow$’ or ‘$*$’ $\text{‘op’}$ is ‘$\uparrow$’ or ‘$+$’ not possible to evaluate without storing
asked Sep 29, 2014 in Compiler Design Kathleen 1.9k views
22 votes
3 answers
12
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment. c = a + b; d = c ... place to another while preserving correctness. What is the minimum number of spills to memory in the compiled code? 0 1 2 3
asked Sep 24, 2014 in Compiler Design Arjun 10.2k views
22 votes
3 answers
13
Consider the syntax directed definition shown below. ... is $X = Y + Z$ $t_1 = Y+Z; X=t_1$ $t_1 =Y; t_2=t_1 +Z; X=t_2$ $t_1 =Y; t_2=Z; t_3=t_1+t_2; X=t_3$
asked Sep 17, 2014 in Compiler Design Kathleen 3.3k views
To see more, click for the full list of questions or popular tags.
...