diff mbox

19/n: trans-mem: middle end/misc patches (LAST PATCH)

Message ID 4EB803EC.2050907@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Nov. 7, 2011, 4:14 p.m. UTC
On 11/07/11 08:08, Richard Henderson wrote:
> On 11/07/2011 08:04 AM, Aldy Hernandez wrote:
>> @@ -1812,6 +1844,8 @@ expand_call_stmt (gimple stmt)
>>     bool builtin_p;
>>     size_t i;
>>
>> +  mark_transaction_restart_calls (stmt);
>> +
>>     if (gimple_call_internal_p (stmt))
>>       {
>>         expand_internal_call (stmt);
>
> You're calling it too early, Aldy.  The call you're searching
> for hasn't been generated yet.

*blush*

Whoops! And that's what happens when you post patches with "OK pending 
tests".  Sorry, my machines are chugging along and I'm queuing up 
patches for testing... Trying to take advantage of Richi's time zone...

TM tests all pass.  Further tests are still going.

OK pending tests?

Comments

Richard Henderson Nov. 7, 2011, 4:29 p.m. UTC | #1
On 11/07/2011 08:14 AM, Aldy Hernandez wrote:
> TM tests all pass.  Further tests are still going.
> 
> OK pending tests?

Much better.  Ok.


r~
diff mbox

Patch

Index: ChangeLog.tm-merge
===================================================================
--- ChangeLog.tm-merge	(revision 181067)
+++ ChangeLog.tm-merge	(working copy)
@@ -58,8 +58,10 @@ 
 	* calls.c (is_tm_builtin): New.
 	(flags_from_decl_or_type): Add ECF_TM_OPS for TM clones.
 	* cfgbuild.c (make_edges): Add edges for REG_TM notes.
-	* cfgexpand.c (expand_gimple_stmt): Add REG_TM notes.
+	* cfgexpand.c (expand_call_stmt): Call
+	mark_transaction_restart_calls.
 	(gimple_expand_cfg): Free the tm_restart map.
+	(mark_transaction_restart_calls): New.
 	* cfgrtl.c (purge_dead_edges): Look for REG_TM notes.
 	* cgraph.c (dump_cgraph_node): Handle tm_clone.
 	* cgraph.h (struct cgraph_node): Add tm_clone field.
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 181067)
+++ cfgexpand.c	(working copy)
@@ -1802,6 +1802,38 @@  expand_gimple_cond (basic_block bb, gimp
   return new_bb;
 }
 
+/* Mark all calls that can have a transaction restart.  */
+
+static void
+mark_transaction_restart_calls (gimple stmt)
+{
+  struct tm_restart_node dummy;
+  void **slot;
+
+  if (!cfun->gimple_df->tm_restart)
+    return;
+
+  dummy.stmt = stmt;
+  slot = htab_find_slot (cfun->gimple_df->tm_restart, &dummy, NO_INSERT);
+  if (slot)
+    {
+      struct tm_restart_node *n = (struct tm_restart_node *) *slot;
+      tree list = n->label_or_list;
+      rtx insn;
+
+      for (insn = next_real_insn (get_last_insn ());
+	   !CALL_P (insn);
+	   insn = next_real_insn (insn))
+	continue;
+
+      if (TREE_CODE (list) == LABEL_DECL)
+	add_reg_note (insn, REG_TM, label_rtx (list));
+      else
+	for (; list ; list = TREE_CHAIN (list))
+	  add_reg_note (insn, REG_TM, label_rtx (TREE_VALUE (list)));
+    }
+}
+
 /* A subroutine of expand_gimple_stmt_1, expanding one GIMPLE_CALL
    statement STMT.  */
 
@@ -1888,6 +1920,8 @@  expand_call_stmt (gimple stmt)
     expand_assignment (lhs, exp, false);
   else
     expand_expr_real_1 (exp, const0_rtx, VOIDmode, EXPAND_NORMAL, NULL);
+
+  mark_transaction_restart_calls (stmt);
 }
 
 /* A subroutine of expand_gimple_stmt, expanding one gimple statement
@@ -2096,32 +2130,6 @@  expand_gimple_stmt (gimple stmt)
 	}
     }
 
-  /* Mark all calls that can have a transaction restart.  */
-  if (cfun->gimple_df->tm_restart && is_gimple_call (stmt))
-    {
-      struct tm_restart_node dummy;
-      void **slot;
-
-      dummy.stmt = stmt;
-      slot = htab_find_slot (cfun->gimple_df->tm_restart, &dummy, NO_INSERT);
-      if (slot)
-	{
-	  struct tm_restart_node *n = (struct tm_restart_node *) *slot;
-	  tree list = n->label_or_list;
-	  rtx insn;
-
-	  for (insn = next_real_insn (last); !CALL_P (insn);
-	       insn = next_real_insn (insn))
-	    continue;
-
-	  if (TREE_CODE (list) == LABEL_DECL)
-	    add_reg_note (insn, REG_TM, label_rtx (list));
-	  else
-	    for (; list ; list = TREE_CHAIN (list))
-	      add_reg_note (insn, REG_TM, label_rtx (TREE_VALUE (list)));
-	}
-    }
-
   return last;
 }