chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] copy-propagation for variables bound to intrin


From: Felix
Subject: [Chicken-hackers] [PATCH] copy-propagation for variables bound to intrinsic
Date: Mon, 01 Oct 2012 20:04:03 +0200 (CEST)

This is the first part of the recently posted copy-propagation
improvement patch. The second part is broken. This part is less
problematic and should improve the generated code a tiny little
bit.


cheers,
felix
>From 3c25195dc7ef09ffd9a8cddec1d6de7fb0705629 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Mon, 1 Oct 2012 19:47:54 +0200
Subject: [PATCH] Copy-propagation of global that refers to intrinsic

If a variable is known to be bound to a global variable which itself
refers to an intrinsic function (one of the "standard-" or "extended"
bindings, that get specifically treated in call position by the
compiler), than references to the former variable will be replaced
with the latter.
---
 compiler.scm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/compiler.scm b/compiler.scm
index 94d178d..2503f33 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -2134,7 +2134,8 @@
                             (if (eq? '##core#variable (node-class value))
                                 (let ((varname (first (node-parameters 
value))))
                                   (or (not (get db varname 'global))
-                                      (variable-mark varname 
'##core#always-bound)))
+                                      (variable-mark varname 
'##core#always-bound)
+                                      (intrinsic? varname)))
                                 (not (expression-has-side-effects? value db)) 
))
                        undefined) )
           (quick-put! plist 'removable #t) )
-- 
1.7.0.4


reply via email to

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