sync.md (atomic_compare_and_swap<dwi>_doubleword): If possible, add .cfi directives...
authorIan Lance Taylor <iant@google.com>
Wed, 6 Nov 2013 01:03:57 +0000 (01:03 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 6 Nov 2013 01:03:57 +0000 (01:03 +0000)
* config/i386/sync.md (atomic_compare_and_swap<dwi>_doubleword):
If possible, add .cfi directives to record change to bx.
* config/i386/i386.c (ix86_emit_cfi): New function.
* config/i386/i386-protos.h (ix86_emit_cfi): Declare.

From-SVN: r204433

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/sync.md

index 2727156ca8dbee8ef443e3dbe9f8b0685ccc3a1c..d5c8ceb1c5ee791c972cbfcad03977fbb82278a3 100644 (file)
@@ -1,3 +1,10 @@
+2013-11-05  Ian Lance Taylor  <iant@google.com>
+
+       * config/i386/sync.md (atomic_compare_and_swap<dwi>_doubleword):
+       If possible, add .cfi directives to record change to bx.
+       * config/i386/i386.c (ix86_emit_cfi): New function.
+       * config/i386/i386-protos.h (ix86_emit_cfi): Declare.
+
 2013-11-05  Steven Bosscher  <steven@gcc.gnu.org>
 
 
index 5799251404bed6e2b0f003f9f5f260f604d2b3f3..fdf9d5804df1eba19a7b51fa4599634cb5adc430 100644 (file)
@@ -143,6 +143,7 @@ extern void ix86_split_lshr (rtx *, rtx, enum machine_mode);
 extern rtx ix86_find_base_term (rtx);
 extern bool ix86_check_movabs (rtx, int);
 extern void ix86_split_idivmod (enum machine_mode, rtx[], bool);
+extern bool ix86_emit_cfi ();
 
 extern rtx assign_386_stack_local (enum machine_mode, enum ix86_stack_slot);
 extern int ix86_attr_length_immediate_default (rtx, bool);
index 771fabe6dc5898c4abb4a2a0e0d0d0e9b83893a8..3d3838b97f9ff1e07dacfdae4f97ed0098c11202 100644 (file)
@@ -17344,6 +17344,14 @@ ix86_split_idivmod (enum machine_mode mode, rtx operands[],
   emit_label (end_label);
 }
 
+/* Whether it is OK to emit CFI directives when emitting asm code.  */
+
+bool
+ix86_emit_cfi ()
+{
+  return dwarf2out_do_cfi_asm ();
+}
+
 #define LEA_MAX_STALL (3)
 #define LEA_SEARCH_THRESHOLD (LEA_MAX_STALL << 1)
 
index 9e5835662e1c690e25bd6f7c0ff6a3077e280c9d..8408a2bfe431eecea1529d2af058ff1618ec4253 100644 (file)
   const char *xchg = "xchg{<imodesuffix>}\t%%<regprefix>bx, %5";
 
   if (swap)
-    output_asm_insn (xchg, operands);
+    {
+      output_asm_insn (xchg, operands);
+      if (ix86_emit_cfi ())
+       {
+         output_asm_insn (".cfi_remember_state", operands);
+         output_asm_insn (".cfi_register\t%%<regprefix>bx, %5", operands);
+       }
+    }
   output_asm_insn ("lock{%;} %K7cmpxchg<doublemodesuffix>b\t%2", operands);
   if (swap)
-    output_asm_insn (xchg, operands);
+    {
+      output_asm_insn (xchg, operands);
+      if (ix86_emit_cfi ())
+       output_asm_insn (".cfi_restore_state", operands);
+    }
 
   return "";
 })