Commit 6aac20b1 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

*** empty log message ***

[r41]
parent d5270b4f
......@@ -66,7 +66,6 @@ get_new_node (ir_node * n)
assert(new);
return new;
}
/* Create this node on a new obstack. */
......@@ -78,6 +77,7 @@ copy_node (ir_node *n, void *env) {
int i;
assert (n);
DDMSG2(n);
if (is_binop(n)) {
a = get_binop_left(n);
......@@ -114,8 +114,9 @@ copy_node (ir_node *n, void *env) {
{
ir_node **in;
in = get_Return_res_arr(n);
for (i = 0; i < get_Return_n_res(n); i++)
for (i = 0; i < get_Return_n_res(n); i++) {
set_Return_res(n, i, get_new_node(get_Return_res(n, i)));
}
res = new_r_Return (current_ir_graph, get_new_node(get_nodes_Block(n)),
get_new_node(get_Return_mem(n)),
get_Return_n_res(n), in);
......@@ -326,6 +327,8 @@ copy_node (ir_node *n, void *env) {
}
/* @@@ Here we could call optimize()!! */
set_new_node(n, res);
printf(" "); DDMSG2(res);
}
......@@ -370,6 +373,7 @@ dead_node_elimination(ir_graph *irg) {
old_node = irg->start;
new_node = new_r_Start (current_ir_graph, irg->start_block);
irg->start = new_node;
DDMSG2(new_node);
set_new_node (old_node, new_node);
set_irn_visited (new_node, get_irg_visited(current_ir_graph)+1);
/* Copy the Bad node */
......
......@@ -448,7 +448,10 @@ inline ir_node **
get_Return_res_arr (ir_node *node)
{
assert ((node->op == op_Return));
return ((ir_node **)get_Return_res(node, 0));
if (get_Return_n_res(node) > 0)
return ((ir_node **)get_Return_res(node, 0));
else
return NULL;
}
inline int
......@@ -467,6 +470,7 @@ set_Return_n_res (ir_node *node, int results) {
inline ir_node *
get_Return_res (ir_node *node, int pos) {
assert (node->op == op_Return);
assert (get_Return_n_res(node) > pos);
return get_irn_n(node, pos+1);
}
......@@ -583,7 +587,10 @@ inline ir_node **
get_Sel_index_arr (ir_node *node)
{
assert ((node->op == op_Sel));
return (ir_node **)get_Sel_index(node, 0);
if (get_Sel_n_index(node) > 0)
return (ir_node **)get_Sel_index(node, 0);
else
return NULL;
}
inline int
......@@ -662,7 +669,10 @@ set_Call_ptr (ir_node *node, ir_node *ptr) {
inline ir_node **
get_Call_param_arr (ir_node *node) {
assert (node->op == op_Call);
return ((ir_node **)get_Call_param (node, 0));
if (get_Call_arity(node) > 0)
return ((ir_node **)get_Call_param (node, 0));
else
return NULL;
}
inline int
......
......@@ -36,6 +36,8 @@ int main(int argc, char **argv)
/* init library */
init_firm ();
set_opt_dead_node_elimination (o);
/* FIRM was designed for oo languages where all methods belong to a class.
* For imperative languages like C we view a file as a large class containing
* all functions as methods in this file.
......@@ -84,6 +86,7 @@ int main(int argc, char **argv)
/* verify the graph */
irg_vrfy(irg);
dead_node_elimination(irg);
printf("\nDone building the graph. Dumping it.\n");
dump_ir_block_graph (irg);
......
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