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: [google] change dump_inline_decisions to make it print more useful and better looking info


I see. The patch is updated:

Thanks,
Dehao

Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 182739)
+++ ipa-inline.c	(working copy)
@@ -303,26 +303,19 @@
   char *buf;
   size_t buf_size;
   const char *bfd_name = lang_hooks.dwarf_name (node->decl, 0);
-  const char *count_text = "count=";
-  const char *max_count_text = "max_count=";

   if (!bfd_name)
     bfd_name = "unknown";

   buf_size = strlen (bfd_name) + 1;
-  if (flag_opt_info >= OPT_INFO_MED)
-    buf_size += (strlen (count_text) + MAX_INT_LENGTH + 1);
-  if (flag_opt_info >= OPT_INFO_MAX)
-    buf_size += (strlen (max_count_text) + MAX_INT_LENGTH + 1);
+  if (flag_opt_info >= OPT_INFO_MED && profile_info)
+    buf_size += (2 * MAX_INT_LENGTH + 5);
   buf = (char *) xmalloc (buf_size);

   strcpy (buf, bfd_name);
-  if (flag_opt_info >= OPT_INFO_MED)
-    sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
-	     buf, count_text, node->count);
-  if (flag_opt_info >= OPT_INFO_MAX)
-    sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
-	     buf, max_count_text, node->max_bb_count);
+  if (flag_opt_info >= OPT_INFO_MED && profile_info)
+    sprintf (buf, "("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")",
+	     node->count, node->max_bb_count);
   return buf;
 }

On Fri, Dec 30, 2011 at 4:59 PM, Xinliang David Li <davidxl@google.com> wrote:
> the early inline decisions are still good to dump out. However the
> opt-info should check 'if (profile_info)' to decide if count and max
> count info need to be dumped.
>
> David
>
> On Fri, Dec 30, 2011 at 12:31 AM, Dehao Chen <dehao@google.com> wrote:
>> Hi,
>>
>> This patch makes the -fopt-info print more concise info:
>> 1. only inline decisions after einline are printed
>> 2. print in a more compact format
>>
>> Bootstrapped with no problem.
>>
>> Is it okay for google-4_6 and google-main branch?
>>
>> Thanks,
>> Dehao
>>
>> gcc/ChangeLog.google-4_6
>> 2011-12-30 ?Dehao Chen ?<dehao@google.com>
>>
>> ? ? ? ?* ipa-inline.c (dump_inline_decision): Print more concise info when
>> ? ? ? ?dumping inline decisions.
>>
>> Index: gcc/ipa-inline.c
>> ===================================================================
>> --- gcc/ipa-inline.c ? ?(revision 182739)
>> +++ gcc/ipa-inline.c ? ?(working copy)
>> @@ -303,26 +303,19 @@
>> ? char *buf;
>> ? size_t buf_size;
>> ? const char *bfd_name = lang_hooks.dwarf_name (node->decl, 0);
>> - ?const char *count_text = "count=";
>> - ?const char *max_count_text = "max_count=";
>>
>> ? if (!bfd_name)
>> ? ? bfd_name = "unknown";
>>
>> ? buf_size = strlen (bfd_name) + 1;
>> ? if (flag_opt_info >= OPT_INFO_MED)
>> - ? ?buf_size += (strlen (count_text) + MAX_INT_LENGTH + 1);
>> - ?if (flag_opt_info >= OPT_INFO_MAX)
>> - ? ?buf_size += (strlen (max_count_text) + MAX_INT_LENGTH + 1);
>> + ? ?buf_size += (2 * MAX_INT_LENGTH + 5);
>> ? buf = (char *) xmalloc (buf_size);
>>
>> ? strcpy (buf, bfd_name);
>> ? if (flag_opt_info >= OPT_INFO_MED)
>> - ? ?sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
>> - ? ? ? ? ? ?buf, count_text, node->count);
>> - ?if (flag_opt_info >= OPT_INFO_MAX)
>> - ? ?sprintf (buf, "%s,%s"HOST_WIDEST_INT_PRINT_DEC,
>> - ? ? ? ? ? ?buf, max_count_text, node->max_bb_count);
>> + ? ?sprintf (buf, "("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")",
>> + ? ? ? ? ? ?node->count, node->max_bb_count);
>> ? return buf;
>> ?}
>>
>> @@ -369,6 +362,14 @@
>> ? const char *inline_chain_text;
>> ? const char *call_count_text;
>> ? struct cgraph_node *final_caller = edge->caller;
>> + ?tree decl = edge->caller->decl;
>> +
>> + ?if (decl)
>> + ? ?{
>> + ? ? ?struct function *fn = DECL_STRUCT_FUNCTION (decl);
>> + ? ? ?if (!fn || !fn->always_inline_functions_inlined)
>> + ? ? ? return;
>> + ? ?}
>>
>> ? if (final_caller->global.inlined_to != NULL)
>> ? ? inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller);


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