[patch] Move register_pass into passes.c

Richard Guenther richard.guenther@gmail.com
Sat Sep 26 10:58:00 GMT 2009


On Sat, Sep 26, 2009 at 2:17 AM, Sriraman Tallam <tmsriram@google.com> wrote:
> Hi,
>
>      This is a patch to move register_patch into passes.c to make it
> generic to allow backends to add passes.
>
>        * tree-pass.h (register_pass_info): New structure.
>        (pass_positioning_ops): Move enum from gcc-plugin.h.
>        (register_pass): New function.
>        * gcc-plugin.h (plugin_pass): Delete structure.
>        (pass_positioning_ops): Delete enum.
>        * plugin.c (regsiter_pass): New function.
>        (position_pass): New function.
>        (added_pass_nodes): Delete variable.
>        (prev_added_pass_nodes): Delete variable.
>        (pass_list_node): Delete structure.
>        * passes.c (make_pass_instance): New function.
>        (next_pass_1): Change to call make_pass_instance.
>        (pass_list_node): Move structure from gcc-plugin.h.
>        (added_pass_nodes): Move variable from plugin.c.
>        (prev_added_pass_nodes): Move variable from plugin.c.
>        (position_pass): New function.
>        (register_pass): New function.
>
> Ran make check.

+  if (!position_pass (pass_info, &all_lowering_passes)
+      && !position_pass (pass_info, &all_ipa_passes)
+      && !position_pass (pass_info, &all_passes))
+    error ("Failed to position pass %s registered by plugin/backend %s. "
+           "Cannot find the (specified instance of) reference pass %s",
+           pass_info->pass->name, disp_name, pass_info->reference_pass_name);

at least the error()s should now become gcc_unreachable()s or
sorry()s.

In the end I would have preferred to have something like a pass iterator
and ways to insert/remove passes as a more generic interface than this,
but for now it's probably ok.

For approval I defer to people who actually care about plugins ;)

Note that for this kind of patches you definitely should do a bootstrap,
not just make check.

Thanks,
Richard.

>
> Thanks,
> -Sriraman.
>



More information about the Gcc-patches mailing list