diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:08:00 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:08:00 +0000 |
commit | 8afacf2c365afa9c3b084728d3bbc5d1fa2fb69e (patch) | |
tree | cdfcef0bf928cbc93a5be0080551cdc3dd1a676a /gcc/dwarf2out.c | |
parent | 70704d4272d3930c29c583b2bca51bf99f570c73 (diff) | |
download | gcc-8afacf2c365afa9c3b084728d3bbc5d1fa2fb69e.zip gcc-8afacf2c365afa9c3b084728d3bbc5d1fa2fb69e.tar.gz gcc-8afacf2c365afa9c3b084728d3bbc5d1fa2fb69e.tar.bz2 |
Split out parts of scompare_loc_descriptor and emit_store_flag
This patch splits some cases out of scompare_loc_descriptor and
emit_store_flag, which helps with the upcoming machmode series.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* dwarf2out.c (scompare_loc_descriptor_wide)
(scompare_loc_descriptor_narrow): New functions, split out from...
(scompare_loc_descriptor): ...here.
* expmed.c (emit_store_flag_int): New function, split out from...
(emit_store_flag): ...here.
From-SVN: r251451
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 116 |
1 files changed, 69 insertions, 47 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 00aab04..e17b58a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -13929,60 +13929,43 @@ compare_loc_descriptor (enum dwarf_location_atom op, dw_loc_descr_ref op0, return ret; } -/* Return location descriptor for signed comparison OP RTL. */ +/* Subroutine of scompare_loc_descriptor for the case in which we're + comparing two scalar integer operands OP0 and OP1 that have mode OP_MODE, + and in which OP_MODE is bigger than DWARF2_ADDR_SIZE. */ static dw_loc_descr_ref -scompare_loc_descriptor (enum dwarf_location_atom op, rtx rtl, - machine_mode mem_mode) +scompare_loc_descriptor_wide (enum dwarf_location_atom op, + machine_mode op_mode, + dw_loc_descr_ref op0, dw_loc_descr_ref op1) { - machine_mode op_mode = GET_MODE (XEXP (rtl, 0)); - dw_loc_descr_ref op0, op1; - int shift; - - if (op_mode == VOIDmode) - op_mode = GET_MODE (XEXP (rtl, 1)); - if (op_mode == VOIDmode) - return NULL; - - if (dwarf_strict - && dwarf_version < 5 - && (!SCALAR_INT_MODE_P (op_mode) - || GET_MODE_SIZE (op_mode) > DWARF2_ADDR_SIZE)) - return NULL; - - op0 = mem_loc_descriptor (XEXP (rtl, 0), op_mode, mem_mode, - VAR_INIT_STATUS_INITIALIZED); - op1 = mem_loc_descriptor (XEXP (rtl, 1), op_mode, mem_mode, - VAR_INIT_STATUS_INITIALIZED); + dw_die_ref type_die = base_type_for_mode (op_mode, 0); + dw_loc_descr_ref cvt; - if (op0 == NULL || op1 == NULL) + if (type_die == NULL) return NULL; + cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0); + cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref; + cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die; + cvt->dw_loc_oprnd1.v.val_die_ref.external = 0; + add_loc_descr (&op0, cvt); + cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0); + cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref; + cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die; + cvt->dw_loc_oprnd1.v.val_die_ref.external = 0; + add_loc_descr (&op1, cvt); + return compare_loc_descriptor (op, op0, op1); +} - if (!SCALAR_INT_MODE_P (op_mode) - || GET_MODE_SIZE (op_mode) == DWARF2_ADDR_SIZE) - return compare_loc_descriptor (op, op0, op1); - - if (GET_MODE_SIZE (op_mode) > DWARF2_ADDR_SIZE) - { - dw_die_ref type_die = base_type_for_mode (op_mode, 0); - dw_loc_descr_ref cvt; +/* Subroutine of scompare_loc_descriptor for the case in which we're + comparing two scalar integer operands OP0 and OP1 that have mode OP_MODE, + and in which OP_MODE is smaller than DWARF2_ADDR_SIZE. */ - if (type_die == NULL) - return NULL; - cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0); - cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref; - cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die; - cvt->dw_loc_oprnd1.v.val_die_ref.external = 0; - add_loc_descr (&op0, cvt); - cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0); - cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref; - cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die; - cvt->dw_loc_oprnd1.v.val_die_ref.external = 0; - add_loc_descr (&op1, cvt); - return compare_loc_descriptor (op, op0, op1); - } - - shift = (DWARF2_ADDR_SIZE - GET_MODE_SIZE (op_mode)) * BITS_PER_UNIT; +static dw_loc_descr_ref +scompare_loc_descriptor_narrow (enum dwarf_location_atom op, rtx rtl, + machine_mode op_mode, + dw_loc_descr_ref op0, dw_loc_descr_ref op1) +{ + int shift = (DWARF2_ADDR_SIZE - GET_MODE_SIZE (op_mode)) * BITS_PER_UNIT; /* For eq/ne, if the operands are known to be zero-extended, there is no need to do the fancy shifting up. */ if (op == DW_OP_eq || op == DW_OP_ne) @@ -14040,6 +14023,45 @@ scompare_loc_descriptor (enum dwarf_location_atom op, rtx rtl, return compare_loc_descriptor (op, op0, op1); } +/* Return location descriptor for signed comparison OP RTL. */ + +static dw_loc_descr_ref +scompare_loc_descriptor (enum dwarf_location_atom op, rtx rtl, + machine_mode mem_mode) +{ + machine_mode op_mode = GET_MODE (XEXP (rtl, 0)); + dw_loc_descr_ref op0, op1; + + if (op_mode == VOIDmode) + op_mode = GET_MODE (XEXP (rtl, 1)); + if (op_mode == VOIDmode) + return NULL; + + if (dwarf_strict + && dwarf_version < 5 + && (!SCALAR_INT_MODE_P (op_mode) + || GET_MODE_SIZE (op_mode) > DWARF2_ADDR_SIZE)) + return NULL; + + op0 = mem_loc_descriptor (XEXP (rtl, 0), op_mode, mem_mode, + VAR_INIT_STATUS_INITIALIZED); + op1 = mem_loc_descriptor (XEXP (rtl, 1), op_mode, mem_mode, + VAR_INIT_STATUS_INITIALIZED); + + if (op0 == NULL || op1 == NULL) + return NULL; + + if (SCALAR_INT_MODE_P (op_mode)) + { + if (GET_MODE_SIZE (op_mode) < DWARF2_ADDR_SIZE) + return scompare_loc_descriptor_narrow (op, rtl, op_mode, op0, op1); + + if (GET_MODE_SIZE (op_mode) > DWARF2_ADDR_SIZE) + return scompare_loc_descriptor_wide (op, op_mode, op0, op1); + } + return compare_loc_descriptor (op, op0, op1); +} + /* Return location descriptor for unsigned comparison OP RTL. */ static dw_loc_descr_ref |