1 ! Copyright (C) 2009, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors combinators.short-circuit
4 compiler.cfg.instructions compiler.cfg.registers
5 compiler.cfg.rpo cpu.architecture kernel sequences vectors ;
6 IN: compiler.cfg.save-contexts
8 ! Insert context saves.
10 : needs-save-context? ( insns -- ? )
13 [ ##unary-float-function? ]
14 [ ##binary-float-function? ]
21 : insert-save-context ( bb -- )
22 dup instructions>> dup needs-save-context? [
23 tagged-rep next-vreg-rep
24 tagged-rep next-vreg-rep
25 \ ##save-context new-insn prefix
29 : insert-save-contexts ( cfg -- cfg' )
30 dup [ insert-save-context ] each-basic-block ;