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;
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;
}
#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)
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;
}
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;
gimple_stmt_iterator *gsi;
};
+void op_default_insert_before (struct aop_joinpoint *jp, gimple stmt);
+
#endif
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);
}