diff --git a/basis/compiler/cfg/value-numbering/graph/graph-docs.factor b/basis/compiler/cfg/value-numbering/graph/graph-docs.factor new file mode 100644 index 0000000000..c5db31f365 --- /dev/null +++ b/basis/compiler/cfg/value-numbering/graph/graph-docs.factor @@ -0,0 +1,13 @@ +USING: help.markup help.syntax ; +IN: compiler.cfg.value-numbering.graph + +HELP: vregs>vns +{ $var-description "assoc mapping vregs to value numbers this is the identity on canonical representatives." } ; + +HELP: exprs>vns +{ $var-description "assoc mapping expressions to value numbers." } ; + +HELP: vns>insns +{ $var-description "assoc mapping value numbers to instructions." } ; + +ABOUT: "compiler.cfg.value-numbering.graph" diff --git a/basis/compiler/cfg/value-numbering/graph/graph-tests.factor b/basis/compiler/cfg/value-numbering/graph/graph-tests.factor new file mode 100644 index 0000000000..aea33f1bd1 --- /dev/null +++ b/basis/compiler/cfg/value-numbering/graph/graph-tests.factor @@ -0,0 +1,11 @@ +USING: arrays compiler.cfg.instructions +compiler.cfg.value-numbering.graph kernel namespaces tools.test ; +IN: compiler.cfg.value-numbering.graph.tests + +{ + T{ ##and-imm { dst 4 } { src1 5 } { src2 6 } } +} [ + H{ { 10 10 } } vregs>vns set + 10 4 5 6 f ##and-imm boa 2array 1array vns>insns set + 10 vn>insn +] unit-test diff --git a/basis/compiler/cfg/value-numbering/graph/graph.factor b/basis/compiler/cfg/value-numbering/graph/graph.factor index 7f550120d0..b248830d05 100644 --- a/basis/compiler/cfg/value-numbering/graph/graph.factor +++ b/basis/compiler/cfg/value-numbering/graph/graph.factor @@ -5,14 +5,10 @@ IN: compiler.cfg.value-numbering.graph SYMBOL: input-expr-counter -! assoc mapping vregs to value numbers -! this is the identity on canonical representatives SYMBOL: vregs>vns -! assoc mapping expressions to value numbers SYMBOL: exprs>vns -! assoc mapping value numbers to instructions SYMBOL: vns>insns : vn>insn ( vn -- insn ) vns>insns get at ;