]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2out.c (need_data_align_sf_opcode): New.
authorRichard Henderson <rth@redhat.com>
Fri, 12 Jun 2009 04:53:54 +0000 (21:53 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 12 Jun 2009 04:53:54 +0000 (21:53 -0700)
        * dwarf2out.c (need_data_align_sf_opcode): New.
        (div_data_align): Move earlier.
        (def_cfa_1, reg_save): Use it.

From-SVN: r148411

gcc/ChangeLog
gcc/dwarf2out.c

index 8ced87250c554b76db6b3939cfbf7ea0f449645d..b1d0cd77d179e247da2f176fd3d01797ed2e015f 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-11  Richard Henderson  <rth@redhat.com>
+
+       * dwarf2out.c (need_data_align_sf_opcode): New.
+       (div_data_align): Move earlier.
+       (def_cfa_1, reg_save): Use it.
+
 2009-06-11  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/i386.c (OPTION_MASK_ISA_CRC32_SET): New.
index bbd763a5aa922216df4a7b186fcd18d1ef778230..1d3a1ca2f520c099c671fe8202fc78826d577556 100644 (file)
@@ -522,6 +522,25 @@ init_return_column_size (enum machine_mode mode, rtx mem, unsigned int c)
   emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
 }
 
+/* Divide OFF by DWARF_CIE_DATA_ALIGNMENT, asserting no remainder.  */
+
+static HOST_WIDE_INT
+div_data_align (HOST_WIDE_INT off)
+{
+  HOST_WIDE_INT r = off / DWARF_CIE_DATA_ALIGNMENT;
+  gcc_assert (r * DWARF_CIE_DATA_ALIGNMENT == off);
+  return r;
+}
+
+/* Return true if we need a signed version of a given opcode
+   (e.g. DW_CFA_offset_extended_sf vs DW_CFA_offset_extended).  */
+
+static bool
+need_data_align_sf_opcode (HOST_WIDE_INT off)
+{
+  return DWARF_CIE_DATA_ALIGNMENT < 0 ? off > 0 : off < 0;
+}
+
 /* Generate code to initialize the register size table.  */
 
 void
@@ -1000,7 +1019,7 @@ def_cfa_1 (const char *label, dw_cfa_location *loc_p)
         the specified offset.  The data factoring for DW_CFA_def_cfa_sf
         happens in output_cfi, or in the assembler via the .cfi_def_cfa
         directive.  */
-      if (loc.offset < 0)
+      if (need_data_align_sf_opcode (loc.offset))
        cfi->dw_cfi_opc = DW_CFA_def_cfa_sf;
       else
        cfi->dw_cfi_opc = DW_CFA_def_cfa;
@@ -1048,7 +1067,7 @@ reg_save (const char *label, unsigned int reg, unsigned int sreg, HOST_WIDE_INT
     }
   else if (sreg == INVALID_REGNUM)
     {
-      if (offset < 0)
+      if (need_data_align_sf_opcode (offset))
        cfi->dw_cfi_opc = DW_CFA_offset_extended_sf;
       else if (reg & ~0x3f)
        cfi->dw_cfi_opc = DW_CFA_offset_extended;
@@ -2926,16 +2945,6 @@ switch_to_eh_frame_section (void)
     }
 }
 
-/* Divide OFF by DWARF_CIE_DATA_ALIGNMENT, asserting no remainder.  */
-
-static HOST_WIDE_INT
-div_data_align (HOST_WIDE_INT off)
-{
-  HOST_WIDE_INT r = off / DWARF_CIE_DATA_ALIGNMENT;
-  gcc_assert (r * DWARF_CIE_DATA_ALIGNMENT == off);
-  return r;
-}
-
 /* Output a Call Frame Information opcode and its operand(s).  */
 
 static void