- add pass for combo()
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 16 Aug 2009 01:33:42 +0000 (01:33 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 16 Aug 2009 01:33:42 +0000 (01:33 +0000)
- fixed pass generator for lower_intrinsics
- add irpass.h to firm.h header

[r26346]

include/libfirm/firm.h
include/libfirm/iroptimize.h
include/libfirm/lowering.h
ir/lower/lower_intrinsics.c
ir/opt/combo.c

index 1020f6a..041ea0e 100644 (file)
@@ -83,6 +83,7 @@ extern "C" {
 #include "iroptimize.h"     /* optimize ir by reassociation */
 #include "ircgopt.h"        /* Optimizations based on interprocedural graph */
 #include "iropt.h"
+#include "irpass.h"         /* Pass management */
 
 /* Lowering */
 #include "lowering.h"         /* lowering of different calls parameters, intrinsic calls, double word types, high-level constructs */
index 7a1c1ba..f4aa87d 100644 (file)
@@ -550,6 +550,17 @@ void optimize_class_casts(void);
  */
 void combo(ir_graph *irg);
 
+/**
+ * Creates an ir_graph pass for combo.
+ *
+ * @param name     the name of this pass or NULL
+ * @param verify   should this pass be verified?
+ * @param dump     should this pass result be dumped?
+ *
+ * @return  the newly created ir_graph pass
+ */
+ir_graph_pass_t *combo_pass(const char *name, int verify, int dump);
+
 /** Inlines all small methods at call sites where the called address comes
  *  from a SymConst node that references the entity representing the called
  *  method.
index 6be3b8e..79c7522 100644 (file)
@@ -324,7 +324,7 @@ ir_prog_pass_t *lower_intrinsics_pass(
        const char *name,
        int verify,
        int dump,
-       i_record *list, int length);
+       i_record *list, int length, int part_block_used);
 
 /**
  * A mapper for the integer/float absolute value: type abs(type v).
index 448551a..f748f43 100644 (file)
@@ -168,7 +168,7 @@ struct pass_t {
 };
 
 /**
- * Wrapper for running lower_intrinsics() as an irprog pass.
+ * Wrapper for running lower_intrinsics() as an ir_prog pass.
  */
 static int pass_wrapper(ir_prog *irp, void *context)
 {
@@ -179,7 +179,7 @@ static int pass_wrapper(ir_prog *irp, void *context)
 }  /* pass_wrapper */
 
 /**
- * Creates an irprog pass for lower_intrinsics.
+ * Creates an ir_prog pass for lower_intrinsics.
  *
  * @param name             the name of this pass or NULL
  * @param verify           should this pass be verified?
@@ -192,7 +192,7 @@ ir_prog_pass_t *lower_intrinsics_pass(
        const char *name,
        int verify,
        int dump,
-       i_record *list, int length)
+       i_record *list, int length, int part_block_used)
 {
        struct pass_t *pass = xmalloc(sizeof(*pass) + (length-1) * sizeof(pass->list[0]));
 
@@ -206,6 +206,10 @@ ir_prog_pass_t *lower_intrinsics_pass(
 
        INIT_LIST_HEAD(&pass->pass.list);
 
+       memcpy(pass->list, list, sizeof(list[0]) * length);
+       pass->length          = length;
+       pass->part_block_used = part_block_used;
+
        return &pass->pass;
 }  /* lower_intrinsics_pass*/
 
index aeee472..081eee9 100644 (file)
@@ -72,6 +72,7 @@
 #include "irgraph_t.h"
 #include "irnode_t.h"
 #include "iropt_t.h"
+#include "irpass_t.h"
 #include "irgwalk.h"
 #include "irop.h"
 #include "irouts.h"
@@ -3567,3 +3568,29 @@ void combo(ir_graph *irg) {
        set_value_of_func(NULL);
        current_ir_graph = rem;
 }  /* combo */
+
+/**
+ * Wrapper for running combo() as an ir_graph pass.
+ */
+static int pass_wrapper(ir_graph *irg, void *context) {
+       (void)context;
+       combo(irg);
+       /* combo is a fix-point iteration */
+       return 0;
+}  /* pass_wrapper */
+
+/* Creates an ir_graph pass for combo. */
+ir_graph_pass_t *combo_pass(const char *name, int verify, int dump) {
+       struct ir_graph_pass_t *pass = XMALLOCZ(ir_graph_pass_t);
+
+       pass->kind       = k_ir_prog_pass;
+       pass->run_on_irg = pass_wrapper;
+       pass->context    = pass;
+       pass->name       = name ? name : "combo";
+       pass->verify     = verify != 0;
+       pass->dump       = dump != 0;
+
+       INIT_LIST_HEAD(&pass->list);
+
+       return pass;
+}  /* combo_pass */