From 7004ccfb8fac4a58d9b60e8373590eb0df4c210e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 30 Jul 2009 21:27:52 -0500 Subject: [PATCH] Passing -profile-compiler switch to bootstrap collects timing information from optimizer passes --- basis/bootstrap/compiler/compiler.factor | 4 ++ basis/bootstrap/compiler/timing/timing.factor | 38 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 basis/bootstrap/compiler/timing/timing.factor diff --git a/basis/bootstrap/compiler/compiler.factor b/basis/bootstrap/compiler/compiler.factor index 0a3ff10a8e..4394535b8d 100755 --- a/basis/bootstrap/compiler/compiler.factor +++ b/basis/bootstrap/compiler/compiler.factor @@ -10,6 +10,10 @@ math.order quotations quotations.private assocs.private ; FROM: compiler => enable-optimizer ; IN: bootstrap.compiler +"profile-compiler" get [ + "bootstrap.compiler.timing" require +] when + ! Don't bring this in when deploying, since it will store a ! reference to 'eval' in a global variable "deploy-vocab" get "staging" get or [ diff --git a/basis/bootstrap/compiler/timing/timing.factor b/basis/bootstrap/compiler/timing/timing.factor new file mode 100644 index 0000000000..e1466e3409 --- /dev/null +++ b/basis/bootstrap/compiler/timing/timing.factor @@ -0,0 +1,38 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors compiler.cfg.builder compiler.cfg.linear-scan +compiler.cfg.liveness compiler.cfg.mr compiler.cfg.optimizer +compiler.cfg.stacks.finalize compiler.cfg.stacks.global +compiler.codegen compiler.tree.builder compiler.tree.optimizer +kernel make sequences tools.annotations tools.crossref ; +IN: bootstrap.compiler.timing + +: passes ( word -- seq ) + def>> uses [ vocabulary>> "compiler." head? ] filter ; + +: high-level-passes ( -- seq ) \ optimize-tree passes ; + +: low-level-passes ( -- seq ) \ optimize-cfg passes ; + +: machine-passes ( -- seq ) \ build-mr passes ; + +: linear-scan-passes ( -- seq ) \ (linear-scan) passes ; + +: all-passes ( -- seq ) + [ + \ build-tree , + \ optimize-tree , + high-level-passes % + \ build-cfg , + \ compute-global-sets , + \ finalize-stack-shuffling , + \ optimize-cfg , + low-level-passes % + \ compute-live-sets , + \ build-mr , + machine-passes % + linear-scan-passes % + \ generate , + ] { } make ; + +all-passes [ [ reset ] [ add-timing ] bi ] each \ No newline at end of file