Added support for out edges.
[libfirm] / ir / ir / ircons.c
index dd9388f..0669e1d 100644 (file)
@@ -37,6 +37,7 @@
 # include "array.h"
 # include "irbackedge_t.h"
 # include "irflag_t.h"
+# include "iredges_t.h"
 
 #if USE_EXPLICIT_PHI_IN_STACK
 /* A stack needed for the automatic Phi node construction in constructor
@@ -58,7 +59,7 @@ typedef struct Phi_in_stack Phi_in_stack;
 /*
  * language dependant initialization variable
  */
-static default_initialize_local_variable_func_t *default_initialize_local_variable = NULL;
+static uninitialized_local_variable_func_t *default_initialize_local_variable = NULL;
 
 /* -------------------------------------------- */
 /* privat interfaces, for professional use only */
@@ -67,7 +68,7 @@ static default_initialize_local_variable_func_t *default_initialize_local_variab
 /* Constructs a Block with a fixed number of predecessors.
    Does not set current_block.  Can not be used with automatic
    Phi node construction. */
-INLINE ir_node *
+ir_node *
 new_rd_Block (dbg_info* db, ir_graph *irg,  int arity, ir_node **in)
 {
   ir_node *res;
@@ -88,7 +89,7 @@ new_rd_Block (dbg_info* db, ir_graph *irg,  int arity, ir_node **in)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Start (dbg_info* db, ir_graph *irg, ir_node *block)
 {
   ir_node *res;
@@ -100,7 +101,7 @@ new_rd_Start (dbg_info* db, ir_graph *irg, ir_node *block)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_End (dbg_info* db, ir_graph *irg, ir_node *block)
 {
   ir_node *res;
@@ -113,7 +114,7 @@ new_rd_End (dbg_info* db, ir_graph *irg, ir_node *block)
 
 /* Creates a Phi node with all predecessors.  Calling this constructor
    is only allowed if the corresponding block is mature.  */
-INLINE ir_node *
+ir_node *
 new_rd_Phi (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in, ir_mode *mode)
 {
   ir_node *res;
@@ -145,7 +146,7 @@ new_rd_Phi (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block, ir_mode *mode, tarval *con, type *tp)
 {
   ir_node *res;
@@ -160,15 +161,19 @@ new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block, ir_mode *mode, t
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Const (dbg_info* db, ir_graph *irg, ir_node *block, ir_mode *mode, tarval *con)
 {
-  type *tp = unknown_type;
-  /* removing this somehow causes errors in jack. */
-  return new_rd_Const_type (db, irg, block, mode, con, tp);
+  return new_rd_Const_type (db, irg, block, mode, con, firm_unknown_type);
 }
 
-INLINE ir_node *
+ir_node *
+new_rd_Const_long (dbg_info* db, ir_graph *irg, ir_node *block, ir_mode *mode, long value)
+{
+       return new_rd_Const(db, irg, block, mode, new_tarval_from_long(value, mode));
+}
+
+ir_node *
 new_rd_Id (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *val, ir_mode *mode)
 {
   ir_node *res;
@@ -179,7 +184,7 @@ new_rd_Id (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *val, ir_mode *m
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Proj (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *arg, ir_mode *mode,
         long proj)
 {
@@ -199,7 +204,7 @@ new_rd_Proj (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *arg, ir_mode
 
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_defaultProj (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *arg,
            long max_proj)
 {
@@ -211,7 +216,7 @@ new_rd_defaultProj (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *arg,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Conv (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *op, ir_mode *mode)
 {
   ir_node *res;
@@ -222,7 +227,7 @@ new_rd_Conv (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *op, ir_mode *
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Cast (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *op, type *to_tp)
 {
   ir_node *res;
@@ -236,7 +241,7 @@ new_rd_Cast (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *op, type *to_
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Tuple (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in)
 {
   ir_node *res;
@@ -247,7 +252,7 @@ new_rd_Tuple (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Add (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op1, ir_node *op2, ir_mode *mode)
 {
@@ -262,7 +267,7 @@ new_rd_Add (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Sub (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op1, ir_node *op2, ir_mode *mode)
 {
@@ -277,7 +282,7 @@ new_rd_Sub (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Minus (dbg_info* db, ir_graph *irg, ir_node *block,
          ir_node *op, ir_mode *mode)
 {
@@ -289,7 +294,7 @@ new_rd_Minus (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Mul (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op1, ir_node *op2, ir_mode *mode)
 {
@@ -304,7 +309,7 @@ new_rd_Mul (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Quot (dbg_info* db, ir_graph *irg, ir_node *block,
             ir_node *memop, ir_node *op1, ir_node *op2)
 {
@@ -320,7 +325,7 @@ new_rd_Quot (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_DivMod (dbg_info* db, ir_graph *irg, ir_node *block,
           ir_node *memop, ir_node *op1, ir_node *op2)
 {
@@ -336,7 +341,7 @@ new_rd_DivMod (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Div (dbg_info* db, ir_graph *irg, ir_node *block,
            ir_node *memop, ir_node *op1, ir_node *op2)
 {
@@ -352,7 +357,7 @@ new_rd_Div (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Mod (dbg_info* db, ir_graph *irg, ir_node *block,
            ir_node *memop, ir_node *op1, ir_node *op2)
 {
@@ -368,7 +373,7 @@ new_rd_Mod (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_And (dbg_info* db, ir_graph *irg, ir_node *block,
            ir_node *op1, ir_node *op2, ir_mode *mode)
 {
@@ -383,7 +388,7 @@ new_rd_And (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Or (dbg_info* db, ir_graph *irg, ir_node *block,
           ir_node *op1, ir_node *op2, ir_mode *mode)
 {
@@ -398,7 +403,7 @@ new_rd_Or (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Eor (dbg_info* db, ir_graph *irg, ir_node *block,
           ir_node *op1, ir_node *op2, ir_mode *mode)
 {
@@ -413,7 +418,7 @@ new_rd_Eor (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Not    (dbg_info* db, ir_graph *irg, ir_node *block,
           ir_node *op, ir_mode *mode)
 {
@@ -425,7 +430,7 @@ new_rd_Not    (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Shl (dbg_info* db, ir_graph *irg, ir_node *block,
           ir_node *op, ir_node *k, ir_mode *mode)
 {
@@ -440,7 +445,7 @@ new_rd_Shl (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Shr (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op, ir_node *k, ir_mode *mode)
 {
@@ -455,7 +460,7 @@ new_rd_Shr (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Shrs (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op, ir_node *k, ir_mode *mode)
 {
@@ -470,7 +475,7 @@ new_rd_Shrs (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Rot (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op, ir_node *k, ir_mode *mode)
 {
@@ -485,7 +490,7 @@ new_rd_Rot (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Abs (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op, ir_mode *mode)
 {
@@ -497,7 +502,7 @@ new_rd_Abs (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Cmp (dbg_info* db, ir_graph *irg, ir_node *block,
        ir_node *op1, ir_node *op2)
 {
@@ -512,7 +517,7 @@ new_rd_Cmp (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Jmp (dbg_info* db, ir_graph *irg, ir_node *block)
 {
   ir_node *res;
@@ -523,7 +528,7 @@ new_rd_Jmp (dbg_info* db, ir_graph *irg, ir_node *block)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Cond (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *c)
 {
   ir_node *res;
@@ -552,7 +557,7 @@ new_rd_Call (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
 
   res = new_ir_node(db, irg, block, op_Call, mode_T, r_arity, r_in);
 
-  assert((get_unknown_type() == tp) || is_method_type(tp));
+  assert((get_unknown_type() == tp) || is_Method_type(tp));
   set_Call_type(res, tp);
   res->attr.call.exc.pin_state = op_pin_state_pinned;
   res->attr.call.callee_arr    = NULL;
@@ -579,7 +584,7 @@ new_rd_Return (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Raise (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_node *obj)
 {
   ir_node *in[2];
@@ -593,7 +598,7 @@ new_rd_Raise (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_no
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Load (dbg_info* db, ir_graph *irg, ir_node *block,
         ir_node *store, ir_node *adr, ir_mode *mode)
 {
@@ -611,7 +616,7 @@ new_rd_Load (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Store (dbg_info* db, ir_graph *irg, ir_node *block,
          ir_node *store, ir_node *adr, ir_node *val)
 {
@@ -629,7 +634,7 @@ new_rd_Store (dbg_info* db, ir_graph *irg, ir_node *block,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Alloc (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
         ir_node *size, type *alloc_type, where_alloc where)
 {
@@ -647,9 +652,9 @@ new_rd_Alloc (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Free (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
-        ir_node *ptr, ir_node *size, type *free_type)
+        ir_node *ptr, ir_node *size, type *free_type, where_alloc where)
 {
   ir_node *in[3];
   ir_node *res;
@@ -657,8 +662,9 @@ new_rd_Free (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
   in[0] = store;
   in[1] = ptr;
   in[2] = size;
-  res = new_ir_node (db, irg, block, op_Free, mode_T, 3, in);
-  res->attr.f = free_type;
+  res = new_ir_node (db, irg, block, op_Free, mode_M, 3, in);
+  res->attr.f.where = where;
+  res->attr.f.type  = free_type;
   res = optimize_node(res);
   IRN_VRFY_IRG(res, irg);
   return res;
@@ -707,7 +713,7 @@ new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
                      symconst_kind symkind, type *tp) {
   ir_node *res;
@@ -729,11 +735,11 @@ new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symb
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
                 symconst_kind symkind)
 {
-  ir_node *res = new_rd_SymConst_type(db, irg, block, value, symkind, unknown_type);
+  ir_node *res = new_rd_SymConst_type(db, irg, block, value, symkind, firm_unknown_type);
   return res;
 }
 
@@ -757,7 +763,7 @@ ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *
   return new_rd_SymConst_type(db, irg, irg->start_block, sym, symconst_size, tp);
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Sync (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in)
 {
   ir_node *res;
@@ -768,13 +774,13 @@ new_rd_Sync (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **i
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Bad (ir_graph *irg)
 {
   return irg->bad;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp)
 {
   ir_node *in[2], *res;
@@ -788,13 +794,13 @@ new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *val, ir_no
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Unknown (ir_graph *irg, ir_mode *m)
 {
   return new_ir_node(NULL, irg, irg->start_block, op_Unknown, m, 0, NULL);
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_CallBegin (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *call)
 {
   ir_node *in[1];
@@ -809,7 +815,7 @@ new_rd_CallBegin (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *call)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block)
 {
   ir_node *res;
@@ -820,7 +826,7 @@ new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_EndExcept (dbg_info *db, ir_graph *irg, ir_node *block)
 {
   ir_node *res;
@@ -831,7 +837,7 @@ new_rd_EndExcept (dbg_info *db, ir_graph *irg, ir_node *block)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block)
 {
   ir_node *res;
@@ -842,7 +848,7 @@ new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block)
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg, ir_mode *mode,
            long proj)
 {
@@ -860,207 +866,235 @@ new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg, ir_mod
   res = optimize_node(res);
   IRN_VRFY_IRG(res, irg);
   return res;
+}
 
+ir_node *
+new_rd_NoMem (ir_graph *irg) {
+  return irg->no_mem;
 }
 
-INLINE ir_node *
-new_rd_NoMem (ir_graph *irg)
+ir_node *
+new_rd_Mux  (dbg_info *db, ir_graph *irg, ir_node *block,
+    ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
 {
-  return irg->no_mem;
+  ir_node *in[3];
+  ir_node *res;
+
+  in[0] = sel;
+  in[1] = ir_false;
+  in[2] = ir_true;
+
+  res = new_ir_node(db, irg, block, op_Mux, mode, 3, in);
+  assert(res);
+
+  res = optimize_node(res);
+  IRN_VRFY_IRG(res, irg);
+  return res;
 }
 
 
-INLINE ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node **in) {
+ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node **in) {
   return new_rd_Block(NULL, irg, arity, in);
 }
-INLINE ir_node *new_r_Start  (ir_graph *irg, ir_node *block) {
+ir_node *new_r_Start  (ir_graph *irg, ir_node *block) {
   return new_rd_Start(NULL, irg, block);
 }
-INLINE ir_node *new_r_End    (ir_graph *irg, ir_node *block) {
+ir_node *new_r_End    (ir_graph *irg, ir_node *block) {
   return new_rd_End(NULL, irg, block);
 }
-INLINE ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block) {
+ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block) {
   return new_rd_Jmp(NULL, irg, block);
 }
-INLINE ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c) {
+ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c) {
   return new_rd_Cond(NULL, irg, block, c);
 }
-INLINE ir_node *new_r_Return (ir_graph *irg, ir_node *block,
+ir_node *new_r_Return (ir_graph *irg, ir_node *block,
                ir_node *store, int arity, ir_node **in) {
   return new_rd_Return(NULL, irg, block, store, arity, in);
 }
-INLINE ir_node *new_r_Raise  (ir_graph *irg, ir_node *block,
+ir_node *new_r_Raise  (ir_graph *irg, ir_node *block,
                ir_node *store, ir_node *obj) {
   return new_rd_Raise(NULL, irg, block, store, obj);
 }
-INLINE ir_node *new_r_Const  (ir_graph *irg, ir_node *block,
+ir_node *new_r_Const  (ir_graph *irg, ir_node *block,
                ir_mode *mode, tarval *con) {
   return new_rd_Const(NULL, irg, block, mode, con);
 }
-INLINE ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
+
+ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
+               ir_mode *mode, long value) {
+  return new_rd_Const_long(NULL, irg, block, mode, value);
+}
+
+
+ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
                        symconst_symbol value, symconst_kind symkind) {
   return new_rd_SymConst(NULL, irg, block, value, symkind);
 }
-INLINE ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
+ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
                   ir_node *objptr, int n_index, ir_node **index,
                   entity *ent) {
   return new_rd_Sel(NULL, irg, block, store, objptr, n_index, index, ent);
 }
-INLINE ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr,
+ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr,
                   type *ent) {
   return (new_rd_InstOf (NULL, irg, block, store, objptr, ent));
 }
-INLINE ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
+ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
                   ir_node *callee, int arity, ir_node **in,
                   type *tp) {
   return new_rd_Call(NULL, irg, block, store, callee, arity, in, tp);
 }
-INLINE ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
                   ir_node *op1, ir_node *op2, ir_mode *mode) {
   return new_rd_Add(NULL, irg, block, op1, op2, mode);
 }
-INLINE ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
                   ir_node *op1, ir_node *op2, ir_mode *mode) {
   return new_rd_Sub(NULL, irg, block, op1, op2, mode);
 }
-INLINE ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
+ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
                   ir_node *op,  ir_mode *mode) {
   return new_rd_Minus(NULL, irg, block,  op, mode);
 }
-INLINE ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
                   ir_node *op1, ir_node *op2, ir_mode *mode) {
   return new_rd_Mul(NULL, irg, block, op1, op2, mode);
 }
-INLINE ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
+ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
                   ir_node *memop, ir_node *op1, ir_node *op2) {
   return new_rd_Quot(NULL, irg, block, memop, op1, op2);
 }
-INLINE ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
+ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
                   ir_node *memop, ir_node *op1, ir_node *op2) {
   return new_rd_DivMod(NULL, irg, block, memop, op1, op2);
 }
-INLINE ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
                   ir_node *memop, ir_node *op1, ir_node *op2) {
   return new_rd_Div(NULL, irg, block, memop, op1, op2);
 }
-INLINE ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
                   ir_node *memop, ir_node *op1, ir_node *op2) {
   return new_rd_Mod(NULL, irg, block, memop, op1, op2);
 }
-INLINE ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
                   ir_node *op, ir_mode *mode) {
   return new_rd_Abs(NULL, irg, block, op, mode);
 }
-INLINE ir_node *new_r_And    (ir_graph *irg, ir_node *block,
+ir_node *new_r_And    (ir_graph *irg, ir_node *block,
                   ir_node *op1, ir_node *op2, ir_mode *mode) {
   return new_rd_And(NULL, irg, block,  op1, op2, mode);
 }
-INLINE ir_node *new_r_Or     (ir_graph *irg, ir_node *block,
+ir_node *new_r_Or     (ir_graph *irg, ir_node *block,
                   ir_node *op1, ir_node *op2, ir_mode *mode) {
   return new_rd_Or(NULL, irg, block,  op1, op2, mode);
 }
-INLINE ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
                   ir_node *op1, ir_node *op2, ir_mode *mode) {
   return new_rd_Eor(NULL, irg, block,  op1, op2, mode);
 }
-INLINE ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
                ir_node *op, ir_mode *mode) {
   return new_rd_Not(NULL, irg, block, op, mode);
 }
-INLINE ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
                ir_node *op1, ir_node *op2) {
   return new_rd_Cmp(NULL, irg, block, op1, op2);
 }
-INLINE ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
                ir_node *op, ir_node *k, ir_mode *mode) {
   return new_rd_Shl(NULL, irg, block, op, k, mode);
 }
-INLINE ir_node *new_r_Shr    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Shr    (ir_graph *irg, ir_node *block,
                ir_node *op, ir_node *k, ir_mode *mode) {
   return new_rd_Shr(NULL, irg, block, op, k, mode);
 }
-INLINE ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
+ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
                ir_node *op, ir_node *k, ir_mode *mode) {
   return new_rd_Shrs(NULL, irg, block, op, k, mode);
 }
-INLINE ir_node *new_r_Rot    (ir_graph *irg, ir_node *block,
+ir_node *new_r_Rot    (ir_graph *irg, ir_node *block,
                ir_node *op, ir_node *k, ir_mode *mode) {
   return new_rd_Rot(NULL, irg, block, op, k, mode);
 }
-INLINE ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
+ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
                ir_node *op, ir_mode *mode) {
   return new_rd_Conv(NULL, irg, block, op, mode);
 }
-INLINE ir_node *new_r_Cast   (ir_graph *irg, ir_node *block, ir_node *op, type *to_tp) {
+ir_node *new_r_Cast   (ir_graph *irg, ir_node *block, ir_node *op, type *to_tp) {
   return new_rd_Cast(NULL, irg, block, op, to_tp);
 }
-INLINE ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
+ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
                ir_node **in, ir_mode *mode) {
   return new_rd_Phi(NULL, irg, block, arity, in, mode);
 }
-INLINE ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
+ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
                ir_node *store, ir_node *adr, ir_mode *mode) {
   return new_rd_Load(NULL, irg, block, store, adr, mode);
 }
-INLINE ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
+ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
                ir_node *store, ir_node *adr, ir_node *val) {
   return new_rd_Store(NULL, irg, block, store, adr, val);
 }
-INLINE ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
+ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
                ir_node *size, type *alloc_type, where_alloc where) {
   return new_rd_Alloc(NULL, irg, block, store, size, alloc_type, where);
 }
-INLINE ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
-               ir_node *ptr, ir_node *size, type *free_type) {
-  return new_rd_Free(NULL, irg, block, store, ptr, size, free_type);
+ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
+               ir_node *ptr, ir_node *size, type *free_type, where_alloc where) {
+  return new_rd_Free(NULL, irg, block, store, ptr, size, free_type, where);
 }
-INLINE ir_node *new_r_Sync   (ir_graph *irg, ir_node *block, int arity, ir_node **in) {
+ir_node *new_r_Sync   (ir_graph *irg, ir_node *block, int arity, ir_node **in) {
   return new_rd_Sync(NULL, irg, block, arity, in);
 }
-INLINE ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
+ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
                ir_mode *mode, long proj) {
   return new_rd_Proj(NULL, irg, block, arg, mode, proj);
 }
-INLINE ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg,
+ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg,
                 long max_proj) {
   return new_rd_defaultProj(NULL, irg, block, arg, max_proj);
 }
-INLINE ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block,
+ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block,
                int arity, ir_node **in) {
   return new_rd_Tuple(NULL, irg, block, arity, in );
 }
-INLINE ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
+ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
                ir_node *val, ir_mode *mode) {
   return new_rd_Id(NULL, irg, block, val, mode);
 }
-INLINE ir_node *new_r_Bad    (ir_graph *irg) {
+ir_node *new_r_Bad    (ir_graph *irg) {
   return new_rd_Bad(irg);
 }
-INLINE ir_node *new_r_Confirm (ir_graph *irg, ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp) {
+ir_node *new_r_Confirm (ir_graph *irg, ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp) {
   return new_rd_Confirm (NULL, irg, block, val, bound, cmp);
 }
-INLINE ir_node *new_r_Unknown (ir_graph *irg, ir_mode *m) {
+ir_node *new_r_Unknown (ir_graph *irg, ir_mode *m) {
   return new_rd_Unknown(irg, m);
 }
-INLINE ir_node *new_r_CallBegin (ir_graph *irg, ir_node *block, ir_node *callee) {
+ir_node *new_r_CallBegin (ir_graph *irg, ir_node *block, ir_node *callee) {
   return new_rd_CallBegin(NULL, irg, block, callee);
 }
-INLINE ir_node *new_r_EndReg (ir_graph *irg, ir_node *block) {
+ir_node *new_r_EndReg (ir_graph *irg, ir_node *block) {
   return new_rd_EndReg(NULL, irg, block);
 }
-INLINE ir_node *new_r_EndExcept (ir_graph *irg, ir_node *block) {
+ir_node *new_r_EndExcept (ir_graph *irg, ir_node *block) {
   return new_rd_EndExcept(NULL, irg, block);
 }
-INLINE ir_node *new_r_Break  (ir_graph *irg, ir_node *block) {
+ir_node *new_r_Break  (ir_graph *irg, ir_node *block) {
   return new_rd_Break(NULL, irg, block);
 }
-INLINE ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
+ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
                ir_mode *mode, long proj) {
   return new_rd_Filter(NULL, irg, block, arg, mode, proj);
 }
-INLINE ir_node *new_r_NoMem  (ir_graph *irg) {
+ir_node *new_r_NoMem  (ir_graph *irg) {
   return new_rd_NoMem(irg);
 }
+ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
+    ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode) {
+  return new_rd_Mux(NULL, irg, block, sel, ir_false, ir_true, mode);
+}
 
 
 /** ********************/
@@ -1184,7 +1218,7 @@ new_rd_Phi0 (ir_graph *irg, ir_node *block, ir_mode *mode)
    to model this stack, now it is explicit.  This reduces side effects.
 */
 #if USE_EXPLICIT_PHI_IN_STACK
-INLINE Phi_in_stack *
+Phi_in_stack *
 new_Phi_in_stack(void) {
   Phi_in_stack *res;
 
@@ -1196,7 +1230,7 @@ new_Phi_in_stack(void) {
   return res;
 }
 
-INLINE void
+void
 free_Phi_in_stack(Phi_in_stack *s) {
   DEL_ARR_F(s->stack);
   free(s);
@@ -1311,6 +1345,7 @@ new_rd_Phi_in (ir_graph *irg, ir_node *block, ir_mode *mode, ir_node **in, int i
 #if USE_EXPLICIT_PHI_IN_STACK
     free_to_Phi_in_stack(res);
 #else
+               edges_node_deleted(res, current_ir_graph);
     obstack_free (current_ir_graph->obst, res);
 #endif
     res = known;
@@ -1492,8 +1527,8 @@ get_r_value_internal (ir_node *block, int pos, ir_mode *mode)
 
 #if USE_EXPLICIT_PHI_IN_STACK
 /* Just dummies */
-INLINE Phi_in_stack * new_Phi_in_stack() {  return NULL; }
-INLINE void free_Phi_in_stack(Phi_in_stack *s) { }
+Phi_in_stack * new_Phi_in_stack() {  return NULL; }
+void free_Phi_in_stack(Phi_in_stack *s) { }
 #endif
 
 static INLINE ir_node *
@@ -1534,6 +1569,7 @@ new_rd_Phi_in (ir_graph *irg, ir_node *block, ir_mode *mode,
   /* i==ins: there is at most one predecessor, we don't need a phi node. */
   if (i == ins) {
     if (res != known) {
+                       edges_node_deleted(res, current_ir_graph);
       obstack_free (current_ir_graph->obst, res);
       if (is_Phi(known)) {
        /* If pred is a phi node we want to optmize it: If loops are matured in a bad
@@ -1717,7 +1753,7 @@ phi_merge (ir_node *block, int pos, ir_mode *mode, ir_node **nin, int ins)
          before recuring.
       */
       if (default_initialize_local_variable)
-        block->attr.block.graph_arr[pos] = default_initialize_local_variable(mode, pos - 1);
+        block->attr.block.graph_arr[pos] = default_initialize_local_variable(current_ir_graph, mode, pos - 1);
       else
         block->attr.block.graph_arr[pos] = new_Const(mode, tarval_bad);
       /* We don't need to care about exception ops in the start block.
@@ -1954,6 +1990,12 @@ new_d_Const (dbg_info* db, ir_mode *mode, tarval *con)
 }
 
 ir_node *
+new_d_Const_long(dbg_info* db, ir_mode *mode, long value)
+{
+  return new_rd_Const_long(db, current_ir_graph, current_ir_graph->start_block, mode, value);
+}
+
+       ir_node *
 new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp)
 {
   return new_rd_Const_type(db, current_ir_graph, current_ir_graph->start_block,
@@ -2256,10 +2298,11 @@ new_d_Alloc (dbg_info* db, ir_node *store, ir_node *size, type *alloc_type,
 }
 
 ir_node *
-new_d_Free (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size, type *free_type)
+new_d_Free (dbg_info* db, ir_node *store, ir_node *ptr,
+    ir_node *size, type *free_type, where_alloc where)
 {
   return new_rd_Free (db, current_ir_graph, current_ir_graph->current_block,
-             store, ptr, size, free_type);
+             store, ptr, size, free_type, where);
 }
 
 ir_node *
@@ -2310,7 +2353,7 @@ new_d_Sync (dbg_info* db, int arity, ir_node** in)
 ir_node *
 (new_d_Bad)(void)
 {
-  return __new_d_Bad();
+  return _new_d_Bad();
 }
 
 ir_node *
@@ -2366,7 +2409,14 @@ new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj)
 ir_node *
 (new_d_NoMem)(void)
 {
-  return __new_d_NoMem();
+  return _new_d_NoMem();
+}
+
+ir_node *
+new_d_Mux (dbg_info *db, ir_node *sel, ir_node *ir_false,
+    ir_node *ir_true, ir_mode *mode) {
+  return new_rd_Mux (db, current_ir_graph, current_ir_graph->current_block,
+      sel, ir_false, ir_true, mode);
 }
 
 /* ********************************************************************* */
@@ -2404,7 +2454,7 @@ ir_node *new_d_immBlock (dbg_info* db) {
   return res;
 }
 
-INLINE ir_node *
+ir_node *
 new_immBlock (void) {
   return new_d_immBlock(NULL);
 }
@@ -2442,14 +2492,14 @@ get_d_value (dbg_info* db, int pos, ir_mode *mode)
   return get_r_value_internal (current_ir_graph->current_block, pos + 1, mode);
 }
 /* get a value from the parameter array from the current block by its index */
-INLINE ir_node *
+ir_node *
 get_value (int pos, ir_mode *mode)
 {
   return get_d_value(NULL, pos, mode);
 }
 
 /* set a value at position pos in the parameter array from the current block */
-INLINE void
+void
 set_value (int pos, ir_node *value)
 {
   assert(get_irg_phase_state (current_ir_graph) == phase_building);
@@ -2458,7 +2508,7 @@ set_value (int pos, ir_node *value)
 }
 
 /* get the current store */
-INLINE ir_node *
+ir_node *
 get_store (void)
 {
   assert(get_irg_phase_state (current_ir_graph) == phase_building);
@@ -2468,7 +2518,7 @@ get_store (void)
 }
 
 /* set the current store */
-INLINE void
+void
 set_store (ir_node *store)
 {
   /* GL: one could call set_value instead */
@@ -2500,7 +2550,7 @@ type *get_cur_frame_type() {
 
 /* call once for each run of the library */
 void
-init_cons (default_initialize_local_variable_func_t *func)
+init_cons(uninitialized_local_variable_func_t *func)
 {
   default_initialize_local_variable = func;
 }
@@ -2537,6 +2587,11 @@ ir_node *new_Const  (ir_mode *mode, tarval *con) {
   return new_d_Const(NULL, mode, con);
 }
 
+ir_node *new_Const_long(ir_mode *mode, long value)
+{
+       return new_d_Const_long(NULL, mode, value);
+}
+
 ir_node *new_Const_type(tarval *con, type *tp) {
   return new_d_Const_type(NULL, get_type_mode(tp), con, tp);
 }
@@ -2633,8 +2688,8 @@ ir_node *new_Alloc  (ir_node *store, ir_node *size, type *alloc_type,
   return new_d_Alloc(NULL, store, size, alloc_type, where);
 }
 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
-             type *free_type) {
-  return new_d_Free(NULL, store, ptr, size, free_type);
+             type *free_type, where_alloc where) {
+  return new_d_Free(NULL, store, ptr, size, free_type, where);
 }
 ir_node *new_Sync   (int arity, ir_node **in) {
   return new_d_Sync(NULL, arity, in);
@@ -2678,3 +2733,6 @@ ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj) {
 ir_node *new_NoMem  (void) {
   return new_d_NoMem();
 }
+ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode) {
+  return new_d_Mux(NULL, sel, ir_false, ir_true, mode);
+}