Added an op in the aop_pointcut op vector for inserting a gimple stmt.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Wed, 24 Mar 2010 23:29:45 +0000 (19:29 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Wed, 24 Mar 2010 23:29:45 +0000 (19:29 -0400)
src/aop-pc-assign.c
src/aop-pc-entry.c
src/aop-pc-exit.c
src/aop-pointcut.h
src/aop-weave.c

index 90859c14f2cb04f4763da71c42d3e012020b0265..0e54209872543361320a61aac8b0b97295929a61 100644 (file)
@@ -115,6 +115,7 @@ aop_match_assignment_by_type (const struct aop_type *type)
   pc = ggc_alloc (sizeof (struct aop_pointcut *));
   pc->kind = ATP_ASSIGN;
   pc->join_on = op_join_on_assign;
+  pc->insert_before = op_default_insert_before;
 
   pc->pc_assign.type = type;
 
index a18d51f7003ca02860d4ef07b0a9a95ff0ed7f1b..74c7c3f18e1c90ce6d0c6f3a7c60cd998accb303 100644 (file)
@@ -67,6 +67,7 @@ aop_match_function_entry ()
   pc = ggc_alloc (sizeof (struct aop_pointcut *));
   pc->kind = ATP_ENTRY;
   pc->join_on = op_join_on_function_entry;
+  pc->insert_before = op_default_insert_before;
 
   return pc;
 }
index eb4f986df291a6cfb230fe3dcb2e3a077f0296fc..97f889147381ae60386b0fde807a8c2bb806be65 100644 (file)
@@ -37,7 +37,6 @@
 #include "aop-pointcut.h"
 #include "aop-type.h"
 
-
 static void
 op_join_on_function_exit (struct aop_pointcut *pc, join_callback cb, 
                          void *callback_param)
@@ -72,6 +71,7 @@ aop_match_function_exit ()
   pc = ggc_alloc (sizeof (struct aop_pointcut *));
   pc->kind = ATP_EXIT;
   pc->join_on = op_join_on_function_exit;
+  pc->insert_before = op_default_insert_before;
   
   return pc;
 }
index f267501a1802802f2936989fa54f8c9b6362601b..cfba5fc77369dab6ec923696bdb45a12b1ec293f 100644 (file)
@@ -40,6 +40,7 @@ struct aop_pointcut {
   enum aop_pckind kind;
 
   void (*join_on) (struct aop_pointcut *, join_callback, void *);
+  void (*insert_before) (struct aop_joinpoint *, gimple);
 
   union {
     struct aop_pc_assign pc_assign;
@@ -59,4 +60,6 @@ struct aop_joinpoint {
   gimple_stmt_iterator *gsi;
 };
 
+void op_default_insert_before (struct aop_joinpoint *jp, gimple stmt);
+
 #endif
index c6ad9b03bbfabf8c0a093dc7fdd5a0f5a01224e9..a883a80ad54632dd9c7ea7430885c7be6327c366 100644 (file)
@@ -115,15 +115,29 @@ build_gcc_call (const char *func_name, tree return_type, va_list argp)
   return func_call;
 }
 
+/* This is the default insert_before() operation for aop_pointcut
+   objects.  It just inserts a gimple statement before the iterator in
+   the aop_joinpoint object.  This function holds to the requirement
+   that inserting multiple gimple statements at the joinpoint will
+   result in those statements appearing in the order they were
+   added. */
+void
+op_default_insert_before (struct aop_joinpoint *jp, gimple stmt)
+{
+  gsi_insert_before (jp->gsi, stmt, GSI_SAME_STMT);
+}
+
 void
 aop_insert_advice (struct aop_joinpoint *jp, const char *func_name, ...)
 {
   va_list argp;
   gimple func_call;
+  struct aop_pointcut *pc;
 
   va_start (argp, func_name);
   func_call = build_gcc_call (func_name, void_type_node, argp);
   va_end (argp);
 
-  gsi_insert_before (jp->gsi, func_call, GSI_SAME_STMT);
+  pc = jp->pc;
+  pc->insert_before(jp, func_call);
 }