diff options
author | dos-reis <gdr@axiomatics.org> | 2010-06-06 05:36:53 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-06-06 05:36:53 +0000 |
commit | 4348e69c730e4e3faa7b993ac0dac5ec426a374c (patch) | |
tree | 093aafc4e19ce9661a0aee78ecad4aab58c46e38 /src/interp | |
parent | f39c8c2ab9bf4ab06fefc09d75bcc95124d0acc1 (diff) | |
download | open-axiom-4348e69c730e4e3faa7b993ac0dac5ec426a374c.tar.gz |
* interp/c-util.boot (needPROGS?): New.
(transformToBackendCode): Use it. Don't add unneeded PROG/RETURN.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/c-util.boot | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 6090497d..2798bf98 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1587,6 +1587,16 @@ simplifySEQ form == stmts.first := simplifySEQ first stmts form +++ Return true if the Lisp `form' has a `RETURN' form +++ that needs to be enclosed in a `PROG' form. +needsPROG? form == + isAtomicForm form => false + op := form.op + op = 'RETURN => true + op in '(LOOP PROG) => false + form is ['BLOCK,=nil,:.] => false + or/[needsPROG? x for x in form] + ++ Generate Lisp code by lowering middle end defining form `x'. ++ x has the strucrure: <name, parms, stmt1, ...> transformToBackendCode: %Form -> %Code @@ -1612,7 +1622,7 @@ transformToBackendCode x == body := fluids ~= nil => [["PROG",lvars,declareGlobalVariables fluids, ["RETURN",:body]]] - lvars ~= nil or CONTAINED("RETURN",body) => + lvars ~= nil or needsPROG? body => [["PROG",lvars,["RETURN",:body]]] body -- add reference parameters to the list of special variables. |