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 > register alloca...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 2366 of 2421
Post > Topic >>

register allocation: basic blocks, liveness and next use

by kphillips <kevin.phillips83@[EMAIL PROTECTED] > Mar 22, 2008 at 05:22 PM

Hi,

I've just implemented register allocation by splitting three address
code instructions into basic blocks, and computing liveness and next
use for each block. I'm assuming that all variables are live at the
end of the block, and all temporaries dead, and move backwards.

This technique works well, except for the following scenario.
Assume the following code segment: print(a(2) + a(-3));

The TAC would be something of this sort:

== Block 1 =========
PUSHPARAM 2
CALL t1 A                       //call A and store the return value in
t1
== Block 2 =========
PUSHPARAM -3
CALL t2 A
== Block 3 =========
ADD t3 = t1, t2
PRINT t3
=================

The problem is that the temporaries in both block 1 (t1) and block 2
(t2) would be discarded (assumed dead since they are at the end of the
block) and block 3 can't compute the addition.

Am I missing something here?

Many thanks for all your help,
K. Phillips.

p.s. I know about the graph colouring technique, I just want to try
both techniques.




 10 Posts in Topic:
register allocation: basic blocks, liveness and next use
kphillips <kevin.phill  2008-03-22 17:22:06 
Re: register allocation: basic blocks, liveness and next use
Gene <gene.ressler@[EM  2008-03-22 20:47:01 
Re: register allocation: basic blocks, liveness and next use
Max Hailperin <max@[EM  2008-03-23 12:16:23 
Re: register allocation: basic blocks, liveness and next use
Gene <gene.ressler@[EM  2008-03-23 19:27:05 
Re: register allocation: basic blocks, liveness and next use
Max Hailperin <max@[EM  2008-03-23 09:38:50 
Re: register allocation: basic blocks, liveness and next use
Max Hailperin <max@[EM  2008-03-23 12:04:59 
Re: register allocation: basic blocks, liveness and next use
kphillips <kevin.phill  2008-03-23 10:47:36 
Re: register allocation: basic blocks, liveness and next use
Chris F Clark <cfc@[EM  2008-03-23 22:43:28 
Re: register allocation: basic blocks, liveness and next use
kphillips <kevin.phill  2008-03-27 03:26:50 
Re: register allocation: basic blocks, liveness and next use
Jeff Kenton <jeffrey.k  2008-04-03 20:18:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Tue May 13 3:40:09 CDT 2008.