# Recent questions tagged register-allocation

1
Show how to do the following statement c = a[2] + b[0] a) using register direct, imm, register indirect b) using register direct, imm, absolute addressing c) using register direct, imm, register indirect with displacement
2
3
Consider the following expression and identify minimum number of registers required to implement the following expression : (a-b)+(e+(c-d))/f Can anyone please give the theory or notes of prerequisites -, how to solve these questions. The solution of the above problem is :- ... performed by adding R1 to the R2 and result is stored back into R1 since R1=R1+R2. Number of registers used is only 3.
4
5
The following program uses six different variables p, q, r, s, t and u. The code is: p=6 q=7 t=p*q s=t+p u=8 u=s*p s=p+u r=r*q t=t+p return t Assume that all operations take their operands from registers, the minimum number of registers needed to ... _____________? Given answer is 5, but my answer is 4. I think that the step u=8 can be skipped since 'u' is being reinitialized in the next step.
6
Consider the evaluation of following expression tree on a machine in which memory can be accessed only through load and store instructions. The variable p, q, r, s, t and u are initially stored in memory. The binary operators used in the tree can be ... a register. What is the minimum number of registers needed to evaluate the expression if, no intermediate results can be stored in memory?
1 vote
7
8
X= (a+b)*(c+d) variables are in the memory execute on a register -register cpu Then how many 2 address and 3 address instructions requare .. Explain please
9
Consider the expression $(a-1) * (((b+c)/3)+d)$. Let $X$ be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture, in which only load and store instructions can have memory operands and arithmetic instructions can have only register or immediate operands. The value of $X$ is _____________ .
10
How to draw register allocation interference graph ? Can anyone explain this along with " What is a live variable "? Explain with the example given below ? 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
1 vote
11
Do we have register interference graphs/ coloring in our syllabus and if so can someone please provide any online material for it.I am facing difficulty understanding how the graph is actually constructed.
1 vote
12
Could someone explain me register allocation algorithm in simple manner . I referred some text books but couldn't understand properly . Please help me
13
The arithmetic expression $(a+b) * c- d/e ** l$ is to be evaluated on a two address machine, where each operand is either a register or a memory location. With a minimum number of memory accesses of operands.the number of registers required to evaluate this expression is ______. The number of memory accesses of operands is ____________
14
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$
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
Consider evaluating the following expression tree on a machine with load-store architecture in which memory can be accessed only through load and store instructions. The variables $a, b, c, d,$ and $e$ are initially stored in memory. The binary operators used in this expression ... be stored in memory, what is the minimum number of registers needed to evaluate this expression? $2$ $9$ $5$ $3$