Added a new initialization pass.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Wed, 8 Sep 2010 01:50:05 +0000 (21:50 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Wed, 8 Sep 2010 01:50:05 +0000 (21:50 -0400)
src/aop-main.c

index 35833fa728fa5dbd0e2bf2eb0e43700d67975414..4b774e8176d0da7ad4479ac4d4ed4334401613d9 100644 (file)
@@ -154,6 +154,46 @@ aop_join_on_copy (struct aop_pointcut *pc, int copy, join_callback callback,
   }
 }
 
+/* This pass gets called before any passes that the client plug-in
+   registers.  It's here for any administrative details that need to
+   take place before the instrumentation passes can execute. */
+static unsigned int
+execute_pass_init ()
+{
+  return 0;
+}
+
+static struct opt_pass pass_init = {
+  .type = GIMPLE_PASS,
+  .name = "interaspect-init",
+  .gate = NULL,
+  .execute = execute_pass_init,
+  .sub = NULL,
+  .next = NULL,
+  .static_pass_number = 0,
+  .tv_id = 0,
+  .properties_required = 0,
+  .properties_provided = 0,
+  .properties_destroyed = 0,
+  .todo_flags_start = 0,
+  .todo_flags_finish = 0,
+};
+
+/* Register pass_init as the first InterAspect pass. */
+void
+register_pass_init ()
+{
+  struct register_pass_info pass_info;
+
+  pass_info.pass = &pass_init;
+  pass_info.reference_pass_name = "cfg";
+  pass_info.ref_pass_instance_number = 0;
+  pass_info.pos_op = PASS_POS_INSERT_BEFORE;
+
+  register_callback (aop_plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL,
+                    &pass_info);
+}
+
 /**
  * InterAspect calls this function after all compilation is finished
  * and before GCC and InterAspect data structures are destroyed.  It
@@ -324,6 +364,8 @@ plugin_init (struct plugin_name_args *plugin_info,
   /* Register our cleanup function. */
   register_callback (aop_plugin_name, PLUGIN_FINISH, aop_cleanup, NULL);
 
+  register_pass_init ();
+
   /* Give the client plug-in its chance to register a pass. */
   aop_main ();