From 79dcce8f39273cc8b0b90ee3e2d522a682ad8331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Wed, 23 Nov 2016 18:56:03 +0100 Subject: [PATCH] compiler.cfg.debugger: also print the instruction number it's useful to see when debugging some compiler passes --- basis/compiler/cfg/debugger/debugger.factor | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/basis/compiler/cfg/debugger/debugger.factor b/basis/compiler/cfg/debugger/debugger.factor index 6842580e6e..884be50db7 100644 --- a/basis/compiler/cfg/debugger/debugger.factor +++ b/basis/compiler/cfg/debugger/debugger.factor @@ -6,9 +6,8 @@ compiler.cfg.instructions compiler.cfg.linearization compiler.cfg.optimizer compiler.cfg.registers compiler.cfg.representations compiler.cfg.save-contexts compiler.cfg.utilities compiler.tree.builder compiler.tree.optimizer -formatting fry io kernel namespaces prettyprint quotations sequences -strings words ; -FROM: compiler.cfg.linearization => number-blocks ; +formatting fry io kernel math namespaces prettyprint quotations +sequences strings words ; IN: compiler.cfg.debugger GENERIC: test-builder ( quot -- cfgs ) @@ -48,11 +47,13 @@ M: ##phi insn. ! XXX: pprint on a string prints the double quotes. ! This will cause graphviz to choke, so print without quotes. -M: insn insn. tuple>array but-last [ - bl - ] [ - dup string? [ write ] [ pprint ] if - ] interleave nl ; +: insn-number. ( n -- ) + dup integer? [ "%4d " printf ] [ drop " " printf ] if ; + +M: insn insn. ( insn -- ) + tuple>array unclip-last insn-number. [ + dup string? [ ] [ unparse ] if + ] map " " join write nl ; : block-header. ( bb -- ) [ number>> ] [ kill-block?>> "(k)" "" ? ] bi