Added joinpoint data structure.
#include <config.h>
#include <system.h>
+#include <coretypes.h>
+#include <tm.h>
+#include <tree.h>
#include <ggc.h>
+#include <basic-block.h>
+#include <gimple.h>
#include "aop.h"
#include "aop-pointcut.h"
+#include "aop-type.h"
+
+static bool
+stmt_matches_pointcut (struct aop_pointcut *pc, gimple stmt)
+{
+ if (gimple_has_lhs (stmt))
+ {
+ tree type = TREE_TYPE (gimple_get_lhs (stmt));
+ return does_type_match (type, pc->pc_assign.type);
+ }
+ else
+ {
+ return false;
+ }
+}
static void
op_join_on_assign (struct aop_pointcut *pc, join_callback cb)
{
- aop_assert(pc->kind == ATP_ASSIGN);
+ basic_block bb;
+
+ aop_assert (pc->kind == ATP_ASSIGN);
+
+ 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;
+ jp.pc = pc;
+ jp.gsi = &gsi;
+
+ cb (&jp);
+ }
+ }
+ }
}
struct aop_pointcut *
struct aop_type *type;
};
+/* An AOP pointcut represents the a set of joinponts: locations in the
+ source code that are available for inserting instrumentation.
+
+ In practice, we do not directly store the set of joinpoints.
+ Instead, we store a description of the set that a join function can
+ use to find matching joinpoints. */
struct aop_pointcut {
enum aop_pckind kind;
};
};
+/* An AOP joinpoint represents a specific location in the code where
+ it is possible to insert instrumentation. Because joinpoints are
+ passed to do_weave functions, they must have all the information
+ necessary to directly add a hook function. */
+struct aop_joinpoint {
+ /* The pointcut that this joinpoint is a member of. */
+ struct aop_pointcut *pc;
+
+ /* A GCC iterator for where weave functions can insert their
+ instrumentation.*/
+ gimple_stmt_iterator *gsi;
+};
+
#endif
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/* Whether we want them or not (we don't), Autoconf _insists_ on
+ defining these. Since GCC's config.h (which we must include) also
+ defines them, we have to undef them here. */
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+
#include <stddef.h>
+#include <config.h>
+#include <system.h>
+#include <coretypes.h>
+
#include "aop-type.h"
static struct aop_type _aop_t_all_signed = {
{
return &_aop_t_all_pointer;
}
+
+/* Match an actual GCC type with an AOP type specification. */
+bool
+does_type_match (tree gcc_type, struct aop_type *aop_type)
+{
+ return true;
+}
const char *tag;
};
+bool does_type_match (tree gcc_type, struct aop_type *aop_type);
+
#endif
#define aop_assert(EXPR) ((void)(0 && (EXPR)))
#endif
+struct aop_joinpoint;
struct aop_pointcut;
struct aop_type;
typedef unsigned int (*pass_callback) ();
-typedef void (*join_callback) ();
+typedef void (*join_callback) (struct aop_joinpoint *);
extern struct aop_pointcut *aop_match_assignment_by_type (struct aop_type *type);