]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/linear-scan/linear-scan.factor
Merge branch 'master' into irc
[factor.git] / basis / compiler / cfg / linear-scan / linear-scan.factor
1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel accessors namespaces make
4 cpu.architecture
5 compiler.cfg
6 compiler.cfg.rpo
7 compiler.cfg.instructions
8 compiler.cfg.linear-scan.numbering
9 compiler.cfg.linear-scan.live-intervals
10 compiler.cfg.linear-scan.allocation
11 compiler.cfg.linear-scan.assignment ;
12 IN: compiler.cfg.linear-scan
13
14 ! References:
15
16 ! Linear Scan Register Allocation
17 ! by Massimiliano Poletto and Vivek Sarkar
18 ! http://www.cs.ucla.edu/~palsberg/course/cs132/linearscan.pdf
19
20 ! Linear Scan Register Allocation for the Java HotSpot Client Compiler
21 ! by Christian Wimmer
22 ! and http://www.ssw.uni-linz.ac.at/Research/Papers/Wimmer04Master/
23
24 ! Quality and Speed in Linear-scan Register Allocation
25 ! by Omri Traub, Glenn Holloway, Michael D. Smith
26 ! http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.8435
27
28 : (linear-scan) ( rpo -- )
29     dup number-instructions
30     dup compute-live-intervals
31     machine-registers allocate-registers assign-registers ;
32
33 : linear-scan ( cfg -- cfg' )
34     [
35         dup reverse-post-order (linear-scan)
36         spill-counts get >>spill-counts
37     ] with-scope ;