Commit 7412de5c authored by Michael Beck's avatar Michael Beck
Browse files

- add pass for combo()

- fixed pass generator for lower_intrinsics
- add irpass.h to firm.h header

[r26346]
parent eabef690
...@@ -83,6 +83,7 @@ extern "C" { ...@@ -83,6 +83,7 @@ extern "C" {
#include "iroptimize.h" /* optimize ir by reassociation */ #include "iroptimize.h" /* optimize ir by reassociation */
#include "ircgopt.h" /* Optimizations based on interprocedural graph */ #include "ircgopt.h" /* Optimizations based on interprocedural graph */
#include "iropt.h" #include "iropt.h"
#include "irpass.h" /* Pass management */
/* Lowering */ /* Lowering */
#include "lowering.h" /* lowering of different calls parameters, intrinsic calls, double word types, high-level constructs */ #include "lowering.h" /* lowering of different calls parameters, intrinsic calls, double word types, high-level constructs */
......
...@@ -550,6 +550,17 @@ void optimize_class_casts(void); ...@@ -550,6 +550,17 @@ void optimize_class_casts(void);
*/ */
void combo(ir_graph *irg); 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 /** Inlines all small methods at call sites where the called address comes
* from a SymConst node that references the entity representing the called * from a SymConst node that references the entity representing the called
* method. * method.
......
...@@ -324,7 +324,7 @@ ir_prog_pass_t *lower_intrinsics_pass( ...@@ -324,7 +324,7 @@ ir_prog_pass_t *lower_intrinsics_pass(
const char *name, const char *name,
int verify, int verify,
int dump, 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). * A mapper for the integer/float absolute value: type abs(type v).
......
...@@ -168,7 +168,7 @@ struct pass_t { ...@@ -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) static int pass_wrapper(ir_prog *irp, void *context)
{ {
...@@ -179,7 +179,7 @@ static int pass_wrapper(ir_prog *irp, void *context) ...@@ -179,7 +179,7 @@ static int pass_wrapper(ir_prog *irp, void *context)
} /* pass_wrapper */ } /* 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 name the name of this pass or NULL
* @param verify should this pass be verified? * @param verify should this pass be verified?
...@@ -192,7 +192,7 @@ ir_prog_pass_t *lower_intrinsics_pass( ...@@ -192,7 +192,7 @@ ir_prog_pass_t *lower_intrinsics_pass(
const char *name, const char *name,
int verify, int verify,
int dump, 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])); struct pass_t *pass = xmalloc(sizeof(*pass) + (length-1) * sizeof(pass->list[0]));
...@@ -206,6 +206,10 @@ ir_prog_pass_t *lower_intrinsics_pass( ...@@ -206,6 +206,10 @@ ir_prog_pass_t *lower_intrinsics_pass(
INIT_LIST_HEAD(&pass->pass.list); 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; return &pass->pass;
} /* lower_intrinsics_pass*/ } /* lower_intrinsics_pass*/
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include "irgraph_t.h" #include "irgraph_t.h"
#include "irnode_t.h" #include "irnode_t.h"
#include "iropt_t.h" #include "iropt_t.h"
#include "irpass_t.h"
#include "irgwalk.h" #include "irgwalk.h"
#include "irop.h" #include "irop.h"
#include "irouts.h" #include "irouts.h"
...@@ -3567,3 +3568,29 @@ void combo(ir_graph *irg) { ...@@ -3567,3 +3568,29 @@ void combo(ir_graph *irg) {
set_value_of_func(NULL); set_value_of_func(NULL);
current_ir_graph = rem; current_ir_graph = rem;
} /* combo */ } /* 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 */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment