re PR debug/39485 (-O0 -g still puts whole object to a register)
authorJakub Jelinek <jakub@redhat.com>
Wed, 18 Mar 2009 17:06:15 +0000 (18:06 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 18 Mar 2009 17:06:15 +0000 (18:06 +0100)
PR debug/39485
* function.c (use_register_for_decl): When not optimizing, disregard
register keyword for variables with types containing methods.

From-SVN: r144939

gcc/ChangeLog
gcc/function.c

index c192bd6..a13d05e 100644 (file)
        * function.c (struct temp_slot): Likewise.
        * cfgloop.h (struct loop): Likewise.
 
        * function.c (struct temp_slot): Likewise.
        * cfgloop.h (struct loop): Likewise.
 
+       PR debug/39485
+       * function.c (use_register_for_decl): When not optimizing, disregard
+       register keyword for variables with types containing methods.
+
 2009-03-18  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/39447
 2009-03-18  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/39447
index 76d4834..e8d9901 100644 (file)
@@ -1942,7 +1942,28 @@ use_register_for_decl (const_tree decl)
   if (DECL_IGNORED_P (decl))
     return true;
 
   if (DECL_IGNORED_P (decl))
     return true;
 
-  return (optimize || DECL_REGISTER (decl));
+  if (optimize)
+    return true;
+
+  if (!DECL_REGISTER (decl))
+    return false;
+
+  switch (TREE_CODE (TREE_TYPE (decl)))
+    {
+    case RECORD_TYPE:
+    case UNION_TYPE:
+    case QUAL_UNION_TYPE:
+      /* When not optimizing, disregard register keyword for variables with
+        types containing methods, otherwise the methods won't be callable
+        from the debugger.  */
+      if (TYPE_METHODS (TREE_TYPE (decl)))
+       return false;
+      break;
+    default:
+      break;
+    }
+
+  return true;
 }
 
 /* Return true if TYPE should be passed by invisible reference.  */
 }
 
 /* Return true if TYPE should be passed by invisible reference.  */