From: Justin Seyster Date: Wed, 8 Sep 2010 01:50:05 +0000 (-0400) Subject: Added a new initialization pass. X-Git-Tag: release-v1.0~47 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=ca28bdbfed3cc2762f9efce4136608494a3336fa;p=interaspect.git Added a new initialization pass. --- diff --git a/src/aop-main.c b/src/aop-main.c index 35833fa..4b774e8 100644 --- a/src/aop-main.c +++ b/src/aop-main.c @@ -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 ();