Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > basic question ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 2335 of 2420
Post > Topic >>

basic question on register allocation

by johnhull2008@[EMAIL PROTECTED] Feb 20, 2008 at 09:06 PM

I have a very basic question on register allocation, the answer to
which I cannot find in any textbook.

Suppose you have a code that consists of 4 instructions before
register allocation, and registers are all virtual, like in SSA
format. The first operand is the destination, the remaining two
operands are the sources. The architecture I have in mind is a
textbook pipelined RISC, like the one you find in H&P architecture
books.

1. add R0, R1, R2
2. add R3, R4, R5
3. add R6, R7, R8
4. add R9, R0, R10

Suppose after constructing an interference graph, the register
allocator decided R0 must be spilled, since it interferes with at
least 5 registers.
R0 - R4, R5, R7, R8, R10

Here is the code after insertion of spill and fill codes:
1. add R0, R1, R2
(1-spill.) store (loc), R0
2. add R3, R4, R5
3. add R6, R7, R8
(1-fill.) load R0, (loc)
4.add R9, R1, R10

My question is, how does this code remove the interference between R0
and the other registers? When instruction 1. completes and writes back
to the register file, it still consumes a physical register (although
just for one cycle), so there should be interferences remaining.

Since register allocation is a problem that has been studied for
decades, there must be something I am missing, but I can't find what
it is.

I would appreciate it very much if you could explain how this works.
Thank you for reading my post.




 4 Posts in Topic:
basic question on register allocation
johnhull2008@[EMAIL PROTE  2008-02-20 21:06:57 
Re: basic question on register allocation
Max Hailperin <max@[EM  2008-02-24 08:42:10 
Re: basic question on register allocation
torbenm@[EMAIL PROTECTED]  2008-02-25 11:29:11 
Re: basic question on register allocation
johnhull2008@[EMAIL PROTE  2008-02-28 21:50:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 17:30:44 CDT 2008.