[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch master updated: Wire up the baseline compiler to

From: Andy Wingo
Subject: [Guile-commits] branch master updated: Wire up the baseline compiler to -O0
Date: Fri, 08 May 2020 17:10:14 -0400

This is an automated email from the git hooks/post-receive script.

wingo pushed a commit to branch master
in repository guile.

The following commit(s) were added to refs/heads/master by this push:
     new b5a52b4  Wire up the baseline compiler to -O0
b5a52b4 is described below

commit b5a52b496112f882485373c89863791f695c3423
Author: Andy Wingo <address@hidden>
AuthorDate: Fri May 8 23:07:30 2020 +0200

    Wire up the baseline compiler to -O0
    * module/language/tree-il/spec.scm (join): Use match rather than
      (tree-il): Declare compiler to bytecode.
      (choose-compiler): New implementation.  Note, the baseline compiler
      probably doesn't even work!!!
 module/language/tree-il/spec.scm | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/module/language/tree-il/spec.scm b/module/language/tree-il/spec.scm
index 8ee4bf3..441ff7e 100644
--- a/module/language/tree-il/spec.scm
+++ b/module/language/tree-il/spec.scm
@@ -20,9 +20,10 @@
 (define-module (language tree-il spec)
   #:use-module (system base language)
-  #:use-module (system base pmatch)
+  #:use-module (ice-9 match)
   #:use-module (language tree-il)
   #:use-module (language tree-il compile-cps)
+  #:use-module (language tree-il compile-bytecode)
   #:use-module ((language tree-il analyze) #:select (make-analyzer))
   #:use-module ((language tree-il optimize) #:select (make-lowerer))
   #:export (tree-il))
@@ -31,12 +32,19 @@
   (apply write (unparse-tree-il exp) port))
 (define (join exps env)
-  (pmatch exps
+  (match exps
     (() (make-void #f))
-    ((,x) x)
-    ((,x . ,rest)
+    ((x) x)
+    ((x . rest)
      (make-seq #f x (join rest env)))
-    (else (error "what!" exps env))))
+    (_ (error "what!" exps env))))
+(define (choose-compiler target optimization-level opts)
+  (if (match (memq #:cps? opts)
+        ((_ cps? . _) cps?)
+        (#f (<= 1 optimization-level)))
+      (cons 'cps compile-cps)
+      (cons 'bytecode compile-bytecode)))
 (define-language tree-il
   #:title      "Tree Intermediate Language"
@@ -44,7 +52,9 @@
   #:printer    write-tree-il
   #:parser      parse-tree-il
   #:joiner      join
-  #:compilers   `((cps . ,compile-cps))
+  #:compilers   `((cps . ,compile-cps)
+                  (bytecode . ,compile-bytecode))
+  #:compiler-chooser choose-compiler
   #:analyzer    make-analyzer
   #:lowerer     make-lowerer
   #:for-humans? #f)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]