- add ir_bk_outport and ir_bk_inport
[libfirm] / ir / ir / irnode.c
index 5348ef7..3fb0473 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
  * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
  * @version $Id$
  */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
+#include <string.h>
 
+#include "pset_new.h"
 #include "ident.h"
 #include "irnode_t.h"
 #include "irgraph_t.h"
 #include "irprog_t.h"
 #include "iredgekinds.h"
 #include "iredges_t.h"
+#include "ircons.h"
 
 #include "irhooks.h"
 #include "irtools.h"
 
+#include "beinfo.h"
+
 /* some constants fixing the positions of nodes predecessors
    in the in array */
 #define CALL_PARAM_OFFSET     2
-#define FUNCCALL_PARAM_OFFSET 1
+#define BUILDIN_PARAM_OFFSET  1
 #define SEL_INDEX_OFFSET      2
 #define RETURN_RESULT_OFFSET  1  /* mem is not a result */
 #define END_KEEPALIVE_OFFSET  0
@@ -72,26 +72,25 @@ const char *get_pnc_string(int pnc) {
 /*
  * Calculates the negated (Complement(R)) pnc condition.
  */
-int get_negated_pnc(int pnc, ir_mode *mode) {
+pn_Cmp get_negated_pnc(long pnc, ir_mode *mode) {
        pnc ^= pn_Cmp_True;
 
        /* do NOT add the Uo bit for non-floating point values */
        if (! mode_is_float(mode))
                pnc &= ~pn_Cmp_Uo;
 
-       return pnc;
+       return (pn_Cmp) pnc;
 }
 
 /* Calculates the inversed (R^-1) pnc condition, i.e., "<" --> ">" */
-int
-get_inversed_pnc(int pnc) {
-       int code    = pnc & ~(pn_Cmp_Lt|pn_Cmp_Gt);
-       int lesser  = pnc & pn_Cmp_Lt;
-       int greater = pnc & pn_Cmp_Gt;
+pn_Cmp get_inversed_pnc(long pnc) {
+       long code    = pnc & ~(pn_Cmp_Lt|pn_Cmp_Gt);
+       long lesser  = pnc & pn_Cmp_Lt;
+       long greater = pnc & pn_Cmp_Gt;
 
        code |= (lesser ? pn_Cmp_Gt : 0) | (greater ? pn_Cmp_Lt : 0);
 
-       return code;
+       return (pn_Cmp) code;
 }
 
 /**
@@ -118,8 +117,7 @@ unsigned firm_register_additional_node_data(unsigned size) {
 }
 
 
-void
-init_irnode(void) {
+void init_irnode(void) {
        /* Forbid the addition of new data to an ir node. */
        forbid_new_data = 1;
 }
@@ -139,7 +137,9 @@ new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mod
        char *p;
        int i;
 
-       assert(irg && op && mode);
+       assert(irg);
+       assert(op);
+       assert(mode);
        p = obstack_alloc(irg->obst, node_size);
        memset(p, 0, node_size);
        res = (ir_node *)(p + firm_add_node_size);
@@ -155,7 +155,11 @@ new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mod
        if (arity < 0) {
                res->in = NEW_ARR_F(ir_node *, 1);  /* 1: space for block */
        } else {
-               res->in = NEW_ARR_D(ir_node *, irg->obst, (arity+1));
+               /* not nice but necessary: End and Sync must always have a flexible array */
+               if (op == op_End || op == op_Sync)
+                       res->in = NEW_ARR_F(ir_node *, (arity+1));
+               else
+                       res->in = NEW_ARR_D(ir_node *, irg->obst, (arity+1));
                memcpy(&res->in[1], in, sizeof(ir_node *) * arity);
        }
 
@@ -176,31 +180,30 @@ new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mod
                edges_notify_edge(res, i - 1, res->in[i], NULL, irg);
 
        hook_new_node(irg, res);
+       if (get_irg_phase_state(irg) == phase_backend) {
+               be_info_new_node(res);
+       }
 
        return res;
 }
 
 /*-- getting some parameters from ir_nodes --*/
 
-int
-(is_ir_node)(const void *thing) {
+int (is_ir_node)(const void *thing) {
        return _is_ir_node(thing);
 }
 
-int
-(get_irn_intra_arity)(const ir_node *node) {
+int (get_irn_intra_arity)(const ir_node *node) {
        return _get_irn_intra_arity(node);
 }
 
-int
-(get_irn_inter_arity)(const ir_node *node) {
+int (get_irn_inter_arity)(const ir_node *node) {
        return _get_irn_inter_arity(node);
 }
 
 int (*_get_irn_arity)(const ir_node *node) = _get_irn_intra_arity;
 
-int
-(get_irn_arity)(const ir_node *node) {
+int (get_irn_arity)(const ir_node *node) {
        return _get_irn_arity(node);
 }
 
@@ -210,9 +213,9 @@ int
    The order of the predecessors in this array is not guaranteed, except that
    lists of operands as predecessors of Block or arguments of a Call are
    consecutive. */
-ir_node **
-get_irn_in(const ir_node *node) {
+ir_node **get_irn_in(const ir_node *node) {
        assert(node);
+#ifdef INTERPROCEDURAL_VIEW
        if (get_interprocedural_view()) { /* handle Filter and Block specially */
                if (get_irn_opcode(node) == iro_Filter) {
                        assert(node->attr.filter.in_cg);
@@ -222,67 +225,67 @@ get_irn_in(const ir_node *node) {
                }
                /* else fall through */
        }
+#endif /* INTERPROCEDURAL_VIEW */
        return node->in;
 }
 
-void
-set_irn_in(ir_node *node, int arity, ir_node **in) {
+void set_irn_in(ir_node *node, int arity, ir_node **in) {
        int i;
-       ir_node *** arr;
+       ir_node *** pOld_in;
        ir_graph *irg = current_ir_graph;
+
        assert(node);
+#ifdef INTERPROCEDURAL_VIEW
        if (get_interprocedural_view()) { /* handle Filter and Block specially */
-               if (get_irn_opcode(node) == iro_Filter) {
+               ir_opcode code = get_irn_opcode(node);
+               if (code  == iro_Filter) {
                        assert(node->attr.filter.in_cg);
-                       arr = &node->attr.filter.in_cg;
-               } else if (get_irn_opcode(node) == iro_Block && node->attr.block.in_cg) {
-                       arr = &node->attr.block.in_cg;
+                       pOld_in = &node->attr.filter.in_cg;
+               } else if (code == iro_Block && node->attr.block.in_cg) {
+                       pOld_in = &node->attr.block.in_cg;
                } else {
-                       arr = &node->in;
+                       pOld_in = &node->in;
                }
-       } else {
-               arr = &node->in;
-       }
+       } else
+#endif /* INTERPROCEDURAL_VIEW */
+               pOld_in = &node->in;
+
 
        for (i = 0; i < arity; i++) {
-               if (i < ARR_LEN(*arr)-1)
-                       edges_notify_edge(node, i, in[i], (*arr)[i+1], irg);
+               if (i < ARR_LEN(*pOld_in)-1)
+                       edges_notify_edge(node, i, in[i], (*pOld_in)[i+1], irg);
                else
-                       edges_notify_edge(node, i, in[i], NULL,        irg);
+                       edges_notify_edge(node, i, in[i], NULL,            irg);
        }
-       for(;i < ARR_LEN(*arr)-1; i++) {
-               edges_notify_edge(node, i, NULL, (*arr)[i+1], irg);
+       for (;i < ARR_LEN(*pOld_in)-1; i++) {
+               edges_notify_edge(node, i, NULL, (*pOld_in)[i+1], irg);
        }
 
-       if (arity != ARR_LEN(*arr) - 1) {
-               ir_node * block = (*arr)[0];
-               *arr = NEW_ARR_D(ir_node *, irg->obst, arity + 1);
-               (*arr)[0] = block;
+       if (arity != ARR_LEN(*pOld_in) - 1) {
+               ir_node * block = (*pOld_in)[0];
+               *pOld_in = NEW_ARR_D(ir_node *, irg->obst, arity + 1);
+               (*pOld_in)[0] = block;
        }
        fix_backedges(irg->obst, node);
 
-       memcpy((*arr) + 1, in, sizeof(ir_node *) * arity);
+       memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity);
 }
 
-ir_node *
-(get_irn_intra_n)(const ir_node *node, int n) {
+ir_node *(get_irn_intra_n)(const ir_node *node, int n) {
        return _get_irn_intra_n (node, n);
 }
 
-ir_node *
-(get_irn_inter_n)(const ir_node *node, int n) {
+ir_node *(get_irn_inter_n)(const ir_node *node, int n) {
        return _get_irn_inter_n (node, n);
 }
 
 ir_node *(*_get_irn_n)(const ir_node *node, int n) = _get_irn_intra_n;
 
-ir_node *
-(get_irn_n)(const ir_node *node, int n) {
+ir_node *(get_irn_n)(const ir_node *node, int n) {
        return _get_irn_n(node, n);
 }
 
-void
-set_irn_n(ir_node *node, int n, ir_node *in) {
+void set_irn_n(ir_node *node, int n, ir_node *in) {
        assert(node && node->kind == k_ir_node);
        assert(-1 <= n);
        assert(n < get_irn_arity(node));
@@ -295,6 +298,7 @@ set_irn_n(ir_node *node, int n, ir_node *in) {
                node->attr.filter.in_cg[n + 1] = in;
                return;
        }
+#ifdef INTERPROCEDURAL_VIEW
        if (get_interprocedural_view()) { /* handle Filter and Block specially */
                if (get_irn_opcode(node) == iro_Filter) {
                        assert(node->attr.filter.in_cg);
@@ -306,6 +310,7 @@ set_irn_n(ir_node *node, int n, ir_node *in) {
                }
                /* else fall through */
        }
+#endif /* INTERPROCEDURAL_VIEW */
 
        /* Call the hook */
        hook_set_irn_n(node, n, in, node->in[n + 1]);
@@ -331,24 +336,32 @@ int add_irn_n(ir_node *node, ir_node *in) {
        return pos;
 }
 
-int
-(get_irn_deps)(const ir_node *node) {
+void del_Sync_n(ir_node *n, int i)
+{
+       int      arity     = get_Sync_n_preds(n);
+       ir_node *last_pred = get_Sync_pred(n, arity - 1);
+       set_Sync_pred(n, i, last_pred);
+       edges_notify_edge(n, arity - 1, NULL, last_pred, get_irn_irg(n));
+       ARR_SHRINKLEN(get_irn_in(n), arity);
+}
+
+int (get_irn_deps)(const ir_node *node) {
        return _get_irn_deps(node);
 }
 
-ir_node *
-(get_irn_dep)(const ir_node *node, int pos) {
+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) {
+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;
 
+       /* DEP edges are only allowed in backend phase */
+       assert(get_irg_phase_state(get_irn_irg(node)) == phase_backend);
        if (node->deps == NULL) {
                node->deps = NEW_ARR_F(ir_node *, 1);
                node->deps[0] = dep;
@@ -386,112 +399,93 @@ void add_irn_deps(ir_node *tgt, ir_node *src) {
 }
 
 
-ir_mode *
-(get_irn_mode)(const ir_node *node) {
+ir_mode *(get_irn_mode)(const ir_node *node) {
        return _get_irn_mode(node);
 }
 
-void
-(set_irn_mode)(ir_node *node, ir_mode *mode) {
+void (set_irn_mode)(ir_node *node, ir_mode *mode) {
        _set_irn_mode(node, mode);
 }
 
-modecode
-get_irn_modecode(const ir_node *node) {
+ir_modecode get_irn_modecode(const ir_node *node) {
        assert(node);
        return node->mode->code;
 }
 
 /** Gets the string representation of the mode .*/
-const char *
-get_irn_modename(const ir_node *node) {
+const char *get_irn_modename(const ir_node *node) {
        assert(node);
        return get_mode_name(node->mode);
 }
 
-ident *
-get_irn_modeident(const ir_node *node) {
+ident *get_irn_modeident(const ir_node *node) {
        assert(node);
        return get_mode_ident(node->mode);
 }
 
-ir_op *
-(get_irn_op)(const ir_node *node) {
+ir_op *(get_irn_op)(const ir_node *node) {
        return _get_irn_op(node);
 }
 
 /* should be private to the library: */
-void
-(set_irn_op)(ir_node *node, ir_op *op) {
+void (set_irn_op)(ir_node *node, ir_op *op) {
        _set_irn_op(node, op);
 }
 
-unsigned
-(get_irn_opcode)(const ir_node *node) {
+unsigned (get_irn_opcode)(const ir_node *node) {
        return _get_irn_opcode(node);
 }
 
-const char *
-get_irn_opname(const ir_node *node) {
+const char *get_irn_opname(const ir_node *node) {
        assert(node);
        if (is_Phi0(node)) return "Phi0";
        return get_id_str(node->op->name);
 }
 
-ident *
-get_irn_opident(const ir_node *node) {
+ident *get_irn_opident(const ir_node *node) {
        assert(node);
        return node->op->name;
 }
 
-unsigned long
-(get_irn_visited)(const ir_node *node) {
+ir_visited_t (get_irn_visited)(const ir_node *node) {
        return _get_irn_visited(node);
 }
 
-void
-(set_irn_visited)(ir_node *node, unsigned long visited) {
+void (set_irn_visited)(ir_node *node, ir_visited_t visited) {
        _set_irn_visited(node, visited);
 }
 
-void
-(mark_irn_visited)(ir_node *node) {
+void (mark_irn_visited)(ir_node *node) {
        _mark_irn_visited(node);
 }
 
-int
-(irn_not_visited)(const ir_node *node) {
-       return _irn_not_visited(node);
+int (irn_visited)(const ir_node *node) {
+       return _irn_visited(node);
 }
 
-int
-(irn_visited)(const ir_node *node) {
-       return _irn_visited(node);
+int (irn_visited_else_mark)(ir_node *node) {
+       return _irn_visited_else_mark(node);
 }
 
-void
-(set_irn_link)(ir_node *node, void *link) {
+void (set_irn_link)(ir_node *node, void *link) {
        _set_irn_link(node, link);
 }
 
-void *
-(get_irn_link)(const ir_node *node) {
+void *(get_irn_link)(const ir_node *node) {
        return _get_irn_link(node);
 }
 
-op_pin_state
-(get_irn_pinned)(const ir_node *node) {
+op_pin_state (get_irn_pinned)(const ir_node *node) {
        return _get_irn_pinned(node);
 }
 
-op_pin_state
-(is_irn_pinned_in_irg) (const ir_node *node) {
+op_pin_state (is_irn_pinned_in_irg) (const ir_node *node) {
        return _is_irn_pinned_in_irg(node);
 }
 
 void set_irn_pinned(ir_node *node, op_pin_state state) {
        /* due to optimization an opt may be turned into a Tuple */
-       if (get_irn_op(node) == op_Tuple)
+       if (is_Tuple(node))
                return;
 
        assert(node && get_op_pinned(get_irn_op(node)) >= op_pin_state_exc_pinned);
@@ -500,43 +494,6 @@ void set_irn_pinned(ir_node *node, op_pin_state state) {
        node->attr.except.pin_state = state;
 }
 
-#ifdef DO_HEAPANALYSIS
-/* Access the abstract interpretation information of a node.
-   Returns NULL if no such information is available. */
-struct abstval *get_irn_abst_value(ir_node *n) {
-       return n->av;
-}
-/* Set the abstract interpretation information of a node. */
-void set_irn_abst_value(ir_node *n, struct abstval *os) {
-       n->av = os;
-}
-struct section *firm_get_irn_section(ir_node *n) {
-       return n->sec;
-}
-void firm_set_irn_section(ir_node *n, struct section *s) {
-       n->sec = s;
-}
-#else
-/* Dummies needed for firmjni. */
-struct abstval *get_irn_abst_value(ir_node *n) {
-       (void) n;
-       return NULL;
-}
-void set_irn_abst_value(ir_node *n, struct abstval *os) {
-       (void) n;
-       (void) os;
-}
-struct section *firm_get_irn_section(ir_node *n) {
-       (void) n;
-       return NULL;
-}
-void firm_set_irn_section(ir_node *n, struct section *s) {
-       (void) n;
-       (void) s;
-}
-#endif /* DO_HEAPANALYSIS */
-
-
 /* Outputs a unique number for this node */
 long get_irn_node_nr(const ir_node *node) {
        assert(node);
@@ -547,79 +504,78 @@ long get_irn_node_nr(const ir_node *node) {
 #endif
 }
 
-const_attr *
-get_irn_const_attr(ir_node *node) {
-       assert(node->op == op_Const);
+const_attr *get_irn_const_attr(ir_node *node) {
+       assert(is_Const(node));
        return &node->attr.con;
 }
 
-long
-get_irn_proj_attr(ir_node *node) {
+long get_irn_proj_attr(ir_node *node) {
+       /* BEWARE: check for true Proj node here, no Filter */
        assert(node->op == op_Proj);
        return node->attr.proj;
 }
 
-alloc_attr *
-get_irn_alloc_attr(ir_node *node) {
-       assert(node->op == op_Alloc);
+alloc_attr *get_irn_alloc_attr(ir_node *node) {
+       assert(is_Alloc(node));
        return &node->attr.alloc;
 }
 
-free_attr *
-get_irn_free_attr(ir_node *node) {
-       assert(node->op == op_Free);
+free_attr *get_irn_free_attr(ir_node *node) {
+       assert(is_Free(node));
        return &node->attr.free;
 }
 
-symconst_attr *
-get_irn_symconst_attr(ir_node *node) {
-       assert(node->op == op_SymConst);
+symconst_attr *get_irn_symconst_attr(ir_node *node) {
+       assert(is_SymConst(node));
        return &node->attr.symc;
 }
 
-ir_type *
-get_irn_call_attr(ir_node *node) {
-       assert(node->op == op_Call);
+ir_type *get_irn_call_attr(ir_node *node) {
+       assert(is_Call(node));
        return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
 }
 
-sel_attr *
-get_irn_sel_attr(ir_node *node) {
-       assert(node->op == op_Sel);
+sel_attr *get_irn_sel_attr(ir_node *node) {
+       assert(is_Sel(node));
        return &node->attr.sel;
 }
 
-int
-get_irn_phi0_attr(ir_node *node) {
-       assert(is_Phi0(node));
-       return node->attr.phi0.pos;
+phi_attr *get_irn_phi_attr(ir_node *node) {
+       return &node->attr.phi;
 }
 
-block_attr *
-get_irn_block_attr(ir_node *node) {
-       assert(node->op == op_Block);
+block_attr *get_irn_block_attr(ir_node *node) {
+       assert(is_Block(node));
        return &node->attr.block;
 }
 
-load_attr *
-get_irn_load_attr(ir_node *node) {
-       assert(node->op == op_Load);
+load_attr *get_irn_load_attr(ir_node *node) {
+       assert(is_Load(node));
        return &node->attr.load;
 }
 
-store_attr *
-get_irn_store_attr(ir_node *node) {
-       assert(node->op == op_Store);
+store_attr *get_irn_store_attr(ir_node *node) {
+       assert(is_Store(node));
        return &node->attr.store;
 }
 
-except_attr *
-get_irn_except_attr(ir_node *node) {
+except_attr *get_irn_except_attr(ir_node *node) {
        assert(node->op == op_Div || node->op == op_Quot ||
-              node->op == op_DivMod || node->op == op_Mod || node->op == op_Call || node->op == op_Alloc);
+              node->op == op_DivMod || node->op == op_Mod || node->op == op_Call || node->op == op_Alloc || node->op == op_Bound);
        return &node->attr.except;
 }
 
+divmod_attr *get_irn_divmod_attr(ir_node *node) {
+       assert(node->op == op_Div || node->op == op_Quot ||
+              node->op == op_DivMod || node->op == op_Mod);
+       return &node->attr.divmod;
+}
+
+builtin_attr *get_irn_builtin_attr(ir_node *node) {
+       assert(is_Builtin(node));
+       return &node->attr.builtin;
+}
+
 void *(get_irn_generic_attr)(ir_node *node) {
        assert(is_ir_node(node));
        return _get_irn_generic_attr(node);
@@ -646,46 +602,41 @@ int get_irn_pred_pos(ir_node *node, ir_node *arg) {
 
 /** manipulate fields of individual nodes **/
 
-ir_node *
-(get_nodes_block)(const ir_node *node) {
-       return _get_nodes_block(node);
+/* this works for all except Block */
+ir_node *get_nodes_block(const ir_node *node) {
+       assert(node->op != op_Block);
+       return get_irn_n(node, -1);
 }
 
-void
-set_nodes_block(ir_node *node, ir_node *block) {
-       node->op->ops.set_block(node, block);
+void set_nodes_block(ir_node *node, ir_node *block) {
+       assert(node->op != op_Block);
+       set_irn_n(node, -1, block);
+}
+
+/* this works for all except Block */
+ir_node *get_nodes_MacroBlock(const ir_node *node) {
+       assert(node->op != op_Block);
+       return get_Block_MacroBlock(get_irn_n(node, -1));
 }
 
 /* Test whether arbitrary node is frame pointer, i.e. Proj(pn_Start_P_frame_base)
  * from Start.  If so returns frame type, else Null. */
-ir_type *is_frame_pointer(ir_node *n) {
+ir_type *is_frame_pointer(const ir_node *n) {
        if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_frame_base)) {
                ir_node *start = get_Proj_pred(n);
-               if (get_irn_op(start) == op_Start) {
+               if (is_Start(start)) {
                        return get_irg_frame_type(get_irn_irg(start));
                }
        }
        return NULL;
 }
 
-/* Test whether arbitrary node is globals pointer, i.e. Proj(pn_Start_P_globals)
- * from Start.  If so returns global type, else Null. */
-ir_type *is_globals_pointer(ir_node *n) {
-       if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_globals)) {
-               ir_node *start = get_Proj_pred(n);
-               if (get_irn_op(start) == op_Start) {
-                       return get_glob_type();
-               }
-       }
-       return NULL;
-}
-
 /* Test whether arbitrary node is tls pointer, i.e. Proj(pn_Start_P_tls)
  * from Start.  If so returns tls type, else Null. */
-ir_type *is_tls_pointer(ir_node *n) {
-       if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_globals)) {
+ir_type *is_tls_pointer(const ir_node *n) {
+       if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_tls)) {
                ir_node *start = get_Proj_pred(n);
-               if (get_irn_op(start) == op_Start) {
+               if (is_Start(start)) {
                        return get_tls_type();
                }
        }
@@ -694,10 +645,10 @@ ir_type *is_tls_pointer(ir_node *n) {
 
 /* Test whether arbitrary node is value arg base, i.e. Proj(pn_Start_P_value_arg_base)
  * from Start.  If so returns 1, else 0. */
-int is_value_arg_pointer(ir_node *n) {
-       if ((get_irn_op(n) == op_Proj) &&
+int is_value_arg_pointer(const ir_node *n) {
+       if (is_Proj(n) &&
                (get_Proj_proj(n) == pn_Start_P_value_arg_base) &&
-               (get_irn_op(get_Proj_pred(n)) == op_Start))
+               is_Start(get_Proj_pred(n)))
                return 1;
        return 0;
 }
@@ -706,85 +657,68 @@ int is_value_arg_pointer(ir_node *n) {
    the implementation of the graph data structure this can be a copy of
    the internal representation of predecessors as well as the internal
    array itself. Therefore writing to this array might obstruct the ir. */
-ir_node **
-get_Block_cfgpred_arr(ir_node *node) {
-       assert((node->op == op_Block));
+ir_node **get_Block_cfgpred_arr(ir_node *node) {
+       assert(is_Block(node));
        return (ir_node **)&(get_irn_in(node)[1]);
 }
 
-int
-(get_Block_n_cfgpreds)(const ir_node *node) {
+int (get_Block_n_cfgpreds)(const ir_node *node) {
        return _get_Block_n_cfgpreds(node);
 }
 
-ir_node *
-(get_Block_cfgpred)(ir_node *node, int pos) {
+ir_node *(get_Block_cfgpred)(const ir_node *node, int pos) {
        return _get_Block_cfgpred(node, pos);
 }
 
-void
-set_Block_cfgpred(ir_node *node, int pos, ir_node *pred) {
-       assert(node->op == op_Block);
+void set_Block_cfgpred(ir_node *node, int pos, ir_node *pred) {
+       assert(is_Block(node));
        set_irn_n(node, pos, pred);
 }
 
-ir_node  *
-(get_Block_cfgpred_block)(ir_node *node, int pos) {
+ir_node *(get_Block_cfgpred_block)(const ir_node *node, int pos) {
        return _get_Block_cfgpred_block(node, pos);
 }
 
-int
-get_Block_matured(ir_node *node) {
-       assert(node->op == op_Block);
+int get_Block_matured(const ir_node *node) {
+       assert(is_Block(node));
        return (int)node->attr.block.is_matured;
 }
 
-void
-set_Block_matured(ir_node *node, int matured) {
-       assert(node->op == op_Block);
+void set_Block_matured(ir_node *node, int matured) {
+       assert(is_Block(node));
        node->attr.block.is_matured = matured;
 }
 
-unsigned long
-(get_Block_block_visited)(const ir_node *node) {
+ir_visited_t (get_Block_block_visited)(const ir_node *node) {
        return _get_Block_block_visited(node);
 }
 
-void
-(set_Block_block_visited)(ir_node *node, unsigned long visit) {
+void (set_Block_block_visited)(ir_node *node, ir_visited_t visit) {
        _set_Block_block_visited(node, visit);
 }
 
 /* For this current_ir_graph must be set. */
-void
-(mark_Block_block_visited)(ir_node *node) {
+void (mark_Block_block_visited)(ir_node *node) {
        _mark_Block_block_visited(node);
 }
 
-int
-(Block_not_block_visited)(const ir_node *node) {
-       return _Block_not_block_visited(node);
-}
-
-int
-(Block_block_visited)(const ir_node *node) {
+int (Block_block_visited)(const ir_node *node) {
        return _Block_block_visited(node);
 }
 
-ir_node *
-get_Block_graph_arr (ir_node *node, int pos) {
-       assert(node->op == op_Block);
+ir_node *get_Block_graph_arr(ir_node *node, int pos) {
+       assert(is_Block(node));
        return node->attr.block.graph_arr[pos+1];
 }
 
-void
-set_Block_graph_arr (ir_node *node, int pos, ir_node *value) {
-       assert(node->op == op_Block);
+void set_Block_graph_arr(ir_node *node, int pos, ir_node *value) {
+       assert(is_Block(node));
        node->attr.block.graph_arr[pos+1] = value;
 }
 
+#ifdef INTERPROCEDURAL_VIEW
 void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]) {
-       assert(node->op == op_Block);
+       assert(is_Block(node));
        if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) {
                node->attr.block.in_cg = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
                node->attr.block.in_cg[0] = NULL;
@@ -802,31 +736,31 @@ void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]) {
 }
 
 void set_Block_cg_cfgpred(ir_node *node, int pos, ir_node *pred) {
-       assert(node->op == op_Block &&
-              node->attr.block.in_cg &&
+       assert(is_Block(node) && node->attr.block.in_cg &&
               0 <= pos && pos < ARR_LEN(node->attr.block.in_cg) - 1);
        node->attr.block.in_cg[pos + 1] = pred;
 }
 
 ir_node **get_Block_cg_cfgpred_arr(ir_node *node) {
-       assert(node->op == op_Block);
+       assert(is_Block(node));
        return node->attr.block.in_cg == NULL ? NULL : node->attr.block.in_cg  + 1;
 }
 
-int get_Block_cg_n_cfgpreds(ir_node *node) {
-       assert(node->op == op_Block);
+int get_Block_cg_n_cfgpreds(const ir_node *node) {
+       assert(is_Block(node));
        return node->attr.block.in_cg == NULL ? 0 : ARR_LEN(node->attr.block.in_cg) - 1;
 }
 
-ir_node *get_Block_cg_cfgpred(ir_node *node, int pos) {
-       assert(node->op == op_Block && node->attr.block.in_cg);
+ir_node *get_Block_cg_cfgpred(const ir_node *node, int pos) {
+       assert(is_Block(node) && node->attr.block.in_cg);
        return node->attr.block.in_cg[pos + 1];
 }
 
 void remove_Block_cg_cfgpred_arr(ir_node *node) {
-       assert(node->op == op_Block);
+       assert(is_Block(node));
        node->attr.block.in_cg = NULL;
 }
+#endif /* INTERPROCEDURAL_VIEW */
 
 ir_node *(set_Block_dead)(ir_node *block) {
        return _set_Block_dead(block);
@@ -850,10 +784,33 @@ void set_Block_extbb(ir_node *block, ir_extblk *extblk) {
        block->attr.block.extblk = extblk;
 }
 
-/* returns the macro block header of a block. */
+/* Returns the macro block header of a block.*/
 ir_node *get_Block_MacroBlock(const ir_node *block) {
+       ir_node *mbh;
        assert(is_Block(block));
-       return get_irn_n(block, -1);
+       mbh = get_irn_n(block, -1);
+       /* once macro block header is respected by all optimizations,
+          this assert can be removed */
+       assert(mbh != NULL);
+       return mbh;
+}
+
+/* Sets the macro block header of a block. */
+void set_Block_MacroBlock(ir_node *block, ir_node *mbh) {
+       assert(is_Block(block));
+       assert(is_Block(mbh));
+       set_irn_n(block, -1, mbh);
+}
+
+/* returns the macro block header of a node. */
+ir_node *get_irn_MacroBlock(const ir_node *n) {
+       if (! is_Block(n)) {
+               n = get_nodes_block(n);
+               /* if the Block is Bad, do NOT try to get it's MB, it will fail. */
+               if (is_Bad(n))
+                       return (ir_node *)n;
+       }
+       return get_Block_MacroBlock(n);
 }
 
 /* returns the graph of a Block. */
@@ -862,28 +819,61 @@ ir_graph *get_Block_irg(const ir_node *block) {
        return block->attr.block.irg;
 }
 
-int
-get_End_n_keepalives(ir_node *end) {
-       assert(end->op == op_End);
+int has_Block_label(const ir_node *block) {
+       assert(is_Block(block));
+       return block->attr.block.has_label;
+}
+
+ir_label_t get_Block_label(const ir_node *block) {
+       assert(is_Block(block));
+       return block->attr.block.label;
+}
+
+void set_Block_label(ir_node *block, ir_label_t label) {
+       assert(is_Block(block));
+       block->attr.block.has_label = 1;
+       block->attr.block.label = label;
+}
+
+ir_node *(get_Block_phis)(const ir_node *block) {
+       return _get_Block_phis(block);
+}
+
+void (set_Block_phis)(ir_node *block, ir_node *phi) {
+       _set_Block_phis(block, phi);
+}
+
+void (add_Block_phi)(ir_node *block, ir_node *phi) {
+       _add_Block_phi(block, phi);
+}
+
+/* Get the Block mark (single bit). */
+unsigned (get_Block_mark)(const ir_node *block) {
+       return _get_Block_mark(block);
+}
+
+/* Set the Block mark (single bit). */
+void (set_Block_mark)(ir_node *block, unsigned mark) {
+       _set_Block_mark(block, mark);
+}
+
+int get_End_n_keepalives(const ir_node *end) {
+       assert(is_End(end));
        return (get_irn_arity(end) - END_KEEPALIVE_OFFSET);
 }
 
-ir_node *
-get_End_keepalive(ir_node *end, int pos) {
-       assert(end->op == op_End);
+ir_node *get_End_keepalive(const ir_node *end, int pos) {
+       assert(is_End(end));
        return get_irn_n(end, pos + END_KEEPALIVE_OFFSET);
 }
 
-void
-add_End_keepalive(ir_node *end, ir_node *ka) {
-       assert(end->op == op_End);
-       assert((is_Phi(ka) || is_Proj(ka) || is_Block(ka) || is_irn_keep(ka)) && "Only Phi, Block or Keep nodes can be kept alive!");
+void add_End_keepalive(ir_node *end, ir_node *ka) {
+       assert(is_End(end));
        add_irn_n(end, ka);
 }
 
-void
-set_End_keepalive(ir_node *end, int pos, ir_node *ka) {
-       assert(end->op == op_End);
+void set_End_keepalive(ir_node *end, int pos, ir_node *ka) {
+       assert(is_End(end));
        set_irn_n(end, pos + END_KEEPALIVE_OFFSET, ka);
 }
 
@@ -906,27 +896,77 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[]) {
 
 /* Set new keep-alives from old keep-alives, skipping irn */
 void remove_End_keepalive(ir_node *end, ir_node *irn) {
-       int     n = get_End_n_keepalives(end);
-       ir_node **in;
-       int     i, idx;
+       int      n = get_End_n_keepalives(end);
+       int      i, idx;
+       ir_graph *irg;
+
+       idx = -1;
+       for (i = n -1; i >= 0; --i) {
+               ir_node *old_ka = end->in[1 + END_KEEPALIVE_OFFSET + i];
+
+               /* find irn */
+               if (old_ka == irn) {
+                       idx = i;
+                       goto found;
+               }
+       }
+       return;
+found:
+       irg = get_irn_irg(end);
+
+       /* remove the edge */
+       edges_notify_edge(end, idx, NULL, irn, irg);
+
+       if (idx != n - 1) {
+               /* exchange with the last one */
+               ir_node *old = end->in[1 + END_KEEPALIVE_OFFSET + n - 1];
+               edges_notify_edge(end, n - 1, NULL, old, irg);
+               end->in[1 + END_KEEPALIVE_OFFSET + idx] = old;
+               edges_notify_edge(end, idx, old, NULL, irg);
+       }
+       /* now n - 1 keeps, 1 block input */
+       ARR_RESIZE(ir_node *, end->in, (n - 1) + 1 + END_KEEPALIVE_OFFSET);
+}
+
+/* remove Bads, NoMems and doublets from the keep-alive set */
+void remove_End_Bads_and_doublets(ir_node *end) {
+       pset_new_t keeps;
+       int        idx, n = get_End_n_keepalives(end);
+       ir_graph   *irg;
+
+       if (n <= 0)
+               return;
 
-       NEW_ARR_A(ir_node *, in, n);
+       irg = get_irn_irg(end);
+       pset_new_init(&keeps);
 
-       for (idx = i = 0; i < n; ++i) {
-               ir_node *old_ka = get_End_keepalive(end, i);
+       for (idx = n - 1; idx >= 0; --idx) {
+               ir_node *ka = get_End_keepalive(end, idx);
 
-               /* skip irn */
-               if (old_ka != irn)
-                       in[idx++] = old_ka;
+               if (is_Bad(ka) || is_NoMem(ka) || pset_new_contains(&keeps, ka)) {
+                       /* remove the edge */
+                       edges_notify_edge(end, idx, NULL, ka, irg);
+
+                       if (idx != n - 1) {
+                               /* exchange with the last one */
+                               ir_node *old = end->in[1 + END_KEEPALIVE_OFFSET + n - 1];
+                               edges_notify_edge(end, n - 1, NULL, old, irg);
+                               end->in[1 + END_KEEPALIVE_OFFSET + idx] = old;
+                               edges_notify_edge(end, idx, old, NULL, irg);
+                       }
+                       --n;
+               } else {
+                       pset_new_insert(&keeps, ka);
+               }
        }
+       /* n keeps, 1 block input */
+       ARR_RESIZE(ir_node *, end->in, n + 1 + END_KEEPALIVE_OFFSET);
 
-       /* set new keep-alives */
-       set_End_keepalives(end, idx, in);
+       pset_new_destroy(&keeps);
 }
 
-void
-free_End (ir_node *end) {
-       assert(end->op == op_End);
+void free_End(ir_node *end) {
+       assert(is_End(end));
        end->kind = k_BAD;
        DEL_ARR_F(end->in);
        end->in = NULL;   /* @@@ make sure we get an error if we use the
@@ -934,14 +974,14 @@ free_End (ir_node *end) {
 }
 
 /* Return the target address of an IJmp */
-ir_node *get_IJmp_target(ir_node *ijmp) {
-       assert(ijmp->op == op_IJmp);
+ir_node *get_IJmp_target(const ir_node *ijmp) {
+       assert(is_IJmp(ijmp));
        return get_irn_n(ijmp, 0);
 }
 
 /** Sets the target address of an IJmp */
 void set_IJmp_target(ir_node *ijmp, ir_node *tgt) {
-       assert(ijmp->op == op_IJmp);
+       assert(is_IJmp(ijmp));
        set_irn_n(ijmp, 0, tgt);
 }
 
@@ -952,15 +992,15 @@ void set_IJmp_target(ir_node *ijmp, ir_node *tgt) {
 > Firm to the target machine.  That could be done if there was some way of
 > projecting "default" out of the Cond node.
 I know it's complicated.
-Basically there are two proglems:
- - determining the gaps between the projs
+Basically there are two problems:
+ - determining the gaps between the Projs
  - determining the biggest case constant to know the proj number for
    the default node.
 I see several solutions:
 1. Introduce a ProjDefault node.  Solves both problems.
    This means to extend all optimizations executed during construction.
 2. Give the Cond node for switch two flavors:
-   a) there are no gaps in the projs  (existing flavor)
+   a) there are no gaps in the Projs  (existing flavor)
    b) gaps may exist, default proj is still the Proj with the largest
       projection number.  This covers also the gaps.
 3. Fix the semantic of the Cond to that of 2b)
@@ -977,56 +1017,56 @@ dataflow analysis and 3) does not allow to convert the representation to
 2a).
 */
 ir_node *
-get_Cond_selector(ir_node *node) {
-       assert(node->op == op_Cond);
+get_Cond_selector(const ir_node *node) {
+       assert(is_Cond(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Cond_selector(ir_node *node, ir_node *selector) {
-       assert(node->op == op_Cond);
+       assert(is_Cond(node));
        set_irn_n(node, 0, selector);
 }
 
 cond_kind
-get_Cond_kind(ir_node *node) {
-       assert(node->op == op_Cond);
+get_Cond_kind(const ir_node *node) {
+       assert(is_Cond(node));
        return node->attr.cond.kind;
 }
 
 void
 set_Cond_kind(ir_node *node, cond_kind kind) {
-       assert(node->op == op_Cond);
+       assert(is_Cond(node));
        node->attr.cond.kind = kind;
 }
 
 long
-get_Cond_defaultProj(ir_node *node) {
-       assert(node->op == op_Cond);
+get_Cond_defaultProj(const ir_node *node) {
+       assert(is_Cond(node));
        return node->attr.cond.default_proj;
 }
 
 ir_node *
-get_Return_mem(ir_node *node) {
-       assert(node->op == op_Return);
+get_Return_mem(const ir_node *node) {
+       assert(is_Return(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Return_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Return);
+       assert(is_Return(node));
        set_irn_n(node, 0, mem);
 }
 
 int
-get_Return_n_ress(ir_node *node) {
-       assert(node->op == op_Return);
+get_Return_n_ress(const ir_node *node) {
+       assert(is_Return(node));
        return (get_irn_arity(node) - RETURN_RESULT_OFFSET);
 }
 
 ir_node **
-get_Return_res_arr (ir_node *node) {
-       assert((node->op == op_Return));
+get_Return_res_arr(ir_node *node) {
+       assert(is_Return(node));
        if (get_Return_n_ress(node) > 0)
                return (ir_node **)&(get_irn_in(node)[1 + RETURN_RESULT_OFFSET]);
        else
@@ -1036,20 +1076,20 @@ get_Return_res_arr (ir_node *node) {
 /*
 void
 set_Return_n_res(ir_node *node, int results) {
-       assert(node->op == op_Return);
+       assert(is_Return(node));
 }
 */
 
 ir_node *
-get_Return_res(ir_node *node, int pos) {
-       assert(node->op == op_Return);
+get_Return_res(const ir_node *node, int pos) {
+       assert(is_Return(node));
        assert(get_Return_n_ress(node) > pos);
        return get_irn_n(node, pos + RETURN_RESULT_OFFSET);
 }
 
 void
 set_Return_res(ir_node *node, int pos, ir_node *res){
-       assert(node->op == op_Return);
+       assert(is_Return(node));
        set_irn_n(node, pos + RETURN_RESULT_OFFSET, res);
 }
 
@@ -1059,12 +1099,20 @@ tarval *(get_Const_tarval)(const ir_node *node) {
 
 void
 set_Const_tarval(ir_node *node, tarval *con) {
-       assert(node->op == op_Const);
+       assert(is_Const(node));
        node->attr.con.tv = con;
 }
 
-cnst_classify_t (classify_Const)(ir_node *node) {
-       return _classify_Const(node);
+int (is_Const_null)(const ir_node *node) {
+       return _is_Const_null(node);
+}
+
+int (is_Const_one)(const ir_node *node) {
+       return _is_Const_one(node);
+}
+
+int (is_Const_all_one)(const ir_node *node) {
+       return _is_Const_all_one(node);
 }
 
 
@@ -1073,13 +1121,14 @@ cnst_classify_t (classify_Const)(ir_node *node) {
    entity type. */
 ir_type *
 get_Const_type(ir_node *node) {
-       assert(node->op == op_Const);
+       assert(is_Const(node));
+       node->attr.con.tp = skip_tid(node->attr.con.tp);
        return node->attr.con.tp;
 }
 
 void
 set_Const_type(ir_node *node, ir_type *tp) {
-       assert(node->op == op_Const);
+       assert(is_Const(node));
        if (tp != firm_unknown_type) {
                assert(is_atomic_type(tp));
                assert(get_type_mode(tp) == get_irn_mode(node));
@@ -1090,122 +1139,135 @@ set_Const_type(ir_node *node, ir_type *tp) {
 
 symconst_kind
 get_SymConst_kind(const ir_node *node) {
-       assert(node->op == op_SymConst);
-       return node->attr.symc.num;
+       assert(is_SymConst(node));
+       return node->attr.symc.kind;
 }
 
 void
-set_SymConst_kind(ir_node *node, symconst_kind num) {
-       assert(node->op == op_SymConst);
-       node->attr.symc.num = num;
+set_SymConst_kind(ir_node *node, symconst_kind kind) {
+       assert(is_SymConst(node));
+       node->attr.symc.kind = kind;
 }
 
 ir_type *
-get_SymConst_type(ir_node *node) {
-       assert((node->op == op_SymConst) &&
+get_SymConst_type(const ir_node *node) {
+       /* the cast here is annoying, but we have to compensate for
+          the skip_tip() */
+       ir_node *irn = (ir_node *)node;
+       assert(is_SymConst(node) &&
               (SYMCONST_HAS_TYPE(get_SymConst_kind(node))));
-       return node->attr.symc.sym.type_p = skip_tid(node->attr.symc.sym.type_p);
+       return irn->attr.symc.sym.type_p = skip_tid(irn->attr.symc.sym.type_p);
 }
 
 void
 set_SymConst_type(ir_node *node, ir_type *tp) {
-       assert((node->op == op_SymConst) &&
+       assert(is_SymConst(node) &&
               (SYMCONST_HAS_TYPE(get_SymConst_kind(node))));
        node->attr.symc.sym.type_p = tp;
 }
 
 ident *
 get_SymConst_name(const ir_node *node) {
-       assert(node->op == op_SymConst && SYMCONST_HAS_ID(get_SymConst_kind(node)));
+       assert(is_SymConst(node) && SYMCONST_HAS_ID(get_SymConst_kind(node)));
        return node->attr.symc.sym.ident_p;
 }
 
 void
 set_SymConst_name(ir_node *node, ident *name) {
-       assert(node->op == op_SymConst && SYMCONST_HAS_ID(get_SymConst_kind(node)));
+       assert(is_SymConst(node) && SYMCONST_HAS_ID(get_SymConst_kind(node)));
        node->attr.symc.sym.ident_p = name;
 }
 
 
 /* Only to access SymConst of kind symconst_addr_ent.  Else assertion: */
 ir_entity *get_SymConst_entity(const ir_node *node) {
-       assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
+       assert(is_SymConst(node) && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
        return node->attr.symc.sym.entity_p;
 }
 
 void set_SymConst_entity(ir_node *node, ir_entity *ent) {
-       assert(node->op == op_SymConst && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
+       assert(is_SymConst(node) && SYMCONST_HAS_ENT(get_SymConst_kind(node)));
        node->attr.symc.sym.entity_p  = ent;
 }
 
 ir_enum_const *get_SymConst_enum(const ir_node *node) {
-       assert(node->op == op_SymConst && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
+       assert(is_SymConst(node) && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
        return node->attr.symc.sym.enum_p;
 }
 
 void set_SymConst_enum(ir_node *node, ir_enum_const *ec) {
-       assert(node->op == op_SymConst && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
+       assert(is_SymConst(node) && SYMCONST_HAS_ENUM(get_SymConst_kind(node)));
        node->attr.symc.sym.enum_p  = ec;
 }
 
 union symconst_symbol
 get_SymConst_symbol(const ir_node *node) {
-       assert(node->op == op_SymConst);
+       assert(is_SymConst(node));
        return node->attr.symc.sym;
 }
 
 void
 set_SymConst_symbol(ir_node *node, union symconst_symbol sym) {
-       assert(node->op == op_SymConst);
+       assert(is_SymConst(node));
        node->attr.symc.sym = sym;
 }
 
+ir_label_t get_SymConst_label(const ir_node *node) {
+       assert(is_SymConst(node) && SYMCONST_HAS_LABEL(get_SymConst_kind(node)));
+       return node->attr.symc.sym.label;
+}
+
+void set_SymConst_label(ir_node *node, ir_label_t label) {
+       assert(is_SymConst(node) && SYMCONST_HAS_LABEL(get_SymConst_kind(node)));
+       node->attr.symc.sym.label = label;
+}
+
 ir_type *
 get_SymConst_value_type(ir_node *node) {
-       assert(node->op == op_SymConst);
+       assert(is_SymConst(node));
        if (node->attr.symc.tp) node->attr.symc.tp = skip_tid(node->attr.symc.tp);
        return node->attr.symc.tp;
 }
 
 void
 set_SymConst_value_type(ir_node *node, ir_type *tp) {
-       assert(node->op == op_SymConst);
+       assert(is_SymConst(node));
        node->attr.symc.tp = tp;
 }
 
 ir_node *
-get_Sel_mem(ir_node *node) {
-       assert(node->op == op_Sel);
+get_Sel_mem(const ir_node *node) {
+       assert(is_Sel(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Sel_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Sel);
+       assert(is_Sel(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Sel_ptr(ir_node *node) {
-       assert(node->op == op_Sel);
+get_Sel_ptr(const ir_node *node) {
+       assert(is_Sel(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Sel_ptr(ir_node *node, ir_node *ptr) {
-       assert(node->op == op_Sel);
+       assert(is_Sel(node));
        set_irn_n(node, 1, ptr);
 }
 
 int
-get_Sel_n_indexs(ir_node *node) {
-       assert(node->op == op_Sel);
+get_Sel_n_indexs(const ir_node *node) {
+       assert(is_Sel(node));
        return (get_irn_arity(node) - SEL_INDEX_OFFSET);
 }
 
 ir_node **
 get_Sel_index_arr(ir_node *node) {
-       assert((node->op == op_Sel));
+       assert(is_Sel(node));
        if (get_Sel_n_indexs(node) > 0)
                return (ir_node **)& get_irn_in(node)[SEL_INDEX_OFFSET + 1];
        else
@@ -1213,26 +1275,31 @@ get_Sel_index_arr(ir_node *node) {
 }
 
 ir_node *
-get_Sel_index(ir_node *node, int pos) {
-       assert(node->op == op_Sel);
+get_Sel_index(const ir_node *node, int pos) {
+       assert(is_Sel(node));
        return get_irn_n(node, pos + SEL_INDEX_OFFSET);
 }
 
 void
 set_Sel_index(ir_node *node, int pos, ir_node *index) {
-       assert(node->op == op_Sel);
+       assert(is_Sel(node));
        set_irn_n(node, pos + SEL_INDEX_OFFSET, index);
 }
 
 ir_entity *
-get_Sel_entity(ir_node *node) {
-       assert(node->op == op_Sel);
+get_Sel_entity(const ir_node *node) {
+       assert(is_Sel(node));
        return node->attr.sel.ent;
 }
 
+/* need a version without const to prevent warning */
+static ir_entity *_get_Sel_entity(ir_node *node) {
+       return get_Sel_entity(node);
+}
+
 void
 set_Sel_entity(ir_node *node, ir_entity *ent) {
-       assert(node->op == op_Sel);
+       assert(is_Sel(node));
        node->attr.sel.ent = ent;
 }
 
@@ -1246,153 +1313,240 @@ set_Sel_entity(ir_node *node, ir_entity *ent) {
 
 
 ir_node *
-get_Call_mem(ir_node *node) {
-       assert(node->op == op_Call);
+get_Call_mem(const ir_node *node) {
+       assert(is_Call(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Call_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Call);
+       assert(is_Call(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Call_ptr(ir_node *node) {
-       assert(node->op == op_Call);
+get_Call_ptr(const ir_node *node) {
+       assert(is_Call(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Call_ptr(ir_node *node, ir_node *ptr) {
-       assert(node->op == op_Call);
+       assert(is_Call(node));
        set_irn_n(node, 1, ptr);
 }
 
 ir_node **
 get_Call_param_arr(ir_node *node) {
-       assert(node->op == op_Call);
-       return (ir_node **)&get_irn_in(node)[CALL_PARAM_OFFSET + 1];
+       assert(is_Call(node));
+       return &get_irn_in(node)[CALL_PARAM_OFFSET + 1];
 }
 
 int
-get_Call_n_params(ir_node *node)  {
-       assert(node->op == op_Call);
+get_Call_n_params(const ir_node *node)  {
+       assert(is_Call(node));
        return (get_irn_arity(node) - CALL_PARAM_OFFSET);
 }
 
-int
-get_Call_arity(ir_node *node) {
-       assert(node->op == op_Call);
-       return get_Call_n_params(node);
-}
-
-/* void
-set_Call_arity(ir_node *node, ir_node *arity) {
-       assert(node->op == op_Call);
-}
-*/
-
 ir_node *
-get_Call_param(ir_node *node, int pos) {
-       assert(node->op == op_Call);
+get_Call_param(const ir_node *node, int pos) {
+       assert(is_Call(node));
        return get_irn_n(node, pos + CALL_PARAM_OFFSET);
 }
 
 void
 set_Call_param(ir_node *node, int pos, ir_node *param) {
-       assert(node->op == op_Call);
+       assert(is_Call(node));
        set_irn_n(node, pos + CALL_PARAM_OFFSET, param);
 }
 
 ir_type *
 get_Call_type(ir_node *node) {
-       assert(node->op == op_Call);
+       assert(is_Call(node));
        return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
 }
 
 void
 set_Call_type(ir_node *node, ir_type *tp) {
-       assert(node->op == op_Call);
+       assert(is_Call(node));
        assert((get_unknown_type() == tp) || is_Method_type(tp));
        node->attr.call.cld_tp = tp;
 }
 
-int Call_has_callees(ir_node *node) {
-       assert(node && node->op == op_Call);
+ir_node *
+get_Builtin_mem(const ir_node *node) {
+       assert(is_Builtin(node));
+       return get_irn_n(node, 0);
+}
+
+void
+set_Builin_mem(ir_node *node, ir_node *mem) {
+       assert(is_Builtin(node));
+       set_irn_n(node, 0, mem);
+}
+
+ir_builtin_kind
+get_Builtin_kind(const ir_node *node) {
+       assert(is_Builtin(node));
+       return node->attr.builtin.kind;
+}
+
+void
+set_Builtin_kind(ir_node *node, ir_builtin_kind kind) {
+       assert(is_Builtin(node));
+       node->attr.builtin.kind = kind;
+}
+
+ir_node **
+get_Builtin_param_arr(ir_node *node) {
+       assert(is_Builtin(node));
+       return &get_irn_in(node)[BUILDIN_PARAM_OFFSET + 1];
+}
+
+int
+get_Builtin_n_params(const ir_node *node)  {
+       assert(is_Builtin(node));
+       return (get_irn_arity(node) - BUILDIN_PARAM_OFFSET);
+}
+
+ir_node *
+get_Builtin_param(const ir_node *node, int pos) {
+       assert(is_Builtin(node));
+       return get_irn_n(node, pos + BUILDIN_PARAM_OFFSET);
+}
+
+void
+set_Builtin_param(ir_node *node, int pos, ir_node *param) {
+       assert(is_Builtin(node));
+       set_irn_n(node, pos + BUILDIN_PARAM_OFFSET, param);
+}
+
+ir_type *
+get_Builtin_type(ir_node *node) {
+       assert(is_Builtin(node));
+       return node->attr.builtin.builtin_tp = skip_tid(node->attr.builtin.builtin_tp);
+}
+
+void
+set_Builtin_type(ir_node *node, ir_type *tp) {
+       assert(is_Builtin(node));
+       assert((get_unknown_type() == tp) || is_Method_type(tp));
+       node->attr.builtin.builtin_tp = tp;
+}
+
+/* Returns a human readable string for the ir_builtin_kind. */
+const char *get_builtin_kind_name(ir_builtin_kind kind) {
+#define X(a)    case a: return #a + 6;
+       switch (kind) {
+               X(ir_bk_trap);
+               X(ir_bk_debugbreak);
+               X(ir_bk_return_address);
+               X(ir_bk_frame_addess);
+               X(ir_bk_prefetch);
+               X(ir_bk_ffs);
+               X(ir_bk_clz);
+               X(ir_bk_ctz);
+               X(ir_bk_popcount);
+               X(ir_bk_parity);
+               X(ir_bk_bswap);
+               X(ir_bk_inport);
+               X(ir_bk_outport);
+       }
+       return "<unknown>";
+#undef X
+}
+
+
+int Call_has_callees(const ir_node *node) {
+       assert(is_Call(node));
        return ((get_irg_callee_info_state(get_irn_irg(node)) != irg_callee_info_none) &&
                (node->attr.call.callee_arr != NULL));
 }
 
-int get_Call_n_callees(ir_node * node) {
-  assert(node && node->op == op_Call && node->attr.call.callee_arr);
+int get_Call_n_callees(const ir_node *node) {
+  assert(is_Call(node) && node->attr.call.callee_arr);
   return ARR_LEN(node->attr.call.callee_arr);
 }
 
-ir_entity * get_Call_callee(ir_node * node, int pos) {
+ir_entity *get_Call_callee(const ir_node *node, int pos) {
        assert(pos >= 0 && pos < get_Call_n_callees(node));
        return node->attr.call.callee_arr[pos];
 }
 
-void set_Call_callee_arr(ir_node * node, const int n, ir_entity ** arr) {
-       assert(node->op == op_Call);
+void set_Call_callee_arr(ir_node *node, const int n, ir_entity ** arr) {
+       assert(is_Call(node));
        if (node->attr.call.callee_arr == NULL || get_Call_n_callees(node) != n) {
                node->attr.call.callee_arr = NEW_ARR_D(ir_entity *, current_ir_graph->obst, n);
        }
        memcpy(node->attr.call.callee_arr, arr, n * sizeof(ir_entity *));
 }
 
-void remove_Call_callee_arr(ir_node * node) {
-       assert(node->op == op_Call);
+void remove_Call_callee_arr(ir_node *node) {
+       assert(is_Call(node));
        node->attr.call.callee_arr = NULL;
 }
 
-ir_node * get_CallBegin_ptr(ir_node *node) {
-       assert(node->op == op_CallBegin);
+ir_node *get_CallBegin_ptr(const ir_node *node) {
+       assert(is_CallBegin(node));
        return get_irn_n(node, 0);
 }
 
 void set_CallBegin_ptr(ir_node *node, ir_node *ptr) {
-       assert(node->op == op_CallBegin);
+       assert(is_CallBegin(node));
        set_irn_n(node, 0, ptr);
 }
 
-ir_node * get_CallBegin_call(ir_node *node) {
-       assert(node->op == op_CallBegin);
+ir_node *get_CallBegin_call(const ir_node *node) {
+       assert(is_CallBegin(node));
        return node->attr.callbegin.call;
 }
 
-void  set_CallBegin_call(ir_node *node, ir_node *call) {
-       assert(node->op == op_CallBegin);
+void set_CallBegin_call(ir_node *node, ir_node *call) {
+       assert(is_CallBegin(node));
        node->attr.callbegin.call = call;
 }
 
+/*
+ * Returns non-zero if a Call is surely a self-recursive Call.
+ * Beware: if this functions returns 0, the call might be self-recursive!
+ */
+int is_self_recursive_Call(const ir_node *call) {
+       const ir_node *callee = get_Call_ptr(call);
+
+       if (is_SymConst_addr_ent(callee)) {
+               const ir_entity *ent = get_SymConst_entity(callee);
+               const ir_graph  *irg = get_entity_irg(ent);
+               if (irg == get_irn_irg(call))
+                       return 1;
+       }
+       return 0;
+}
 
 #define BINOP(OP)                                      \
 ir_node * get_##OP##_left(const ir_node *node) {       \
-  assert(node->op == op_##OP);                         \
+  assert(is_##OP(node));                               \
   return get_irn_n(node, node->op->op_index);          \
 }                                                      \
 void set_##OP##_left(ir_node *node, ir_node *left) {   \
-  assert(node->op == op_##OP);                         \
+  assert(is_##OP(node));                               \
   set_irn_n(node, node->op->op_index, left);           \
 }                                                      \
 ir_node *get_##OP##_right(const ir_node *node) {       \
-  assert(node->op == op_##OP);                         \
+  assert(is_##OP(node));                               \
   return get_irn_n(node, node->op->op_index + 1);      \
 }                                                      \
 void set_##OP##_right(ir_node *node, ir_node *right) { \
-  assert(node->op == op_##OP);                         \
+  assert(is_##OP(node));                               \
   set_irn_n(node, node->op->op_index + 1, right);      \
 }
 
 #define UNOP(OP)                                  \
 ir_node *get_##OP##_op(const ir_node *node) {     \
-  assert(node->op == op_##OP);                    \
+  assert(is_##OP(node));                          \
   return get_irn_n(node, node->op->op_index);     \
 }                                                 \
-void set_##OP##_op (ir_node *node, ir_node *op) { \
-  assert(node->op == op_##OP);                    \
+void set_##OP##_op(ir_node *node, ir_node *op) {  \
+  assert(is_##OP(node));                          \
   set_irn_n(node, node->op->op_index, op);        \
 }
 
@@ -1400,14 +1554,14 @@ void set_##OP##_op (ir_node *node, ir_node *op) { \
 BINOP(OP)                                     \
                                               \
 ir_node *                                     \
-get_##OP##_mem(ir_node *node) {               \
-  assert(node->op == op_##OP);                \
+get_##OP##_mem(const ir_node *node) {         \
+  assert(is_##OP(node));                      \
   return get_irn_n(node, 0);                  \
 }                                             \
                                               \
 void                                          \
 set_##OP##_mem(ir_node *node, ir_node *mem) { \
-  assert(node->op == op_##OP);                \
+  assert(is_##OP(node));                      \
   set_irn_n(node, 0, mem);                    \
 }
 
@@ -1415,20 +1569,22 @@ set_##OP##_mem(ir_node *node, ir_node *mem) { \
 BINOP_MEM(OP)                                           \
                                                         \
 ir_mode *get_##OP##_resmode(const ir_node *node) {      \
-  assert(node->op == op_##OP);                          \
+  assert(is_##OP(node));                                \
   return node->attr.divmod.res_mode;                    \
 }                                                       \
                                                         \
 void set_##OP##_resmode(ir_node *node, ir_mode *mode) { \
-  assert(node->op == op_##OP);                          \
+  assert(is_##OP(node));                                \
   node->attr.divmod.res_mode = mode;                    \
 }
 
 
 BINOP(Add)
+BINOP(Carry)
 BINOP(Sub)
 UNOP(Minus)
 BINOP(Mul)
+BINOP(Mulh)
 DIVOP(Quot)
 DIVOP(DivMod)
 DIVOP(Div)
@@ -1441,30 +1597,36 @@ UNOP(Not)
 BINOP(Shl)
 BINOP(Shr)
 BINOP(Shrs)
-BINOP(Rot)
+BINOP(Rotl)
 BINOP(Cmp)
 UNOP(Conv)
 UNOP(Cast)
 
-int get_Conv_strict(ir_node *node) {
-       assert(node->op == op_Conv);
+int is_Div_remainderless(const ir_node *node) {
+       assert(is_Div(node));
+       return node->attr.divmod.no_remainder;
+}
+
+int get_Conv_strict(const ir_node *node) {
+       assert(is_Conv(node));
        return node->attr.conv.strict;
 }
 
 void set_Conv_strict(ir_node *node, int strict_flag) {
-       assert(node->op == op_Conv);
+       assert(is_Conv(node));
        node->attr.conv.strict = (char)strict_flag;
 }
 
 ir_type *
 get_Cast_type(ir_node *node) {
-       assert(node->op == op_Cast);
+       assert(is_Cast(node));
+       node->attr.cast.totype = skip_tid(node->attr.cast.totype);
        return node->attr.cast.totype;
 }
 
 void
 set_Cast_type(ir_node *node, ir_type *to_tp) {
-       assert(node->op == op_Cast);
+       assert(is_Cast(node));
        node->attr.cast.totype = to_tp;
 }
 
@@ -1476,9 +1638,8 @@ set_Cast_type(ir_node *node, ir_type *to_tp) {
 int is_Cast_upcast(ir_node *node) {
        ir_type *totype   = get_Cast_type(node);
        ir_type *fromtype = get_irn_typeinfo_type(get_Cast_op(node));
-       ir_graph *myirg = get_irn_irg(node);
 
-       assert(get_irg_typeinfo_state(myirg) == ir_typeinfo_consistent);
+       assert(get_irg_typeinfo_state(get_irn_irg(node)) == ir_typeinfo_consistent);
        assert(fromtype);
 
        while (is_Pointer_type(totype) && is_Pointer_type(fromtype)) {
@@ -1565,19 +1726,9 @@ set_binop_right(ir_node *node, ir_node *right) {
        set_irn_n(node, node->op->op_index + 1, right);
 }
 
-int is_Phi(const ir_node *n) {
-       ir_op *op;
-
-       assert(n);
-       op = get_irn_op(n);
-
-       if (op == op_Filter) return get_interprocedural_view();
-
-       if (op == op_Phi)
-               return ((get_irg_phase_state(get_irn_irg(n)) !=  phase_building) ||
-                       (get_irn_arity(n) > 0));
-
-       return 0;
+int
+(is_Phi)(const ir_node *n) {
+       return _is_Phi(n);
 }
 
 int is_Phi0(const ir_node *n) {
@@ -1618,12 +1769,20 @@ set_Phi_pred(ir_node *node, int pos, ir_node *pred) {
        set_irn_n(node, pos, pred);
 }
 
+ir_node *(get_Phi_next)(const ir_node *phi) {
+       return _get_Phi_next(phi);
+}
 
-int is_memop(ir_node *node) {
-       return ((get_irn_op(node) == op_Load) || (get_irn_op(node) == op_Store));
+void (set_Phi_next)(ir_node *phi, ir_node *next) {
+       _set_Phi_next(phi, next);
 }
 
-ir_node *get_memop_mem(ir_node *node) {
+int is_memop(const ir_node *node) {
+       ir_opcode code = get_irn_opcode(node);
+       return (code == iro_Load || code == iro_Store);
+}
+
+ir_node *get_memop_mem(const ir_node *node) {
        assert(is_memop(node));
        return get_irn_n(node, 0);
 }
@@ -1633,7 +1792,7 @@ void set_memop_mem(ir_node *node, ir_node *mem) {
        set_irn_n(node, 0, mem);
 }
 
-ir_node *get_memop_ptr(ir_node *node) {
+ir_node *get_memop_ptr(const ir_node *node) {
        assert(is_memop(node));
        return get_irn_n(node, 1);
 }
@@ -1644,241 +1803,265 @@ void set_memop_ptr(ir_node *node, ir_node *ptr) {
 }
 
 ir_node *
-get_Load_mem(ir_node *node) {
-       assert(node->op == op_Load);
+get_Load_mem(const ir_node *node) {
+       assert(is_Load(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Load_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Load);
+       assert(is_Load(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Load_ptr(ir_node *node) {
-       assert(node->op == op_Load);
+get_Load_ptr(const ir_node *node) {
+       assert(is_Load(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Load_ptr(ir_node *node, ir_node *ptr) {
-       assert(node->op == op_Load);
+       assert(is_Load(node));
        set_irn_n(node, 1, ptr);
 }
 
 ir_mode *
-get_Load_mode(ir_node *node) {
-       assert(node->op == op_Load);
+get_Load_mode(const ir_node *node) {
+       assert(is_Load(node));
        return node->attr.load.load_mode;
 }
 
 void
 set_Load_mode(ir_node *node, ir_mode *mode) {
-       assert(node->op == op_Load);
+       assert(is_Load(node));
        node->attr.load.load_mode = mode;
 }
 
 ir_volatility
-get_Load_volatility(ir_node *node) {
-       assert(node->op == op_Load);
+get_Load_volatility(const ir_node *node) {
+       assert(is_Load(node));
        return node->attr.load.volatility;
 }
 
 void
 set_Load_volatility(ir_node *node, ir_volatility volatility) {
-       assert(node->op == op_Load);
+       assert(is_Load(node));
        node->attr.load.volatility = volatility;
 }
 
+ir_align
+get_Load_align(const ir_node *node) {
+       assert(is_Load(node));
+       return node->attr.load.aligned;
+}
+
+void
+set_Load_align(ir_node *node, ir_align align) {
+       assert(is_Load(node));
+       node->attr.load.aligned = align;
+}
+
 
 ir_node *
-get_Store_mem(ir_node *node) {
-       assert(node->op == op_Store);
+get_Store_mem(const ir_node *node) {
+       assert(is_Store(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Store_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Store);
+       assert(is_Store(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Store_ptr(ir_node *node) {
-       assert(node->op == op_Store);
+get_Store_ptr(const ir_node *node) {
+       assert(is_Store(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Store_ptr(ir_node *node, ir_node *ptr) {
-       assert(node->op == op_Store);
+       assert(is_Store(node));
        set_irn_n(node, 1, ptr);
 }
 
 ir_node *
-get_Store_value(ir_node *node) {
-       assert(node->op == op_Store);
+get_Store_value(const ir_node *node) {
+       assert(is_Store(node));
        return get_irn_n(node, 2);
 }
 
 void
 set_Store_value(ir_node *node, ir_node *value) {
-       assert(node->op == op_Store);
+       assert(is_Store(node));
        set_irn_n(node, 2, value);
 }
 
 ir_volatility
-get_Store_volatility(ir_node *node) {
-       assert(node->op == op_Store);
+get_Store_volatility(const ir_node *node) {
+       assert(is_Store(node));
        return node->attr.store.volatility;
 }
 
 void
 set_Store_volatility(ir_node *node, ir_volatility volatility) {
-       assert(node->op == op_Store);
+       assert(is_Store(node));
        node->attr.store.volatility = volatility;
 }
 
+ir_align
+get_Store_align(const ir_node *node) {
+       assert(is_Store(node));
+       return node->attr.store.aligned;
+}
+
+void
+set_Store_align(ir_node *node, ir_align align) {
+       assert(is_Store(node));
+       node->attr.store.aligned = align;
+}
+
 
 ir_node *
-get_Alloc_mem(ir_node *node) {
-       assert(node->op == op_Alloc);
+get_Alloc_mem(const ir_node *node) {
+       assert(is_Alloc(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Alloc_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Alloc);
+       assert(is_Alloc(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Alloc_size(ir_node *node) {
-       assert(node->op == op_Alloc);
+get_Alloc_size(const ir_node *node) {
+       assert(is_Alloc(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Alloc_size(ir_node *node, ir_node *size) {
-       assert(node->op == op_Alloc);
+       assert(is_Alloc(node));
        set_irn_n(node, 1, size);
 }
 
 ir_type *
 get_Alloc_type(ir_node *node) {
-       assert(node->op == op_Alloc);
+       assert(is_Alloc(node));
        return node->attr.alloc.type = skip_tid(node->attr.alloc.type);
 }
 
 void
 set_Alloc_type(ir_node *node, ir_type *tp) {
-       assert(node->op == op_Alloc);
+       assert(is_Alloc(node));
        node->attr.alloc.type = tp;
 }
 
-where_alloc
-get_Alloc_where(ir_node *node) {
-       assert(node->op == op_Alloc);
+ir_where_alloc
+get_Alloc_where(const ir_node *node) {
+       assert(is_Alloc(node));
        return node->attr.alloc.where;
 }
 
 void
-set_Alloc_where(ir_node *node, where_alloc where) {
-       assert(node->op == op_Alloc);
+set_Alloc_where(ir_node *node, ir_where_alloc where) {
+       assert(is_Alloc(node));
        node->attr.alloc.where = where;
 }
 
 
 ir_node *
-get_Free_mem(ir_node *node) {
-       assert(node->op == op_Free);
+get_Free_mem(const ir_node *node) {
+       assert(is_Free(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Free_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Free);
+       assert(is_Free(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Free_ptr(ir_node *node) {
-       assert(node->op == op_Free);
+get_Free_ptr(const ir_node *node) {
+       assert(is_Free(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Free_ptr(ir_node *node, ir_node *ptr) {
-       assert(node->op == op_Free);
+       assert(is_Free(node));
        set_irn_n(node, 1, ptr);
 }
 
 ir_node *
-get_Free_size(ir_node *node) {
-       assert(node->op == op_Free);
+get_Free_size(const ir_node *node) {
+       assert(is_Free(node));
        return get_irn_n(node, 2);
 }
 
 void
 set_Free_size(ir_node *node, ir_node *size) {
-       assert(node->op == op_Free);
+       assert(is_Free(node));
        set_irn_n(node, 2, size);
 }
 
 ir_type *
 get_Free_type(ir_node *node) {
-       assert(node->op == op_Free);
+       assert(is_Free(node));
        return node->attr.free.type = skip_tid(node->attr.free.type);
 }
 
 void
 set_Free_type(ir_node *node, ir_type *tp) {
-       assert(node->op == op_Free);
+       assert(is_Free(node));
        node->attr.free.type = tp;
 }
 
-where_alloc
-get_Free_where(ir_node *node) {
-       assert(node->op == op_Free);
+ir_where_alloc
+get_Free_where(const ir_node *node) {
+       assert(is_Free(node));
        return node->attr.free.where;
 }
 
 void
-set_Free_where(ir_node *node, where_alloc where) {
-       assert(node->op == op_Free);
+set_Free_where(ir_node *node, ir_where_alloc where) {
+       assert(is_Free(node));
        node->attr.free.where = where;
 }
 
 ir_node **get_Sync_preds_arr(ir_node *node) {
-       assert(node->op == op_Sync);
+       assert(is_Sync(node));
        return (ir_node **)&(get_irn_in(node)[1]);
 }
 
-int get_Sync_n_preds(ir_node *node) {
-       assert(node->op == op_Sync);
+int get_Sync_n_preds(const ir_node *node) {
+       assert(is_Sync(node));
        return (get_irn_arity(node));
 }
 
 /*
 void set_Sync_n_preds(ir_node *node, int n_preds) {
-       assert(node->op == op_Sync);
+       assert(is_Sync(node));
 }
 */
 
-ir_node *get_Sync_pred(ir_node *node, int pos) {
-       assert(node->op == op_Sync);
+ir_node *get_Sync_pred(const ir_node *node, int pos) {
+       assert(is_Sync(node));
        return get_irn_n(node, pos);
 }
 
 void set_Sync_pred(ir_node *node, int pos, ir_node *pred) {
-       assert(node->op == op_Sync);
+       assert(is_Sync(node));
        set_irn_n(node, pos, pred);
 }
 
 /* Add a new Sync predecessor */
 void add_Sync_pred(ir_node *node, ir_node *pred) {
-       assert(node->op == op_Sync);
+       assert(is_Sync(node));
        add_irn_n(node, pred);
 }
 
@@ -1893,10 +2076,11 @@ ir_type *get_Proj_type(ir_node *n) {
                /* Deal with Start / Call here: we need to know the Proj Nr. */
                assert(get_irn_mode(pred) == mode_T);
                pred_pred = get_Proj_pred(pred);
-               if (get_irn_op(pred_pred) == op_Start)  {
+
+               if (is_Start(pred_pred))  {
                        ir_type *mtp = get_entity_type(get_irg_entity(get_irn_irg(pred_pred)));
                        tp = get_method_param_type(mtp, get_Proj_proj(n));
-               } else if (get_irn_op(pred_pred) == op_Call) {
+               } else if (is_Call(pred_pred)) {
                        ir_type *mtp = get_Call_type(pred_pred);
                        tp = get_method_res_type(mtp, get_Proj_proj(n));
                }
@@ -1928,145 +2112,169 @@ set_Proj_pred(ir_node *node, ir_node *pred) {
 
 long
 get_Proj_proj(const ir_node *node) {
-       assert(is_Proj(node));
-       if (get_irn_opcode(node) == iro_Proj) {
+#ifdef INTERPROCEDURAL_VIEW
+       ir_opcode code = get_irn_opcode(node);
+
+       if (code == iro_Proj) {
                return node->attr.proj;
-       } else {
-               assert(get_irn_opcode(node) == iro_Filter);
+       }
+       else {
+               assert(code == iro_Filter);
                return node->attr.filter.proj;
        }
+#else
+       assert(is_Proj(node));
+       return node->attr.proj;
+#endif /* INTERPROCEDURAL_VIEW */
 }
 
 void
 set_Proj_proj(ir_node *node, long proj) {
-       assert(node->op == op_Proj);
+#ifdef INTERPROCEDURAL_VIEW
+       ir_opcode code = get_irn_opcode(node);
+
+       if (code == iro_Proj) {
+               node->attr.proj = proj;
+       }
+       else {
+               assert(code == iro_Filter);
+               node->attr.filter.proj = proj;
+       }
+#else
+       assert(is_Proj(node));
        node->attr.proj = proj;
+#endif /* INTERPROCEDURAL_VIEW */
+}
+
+/* Returns non-zero if a node is a routine parameter. */
+int (is_arg_Proj)(const ir_node *node) {
+       return _is_arg_Proj(node);
 }
 
 ir_node **
 get_Tuple_preds_arr(ir_node *node) {
-       assert(node->op == op_Tuple);
+       assert(is_Tuple(node));
        return (ir_node **)&(get_irn_in(node)[1]);
 }
 
 int
-get_Tuple_n_preds(ir_node *node) {
-       assert(node->op == op_Tuple);
-       return (get_irn_arity(node));
+get_Tuple_n_preds(const ir_node *node) {
+       assert(is_Tuple(node));
+       return get_irn_arity(node);
 }
 
 /*
 void
 set_Tuple_n_preds(ir_node *node, int n_preds) {
-       assert(node->op == op_Tuple);
+       assert(is_Tuple(node));
 }
 */
 
 ir_node *
-get_Tuple_pred (ir_node *node, int pos) {
-  assert(node->op == op_Tuple);
+get_Tuple_pred(const ir_node *node, int pos) {
+  assert(is_Tuple(node));
   return get_irn_n(node, pos);
 }
 
 void
 set_Tuple_pred(ir_node *node, int pos, ir_node *pred) {
-       assert(node->op == op_Tuple);
+       assert(is_Tuple(node));
        set_irn_n(node, pos, pred);
 }
 
 ir_node *
-get_Id_pred(ir_node *node) {
-       assert(node->op == op_Id);
+get_Id_pred(const ir_node *node) {
+       assert(is_Id(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Id_pred(ir_node *node, ir_node *pred) {
-       assert(node->op == op_Id);
+       assert(is_Id(node));
        set_irn_n(node, 0, pred);
 }
 
-ir_node *get_Confirm_value(ir_node *node) {
-       assert(node->op == op_Confirm);
+ir_node *get_Confirm_value(const ir_node *node) {
+       assert(is_Confirm(node));
        return get_irn_n(node, 0);
 }
 
 void set_Confirm_value(ir_node *node, ir_node *value) {
-       assert(node->op == op_Confirm);
+       assert(is_Confirm(node));
        set_irn_n(node, 0, value);
 }
 
-ir_node *get_Confirm_bound(ir_node *node) {
-       assert(node->op == op_Confirm);
+ir_node *get_Confirm_bound(const ir_node *node) {
+       assert(is_Confirm(node));
        return get_irn_n(node, 1);
 }
 
 void set_Confirm_bound(ir_node *node, ir_node *bound) {
-       assert(node->op == op_Confirm);
+       assert(is_Confirm(node));
        set_irn_n(node, 0, bound);
 }
 
 pn_Cmp get_Confirm_cmp(const ir_node *node) {
-       assert(node->op == op_Confirm);
+       assert(is_Confirm(node));
        return node->attr.confirm.cmp;
 }
 
 void set_Confirm_cmp(ir_node *node, pn_Cmp cmp) {
-       assert(node->op == op_Confirm);
+       assert(is_Confirm(node));
        node->attr.confirm.cmp = cmp;
 }
 
 ir_node *
 get_Filter_pred(ir_node *node) {
-       assert(node->op == op_Filter);
+       assert(is_Filter(node));
        return node->in[1];
 }
 
 void
 set_Filter_pred(ir_node *node, ir_node *pred) {
-       assert(node->op == op_Filter);
+       assert(is_Filter(node));
        node->in[1] = pred;
 }
 
 long
 get_Filter_proj(ir_node *node) {
-       assert(node->op == op_Filter);
+       assert(is_Filter(node));
        return node->attr.filter.proj;
 }
 
 void
 set_Filter_proj(ir_node *node, long proj) {
-       assert(node->op == op_Filter);
+       assert(is_Filter(node));
        node->attr.filter.proj = proj;
 }
 
 /* Don't use get_irn_arity, get_irn_n in implementation as access
    shall work independent of view!!! */
-void set_Filter_cg_pred_arr(ir_node * node, int arity, ir_node ** in) {
-       assert(node->op == op_Filter);
+void set_Filter_cg_pred_arr(ir_node *node, int arity, ir_node ** in) {
+       assert(is_Filter(node));
        if (node->attr.filter.in_cg == NULL || arity != ARR_LEN(node->attr.filter.in_cg) - 1) {
+               ir_graph *irg = get_irn_irg(node);
                node->attr.filter.in_cg = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
-               node->attr.filter.backedge = NEW_ARR_D (int, current_ir_graph->obst, arity);
-               memset(node->attr.filter.backedge, 0, sizeof(int) * arity);
+               node->attr.filter.backedge = new_backedge_arr(irg->obst, arity);
                node->attr.filter.in_cg[0] = node->in[0];
        }
        memcpy(node->attr.filter.in_cg + 1, in, sizeof(ir_node *) * arity);
 }
 
 void set_Filter_cg_pred(ir_node * node, int pos, ir_node * pred) {
-       assert(node->op == op_Filter && node->attr.filter.in_cg &&
+       assert(is_Filter(node) && node->attr.filter.in_cg &&
               0 <= pos && pos < ARR_LEN(node->attr.filter.in_cg) - 1);
        node->attr.filter.in_cg[pos + 1] = pred;
 }
 
 int get_Filter_n_cg_preds(ir_node *node) {
-       assert(node->op == op_Filter && node->attr.filter.in_cg);
+       assert(is_Filter(node) && node->attr.filter.in_cg);
        return (ARR_LEN(node->attr.filter.in_cg) - 1);
 }
 
 ir_node *get_Filter_cg_pred(ir_node *node, int pos) {
        int arity;
-       assert(node->op == op_Filter && node->attr.filter.in_cg &&
+       assert(is_Filter(node) && node->attr.filter.in_cg &&
               0 <= pos);
        arity = ARR_LEN(node->attr.filter.in_cg);
        assert(pos < arity - 1);
@@ -2074,111 +2282,39 @@ ir_node *get_Filter_cg_pred(ir_node *node, int pos) {
 }
 
 /* Mux support */
-ir_node *get_Mux_sel(ir_node *node) {
-       if (node->op == op_Psi) {
-               assert(get_irn_arity(node) == 3);
-               return get_Psi_cond(node, 0);
-       }
-       assert(node->op == op_Mux);
+ir_node *get_Mux_sel(const ir_node *node) {
+       assert(is_Mux(node));
        return node->in[1];
 }
 
 void set_Mux_sel(ir_node *node, ir_node *sel) {
-       if (node->op == op_Psi) {
-               assert(get_irn_arity(node) == 3);
-               set_Psi_cond(node, 0, sel);
-       } else {
-               assert(node->op == op_Mux);
-               node->in[1] = sel;
-       }
+       assert(is_Mux(node));
+       node->in[1] = sel;
 }
 
-ir_node *get_Mux_false(ir_node *node) {
-       if (node->op == op_Psi) {
-               assert(get_irn_arity(node) == 3);
-               return get_Psi_default(node);
-       }
-       assert(node->op == op_Mux);
+ir_node *get_Mux_false(const ir_node *node) {
+       assert(is_Mux(node));
        return node->in[2];
 }
 
 void set_Mux_false(ir_node *node, ir_node *ir_false) {
-       if (node->op == op_Psi) {
-               assert(get_irn_arity(node) == 3);
-               set_Psi_default(node, ir_false);
-       } else {
-               assert(node->op == op_Mux);
-               node->in[2] = ir_false;
-       }
+       assert(is_Mux(node));
+       node->in[2] = ir_false;
 }
 
-ir_node *get_Mux_true(ir_node *node) {
-       if (node->op == op_Psi) {
-               assert(get_irn_arity(node) == 3);
-               return get_Psi_val(node, 0);
-       }
-       assert(node->op == op_Mux);
+ir_node *get_Mux_true(const ir_node *node) {
+       assert(is_Mux(node));
        return node->in[3];
 }
 
 void set_Mux_true(ir_node *node, ir_node *ir_true) {
-       if (node->op == op_Psi) {
-               assert(get_irn_arity(node) == 3);
-               set_Psi_val(node, 0, ir_true);
-       } else {
-               assert(node->op == op_Mux);
-               node->in[3] = ir_true;
-       }
-}
-
-/* Psi support */
-ir_node *get_Psi_cond(ir_node *node, int pos) {
-       int num_conds = get_Psi_n_conds(node);
-       assert(node->op == op_Psi);
-       assert(pos < num_conds);
-       return get_irn_n(node, 2 * pos);
-}
-
-void set_Psi_cond(ir_node *node, int pos, ir_node *cond) {
-       int num_conds = get_Psi_n_conds(node);
-       assert(node->op == op_Psi);
-       assert(pos < num_conds);
-       set_irn_n(node, 2 * pos, cond);
-}
-
-ir_node *get_Psi_val(ir_node *node, int pos) {
-       int num_vals = get_Psi_n_conds(node);
-       assert(node->op == op_Psi);
-       assert(pos < num_vals);
-       return get_irn_n(node, 2 * pos + 1);
-}
-
-void set_Psi_val(ir_node *node, int pos, ir_node *val) {
-       int num_vals = get_Psi_n_conds(node);
-       assert(node->op == op_Psi);
-       assert(pos < num_vals);
-       set_irn_n(node, 2 * pos + 1, val);
-}
-
-ir_node *get_Psi_default(ir_node *node) {
-       int def_pos = get_irn_arity(node) - 1;
-       assert(node->op == op_Psi);
-       return get_irn_n(node, def_pos);
-}
-
-void set_Psi_default(ir_node *node, ir_node *val) {
-       int def_pos = get_irn_arity(node);
-       assert(node->op == op_Psi);
-       set_irn_n(node, def_pos, val);
-}
-
-int (get_Psi_n_conds)(ir_node *node) {
-       return _get_Psi_n_conds(node);
+       assert(is_Mux(node));
+       node->in[3] = ir_true;
 }
 
 /* CopyB support */
-ir_node *get_CopyB_mem(ir_node *node) {
-       assert(node->op == op_CopyB);
+ir_node *get_CopyB_mem(const ir_node *node) {
+       assert(is_CopyB(node));
        return get_irn_n(node, 0);
 }
 
@@ -2187,194 +2323,194 @@ void set_CopyB_mem(ir_node *node, ir_node *mem) {
        set_irn_n(node, 0, mem);
 }
 
-ir_node *get_CopyB_dst(ir_node *node) {
-       assert(node->op == op_CopyB);
+ir_node *get_CopyB_dst(const ir_node *node) {
+       assert(is_CopyB(node));
        return get_irn_n(node, 1);
 }
 
 void set_CopyB_dst(ir_node *node, ir_node *dst) {
-       assert(node->op == op_CopyB);
+       assert(is_CopyB(node));
        set_irn_n(node, 1, dst);
 }
 
-ir_node *get_CopyB_src (ir_node *node) {
-  assert(node->op == op_CopyB);
+ir_node *get_CopyB_src(const ir_node *node) {
+  assert(is_CopyB(node));
   return get_irn_n(node, 2);
 }
 
 void set_CopyB_src(ir_node *node, ir_node *src) {
-       assert(node->op == op_CopyB);
+       assert(is_CopyB(node));
        set_irn_n(node, 2, src);
 }
 
 ir_type *get_CopyB_type(ir_node *node) {
-       assert(node->op == op_CopyB);
-       return node->attr.copyb.data_type;
+       assert(is_CopyB(node));
+       return node->attr.copyb.data_type = skip_tid(node->attr.copyb.data_type);
 }
 
 void set_CopyB_type(ir_node *node, ir_type *data_type) {
-       assert(node->op == op_CopyB && data_type);
+       assert(is_CopyB(node) && data_type);
        node->attr.copyb.data_type = data_type;
 }
 
 
 ir_type *
 get_InstOf_type(ir_node *node) {
-       assert(node->op = op_InstOf);
-       return node->attr.instof.type;
+       assert(node->op == op_InstOf);
+       return node->attr.instof.type = skip_tid(node->attr.instof.type);
 }
 
 void
 set_InstOf_type(ir_node *node, ir_type *type) {
-       assert(node->op = op_InstOf);
+       assert(node->op == op_InstOf);
        node->attr.instof.type = type;
 }
 
 ir_node *
-get_InstOf_store(ir_node *node) {
-       assert(node->op = op_InstOf);
+get_InstOf_store(const ir_node *node) {
+       assert(node->op == op_InstOf);
        return get_irn_n(node, 0);
 }
 
 void
 set_InstOf_store(ir_node *node, ir_node *obj) {
-       assert(node->op = op_InstOf);
+       assert(node->op == op_InstOf);
        set_irn_n(node, 0, obj);
 }
 
 ir_node *
-get_InstOf_obj(ir_node *node) {
-       assert(node->op = op_InstOf);
+get_InstOf_obj(const ir_node *node) {
+       assert(node->op == op_InstOf);
        return get_irn_n(node, 1);
 }
 
 void
 set_InstOf_obj(ir_node *node, ir_node *obj) {
-       assert(node->op = op_InstOf);
+       assert(node->op == op_InstOf);
        set_irn_n(node, 1, obj);
 }
 
 /* Returns the memory input of a Raise operation. */
 ir_node *
-get_Raise_mem(ir_node *node) {
-       assert(node->op == op_Raise);
+get_Raise_mem(const ir_node *node) {
+       assert(is_Raise(node));
        return get_irn_n(node, 0);
 }
 
 void
 set_Raise_mem(ir_node *node, ir_node *mem) {
-       assert(node->op == op_Raise);
+       assert(is_Raise(node));
        set_irn_n(node, 0, mem);
 }
 
 ir_node *
-get_Raise_exo_ptr(ir_node *node) {
-       assert(node->op == op_Raise);
+get_Raise_exo_ptr(const ir_node *node) {
+       assert(is_Raise(node));
        return get_irn_n(node, 1);
 }
 
 void
 set_Raise_exo_ptr(ir_node *node, ir_node *exo_ptr) {
-       assert(node->op == op_Raise);
+       assert(is_Raise(node));
        set_irn_n(node, 1, exo_ptr);
 }
 
 /* Bound support */
 
 /* Returns the memory input of a Bound operation. */
-ir_node *get_Bound_mem(ir_node *bound) {
-       assert(bound->op == op_Bound);
+ir_node *get_Bound_mem(const ir_node *bound) {
+       assert(is_Bound(bound));
        return get_irn_n(bound, 0);
 }
 
 void set_Bound_mem(ir_node *bound, ir_node *mem) {
-       assert(bound->op == op_Bound);
+       assert(is_Bound(bound));
        set_irn_n(bound, 0, mem);
 }
 
 /* Returns the index input of a Bound operation. */
-ir_node *get_Bound_index(ir_node *bound) {
-       assert(bound->op == op_Bound);
+ir_node *get_Bound_index(const ir_node *bound) {
+       assert(is_Bound(bound));
        return get_irn_n(bound, 1);
 }
 
 void set_Bound_index(ir_node *bound, ir_node *idx) {
-       assert(bound->op == op_Bound);
+       assert(is_Bound(bound));
        set_irn_n(bound, 1, idx);
 }
 
 /* Returns the lower bound input of a Bound operation. */
-ir_node *get_Bound_lower(ir_node *bound) {
-       assert(bound->op == op_Bound);
+ir_node *get_Bound_lower(const ir_node *bound) {
+       assert(is_Bound(bound));
        return get_irn_n(bound, 2);
 }
 
 void set_Bound_lower(ir_node *bound, ir_node *lower) {
-       assert(bound->op == op_Bound);
+       assert(is_Bound(bound));
        set_irn_n(bound, 2, lower);
 }
 
 /* Returns the upper bound input of a Bound operation. */
-ir_node *get_Bound_upper(ir_node *bound) {
-       assert(bound->op == op_Bound);
+ir_node *get_Bound_upper(const ir_node *bound) {
+       assert(is_Bound(bound));
        return get_irn_n(bound, 3);
 }
 
 void set_Bound_upper(ir_node *bound, ir_node *upper) {
-       assert(bound->op == op_Bound);
+       assert(is_Bound(bound));
        set_irn_n(bound, 3, upper);
 }
 
 /* Return the operand of a Pin node. */
 ir_node *get_Pin_op(const ir_node *pin) {
-       assert(pin->op == op_Pin);
+       assert(is_Pin(pin));
        return get_irn_n(pin, 0);
 }
 
 void set_Pin_op(ir_node *pin, ir_node *node) {
-       assert(pin->op == op_Pin);
+       assert(is_Pin(pin));
        set_irn_n(pin, 0, node);
 }
 
 /* Return the assembler text of an ASM pseudo node. */
 ident *get_ASM_text(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return node->attr.assem.asm_text;
 }
 
 /* Return the number of input constraints for an ASM node. */
 int get_ASM_n_input_constraints(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return ARR_LEN(node->attr.assem.inputs);
 }
 
 /* Return the input constraints for an ASM node. This is a flexible array. */
 const ir_asm_constraint *get_ASM_input_constraints(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return node->attr.assem.inputs;
 }
 
 /* Return the number of output constraints for an ASM node.  */
 int get_ASM_n_output_constraints(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return ARR_LEN(node->attr.assem.outputs);
 }
 
 /* Return the output constraints for an ASM node. */
 const ir_asm_constraint *get_ASM_output_constraints(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return node->attr.assem.outputs;
 }
 
 /* Return the number of clobbered registers for an ASM node.  */
 int get_ASM_n_clobbers(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return ARR_LEN(node->attr.assem.clobber);
 }
 
 /* Return the list of clobbered registers for an ASM node. */
 ident **get_ASM_clobbers(const ir_node *node) {
-       assert(node->op == op_ASM);
+       assert(is_ASM(node));
        return node->attr.assem.clobber;
 }
 
@@ -2391,7 +2527,7 @@ get_irn_irg(const ir_node *node) {
                node = get_irn_n(node, -1);
        if (is_Bad(node))  /* sometimes bad is predecessor of nodes instead of block: in case of optimization */
                node = get_irn_n(node, -1);
-       assert(get_irn_op(node) == op_Block);
+       assert(is_Block(node));
        return node->attr.block.irg;
 }
 
@@ -2429,10 +2565,8 @@ skip_Tuple(ir_node *node) {
   ir_node *pred;
   ir_op   *op;
 
-  if (!get_opt_normalize()) return node;
-
 restart:
-       if (get_irn_op(node) == op_Proj) {
+       if (is_Proj(node)) {
            pred = get_Proj_pred(node);
            op   = get_irn_op(pred);
 
@@ -2442,9 +2576,8 @@ restart:
                 */
                if (op == op_Proj) { /* nested Tuple ? */
                    pred = skip_Tuple(pred);
-                   op   = get_irn_op(pred);
 
-                       if (op == op_Tuple) {
+                       if (is_Tuple(pred)) {
                                node = get_Tuple_pred(pred, get_Proj_proj(node));
                                goto restart;
                        }
@@ -2458,22 +2591,37 @@ restart:
 
 /* returns operand of node if node is a Cast */
 ir_node *skip_Cast(ir_node *node) {
-       if (get_irn_op(node) == op_Cast)
+       if (is_Cast(node))
                return get_Cast_op(node);
        return node;
 }
 
+/* returns operand of node if node is a Cast */
+const ir_node *skip_Cast_const(const ir_node *node) {
+       if (is_Cast(node))
+               return get_Cast_op(node);
+       return node;
+}
+
+/* returns operand of node if node is a Pin */
+ir_node *skip_Pin(ir_node *node) {
+       if (is_Pin(node))
+               return get_Pin_op(node);
+       return node;
+}
+
 /* returns operand of node if node is a Confirm */
 ir_node *skip_Confirm(ir_node *node) {
-       if (get_irn_op(node) == op_Confirm)
+       if (is_Confirm(node))
                return get_Confirm_value(node);
        return node;
 }
 
 /* skip all high-level ops */
-ir_node *skip_HighLevel(ir_node *node) {
-       if (is_op_highlevel(get_irn_op(node)))
-               return get_irn_n(node, 0);
+ir_node *skip_HighLevel_ops(ir_node *node) {
+       while (is_op_highlevel(get_irn_op(node))) {
+               node = get_irn_n(node, 0);
+       }
        return node;
 }
 
@@ -2544,6 +2692,11 @@ int
        return _is_Minus(node);
 }
 
+int
+(is_Abs)(const ir_node *node) {
+       return _is_Abs(node);
+}
+
 int
 (is_Mod)(const ir_node *node) {
        return _is_Mod(node);
@@ -2569,6 +2722,11 @@ int
        return _is_Add(node);
 }
 
+int
+(is_Carry)(const ir_node *node) {
+       return _is_Carry(node);
+}
+
 int
 (is_And)(const ir_node *node) {
        return _is_And(node);
@@ -2589,14 +2747,34 @@ int
        return _is_Sub(node);
 }
 
+int
+(is_Shl)(const ir_node *node) {
+       return _is_Shl(node);
+}
+
+int
+(is_Shr)(const ir_node *node) {
+       return _is_Shr(node);
+}
+
+int
+(is_Shrs)(const ir_node *node) {
+       return _is_Shrs(node);
+}
+
+int
+(is_Rotl)(const ir_node *node) {
+       return _is_Rotl(node);
+}
+
 int
 (is_Not)(const ir_node *node) {
        return _is_Not(node);
 }
 
 int
-(is_Psi)(const ir_node *node) {
-       return _is_Psi(node);
+(is_Id)(const ir_node *node) {
+       return _is_Id(node);
 }
 
 int
@@ -2604,6 +2782,11 @@ int
        return _is_Tuple(node);
 }
 
+int
+(is_Bound)(const ir_node *node) {
+       return _is_Bound(node);
+}
+
 int
 (is_Start)(const ir_node *node) {
   return _is_Start(node);
@@ -2624,6 +2807,16 @@ int
        return _is_Conv(node);
 }
 
+int
+(is_strictConv)(const ir_node *node) {
+       return _is_strictConv(node);
+}
+
+int
+(is_Cast)(const ir_node *node) {
+       return _is_Cast(node);
+}
+
 int
 (is_no_Block)(const ir_node *node) {
        return _is_no_Block(node);
@@ -2652,13 +2845,25 @@ int
        return _is_Call(node);
 }
 
+/* returns true if node is a Builtin node. */
+int
+(is_Builtin)(const ir_node *node) {
+       return _is_Builtin(node);
+}
+
+/* returns true if node is a CallBegin node. */
+int
+(is_CallBegin)(const ir_node *node) {
+       return _is_CallBegin(node);
+}
+
 /* returns true if node is a Sel node. */
 int
 (is_Sel)(const ir_node *node) {
        return _is_Sel(node);
 }
 
-/* returns true if node is a Mux node or a Psi with only one condition. */
+/* returns true if node is a Mux node. */
 int
 (is_Mux)(const ir_node *node) {
        return _is_Mux(node);
@@ -2682,25 +2887,31 @@ int
        return _is_Sync(node);
 }
 
-/* returns true if node is a Confirm node. */
+/* Returns true if node is a Confirm node. */
 int
 (is_Confirm)(const ir_node *node) {
        return _is_Confirm(node);
 }
 
-/* returns true if node is a Pin node. */
+/* Returns true if node is a Pin node. */
 int
 (is_Pin)(const ir_node *node) {
        return _is_Pin(node);
 }
 
-/* returns true if node is a SymConst node. */
+/* Returns true if node is a SymConst node. */
 int
 (is_SymConst)(const ir_node *node) {
        return _is_SymConst(node);
 }
 
-/* returns true if node is a Cond node. */
+/* Returns true if node is a SymConst node with kind symconst_addr_ent. */
+int
+(is_SymConst_addr_ent)(const ir_node *node) {
+       return _is_SymConst_addr_ent(node);
+}
+
+/* Returns true if node is a Cond node. */
 int
 (is_Cond)(const ir_node *node) {
        return _is_Cond(node);
@@ -2723,12 +2934,24 @@ int
        return _is_Alloc(node);
 }
 
+/* returns true if node is a Free node. */
+int
+(is_Free)(const ir_node *node) {
+       return _is_Free(node);
+}
+
 /* returns true if a node is a Jmp node. */
 int
 (is_Jmp)(const ir_node *node) {
        return _is_Jmp(node);
 }
 
+/* returns true if a node is a IJmp node. */
+int
+(is_IJmp)(const ir_node *node) {
+       return _is_IJmp(node);
+}
+
 /* returns true if a node is a Raise node. */
 int
 (is_Raise)(const ir_node *node) {
@@ -2742,16 +2965,19 @@ int
 }
 
 int
-is_Proj(const ir_node *node) {
-       assert(node);
-       return node->op == op_Proj ||
-              (!get_interprocedural_view() && node->op == op_Filter);
+(is_Proj)(const ir_node *node) {
+       return _is_Proj(node);
 }
 
-/* Returns true if the operation manipulates control flow. */
+/* Returns true if node is a Filter node. */
 int
-is_cfop(const ir_node *node) {
-       return is_cfopcode(get_irn_op(node));
+(is_Filter)(const ir_node *node) {
+       return _is_Filter(node);
+}
+
+/* Returns true if the operation manipulates control flow. */
+int is_cfop(const ir_node *node) {
+       return is_op_cfopcode(get_irn_op(node));
 }
 
 /* Returns true if the operation manipulates interprocedural control flow:
@@ -2781,7 +3007,8 @@ ir_node *get_fragile_op_mem(ir_node *node) {
        case iro_Store :
        case iro_Alloc :
        case iro_Bound :
-               return get_irn_n(node, 0);
+       case iro_CopyB :
+               return get_irn_n(node, pn_Generic_M_regular);
        case iro_Bad   :
        case iro_Unknown:
                return node;
@@ -2954,7 +3181,7 @@ static ir_entity *get_Null_ent(ir_node *n) {
 ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops) {
        switch (code) {
        case iro_SymConst: ops->get_entity_attr = get_SymConst_attr_entity; break;
-       case iro_Sel:      ops->get_entity_attr = get_Sel_entity; break;
+       case iro_Sel:      ops->get_entity_attr = _get_Sel_entity; break;
        default:
                /* not allowed to be NULL */
                if (! ops->get_entity_attr)
@@ -2978,25 +3205,60 @@ dbg_info *(get_irn_dbg_info)(const ir_node *n) {
        return _get_irn_dbg_info(n);
 }
 
+#if 0 /* allow the global pointer */
 
+/* checks whether a node represents a global address */
+int is_Global(const ir_node *node) {
+       ir_node *ptr;
 
-#ifdef DEBUG_libfirm
-void dump_irn(ir_node *n) {
-       int i, arity = get_irn_arity(n);
-       printf("%s%s: %ld (%p)\n", get_irn_opname(n), get_mode_name(get_irn_mode(n)), get_irn_node_nr(n), (void *)n);
-       if (!is_Block(n)) {
-               ir_node *pred = get_irn_n(n, -1);
-               printf("  block: %s%s: %ld (%p)\n", get_irn_opname(pred), get_mode_name(get_irn_mode(pred)),
-                       get_irn_node_nr(pred), (void *)pred);
-       }
-       printf("  preds: \n");
-       for (i = 0; i < arity; ++i) {
-               ir_node *pred = get_irn_n(n, i);
-               printf("    %d: %s%s: %ld (%p)\n", i, get_irn_opname(pred), get_mode_name(get_irn_mode(pred)),
-                       get_irn_node_nr(pred), (void *)pred);
-       }
+       if (is_SymConst_addr_ent(node))
+               return 1;
+       if (! is_Sel(node))
+               return 0;
+
+       ptr = get_Sel_ptr(node);
+       return is_globals_pointer(ptr) != NULL;
+}
+
+/* returns the entity of a global address */
+ir_entity *get_Global_entity(const ir_node *node) {
+       if (is_SymConst(node))
+               return get_SymConst_entity(node);
+       else
+               return get_Sel_entity(node);
+}
+#else
+
+/* checks whether a node represents a global address */
+int is_Global(const ir_node *node) {
+       return is_SymConst_addr_ent(node);
 }
 
-#else  /* DEBUG_libfirm */
-void dump_irn(ir_node *n) {}
-#endif /* DEBUG_libfirm */
+/* returns the entity of a global address */
+ir_entity *get_Global_entity(const ir_node *node) {
+       return get_SymConst_entity(node);
+}
+#endif
+
+/*
+ * Calculate a hash value of a node.
+ */
+unsigned firm_default_hash(const ir_node *node) {
+       unsigned h;
+       int i, irn_arity;
+
+       /* hash table value = 9*(9*(9*(9*(9*arity+in[0])+in[1])+ ...)+mode)+code */
+       h = irn_arity = get_irn_intra_arity(node);
+
+       /* consider all in nodes... except the block if not a control flow. */
+       for (i = is_cfop(node) ? -1 : 0;  i < irn_arity;  ++i) {
+               h = 9*h + HASH_PTR(get_irn_intra_n(node, i));
+       }
+
+       /* ...mode,... */
+       h = 9*h + HASH_PTR(get_irn_mode(node));
+       /* ...and code */
+       h = 9*h + HASH_PTR(get_irn_op(node));
+
+       return h;
+}  /* firm_default_hash */