#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"
key.u.intVal = get_Conv_strict(irn);
break;
case iro_Div:
- key.u.intVal = is_Div_remainderless(irn);
+ key.u.intVal = get_Div_no_remainder(irn);
break;
case iro_Block:
key.u.block = irn;
assert(key.u.intVal == get_Conv_strict(irn));
break;
case iro_Div:
- assert(key.u.intVal == is_Div_remainderless(irn));
+ assert(key.u.intVal == get_Div_no_remainder(irn));
break;
case iro_Block:
assert(key.u.block == irn);
assert(leader != node && leader->part == node->part);
}
}
+#else
+ (void) env;
#endif
}
* Check list.
*/
static void do_check_list(const node_t *list, int ofs, const partition_t *Z) {
- const node_t *e;
+#ifndef NDEBUG
+ const node_t *e;
#define NEXT(e) *((const node_t **)((char *)(e) + (ofs)))
for (e = list; e != NULL; e = NEXT(e)) {
assert(e->part == Z);
}
#undef NEXT
+#else
+ (void) list;
+ (void) ofs;
+ (void) Z;
+#endif
} /* ido_check_list */
/**
key.u.intVal = get_Conv_strict(irn);
break;
case iro_Div:
- key.u.intVal = is_Div_remainderless(irn);
+ key.u.intVal = get_Div_no_remainder(irn);
break;
case iro_Block:
/*
int i;
ir_node *block = node->node;
- if (block == get_irg_start_block(current_ir_graph) || has_Block_label(block)) {
+ if (block == get_irg_start_block(current_ir_graph) || has_Block_entity(block)) {
/* start block and labelled blocks are always reachable */
node->type.tv = tarval_reachable;
return;
* It would be safe to compute Top IF it can be assured, that only Cmp
* nodes are inputs to Conds. We check that first.
* This is the way Frontends typically build Firm, but some optimizations
- * (cond_eval for instance) might replace them by Phib's...
+ * (jump threading for instance) might replace them by Phib's...
*/
node->type.tv = tarval_UNKNOWN;
} /* compute_Unknown */
* @param block the destination block
*/
static int can_exchange(ir_node *pred, ir_node *block) {
- if (is_Start(pred) || has_Block_label(block))
+ if (is_Start(pred) || has_Block_entity(block))
return 0;
else if (is_Jmp(pred))
return 1;
ir_node *block = get_nodes_block(leader);
dbg_info *dbg = get_irn_dbg_info(irn);
- leader = new_rd_Conv(dbg, current_ir_graph, block, leader, mode);
+ leader = new_rd_Conv(dbg, block, leader, mode);
}
exchange(irn, leader);
} /* exchange_leader */
if (is_Cond(cond)) {
if (only_one_reachable_proj(cond)) {
- ir_node *jmp = new_r_Jmp(current_ir_graph, block->node);
+ ir_node *jmp = new_r_Jmp(block->node);
set_irn_node(jmp, node);
node->node = jmp;
DB((dbg, LEVEL_1, "%+F is replaced by %+F\n", irn, jmp));
} else if (is_entity(node->type.sym.entity_p)) {
if (! is_SymConst(irn)) {
/* can be replaced by a SymConst */
- ir_node *symc = new_r_SymConst(current_ir_graph, block->node, get_irn_mode(irn), node->type.sym, symconst_addr_ent);
+ ir_node *symc = new_r_SymConst(current_ir_graph, get_irn_mode(irn), node->type.sym, symconst_addr_ent);
set_irn_node(symc, node);
node->node = symc;
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 */