This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Gimple and tail calls
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 7 Nov 2003 23:50:40 +0100
- Subject: [tree-ssa] Gimple and tail calls
Hi,
I've extended Zdenek's code for tail recursion into tail calls. THis is
partly necessary for me now as find_sub_basic_blocks does not cope with
placeholders well, so I can construct invalid CFG after tree_expand_cfg.
I would like to ask for opinions on representation. I've added an new
flag to CALL_EXPR (CALL_EXPR_TAILCALL) signalizing calls that can be
converted to tail calls and the tail recognizer updates CFG in a way we
do for tail calls in GCC (removing edges out of CFG, adding abnormal
sibcall edge to exit).
The actual problem is that some tail calls returns return value of
CALL_EXPR, while other do not (either because function return NULL or
undefined value).
TO represnet this I can nest CALL_EXPR with CALL_EXPR_TAILCALL inside
RETURN_EXPR.
Does this sound like sane extension of GIMPLE?
THere is problem with expansion. When the tail conversion fails on RTL
I have to produce the return. THis does work for RETURN_EXPRs
containing CALL_EXPRs but does not work for plain CALL_EXPR. With
tree_expand_cfg this is easy to do as those expressions needs special
handling to update CFG acordingly anyway, but with old expander scheme
this is dificult to do making it dificult to split these changes into
spearate patches...
Better ideas?
Honza