Mercurial > repos > rhope
changeset 172:926b56a43f47
Fix some bugs related to inlining
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 15 May 2011 23:31:58 -0700 |
parents | a32afde77abb |
children | e769b2e0facc |
files | cbackend_c.rhope list.rhope nworker_c.rhope |
diffstat | 3 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/cbackend_c.rhope Sun May 08 18:36:33 2011 -0700 +++ b/cbackend_c.rhope Sun May 15 23:31:58 2011 -0700 @@ -597,6 +597,7 @@ } + Do AddRef@C Function[func,psource,pdest:out] { source <- [psource]Make Op[func] @@ -991,8 +992,9 @@ }{ after free <- Val[after statements] } - out <- [[after free]Add Raw Line["}"] + out <- [[[after free]Add Raw Line["}"] ]Resume Index <<[[stream]Resume Index >>] + ]Variables <<[ Combine[[after free]Variables >>, [stream]Variables >>]] } Discard Outputs@C Function[func,first to discard:out]
--- a/list.rhope Sun May 08 18:36:33 2011 -0700 +++ b/list.rhope Sun May 15 23:31:58 2011 -0700 @@ -116,7 +116,7 @@ Length(Int32,Naked) } -List[:out(List)] +List[:out(List Leaf)] { out <- [Build[List Leaf()]]Buffer <<[Array[]] }
--- a/nworker_c.rhope Sun May 08 18:36:33 2011 -0700 +++ b/nworker_c.rhope Sun May 15 23:31:58 2011 -0700 @@ -881,6 +881,7 @@ out <- Val[after save] }{ fname <- [[node]Data >>]Name >> + first unused <- [Max Used Output[node, [[node]Outputs >>]-[1]]]+[1] [program]Method?[fname] { with call <- [func]Method Call[fname, inputs] @@ -895,7 +896,11 @@ }{ ,normal call <- If[[[inputs]Length]=[1]] { - out,normal call <- Compile Boolean Inline Check[func, justfunc, [[[node]Input Types >>]Index[0]]Index[0], [inputs]Index[0], Result Var Name[0, node index], Result Var Name[1, node index]] + //TODO: Inline a partial version of If when only one output is used + ,normal call <- If[[first unused]>[1]] + { + out,normal call <- Compile Boolean Inline Check[func, justfunc, [[[node]Input Types >>]Index[0]]Index[0], [inputs]Index[0], Result Var Name[0, node index], Result Var Name[1, node index]] + } } } } @@ -905,7 +910,6 @@ with call <- [func]Call[fname, inputs] } } - first unused <- [Max Used Output[node, [[node]Outputs >>]-[1]]]+[1] If[[first unused] > [[node]Min Outputs >>]] { save outs <- [node]Min Outputs >> @@ -981,6 +985,7 @@ } }{ If[[[node]Type >>]=["setglobal"]] + { inputs <- [worker]Collect Inputs[node] [conditions]For Backend