Mercurial > repos > rhope
diff nworker_c.rhope @ 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 | 327bcf35e094 |
line wrap: on
line diff
--- 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