aop_join_on_copy() support for assignment pointcut.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 12 Aug 2010 20:13:01 +0000 (16:13 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 12 Aug 2010 20:13:01 +0000 (16:13 -0400)
src/aop-pc-assign.c

index 84dc685914375a3a5fcb49c79f69b3815028643a..5964704629bdc76f9531f4700e750653ca4b221a 100644 (file)
@@ -34,6 +34,7 @@
 #include <gimple.h>
 
 #include "aop.h"
+#include "aop-duplicate.h"
 #include "aop-dynval.h"
 #include "aop-pointcut.h"
 #include "aop-type.h"
@@ -96,7 +97,6 @@ aop_capture_lhs_name (struct aop_joinpoint *jp)
     }
 }
 
-
 /* Given an expression from the lhs of an assignment, return true
    unless it is a temporary variable created by the compiler.
 
@@ -301,6 +301,24 @@ stmt_matches_pointcut (struct aop_pointcut *pc, gimple stmt)
     }
 }
 
+static void join_on_bb_assign (basic_block bb, struct aop_pointcut *pc,
+                              join_callback cb, void *callback_param)
+{
+  gimple_stmt_iterator gsi;
+
+  for (gsi = gsi_start_bb (bb) ; !gsi_end_p (gsi) ; gsi_next (&gsi))
+    {
+      gimple stmt = gsi_stmt (gsi);
+
+      if (stmt_matches_pointcut (pc, stmt))
+       {
+         struct aop_joinpoint jp;
+         init_joinpoint (&jp, &gsi, pc, stmt);
+         cb (&jp, callback_param);
+       }
+    }
+}
+
 static void
 op_join_on_assign (struct aop_pointcut *pc, join_callback cb,
                   void *callback_param)
@@ -311,19 +329,7 @@ op_join_on_assign (struct aop_pointcut *pc, join_callback cb,
 
   FOR_EACH_BB(bb)
     {
-      gimple_stmt_iterator gsi;
-
-      for (gsi = gsi_start_bb (bb) ; !gsi_end_p (gsi) ; gsi_next (&gsi))
-       {
-         gimple stmt = gsi_stmt (gsi);
-
-         if (stmt_matches_pointcut (pc, stmt))
-           {
-             struct aop_joinpoint jp;
-             init_joinpoint (&jp, &gsi, pc, stmt);
-             cb (&jp, callback_param);
-           }
-       }
+      join_on_bb_assign (bb, pc, cb, callback_param);
     }
 }
 
@@ -331,8 +337,18 @@ static void
 op_join_on_copy_assign (struct aop_pointcut *pc, int copy, join_callback cb,
                        void *callback_param)
 {
-  /* Not yet supported. */
-  aop_assert(0);
+  unsigned int pair_index;
+  bb_pair *pair;
+
+  aop_assert (is_current_func_duplicated ());
+  aop_assert (pc->kind == ATP_ASSIGN);
+
+  FOR_EACH_BB_PAIR (bb_pairs, pair_index, pair)
+    {
+      basic_block bb = (copy == 0) ? pair->old : pair->new;
+
+      join_on_bb_assign (bb, pc, cb, callback_param);
+    }
 }
 
 /**