This is the mail archive of the gcc-patches@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]

Re: [tree-ssa]: PATCH: hookize profiling


On Feb 11, 2004, at 3:28 PM, Jan Hubicka wrote:
*************** coverage_counter_alloc (unsigned counter
*** 367,380 ****
    if (!num)
      return 1;

! if (!ctr_labels[counter])
{
/* Generate and save a copy of this so it can be shared. */
char buf[20];
!
ASM_GENERATE_INTERNAL_LABEL (buf, "LPBX", counter + 1);
! ctr_labels[counter] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
! SYMBOL_REF_FLAGS (ctr_labels[counter]) = SYMBOL_FLAG_LOCAL;

I see you moved initialization of ctr_labels down to the time it is referenced first time but initialize tree_ctr_tables here. Why they can't be initialized at time they are referenced too?

They can, but I don't think it would gain anything, and this is the way it was before.
I moved ctr_labels down because they never need to be initialized at all
when tree-based counters are used.


Also perhaps it would be more safe to count number of counters in
advance instead of doing tricks with the array, but I guess this is OK
for first incarnation of patch.

That would be an extra pass, wouldn't it? I don't think it's worth that.


+
+   if (!ir_type ())
+     {
        /* Re-merge split basic blocks and the mess introduced by
  	 insert_insn_on_edge.  */
        cleanup_cfg (profile_arc_flag ? CLEANUP_EXPENSIVE : 0);
!       if (profile_dump_file())
! 	dump_flow_info (profile_dump_file());
!     }
Perhaps it can be cleaner if this was put out into rest_of_handle* where
we usually do the cleanups/dumping anyway.

This is where it was before, I just put it inside !ir_type().


+ /* Return 1 if BB ends with a call, possibly followed by some
+    instructions that must stay with the call, 0 otherwise.  */
+
+ static bool
+ tree_block_ends_with_call (basic_block bb)
+ {
+   block_stmt_iterator bsi = bsi_last (bb);
+   tree t = tsi_stmt (bsi.tsi);
+   if (TREE_CODE (t) == MODIFY_EXPR)
+     t = TREE_OPERAND (t, 1);
+   return TREE_CODE (t) == CALL_EXPR;

GIMPLE grammar allows: (return_expr (modify_expr (lvalue) (call_expr ...))) so you need to skip return_expr here too.

I tried to get this to happen and couldn't. The call result always went through a temporary. But certainly allowing the case can't hurt anything, so I'll add it.

I'll work on making your other changes.


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