쥸ե르ꥺΥ⡣

0. Instruction Selection

1. SSAѴ

2. Live Variable Analysis Ԥ

3. pruned-SSAѴ(dead -function)

4. live range 롣³ƺƤSSAѿrename
   ȤꤢñPHI硣   

5. liveInfo񤭤

6. interference graph

7. coloring


Spill cost η׻

Τ褦ʥѥͤ롣ʲζ֤̤ѿ a, b liveǤȤ롣

	x <- 
	...
	y <-
	...
	<- y
	...
	<- x

interference graphϰʲΤ褦ˤʤ롣

x: a, b, y
y: a, b, x
a: b, x, y
b: a, x, y

ط interfereǤϤ4ѿоΤǤ롣


====

ѿ y liveǤˤơѿ x(!=y)/ȤȤ
  x disturbs y
ȸƤ֡

طdisturbinterfereȰۤʤꡢоΤǤ롣

δطǤ路Ƥߤ롣(a  bdisturbȤ)

  a b x y
a - t
b t -   
x t t -
y t t t -

 y spillȤ褦¾ѿΥ쥸դˤȤäƱ
Ȥʤ뤫ʤʤyɤΤ˷ɥ쥸񤹤Τǡ¾
ѿ;פ˥쥸Ȥ褦ˤϤʤʤǤ롣

ǤxϤɤxspillСxyƱ쥸Ƥ뤳Ȥ
η¾ѿa,bϰĥ쥸Ϥ롣

x쥸֤ƤƤ⡢ζ֤¾ѿ
save/restoreԤСƱͤ˥쥸Ϥ1餹ȤǤ롣
Ǥ뤫顢Τ褦ʥǤϤĤǤy,xspillʤۤɤ



Τ褦ʥ

	a <-
	b <-
	<- a
	<- b

ǤϡabϸߤdisturbƤ롣Τ褦ʥǤspill cost
spill



disturbing count
================

xliveǤ֤ˤơ¾ѿoccurrence(/)Ʊ
live disturbing countޤϳĥSethi-UllmanȸƤ֤Ȥˤ롣

ο쥸ʾǤѿǡspillcostǾΤΤspill
롣


Algorithm
=========

for each basic block B
  LiveSet = {}
  busycount = 0
  for each LirNode tree T
    Tѿdef/use򸫤LiveSet򹹿
     LiveSetѿxä뤿Ӥbusycount++; x.startcount = busycount
     LiveSetѿ뤿Ӥbusycount--;




spill αƶθѤ

ѿspillȡѿϥ֤뤳Ȥˤʤ뤬ͤ
ȤǤϷɥ쥸˥ɤʤƤϤʤʤ(Load/Store
ƥξ)ȡѿxspillinterference graph
ñxΥΡɤξ֤ǤϤʤѿxθ
(occurrence)ˤ٤û̿ʥ쥸ѿλȤΤȤ
rebuiltʤƤϤʤʤ


