--- /dev/null
+#ifndef __AOP_CALLBACK_H__
+#define __AOP_CALLBACK_H__
+
+/* This program is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* This is a private header. Do not include it in source files for
+ client plug-ins. */
+
+/* Insert callbacks take a joinpoint and insert a gimple statement at
+ that joinpoint. Insert callbacks must maintain the order
+ invariant: statements occur at the joinpoint in the order they were
+ inserted. */
+struct aop_joinpoint;
+typedef void (*insert_callback)(struct aop_joinpoint *, gimple);
+
+#endif
--- /dev/null
+#ifndef __AOP_DYNVAL_H__
+#define __AOP_DYNVAL_H__
+
+/* This program is free software: you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/* This is a private header. Do not include it in source files for
+ client plug-ins. */
+
+struct aop_joinpoint;
+struct aop_type;
+
+enum aop_dvkind {
+ ADV_LHS_ADDR,
+};
+
+/* An aop-dynval represents a dynamic value in the target program that
+ can be passed to an advice function. AOP weaving functions (such
+ as aop_insert_advice()) use a dynval to create instrumentation that
+ extract the dynamic value at run time. */
+struct aop_dynval
+{
+ enum aop_dvkind kind;
+
+ const struct aop_type *type;
+ struct aop_joinpoint *jp;
+
+ /* Ops vector for aop_dynval. */
+ /* The get_dynval() op gets called when an advice call gets
+ inserted. It should add whatever gimple statements are necessary
+ to create a GCC tree object that can be used as an argument to a
+ GIMPLE call and then return that tree. */
+ tree (*get_dynval)(struct aop_dynval *);
+};
+
+#endif
#include <gimple.h>
#include "aop.h"
+#include "aop-dynval.h"
#include "aop-pointcut.h"
static tree
return ret;
}
+static tree
+build_dynval (struct aop_dynval *dv)
+{
+ return dv->get_dynval (dv);
+}
+
/* Weaving functions all take varags parameters that represent the
arguments to pass to the new advice function. This function
iterates through those arguments and creates GIMPLE tree nodes for
{
tree new_arg;
const char *str_cst;
+ struct aop_dynval *dv;
switch (kind)
{
new_arg = build_string_ptr (str_cst);
VEC_safe_push (tree, heap, arg_list, new_arg);
break;
+ case ATA_DYNVAL:
+ dv = va_arg (argp, struct aop_dynval *);
+ new_arg = build_dynval (dv);
+ VEC_safe_push (tree, heap, arg_list, new_arg);
+ break;
default:
aop_assert (0);
}