]> gitweb.factorcode.org Git - factor.git/commitdiff
Passing -profile-compiler switch to bootstrap collects timing information from optimi...
authorSlava Pestov <slava@shill.local>
Fri, 31 Jul 2009 02:27:52 +0000 (21:27 -0500)
committerSlava Pestov <slava@shill.local>
Fri, 31 Jul 2009 02:27:52 +0000 (21:27 -0500)
basis/bootstrap/compiler/compiler.factor
basis/bootstrap/compiler/timing/timing.factor [new file with mode: 0644]

index 0a3ff10a8e7b8c721e985159f1eceff3816072a9..4394535b8d1ad4da95c4067659487b2126ffe378 100755 (executable)
@@ -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 (file)
index 0000000..e1466e3
--- /dev/null
@@ -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