diff options
author | Brian <brian@yutani.localnet.net> | 2007-03-27 16:04:36 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-03-27 16:06:48 -0600 |
commit | e5d00e8cf4659f03fe3061326a24b6a670f7c8f2 (patch) | |
tree | 448035a18748294c6873d4a67dd35857aa6cb0ed /src/mesa/shader/slang/slang_codegen.c | |
parent | 31dc7a3c890a831f9a0d20dc394ddbe854a05718 (diff) |
Implement true CAL/RET subroutines. Some optimizations, clean-ups coming...
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 93b6d9f854..cf3569c3b0 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1107,12 +1107,18 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, else { /* non-assembly function */ inlined = slang_inline_function_call(A, fun, oper, dest); - if (inlined) { + if (inlined && _slang_find_node_type(inlined, SLANG_OPER_RETURN)) { + /* This inlined function has one or more 'return' statements. + * So, we can't truly inline this function because we need to + * implement 'return' with RET (and CAL). + * XXX check if there's one 'return' and if it's the very last + * statement in the function - we can optimize that case. + */ assert(inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE || inlined->type == SLANG_OPER_SEQUENCE); inlined->type = SLANG_OPER_INLINED_CALL; inlined->fun = fun; - inlined->label = _slang_label_new((char*) fun->header.a_name); + inlined->label = _slang_label_new_unique((char*) fun->header.a_name); } } |