]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/linear-scan/linear-scan.factor
Merge branch 'master' of git://factorcode.org/git/factor
[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 locals
4 cpu.architecture
5 compiler.cfg
6 compiler.cfg.rpo
7 compiler.cfg.liveness
8 compiler.cfg.instructions
9 compiler.cfg.linear-scan.numbering
10 compiler.cfg.linear-scan.live-intervals
11 compiler.cfg.linear-scan.allocation
12 compiler.cfg.linear-scan.allocation.state
13 compiler.cfg.linear-scan.assignment
14 compiler.cfg.linear-scan.resolve
15 compiler.cfg.linear-scan.mapping ;
16 IN: compiler.cfg.linear-scan
17
18 ! References:
19
20 ! Linear Scan Register Allocation
21 ! by Massimiliano Poletto and Vivek Sarkar
22 ! http://www.cs.ucla.edu/~palsberg/course/cs132/linearscan.pdf
23
24 ! Linear Scan Register Allocation for the Java HotSpot Client Compiler
25 ! by Christian Wimmer
26 ! and http://www.ssw.uni-linz.ac.at/Research/Papers/Wimmer04Master/
27
28 ! Quality and Speed in Linear-scan Register Allocation
29 ! by Omri Traub, Glenn Holloway, Michael D. Smith
30 ! http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.8435
31
32 :: (linear-scan) ( cfg machine-registers -- )
33     cfg compute-live-sets
34     cfg number-instructions
35     cfg compute-live-intervals machine-registers allocate-registers
36     cfg assign-registers
37     cfg resolve-data-flow
38     cfg check-numbering ;
39
40 : linear-scan ( cfg -- cfg' )
41     [
42         init-mapping
43         dup machine-registers (linear-scan)
44         spill-counts get >>spill-counts
45         cfg-changed
46     ] with-scope ;