ps5 - which register after the instruction (if a register...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 573 Problem Set 5: Register allocation For the following problems, use the following piece of three-address code (the target of each instruction is the last temporary listed): 1. ld a, T1 2. ld b, T2 3. + T1, T2, T3 4. ld c, T4 5. + T1, T2, T5 6. + T4, T5, T6 7. + T3, T6, T7 8. + T7, a When performing register allocation for this code, assume that only temporaries are assigned to registers. 1. For each instruction, show which temporaries are live after the instruction. 2. What is the minimum number of registers that would be needed to perform register allocation without spilling? 3. Assume the machine has three registers available. Perform bottom-up register allo- cation for this basic block. At each instruction, show which temporary is assigned to
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: which register after the instruction (if a register is freed, mark it as such even if it still holds a value). When a register needs to be spilled, pick the one whose value is used the farthest away; in case of a tie, choose the lowest numbered register to spill. If multiple registers are free when allocating registers, choose the lowest numbered one. Indicate where loads and stores due to spills happen. 4. Show the interference graph for this piece of code. 5. Perform register coloring, assuming three registers. If you reach an uncolorable graph, spill the lowest numbered temporary (assume that spills do not require any extra registersyou can use three registers for unspilled temporaries). 1...
View Full Document

This note was uploaded on 02/19/2012 for the course ECE 468 taught by Professor Test during the Fall '08 term at Purdue University-West Lafayette.

Ask a homework question - tutors are online