Nguyễn Thị Thảo Sương
New member
In a simplified computer the instructions are:
The computer has only two registers, and OP is either ADD or SUB. Consider the following basic block:
Assume that all operands are initially in memory. The final value of the computation should be in memory. What is the minimum number of MOV instructions in the code generated for this basic block?
A. 2
B. 3
C. 5
D. 6
Code:
OP R j, Ri − Performs Rj OP Ri and stores the result in register Ri
OP m, Ri − Performs val OP Ri abd stores the result in Ri. value denotes the content of memory location m.
MCVm, Ri −Moves the content off memory loction m to register Ri.
MCVm, Ri, m −Moves the content of register Ri to memory location m.
Code:
t1 = a + b
t2 = c + d
t3 = e − t2
t4 = t 1 − t2
A. 2
B. 3
C. 5
D. 6