diff --git a/basis/compiler/cfg/debugger/debugger.factor b/basis/compiler/cfg/debugger/debugger.factor index f59860f213..b4f7d983ef 100644 --- a/basis/compiler/cfg/debugger/debugger.factor +++ b/basis/compiler/cfg/debugger/debugger.factor @@ -81,10 +81,3 @@ M: insn insn. tuple>array but-last [ : ssa. ( quot/word -- ) test-ssa cfgs. ; : flat. ( quot/word -- ) test-flat cfgs. ; : regs. ( quot/word -- ) test-regs cfgs. ; - -! Prettyprinting -: pprint-loc ( loc word -- ) > pprint* block> ; - -M: ds-loc pprint* \ D: pprint-loc ; - -M: rs-loc pprint* \ R: pprint-loc ; diff --git a/basis/compiler/cfg/registers/registers-tests.factor b/basis/compiler/cfg/registers/registers-tests.factor new file mode 100644 index 0000000000..2d8ce16eae --- /dev/null +++ b/basis/compiler/cfg/registers/registers-tests.factor @@ -0,0 +1,8 @@ +USING: compiler.cfg.registers io.streams.string prettyprint tools.test ; +IN: compiler.cfg.registers.tests + +! Ensure prettyprinting of ds/rs-loc is right + +{ "D: 3\nR: -1\n" } [ + [ D: 3 . R: -1 . ] with-string-writer +] unit-test diff --git a/basis/compiler/cfg/stacks/local/local-docs.factor b/basis/compiler/cfg/stacks/local/local-docs.factor index 7d0565b987..5d25915440 100644 --- a/basis/compiler/cfg/stacks/local/local-docs.factor +++ b/basis/compiler/cfg/stacks/local/local-docs.factor @@ -20,7 +20,7 @@ HELP: height-state>insns { $examples "In this example the datastacks height is increased by 4 and the retainstacks decreased by 2." { $example - "USING: compiler.cfg.debugger compiler.cfg.stacks.local prettyprint ;" + "USING: compiler.cfg.stacks.local prettyprint ;" "{ { 0 4 } { 0 -2 } } height-state>insns ." "{ T{ ##inc { loc D: 4 } } T{ ##inc { loc R: -2 } } }" } @@ -71,7 +71,7 @@ HELP: translate-local-loc { $description "Translates an absolute stack location to one that is relative to the given height state." } { $examples { $example - "USING: compiler.cfg.stacks.local compiler.cfg.registers compiler.cfg.debugger namespaces prettyprint ;" + "USING: compiler.cfg.stacks.local compiler.cfg.registers namespaces prettyprint ;" "D: 7 { { 3 0 } { 0 0 } } translate-local-loc ." "D: 4" } diff --git a/basis/compiler/compiler.factor b/basis/compiler/compiler.factor index afb6580430..be4994bf80 100644 --- a/basis/compiler/compiler.factor +++ b/basis/compiler/compiler.factor @@ -170,13 +170,11 @@ M: optimizing-compiler to-recompile ( -- words ) M: optimizing-compiler process-forgotten-words [ delete-compiled-xref ] each ; -: with-optimizer ( quot -- ) - [ optimizing-compiler compiler-impl ] dip with-variable ; inline - : enable-optimizer ( -- ) optimizing-compiler compiler-impl set-global ; : disable-optimizer ( -- ) f compiler-impl set-global ; +{ "prettyprint" "compiler" } "compiler.prettyprint" require-when { "threads" "compiler" } "compiler.threads" require-when diff --git a/basis/compiler/prettyprint/prettyprint.factor b/basis/compiler/prettyprint/prettyprint.factor new file mode 100644 index 0000000000..305c751f41 --- /dev/null +++ b/basis/compiler/prettyprint/prettyprint.factor @@ -0,0 +1,9 @@ +USING: accessors compiler.cfg.registers prettyprint.backend +prettyprint.custom prettyprint.sections ; +IN: compiler.prettyprint + +: pprint-loc ( loc word -- ) > pprint* block> ; + +M: ds-loc pprint* \ D: pprint-loc ; + +M: rs-loc pprint* \ R: pprint-loc ;