diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/interp/c-util.boot | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5055d842..b7e694f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-07-29 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/c-util.boot (removeToplevelRETURN_-FROM): New. + (transformToBackendCode): Use it to clean function body. + 2010-07-28 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/spad.lisp (DIVIDE2): Remove. diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index d18c4dea..c72da0df 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1603,6 +1603,16 @@ needsPROG? form == form is ['BLOCK,=nil,:.] => false or/[needsPROG? x for x in form] +++ We are processing the complete `body' of a function definition. +++ If this body is a multiway test, there is no need to have +++ a RETURN-FROM operator in the immediate consequence of a branch. +removeToplevelRETURN_-FROM body == + if body is [['COND,:stmts]] then + for stmt in stmts repeat + stmt is [.,['RETURN_-FROM,.,expr]] => + second(stmt) := expr + body + ++ Generate Lisp code by lowering middle end defining form `x'. ++ x has the strucrure: <name, parms, stmt1, ...> transformToBackendCode: %Form -> %Code @@ -1635,7 +1645,7 @@ transformToBackendCode x == [declareGlobalVariables fluids,:body] lvars ~= nil or needsPROG? body => [["PROG",lvars,["RETURN",:body]]] - body + removeToplevelRETURN_-FROM body -- add reference parameters to the list of special variables. fluids := S_+(backendFluidize second x, $SpecialVars) lastdecl := lastDeclarationNode rest x |