Adding a statement to statement list before pass_cfg_build

Saleel Kudchadker skudchad@asu.edu
Fri Feb 19 19:19:00 GMT 2010


Hi

I've been trying to add a statement before the statement list before
the basic blocks are created. I am planning to add a function call
statement before a user function is called and I use the instrument
function definition as a statement . The code and the pass compiles
properly but  no function is called when the actual program runs.

Can someone hint me where I am going wrong?


static void spmm_init_function(tree *tp)
{
tree func_decl;
tree x,spmm_decl,bind;
  tree_stmt_iterator i = tsi_start (*tp);
  tree_stmt_iterator last_i;
  tree stmt=NULL;
  enum tree_code code;
    while (!tsi_end_p (i))
    {
      tree prev_stmt;

      prev_stmt = stmt;
      stmt = tsi_stmt (i);
	   code = TREE_CODE (stmt);
	  switch (code)
	  {
	  	case CALL_EXPR:
	  	print_
	  	x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
	 	x = build_call_expr (x, 0);
	 	tsi_link_after(&i,x,TSI_NEW_STMT);
	 	break;
		
	 	default:
	 	break;
	}
	tsi_next(&i);
}

}

-- 
Regards,

Saleel Kudchadker
Graduate Student
School of Computing , Informatics and Decision Systems
Arizona State University



More information about the Gcc-help mailing list