This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

converting a CALL_EXPR node without any argument into SSA form, thanks


I asked the question about the name compatibility for CALL_EXPR in SSA form. Thanks for the answers from this mailing list. My understanding is that we don't need to convert a stmt node into SSA form as long as the call instruction (CALL_EXPR) does not use any variable as an argument.


But the following simple example make GCC crash, the error is caused by loop_commit_inserts () operation. i.e., when loop_commit_inserts () does bsi_commit_inserts(), the internal data structure is not compatible. (Note: stmt is a CALL_EXPR like void my_special_counter(void), which does not have any argument.)
-----------------------------------------------------------------------------
static
void inserting_call_expr(struct loops *loops){


tree functype;
tree stmt, decl;
basic_block src, dest, new_bb;
int i;
for (i = 1; i < loops->num; i++)
{
struct loop *loop = loops->parray[i];
edge e_instrument;
if (!loop)
continue;
e_instrument = loop_preheader_edge (loop);
functype = build_function_type (void_type_node, NULL_TREE);
decl = build_decl (FUNCTION_DECL, get_identifier ("my_special_counter"), functype);
stmt = build_function_call_expr (decl, NULL_TREE);
bsi_insert_on_edge(e_instrument, stmt);
}
loop_commit_inserts ();
}
--------------------------------------------------------------------------



Can someone give me some further info? I read the code in tree-ssa-*.c and only found code that transforms MODIFY_EXPR nodes from GIMPLE IR to SSA form, like this piece of code in tree-vect-transform.c
----------------converting MODIFY_EXPR into SSA---------------------------
tmp = create_tmp_var (integer_type_node, "update");
add_referenced_tmp_var (tmp);
size = TYPE_SIZE (vect_ptr_type);
type = lang_hooks.types.type_for_size (tree_low_cst (size, 1), 1);
ptr_update = create_tmp_var (type, "update");
add_referenced_tmp_var (ptr_update);
vectype_size = TYPE_SIZE_UNIT (vectype);
vec_stmt = build2 (MULT_EXPR, integer_type_node, idx, vectype_size);
vec_stmt = build2 (MODIFY_EXPR, void_type_node, tmp, vec_stmt);
new_temp = make_ssa_name (tmp, vec_stmt);
TREE_OPERAND (vec_stmt, 0) = new_temp;
bsi_insert_before (bsi, vec_stmt, BSI_SAME_STMT);
-------------------------------------------------


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]