[lto][patch] Small fixes for DECL_ASSEMBLE_NAME computation

Diego Novillo dnovillo@google.com
Wed Jan 14 20:28:00 GMT 2009


On Wed, Jan 14, 2009 at 14:32, Rafael Espindola <espindola@google.com> wrote:

>> It's not clear to me what you are fixing with these two.  I would
>> rather have a test case for all these changes.  If not, it's hard
>> to see the rationale behind them.
>
> I need the change in the assembler name compute function to prevent
> unneeded use of DECL_CONTEXT (the FIXME for doing DECL_CONTEXT (t) =
> decl_function_context (t)).

Sorry, I don't follow.  Specifically, I'm asking:

1- Why is this hunk needed?

-  /* If DECL is ignored or already has its assembler name set, it does
-     not need a new one.  */
-  if (DECL_IGNORED_P (decl)
-      || !HAS_DECL_ASSEMBLER_NAME_P (decl)
+  /* If DECL already has its assembler name set, it does not need a
new one.  */
+  if (!HAS_DECL_ASSEMBLER_NAME_P (decl)
       || DECL_ASSEMBLER_NAME_SET_P (decl))
     return false;



2- Why is this hunk needed?  The map 'decl_for_uid_map' should contain
ALL the decls that were created by the compiler.  Meaning that every
node->decl in the cgraph should *also* exist in decl_for_uid_map, why
isn't this the case?

@@ -4151,10 +4149,19 @@ reset_decl_lang_specific (void **slot, void
*unused ATTRIBUTE_UNUSED)
 static unsigned
 free_lang_specifics (void)
 {
+  struct cgraph_node *node;
+
   /* Set assembler names now, as callbacks from the back-end
      will fail after we strip DECL_CONTEXT from declaration nodes.  */
   htab_traverse (decl_for_uid_map, set_asm_name, NULL);

+  for (node = cgraph_nodes; node; node = node->next)
+    {
+      tree decl = node->decl;
+      if (!DECL_ASSEMBLER_NAME_SET_P (decl))
+	lang_hooks.set_decl_assembler_name (decl);
+    }
+
   htab_traverse (decl_for_uid_map, reset_decl_lang_specific, NULL);
   htab_traverse (uid2type_map, reset_type_lang_specific, NULL);



> Alone, this patch fixes no bugs and introduces no regressions.

OK, but is the patch part of another fix?  Perhaps it would be clearer
if you put them together so that you can include a test case.  All by
themselves these changes make no sense to me.  I'm missing something,
I'm sure.


Thanks.  Diego.



More information about the Gcc-patches mailing list