Fixed bug when trying to get the filename/lineno for a function entry.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Fri, 13 Aug 2010 23:26:44 +0000 (19:26 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Fri, 13 Aug 2010 23:26:44 +0000 (19:26 -0400)
src/aop-duplicate.c

index 29f587e82348a65c35fb6da9218244e2ae64d778..5cd2fd8cf5f13accba56dbda47041dd82824cc6b 100644 (file)
@@ -147,6 +147,12 @@ duplicate_function_body (const char *tmpvar_name, gimple call)
   basic_block cur_bb;
   basic_block last_bb;
 
+  source_location orig_loc;
+
+  /* Remember the source location in the original first block. */
+  cur_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun);
+  orig_loc = gimple_location (first_stmt (cur_bb->next_bb));
+
   bb_pairs = VEC_alloc (bb_pair, gc, INITIAL_PAIRS);
   label_pairs = VEC_alloc (label_pair, heap, INITIAL_PAIRS);
 
@@ -265,7 +271,7 @@ duplicate_function_body (const char *tmpvar_name, gimple call)
       /* TODO: Can this line be removed? */
       DECL_SOURCE_LOCATION(new_label) = DECL_SOURCE_LOCATION(old_label);
       distributor_bb = split_edge(e);
-       
+
       tmpvar = create_tmp_var(integer_type_node, tmpvar_name);
       /*add_referenced_var(tmpvar);*/
                
@@ -314,6 +320,11 @@ duplicate_function_body (const char *tmpvar_name, gimple call)
       make_edge(distributor_bb, new_first_bb, EDGE_TRUE_VALUE);
     }
 
+  /* Make the distributor block have the same source location as the
+     original entry block.  The function entry pointcut relies on this
+     to determine line number/filename for its join point. */
+  gimple_set_location (first_stmt (distributor_bb), orig_loc);
+       
   free_original_copy_tables();
   VEC_free (label_pair, heap, label_pairs);