2007-08-07 Diego Novillo * gimple.h (gimple_call_return): New. * gimplify.c (get_tmp_var_for): Call it. Index: gimplify.c =================================================================== --- gimplify.c (revision 127275) +++ gimplify.c (working copy) @@ -634,9 +634,9 @@ get_tmp_var_for (gimple stmt) /* FIXME tuples, add support for formal temporaries (worth it?) */ if (code == GIMPLE_ASSIGN) - return create_tmp_from_val (gimple_assign_operand (stmt, 1)); + lhs = create_tmp_from_val (gimple_assign_operand (stmt, 1)); else if (code == GIMPLE_CALL) - return create_tmp_var (TREE_TYPE (TREE_TYPE (gimple_call_fn (stmt))), + lhs = create_tmp_var (gimple_call_return_type (stmt), get_name (gimple_call_fn (stmt))); else gcc_unreachable (); Index: gimple.h =================================================================== --- gimple.h (revision 127275) +++ gimple.h (working copy) @@ -574,6 +574,23 @@ gimple_call_fn (gimple gs) } static inline tree +gimple_call_return_type (gimple gs) +{ + tree fn = gimple_call_fn (gs); + tree type = TREE_TYPE (fn); + + /* See through pointer to functions. */ + if (TREE_CODE (type) == POINTER_TYPE) + type = TREE_TYPE (type); + + gcc_assert (TREE_CODE (type) == FUNCTION_TYPE); + + /* The type returned by a FUNCTION_DECL is the type of its + function type. */ + return TREE_TYPE (type); +} + +static inline tree gimple_call_chain (gimple gs) { GIMPLE_CHECK (gs, GIMPLE_CALL);