]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): Do not initialize fields past...
authorJan Hubicka <jh@suse.cz>
Tue, 4 Jun 2002 16:20:30 +0000 (18:20 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 4 Jun 2002 16:20:30 +0000 (16:20 +0000)
* dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): Do not initialize
fields past the register table.

* i386.c (classify_argument): Properly handle base classes.

From-SVN: r54246

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/dwarf2out.c

index f6b10fd290f3cd71452d4859a2b11404fd37dde5..7530a52a0ff0daad85bbaca6fbc599655efc406d 100644 (file)
@@ -1,3 +1,10 @@
+Tue Jun  4 18:16:50 CEST 2002  Jan Hubicka  <jh@suse.cz>
+
+       * dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): Do not initialize
+       fields past the register table.
+
+       * i386.c (classify_argument): Properly handle base classes.
+
 Tue Jun  4 13:09:18 CEST 2002  Jan Hubicka  <jh@suse.cz>
 
        * loop.c (emit_prefetch_instructions): Properly place the address
index 4ef15435cec570fb6ed4b34d6a9c8b7357f8d91d..f081e0395f0dcd52661809a32d11507179ffb549 100644 (file)
@@ -1675,6 +1675,34 @@ classify_argument (mode, type, classes, bit_offset)
       /* Classify each field of record and merge classes.  */
       if (TREE_CODE (type) == RECORD_TYPE)
        {
+         /* For classes first merge in the field of the subclasses.  */
+         if (TYPE_BINFO (type) != NULL && TYPE_BINFO_BASETYPES (type) != NULL)
+           {
+             tree bases = TYPE_BINFO_BASETYPES (type);
+             int n_bases = TREE_VEC_LENGTH (bases);
+             int i;
+
+             for (i = 0; i < n_bases; ++i)
+               {
+                  tree binfo = TREE_VEC_ELT (bases, i);
+                  int num;
+                  int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
+                  tree type = BINFO_TYPE (binfo);
+
+                  num = classify_argument (TYPE_MODE (type),
+                                           type, subclasses,
+                                           (offset + bit_offset) % 256);
+                  if (!num)
+                    return 0;
+                  for (i = 0; i < num; i++)
+                    {
+                      int pos = (offset + bit_offset) / 8 / 8;
+                      classes[i + pos] =
+                        merge_classes (subclasses[i], classes[i + pos]);
+                    }
+               }
+           }
+         /* And now merge the fields of structure.   */
          for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
            {
              if (TREE_CODE (field) == FIELD_DECL)
@@ -1735,6 +1763,33 @@ classify_argument (mode, type, classes, bit_offset)
       else if (TREE_CODE (type) == UNION_TYPE
               || TREE_CODE (type) == QUAL_UNION_TYPE)
        {
+         /* For classes first merge in the field of the subclasses.  */
+         if (TYPE_BINFO (type) != NULL && TYPE_BINFO_BASETYPES (type) != NULL)
+           {
+             tree bases = TYPE_BINFO_BASETYPES (type);
+             int n_bases = TREE_VEC_LENGTH (bases);
+             int i;
+
+             for (i = 0; i < n_bases; ++i)
+               {
+                  tree binfo = TREE_VEC_ELT (bases, i);
+                  int num;
+                  int offset = tree_low_cst (BINFO_OFFSET (binfo), 0) * 8;
+                  tree type = BINFO_TYPE (binfo);
+
+                  num = classify_argument (TYPE_MODE (type),
+                                           type, subclasses,
+                                           (offset + bit_offset) % 256);
+                  if (!num)
+                    return 0;
+                  for (i = 0; i < num; i++)
+                    {
+                      int pos = (offset + bit_offset) / 8 / 8;
+                      classes[i + pos] =
+                        merge_classes (subclasses[i], classes[i + pos]);
+                    }
+               }
+           }
          for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
            {
              if (TREE_CODE (field) == FIELD_DECL)
index 51b0472321ad49d714a0b875e0b69a564100515d..023f621a1d93852be657c727891ef55acdad5512 100644 (file)
@@ -417,16 +417,17 @@ expand_builtin_init_dwarf_reg_sizes (address)
   rtx addr = expand_expr (address, NULL_RTX, VOIDmode, 0);
   rtx mem = gen_rtx_MEM (BLKmode, addr);
 
-  for (i = 0; i < DWARF_FRAME_REGISTERS; i++)
-    {
-      HOST_WIDE_INT offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
-      HOST_WIDE_INT size = GET_MODE_SIZE (reg_raw_mode[i]);
+  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+    if (DWARF_FRAME_REGNUM (i) < DWARF_FRAME_REGISTERS)
+      {
+       HOST_WIDE_INT offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
+       HOST_WIDE_INT size = GET_MODE_SIZE (reg_raw_mode[i]);
 
-      if (offset < 0)
-       continue;
+       if (offset < 0)
+         continue;
 
-      emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
-    }
+       emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
+      }
 }
 
 /* Convert a DWARF call frame info. operation to its string name */