adapt to firm coding conventions
[libfirm] / ir / opt / funccall.c
index 6505f55..2822dae 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <adt/raw_bitset.h>
 
-#include "funccall_t.h"
+#include "opt_init.h"
 
 #include "irnode_t.h"
 #include "irgraph_t.h"
@@ -40,6 +40,7 @@
 #include "ircons.h"
 #include "iredges_t.h"
 #include "irpass_t.h"
+#include "iroptimize.h"
 #include "analyze_irg_args.h"
 #include "irhooks.h"
 #include "debug.h"
@@ -154,10 +155,9 @@ static void collect_const_and_pure_calls(ir_node *node, void *env) {
 
                /* collect the Proj's in the Proj list */
                switch (get_Proj_proj(node)) {
-               case pn_Call_M_regular:
+               case pn_Call_M:
                case pn_Call_X_except:
                case pn_Call_X_regular:
-               case pn_Call_M_except:
                        set_irn_link(node, ctx->proj_list);
                        ctx->proj_list = node;
                        break;
@@ -222,14 +222,13 @@ static void fix_const_call_lists(ir_graph *irg, env_t *ctx) {
                assert(get_irn_mode(mem) == mode_M);
 
                switch (get_Proj_proj(proj)) {
-               case pn_Call_M_regular: {
+               case pn_Call_M: {
                        /* in dead code there might be cycles where proj == mem */
                        if (proj != mem)
                                exchange(proj, mem);
                         break;
                }
                case pn_Call_X_except:
-               case pn_Call_M_except:
                        exc_changed = 1;
                        exchange(proj, get_irg_bad(irg));
                        break;
@@ -320,10 +319,9 @@ static void collect_nothrow_calls(ir_node *node, void *env) {
 
                /* collect the Proj's in the Proj list */
                switch (get_Proj_proj(node)) {
-               case pn_Call_M_regular:
+               case pn_Call_M:
                case pn_Call_X_except:
                case pn_Call_X_regular:
-               case pn_Call_M_except:
                        set_irn_link(node, ctx->proj_list);
                        ctx->proj_list = node;
                        break;
@@ -368,7 +366,6 @@ static void fix_nothrow_call_list(ir_graph *irg, ir_node *call_list, ir_node *pr
                /* kill any exception flow */
                switch (get_Proj_proj(proj)) {
                case pn_Call_X_except:
-               case pn_Call_M_except:
                        exc_changed = 1;
                        exchange(proj, get_irg_bad(irg));
                        break;
@@ -1084,7 +1081,8 @@ struct pass_t {
 /**
  * Wrapper for running optimize_funccalls() as an ir_prog pass.
  */
-static int pass_wrapper(ir_prog *irp, void *context) {
+static int pass_wrapper(ir_prog *irp, void *context)
+{
        struct pass_t *pass = context;
 
        (void)irp;
@@ -1094,22 +1092,14 @@ static int pass_wrapper(ir_prog *irp, void *context) {
 
 /* Creates an ir_prog pass for optimize_funccalls. */
 ir_prog_pass_t *optimize_funccalls_pass(
-       const char *name, int verify, int dump,
+       const char *name,
        int force_run, check_alloc_entity_func callback)
 {
-       struct pass_t *pass = xmalloc(sizeof(*pass));
-
-       pass->pass.kind          = k_ir_prog_pass;
-       pass->pass.run_on_irprog = pass_wrapper;
-       pass->pass.context       = pass;
-       pass->pass.name          = name ? name : "funccalls";
-       pass->pass.verify        = verify != 0;
-       pass->pass.dump          = dump != 0;
-
-       INIT_LIST_HEAD(&pass->pass.list);
+       struct pass_t *pass = XMALLOCZ(struct pass_t);
 
        pass->force_run = force_run;
        pass->callback  = callback;
 
-       return &pass->pass;
+       return def_prog_pass_constructor(
+               &pass->pass, name ? name : "funccall", pass_wrapper);
 }  /* optimize_funccalls_pass */