/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-** All rights reserved.
-**
-** Authors: Martin Trapp, Christian Schaefer, Goetz Lindenmaier
-**
+* All rights reserved.
+*
+* Authors: Martin Trapp, Christian Schaefer, Goetz Lindenmaier
+*
*/
/* $Id$ */
#include "irnode_t.h"
#include "irgraph_t.h"
-#include "ident_t.h"
+#include "xp_help.h"
#include "irmode_t.h"
#include "typegmod_t.h"
#include "array.h"
*arr = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
(*arr)[0] = block;
}
+ fix_backedges(current_ir_graph->obst, node);
memcpy((*arr) + 1, in, sizeof(ir_node *) * arity);
}
get_irn_opcode (ir_node *node)
{
assert (node);
+ assert (k_ir_node == get_kind(node));
+ assert (node -> op);
return node->op->code;
}
INLINE void
set_irn_link (ir_node *node, void *link) {
assert (node);
+ /* Link field is used for Phi construction and various optimizations
+ in iropt. */
+ assert(get_irg_phase_state(current_ir_graph) != phase_building);
+
node->link = link;
}
node->attr.block.in_cg = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
node->attr.block.in_cg[0] = NULL;
node->attr.block.cg_backedge = new_backedge_arr(current_ir_graph->obst, arity);
+ {
+ /* Fix backedge array. fix_backedges operates depending on
+ interprocedural_view. */
+ bool ipv = interprocedural_view;
+ interprocedural_view = true;
+ fix_backedges(current_ir_graph->obst, node);
+ interprocedural_view = ipv;
+ }
}
memcpy(node->attr.block.in_cg + 1, in, sizeof(ir_node *) * arity);
}
}
INLINE void
-set_SymConst_type (ir_node *node, type *type) {
+set_SymConst_type (ir_node *node, type *tp) {
assert ( (node->op == op_SymConst)
&& ( get_SymConst_kind(node) == type_tag
|| get_SymConst_kind(node) == size));
- node->attr.i.tori.typ = type;
+ node->attr.i.tori.typ = tp;
}
INLINE ident *
}
INLINE void
-set_Call_type (ir_node *node, type *type) {
+set_Call_type (ir_node *node, type *tp) {
assert (node->op == op_Call);
- assert (is_method_type(type));
- node->attr.call.cld_tp = type;
+ assert (is_method_type(tp));
+ node->attr.call.cld_tp = tp;
}
int get_Call_n_callees(ir_node * node) {
}
INLINE void
-set_Alloc_type (ir_node *node, type *type) {
+set_Alloc_type (ir_node *node, type *tp) {
assert (node->op == op_Alloc);
- node->attr.a.type = type;
+ node->attr.a.type = tp;
}
INLINE where_alloc
}
INLINE void
-set_Free_type (ir_node *node, type *type) {
+set_Free_type (ir_node *node, type *tp) {
assert (node->op == op_Free);
- node->attr.f = type;
+ node->attr.f = tp;
}
INLINE ir_node **
skip_nop (ir_node *node) {
/* don't assert node !!! */
- if (node && (node->op == op_Id) && (node != get_Id_pred(node))) {
- /* Don't use get_Id_pred: We get into an endless loop for
- self-referencing Ids. */
+ /* Don't use get_Id_pred: We get into an endless loop for
+ self-referencing Ids. */
+ if (node && (node->op == op_Id) && (node != node->in[0+1])) {
assert (get_irn_arity (node) > 0);
return node->in[0+1];
} else {