|
|
Hi!
vta bootstrap was dying with ICE, because mem_loc_descriptor didn't handle
ZERO_EXTRACT/SIGN_EXTRACT. The following patch implements that. While
writing it I've noticed I was using DW_OP_sh{l,r,ra} incorrectly, dunno why
I thought they have an operand when they don't. So this patch fixes that
too.
Bootstrapped/regtested on x86_64-linux and i686-linux and also made
powerpc64-linux bootstrap continue much longer (until libgfortran build).
Ok for vta/vta4.4?
2009-07-30 Jakub Jelinek <jakub@xxxxxxxxxx>
* dwarf2out.c (mem_loc_descriptor): Handle ZERO_EXTRACT and
SIGN_EXTRACT. Fix up DW_OP_sh{l,r,ra} uses in {SIGN,ZERO}_EXTEND,
do_scompare and {U,S}{MIN,MAX}.
--- gcc/dwarf2out.c.jj 2009-07-30 13:44:17.000000000 +0200
+++ gcc/dwarf2out.c 2009-07-30 17:18:53.000000000 +0200
@@ -10860,8 +10860,10 @@ mem_loc_descriptor (rtx rtl, enum machin
else
op = DW_OP_shr;
mem_loc_result = op0;
- add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_shl, shift, 0));
- add_loc_descr (&mem_loc_result, new_loc_descr (op, shift, 0));
+ add_loc_descr (&mem_loc_result, int_loc_descriptor (shift));
+ add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_shl, 0, 0));
+ add_loc_descr (&mem_loc_result, int_loc_descriptor (shift));
+ add_loc_descr (&mem_loc_result, new_loc_descr (op, 0, 0));
}
break;
@@ -11113,11 +11115,15 @@ mem_loc_descriptor (rtx rtl, enum machin
int shift = DWARF2_ADDR_SIZE
- GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0)));
shift *= BITS_PER_UNIT;
- add_loc_descr (&op0, new_loc_descr (DW_OP_shl, shift, 0));
+ add_loc_descr (&op0, int_loc_descriptor (shift));
+ add_loc_descr (&op0, new_loc_descr (DW_OP_shl, 0, 0));
if (CONST_INT_P (XEXP (rtl, 1)))
op1 = int_loc_descriptor (INTVAL (XEXP (rtl, 1)) << shift);
else
- add_loc_descr (&op1, new_loc_descr (DW_OP_shl, shift, 0));
+ {
+ add_loc_descr (&op1, int_loc_descriptor (shift));
+ add_loc_descr (&op1, new_loc_descr (DW_OP_shl, 0, 0));
+ }
}
do_compare:
@@ -11231,8 +11237,10 @@ mem_loc_descriptor (rtx rtl, enum machin
int shift = DWARF2_ADDR_SIZE
- GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0)));
shift *= BITS_PER_UNIT;
- add_loc_descr (&op0, new_loc_descr (DW_OP_shl, shift, 0));
- add_loc_descr (&op1, new_loc_descr (DW_OP_shl, shift, 0));
+ add_loc_descr (&op0, int_loc_descriptor (shift));
+ add_loc_descr (&op0, new_loc_descr (DW_OP_shl, 0, 0));
+ add_loc_descr (&op1, int_loc_descriptor (shift));
+ add_loc_descr (&op1, new_loc_descr (DW_OP_shl, 0, 0));
}
if (GET_CODE (rtl) == SMIN || GET_CODE (rtl) == UMIN)
@@ -11255,6 +11263,40 @@ mem_loc_descriptor (rtx rtl, enum machin
}
break;
+ case ZERO_EXTRACT:
+ case SIGN_EXTRACT:
+ if (CONST_INT_P (XEXP (rtl, 1))
+ && CONST_INT_P (XEXP (rtl, 2))
+ && ((unsigned) INTVAL (XEXP (rtl, 1))
+ + (unsigned) INTVAL (XEXP (rtl, 2))
+ <= GET_MODE_BITSIZE (GET_MODE (rtl)))
+ && GET_MODE_BITSIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE
+ && GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE)
+ {
+ int shift, size;
+ op0 = mem_loc_descriptor (XEXP (rtl, 0), mode,
+ VAR_INIT_STATUS_INITIALIZED);
+ if (op0 == 0)
+ break;
+ if (GET_CODE (rtl) == SIGN_EXTRACT)
+ op = DW_OP_shra;
+ else
+ op = DW_OP_shr;
+ mem_loc_result = op0;
+ size = INTVAL (XEXP (rtl, 1));
+ shift = INTVAL (XEXP (rtl, 2));
+ if (BITS_BIG_ENDIAN)
+ shift = GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0)))
+ - shift - size;
+ add_loc_descr (&mem_loc_result,
+ int_loc_descriptor (DWARF2_ADDR_SIZE - shift - size));
+ add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_shl, 0, 0));
+ add_loc_descr (&mem_loc_result,
+ int_loc_descriptor (DWARF2_ADDR_SIZE - size));
+ add_loc_descr (&mem_loc_result, new_loc_descr (op, 0, 0));
+ }
+ break;
+
case COMPARE:
case IF_THEN_ELSE:
case ROTATE:
Jakub
|
|