> You'll have to post your work so people can see. Now the > best the > experts here can do is guess what you're holding behind > your back :-) > > Ciao! > Steven >
I completely agree with you. This is my pass: static unsigned int execute_mypass (void) { basic_block bb; gimple stmt, def_stmt; gimple_stmt_iterator gsi; struct cgraph_node *node; unsigned int rhs_code_class; if (flag_mypass) { for (node = cgraph_nodes; node; node = node->next) { if (node->analyzed && cgraph_is_master_clone (node)) { push_cfun (DECL_STRUCT_FUNCTION (node->decl)); FOR_EACH_BB (bb) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { stmt = gsi_stmt (gsi); if (gimple_code (stmt) == GIMPLE_ASSIGN) { /* Check if the assignment is acctually a function call. For example: D.1 = func (args...); a.9 = D.1 a = a.9 The last one is seen as a GIMPLE_ASSIGN stmt but I want to check if it refers to a function call */ rhs_code_class = get_gimple_rhs_class (gimple_assign_rhs_code (stmt)); if ((rhs_code_class == GIMPLE_UNARY_RHS) || (rhs_code_class == GIMPLE_SINGLE_RHS)) { if (is_temporary_var (gimple_assign_rhs1 (stmt))) // e.g.: a.1, D.1234... { def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); fprintf (dump_file, "gimple_code: %d\n", gimple_code (def_stmt)); // Here I get segmentation fault... } } } } } pop_cfun (); } } } return 0; } The problem is that "SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt))" does not return a gimple stmt. I think that's because, when I make a dump of the stmts with the code above, this one has not the SSA-form. But if only use the FOR_EACH (bb), without "for (node = cgraph_nodes; ...", the SS-form is OK and SSA_NAME_DEF_STMT works well. How can I do? Thank you!