From: Jan Hubicka Date: Tue, 4 Jun 2002 16:20:30 +0000 (+0200) Subject: dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): Do not initialize fields past... X-Git-Tag: releases/gcc-3.1.1~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b6a3a3c16704c3a297bc033f682858f50f6d50e;p=thirdparty%2Fgcc.git dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): Do not initialize fields past the register table. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6b10fd290f3..7530a52a0ff0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Tue Jun 4 18:16:50 CEST 2002 Jan Hubicka + + * 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 * loop.c (emit_prefetch_instructions): Properly place the address diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 4ef15435cec5..f081e0395f0d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 51b0472321ad..023f621a1d93 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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 */