- assert(node && node->kind == k_ir_node);
- assert(-1 <= n);
- assert(n < get_irn_arity(node));
- assert(in && in->kind == k_ir_node);
-
- if ((n == -1) && (get_irn_opcode(node) == iro_Filter)) {
- /* Change block pred in both views! */
- node->in[n + 1] = in;
- assert(node->attr.filter.in_cg);
- node->attr.filter.in_cg[n + 1] = in;
- return;
- }
- if (get_interprocedural_view()) { /* handle Filter and Block specially */
- if (get_irn_opcode(node) == iro_Filter) {
- assert(node->attr.filter.in_cg);
- node->attr.filter.in_cg[n + 1] = in;
- return;
- } else if (get_irn_opcode(node) == iro_Block && node->attr.block.in_cg) {
- node->attr.block.in_cg[n + 1] = in;
- return;
- }
- /* else fall through */
- }
-
- /* Call the hook */
- hook_set_irn_n(node, n, in, node->in[n + 1]);
-
- /* Here, we rely on src and tgt being in the current ir graph */
- edges_notify_edge(node, n, in, node->in[n + 1], current_ir_graph);
-
- node->in[n + 1] = in;
+ assert(node && node->kind == k_ir_node);
+ assert(-1 <= n);
+ assert(n < get_irn_arity(node));
+ assert(in && in->kind == k_ir_node);
+
+ if ((n == -1) && (get_irn_opcode(node) == iro_Filter)) {
+ /* Change block pred in both views! */
+ node->in[n + 1] = in;
+ assert(node->attr.filter.in_cg);
+ node->attr.filter.in_cg[n + 1] = in;
+ return;
+ }
+ if (get_interprocedural_view()) { /* handle Filter and Block specially */
+ if (get_irn_opcode(node) == iro_Filter) {
+ assert(node->attr.filter.in_cg);
+ node->attr.filter.in_cg[n + 1] = in;
+ return;
+ } else if (get_irn_opcode(node) == iro_Block && node->attr.block.in_cg) {
+ node->attr.block.in_cg[n + 1] = in;
+ return;
+ }
+ /* else fall through */
+ }
+
+ /* Call the hook */
+ hook_set_irn_n(node, n, in, node->in[n + 1]);
+
+ /* Here, we rely on src and tgt being in the current ir graph */
+ edges_notify_edge(node, n, in, node->in[n + 1], current_ir_graph);
+
+ node->in[n + 1] = in;
+}
+
+int
+(get_irn_deps)(const ir_node *node)
+{
+ return _get_irn_deps(node);
+}
+
+ir_node *
+(get_irn_dep)(const ir_node *node, int pos)
+{
+ return _get_irn_dep(node, pos);
+}
+
+void
+(set_irn_dep)(ir_node *node, int pos, ir_node *dep)
+{
+ _set_irn_dep(node, pos, dep);
+}
+
+int add_irn_dep(ir_node *node, ir_node *dep)
+{
+ int res = 0;
+
+ if (node->deps == NULL) {
+ node->deps = NEW_ARR_F(ir_node *, 1);
+ node->deps[0] = dep;
+ } else {
+ int i, n;
+ int first_zero = -1;
+
+ for(i = 0, n = ARR_LEN(node->deps); i < n; ++i) {
+ if(node->deps[i] == NULL)
+ first_zero = i;
+
+ if(node->deps[i] == dep)
+ return i;
+ }
+
+ if (first_zero >= 0) {
+ node->deps[first_zero] = dep;
+ res = first_zero;
+ } else {
+ ARR_APP1(ir_node *, node->deps, dep);
+ res = n;
+ }
+ }
+
+ edges_notify_edge_kind(node, res, dep, NULL, EDGE_KIND_DEP, get_irn_irg(node));
+
+ return res;