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 -- ? )
14 [ ##unary-float-function? ]
15 [ ##binary-float-function? ]
22 : insert-save-context ( bb -- )
23 dup instructions>> dup needs-save-context? [
24 tagged-rep next-vreg-rep
25 tagged-rep next-vreg-rep
26 \ ##save-context new-insn prefix
30 : insert-save-contexts ( cfg -- cfg' )
31 dup [ insert-save-context ] each-basic-block ;