compiler.codegen: collect instruction statistics

db4
Slava Pestov 2009-07-27 03:58:15 -05:00
parent 9fa71959b5
commit 31555b05cf
1 changed files with 11 additions and 2 deletions

View File

@ -4,7 +4,7 @@ USING: namespaces make math math.order math.parser sequences accessors
kernel kernel.private layouts assocs words summary arrays
combinators classes.algebra alien alien.c-types alien.structs
alien.strings alien.arrays alien.complex alien.libraries sets libc
continuations.private fry cpu.architecture
continuations.private fry cpu.architecture classes
source-files.errors
compiler.errors
compiler.alien
@ -18,6 +18,10 @@ compiler.codegen.fixup
compiler.utilities ;
IN: compiler.codegen
SYMBOL: insn-counts
H{ } clone insn-counts set-global
GENERIC: generate-insn ( insn -- )
SYMBOL: registers
@ -54,7 +58,12 @@ SYMBOL: labels
[ word>> init-generator ]
[
instructions>>
[ [ regs>> registers set ] [ generate-insn ] bi ] each
[
[ class insn-counts get inc-at ]
[ regs>> registers set ]
[ generate-insn ]
tri
] each
] bi
] with-fixup ;