aboutsummaryrefslogtreecommitdiff
path: root/src/interp/g-util.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-05-26 18:40:13 +0000
committerdos-reis <gdr@axiomatics.org>2010-05-26 18:40:13 +0000
commita7e98a2ab2fcc87c3505ab11708d5bf24607ae85 (patch)
treea4bbe3b50760d18318402714211e02b545562f76 /src/interp/g-util.boot
parent8e0498b66e19be7e22039866d695c1cb81707bd6 (diff)
downloadopen-axiom-a7e98a2ab2fcc87c3505ab11708d5bf24607ae85.tar.gz
* interp/slam.boot (compileRecurrenceRelation): Generate code to
access and set the global value of the variable holding the cache state. * interp/g-util.boot: Add more middle end form expanders.
Diffstat (limited to 'src/interp/g-util.boot')
-rw-r--r--src/interp/g-util.boot61
1 files changed, 46 insertions, 15 deletions
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index e3c4ec2b..8815cf5b 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -191,34 +191,65 @@ expandAnd ["%and",:args] ==
expandOr ["%or",:args] ==
["OR",:expandToVMForm args]
+-- Arithmetic operations
+expandImul ["%imul",:args] ==
+ ["*",:expandToVMForm args]
+
+expandIadd ["%iadd",:args] ==
+ ["+",:expandToVMForm args]
+
+expandIsub ["%isub",:args] ==
+ ["-",:expandToVMForm args]
+
+expandIeq ["%ieq",:args] ==
+ ["EQL",:expandToVMForm args]
+
-- Local variable bindings
expandBind ["%bind",inits,body] ==
body := expandToVMForm body
inits := [[first x,expandToVMForm second x] for x in inits]
-- FIXME: we should consider turning LET* into LET or direct inlining.
["LET*",inits,body]
-
+
+-- Memory load/store
+
+expandDynval ["%dynval",:args] ==
+ ["SYMBOL-VALUE",:expandToVMForm args]
+
+expandStore ["%store",place,value] ==
+ place := expandToVMForm place
+ value := expandToVMForm value
+ cons? place => ["SETF",place,value]
+ ["SETQ",place,value]
+
++ Table of opcode-expander pairs.
-$OpcodeExpanders == [
- ["%not",:"expandNot"],
- ["%and",:"expandAnd"],
- ["%or",:"expandOr"],
+for x in [
+ ["%not",:function expandNot],
+ ["%and",:function expandAnd],
+ ["%or",:function expandOr],
- ["%collect",:"expandCollect"],
- ["%repeat",:"expandRepeat"],
+ ["%collect",:function expandCollect],
+ ["%repeat",:function expandRepeat],
- ["%le",:"expandLessEqual"],
- ["%lt",:"expandLess"],
- ["%ge",:"expandGreaterEqual"],
- ["%gt",:"expandGreater"],
+ ["%le",:function expandLessEqual],
+ ["%lt",:function expandLess],
+ ["%ge",:function expandGreaterEqual],
+ ["%gt",:function expandGreater],
- ["%bind",:"expandBind"]
- ]
+ ["%imul",:function expandImul],
+ ["%iadd",:function expandIadd],
+ ["%isub",:function expandIsub],
+
+ ["%ieq",:function expandIeq],
+
+ ["%bind",:function expandBind],
+ ["%store",:function expandStore],
+ ["%dynval",:function expandDynval]
+ ] repeat MAKEPROP(first x,"%Expander", rest x)
++ Return the expander of a middle-end opcode, or nil if there is none.
getOpcodeExpander op ==
- x := ASSOC(op,$OpcodeExpanders) => rest x
- nil
+ op has %Expander
++ Expand all opcodes contained in the form `x' into a form
++ suitable for evaluation by the VM.