Adapted to changes in tv and irmode
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 26 Mar 2003 09:46:31 +0000 (09:46 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 26 Mar 2003 09:46:31 +0000 (09:46 +0000)
[r983]

33 files changed:
ir/adt/cookies.h
ir/ana/cgana.c
ir/common/firm.c
ir/ident/ident.c
ir/ir/ircons.c
ir/ir/irgopt.c
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/iropt.c
ir/tr/entity.c
ir/tr/trvrfy.h
ir/tr/type.c
testprograms/array-heap_example.c
testprograms/array-stack_example.c
testprograms/call_str_example.c
testprograms/cond_example.c
testprograms/const_ent_example.c
testprograms/const_eval_example.c
testprograms/dead_block_example.c
testprograms/endless_loop.c
testprograms/float_example.c
testprograms/global_cse.c
testprograms/global_var_example.c
testprograms/if_else_example.c
testprograms/if_example.c
testprograms/if_while_example.c
testprograms/irr_cf_example.c
testprograms/irr_loop_example.c
testprograms/memory_example.c
testprograms/oo_inline_example.c
testprograms/oo_program_example.c
testprograms/three_cfpred_example.c
testprograms/while_example.c

index 1517caa..7a641a5 100644 (file)
@@ -20,7 +20,7 @@
 #define SPDICT_COOKIE1 0xB0031E7
 #define SPDICT_COOKIE2 0xBA17B003
 
-/* Line N_o_mbers ToDo: Warum o? */
+/* Line N_o_mbers ToDo: Warum o? Answer: No. 5, not Nu. 5*/
 #define LINO_COOKIE    0x71b83bd5
 
 #endif
index 016ce5b..a5ac9ef 100644 (file)
@@ -68,7 +68,7 @@ entity *get_inherited_methods_implementation(entity *inh_meth) {
   assert(addr && "constant entity without value");
 
   if (get_irn_op(addr) == op_Const) {
-    impl_meth = get_tv_entity(get_Const_tarval(addr));
+    impl_meth = tarval_to_entity(get_Const_tarval(addr));
   }
 
   assert(!impl_meth || get_entity_peculiarity(impl_meth) == existent);
@@ -184,7 +184,7 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
          assert(get_entity_irg(ent));
          set_irg_current_block(current_ir_graph, get_nodes_Block(node));
          new_node = new_d_Const(get_irn_dbg_info(node),
-                                mode_P, tarval_P_from_entity(ent));       DBG_OPT_NORMALIZE;
+                                mode_P, new_tarval_from_entity(ent, mode_P));       DBG_OPT_NORMALIZE;
          exchange(node, new_node);
        }
       }
@@ -398,7 +398,7 @@ static void callee_ana_node(ir_node * node, eset * methods) {
 
   case iro_Const: {
     /* interne Methode */
-    entity * ent = get_Const_tarval(node)->u.P.ent;
+    entity * ent = tarval_to_entity(get_Const_tarval(node));
     assert(ent && is_method_type(get_entity_type(ent)));
     if (get_entity_visibility(ent) != external_allocated) {
       assert(get_entity_irg(ent));
@@ -570,9 +570,11 @@ static void free_mark(ir_node * node, eset * set) {
     break;
   case iro_Const: {
     tarval * val = get_Const_tarval(node);
-    entity * ent = val->u.P.ent;
-    if (ent != NULL && is_method_type(get_entity_type(ent))) {
-      eset_insert(set, ent);
+    if (tarval_is_entity(val)) { /* filter null pointer */
+      entity * ent = tarval_to_entity(val);
+      if (is_method_type(get_entity_type(ent))) {
+        eset_insert(set, ent);
+      }
     }
     break;
   }
index 3fdc5df..c1bd93c 100644 (file)
@@ -38,11 +38,11 @@ init_firm (default_initialize_local_variable_func_t *func)
   /* create the type kinds. */
   init_tpop ();
   /* create an obstack and put all tarvals in a pdeq */
-  tarval_init_1 ();
+  init_tarval_1 ();
   /* initialize all modes an ir node can consist of */
   init_mode ();
   /* initialize tarvals, and floating point arithmetic */
-  tarval_init_2 ();
+  init_tarval_2 ();
   /* init graph construction */
   init_irgraph();
   /* kind of obstack initialization */
index 22d15c2..e541c6f 100644 (file)
@@ -12,6 +12,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <stddef.h>
+#include <stdlib.h>
 
 #include "ident_t.h"
 #include "array.h"
index 52037ba..5497c52 100644 (file)
@@ -1627,7 +1627,7 @@ get_r_value_internal (ir_node *block, int pos, ir_mode *mode)
     printf("Error: no value set.  Use of undefined variable.  Initializing to zero.\n");
     assert (mode->code >= irm_F && mode->code <= irm_P);
     res = new_rd_Const (NULL, current_ir_graph, block, mode,
-                      tarval_mode_null[mode->code]);
+                      get_mode_null(mode));
   }
 
   /* The local valid value is available now. */
index 0f20d7a..0bbec9c 100644 (file)
@@ -813,8 +813,8 @@ static void collect_calls(ir_node *call, void *env) {
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
     tv = get_Const_tarval(addr);
-    if (tv->u.P.ent) {
-      called_irg = get_entity_irg(tv->u.P.ent);
+    if (tarval_to_entity(tv)) {
+      called_irg = get_entity_irg(tarval_to_entity(tv));
       if (called_irg && pos < MAX_INLINE) {
        /* The Call node calls a locally defined method.  Remember to inline. */
        calls[pos] = call;
@@ -856,7 +856,7 @@ void inline_small_irgs(ir_graph *irg, int size) {
       tarval *tv;
       ir_graph *callee;
       tv = get_Const_tarval(get_Call_ptr(calls[i]));
-      callee = get_entity_irg(tv->u.P.ent);
+      callee = get_entity_irg(tarval_to_entity(tv));
       if ((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) {
        inline_method(calls[i], callee);
       }
index 02aa313..8012f8b 100644 (file)
@@ -326,7 +326,7 @@ INLINE ident *
 get_irn_modeident (const ir_node *node)
 {
   assert(node);
-  return node->mode->name;
+  return get_mode_ident(node->mode);
 }
 
 INLINE ir_op *
index a24ba98..b33bcdf 100644 (file)
@@ -7,12 +7,34 @@
 # ifndef _IRNODE_H_
 # define _IRNODE_H_
 
+/* Projection numbers of compare: use for Proj nodes! */
+typedef enum {
+  False,               /* false */
+  Eq,                  /* equal */
+  Lt,                  /* less */
+  Le,                  /* less or equal */
+  Gt,                  /* greater */
+  Ge,                  /* greater or equal */
+  Lg,                  /* less or greater */
+  Leg,                 /* less, equal or greater = ordered */
+  Uo,                  /* unordered */
+  Ue,                  /* unordered or equal */
+  Ul,                  /* unordered or less */
+  Ule,                 /* unordered, less or equal */
+  Ug,                  /* unordered or greater */
+  Uge,                 /* unordered, greater or equal */
+  Ne,                  /* unordered, less or greater = not equal */
+  True                 /* true */
+  /* not_mask = Leg*/  /* bits to flip to negate comparison * @@ hack for jni interface */
+} pnc_number;
+#define not_mask Leg
+
+# include "tv.h"
 # include "irgraph.h"
 # include "entity.h"
 # include "firm_common.h"
 # include "irop.h"
 # include "irmode.h"
-# include "tv.h"
 # include "type.h"
 # include "dbginfo.h"
 # include "exc.h"
@@ -388,28 +410,8 @@ INLINE void     set_Eor_right (ir_node *node, ir_node *right);
 INLINE ir_node *get_Not_op (ir_node *node);
 INLINE void     set_Not_op (ir_node *node, ir_node *op);
 
-/** Projection numbers of compare: use for Proj nodes! */
-typedef enum {
-  False,               /**< false */
-  Eq,                  /**< equal */
-  Lt,                  /**< less */
-  Le,                  /**< less or equal */
-  Gt,                  /**< greater */
-  Ge,                  /**< greater or equal */
-  Lg,                  /**< less or greater */
-  Leg,                 /**< less, equal or greater = ordered */
-  Uo,                  /**< unordered */
-  Ue,                  /**< unordered or equal */
-  Ul,                  /**< unordered or less */
-  Ule,                 /**< unordered, less or equal */
-  Ug,                  /**< unordered or greater */
-  Uge,                 /**< unordered, greater or equal */
-  Ne,                  /**< unordered, less or greater = not equal */
-  True                 /**< true */
-  /* not_mask = Leg*/  /* bits to flip to negate comparison * @@ hack for jni interface */
-} pnc_number;
-#define not_mask Leg
 INLINE const char *get_pnc_string(int pnc);
+
 INLINE int   get_negated_pnc(int pnc);
 INLINE ir_node *get_Cmp_left (ir_node *node);
 INLINE void     set_Cmp_left (ir_node *node, ir_node *left);
index 8408832..dd79853 100644 (file)
@@ -39,9 +39,9 @@ static INLINE tarval *
 value_of (ir_node *n)
 {
   if ((n != NULL) && (get_irn_op(n) == op_Const))
-    return get_Const_tarval(n);
+    return get_Const_tarval(n); /* might return tarval_bad */
   else
-    return NULL;
+    return tarval_bad;
 }
 
 /* if n can be computed, return the value, else NULL. Performs
@@ -52,9 +52,10 @@ computed_value (ir_node *n)
   tarval *res;
 
   ir_node *a = NULL, *b = NULL;         /* initialized to shut up gcc */
-  tarval *ta = NULL, *tb = NULL; /* initialized to shut up gcc */
+  /* initialized to uniformly filter invalid constants */
+  tarval *ta = tarval_bad, *tb = tarval_bad;
 
-  res = NULL;
+  res = tarval_bad;
 
   /* get the operands we will work on for simple cases. */
   if (is_binop(n)) {
@@ -77,79 +78,83 @@ computed_value (ir_node *n)
   case iro_SymConst:
     if ((get_SymConst_kind(n) == size) &&
        (get_type_state(get_SymConst_type(n))) == layout_fixed)
-      res = tarval_from_long (mode_Is, get_type_size(get_SymConst_type(n)));
+      res = new_tarval_from_long (get_type_size(get_SymConst_type(n)), mode_Is);
     break;
   case iro_Add:
-    if (ta && tb && (get_irn_mode(a) == get_irn_mode(b))
-       && (get_irn_mode(a) != mode_P)) {
+    if ((ta != tarval_bad) && (tb != tarval_bad)
+          && (get_irn_mode(a) == get_irn_mode(b))
+          && !(get_mode_sort(get_irn_mode(a)) == reference)) {
       res = tarval_add (ta, tb);
     }
     break;
   case iro_Sub:
-    if (ta && tb && (get_irn_mode(a) == get_irn_mode(b))
-       && (get_irn_mode(a) != mode_P)) {
+    if ((ta != tarval_bad) && (tb != tarval_bad)
+          && (get_irn_mode(a) == get_irn_mode(b))
+          && !(get_mode_sort(get_irn_mode(a)) == reference)) {
       res = tarval_sub (ta, tb);
-    } else if (a == b) {
-      res = tarval_mode_null [get_irn_modecode (n)];
     }
     break;
   case iro_Minus:
-      if (ta && mode_is_float(get_irn_mode(a)))
+      if ((ta != tarval_bad) && mode_is_signed(get_irn_mode(a)))
         res = tarval_neg (ta);
     break;
   case iro_Mul:
-    if (ta && tb) /* tarval_mul tests for equivalent modes itself */ {
+    if ((ta != tarval_bad) && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
       res = tarval_mul (ta, tb);
     } else {
       /* a*0 = 0 or 0*b = 0:
         calls computed_value recursive and returns the 0 with proper
          mode. */
       tarval *v;
-      if (   (tarval_classify ((v = computed_value (a))) == 0)
-         || (tarval_classify ((v = computed_value (b))) == 0)) {
+      if ( ( ((v = computed_value (a)) != tarval_bad)
+               && (v == get_mode_null(get_tarval_mode(v))) )
+       || ( ((v = computed_value (b)) != tarval_bad)
+               && (v == get_mode_null(get_tarval_mode(v))) )) {
        res = v;
       }
     }
     break;
   case iro_Quot:
     /* This was missing in original implementation. Why? */
-    if (ta && tb  && (get_irn_mode(a) == get_irn_mode(b))) {
-      if (tarval_classify(tb) == 0) {res = NULL; break;}
+    if ((ta != tarval_bad) && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
+      if (tb == get_mode_null(get_tarval_mode(tb))) break;  /* div by zero: return tarval_bad */
       res = tarval_quo(ta, tb);
     }
     break;
   case iro_Div:
     /* This was missing in original implementation. Why? */
-    if (ta && tb  && (get_irn_mode(a) == get_irn_mode(b))) {
-      if (tarval_classify(tb) == 0) {res = NULL; break;}
+    if ((ta != tarval_bad) && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
+      if (tb == get_mode_null(get_tarval_mode(tb))) break;  /* div by zero: return tarval_bad */
       res = tarval_div(ta, tb);
     }
     break;
   case iro_Mod:
     /* This was missing in original implementation. Why? */
-    if (ta && tb  && (get_irn_mode(a) == get_irn_mode(b))) {
-      if (tarval_classify(tb) == 0) {res = NULL; break;}
+    if ((ta != tarval_bad) && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
+      if (tb == get_mode_null(get_tarval_mode(tb))) break;  /* div by zero: return tarval_bad */
       res = tarval_mod(ta, tb);
     }
     break;
   /* for iro_DivMod see iro_Proj */
   case iro_Abs:
-    if (ta)
+    if (ta != tarval_bad)
       res = tarval_abs (ta);
     break;
   case iro_And:
-    if (ta && tb) {
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
       res = tarval_and (ta, tb);
     } else {
       tarval *v;
-      if (   (tarval_classify ((v = computed_value (a))) == 0)
-         || (tarval_classify ((v = computed_value (b))) == 0)) {
+      if ( ( ((v = computed_value (a)) != tarval_bad)
+               && (v == get_mode_null(get_tarval_mode(v))) )
+       || ( ((v = computed_value (b)) != tarval_bad)
+               && (v == get_mode_null(get_tarval_mode(v))) )) {
        res = v;
       }
     }
     break;
   case iro_Or:
-    if (ta && tb) {
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
       res = tarval_or (ta, tb);
     } else {
       tarval *v;
@@ -159,14 +164,40 @@ computed_value (ir_node *n)
       }
     }
     break;
-  case iro_Eor: if (ta && tb) { res = tarval_eor (ta, tb); } break;
-  case iro_Not: if (ta)       { res = tarval_neg (ta); } break;
-  case iro_Shl: if (ta && tb) { res = tarval_shl (ta, tb); } break;
-    /* tarval_shr is faulty !! */
-  case iro_Shr: if (ta && tb) { res = tarval_shr (ta, tb); } break;
-  case iro_Shrs:if (ta && tb) { /*res = tarval_shrs (ta, tb)*/; } break;
-  case iro_Rot: if (ta && tb) { /*res = tarval_rot (ta, tb)*/; } break;
-  case iro_Conv:if (ta)       { res = tarval_convert_to (ta, get_irn_mode (n)); }
+  case iro_Eor:
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
+      res = tarval_eor (ta, tb);
+    }
+    break;
+  case iro_Not:
+    if ((ta != tarval_bad)) {
+      res = tarval_neg (ta);
+    }
+    break;
+  case iro_Shl:
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
+      res = tarval_shl (ta, tb);
+    }
+    break;
+  case iro_Shr:
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
+      res = tarval_shr (ta, tb);
+    }
+    break;
+  case iro_Shrs:
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
+     res = tarval_shrs (ta, tb);
+    }
+    break;
+  case iro_Rot:
+    if ((ta != tarval_bad) && (tb != tarval_bad)) {
+      /*res = tarval_rot (ta, tb)*/;
+    }
+    break;
+  case iro_Conv:
+    if (ta != tarval_bad) {
+      res = tarval_convert_to (ta, get_irn_mode (n));
+    }
     break;
   case iro_Proj:  /* iro_Cmp */
     {
@@ -193,16 +224,16 @@ computed_value (ir_node *n)
        if (aa == ab) { /* 1.: */
           /* This is a tric with the bits used for encoding the Cmp
              Proj numbers, the following statement is not the same:
-          res = tarval_from_long (mode_b, (get_Proj_proj(n) == Eq)):    */
-         res = tarval_from_long (mode_b, (get_Proj_proj(n) & irpn_Eq));
+          res = new_tarval_from_long ((get_Proj_proj(n) == Eq), mode_b) */
+         res = new_tarval_from_long ((get_Proj_proj(n) & Eq), mode_b);
        } else {
          tarval *taa = computed_value (aa);
          tarval *tab = computed_value (ab);
-         if (taa && tab) { /* 2.: */
+         if ((taa != tarval_bad) && (tab != tarval_bad)) { /* 2.: */
             /* strange checks... */
-           ir_pncmp flags = tarval_comp (taa, tab);
-           if (flags != irpn_False) {
-              res = tarval_from_long (mode_b, get_Proj_proj(n) & flags);
+           pnc_number flags = tarval_cmp (taa, tab);
+           if (flags != False) {
+              res = new_tarval_from_long (get_Proj_proj(n) & flags, mode_b);
            }
          } else {  /* check for 3.: */
             ir_node *aaa = skip_nop(skip_Proj(aa));
@@ -214,7 +245,7 @@ computed_value (ir_node *n)
                     && (   (/* ab is constant void */
                                (get_irn_op(ab) == op_Const)
                             && (get_irn_mode(ab) == mode_P)
-                            && (get_Const_tarval(ab) == tarval_P_void))
+                            && (get_Const_tarval(ab) == get_mode_null(mode_P)))
                        || (/* ab is other Alloc */
                                (get_irn_op(ab) == op_Proj)
                            && (get_irn_mode(ab) == mode_P)
@@ -223,19 +254,19 @@ computed_value (ir_node *n)
                || (/* aa is void and aba is Alloc */
                        (get_irn_op(aa) == op_Const)
                     && (get_irn_mode(aa) == mode_P)
-                    && (get_Const_tarval(aa) == tarval_P_void)
+                    && (get_Const_tarval(aa) == get_mode_null(mode_P))
                     && (get_irn_op(ab) == op_Proj)
                    && (get_irn_mode(ab) == mode_P)
                     && (get_irn_op(aba) == op_Alloc)))
              /* 3.: */
-             res = tarval_from_long (mode_b, get_Proj_proj(n) & irpn_Ne);
+             res = new_tarval_from_long (get_Proj_proj(n) & Ne, mode_b);
          }
        }
       } else if (get_irn_op(a) == op_DivMod) {
         ta = value_of(get_DivMod_left(a));
         tb = value_of(get_DivMod_right(a));
-       if (ta && tb  && (get_irn_mode(a) == get_irn_mode(b))) {
-         if (tarval_classify(tb) == 0) {res = NULL; break;}
+       if ((ta != tarval_bad)  && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
+         if (tb == get_mode_null(get_tarval_mode(tb))) break;  /* div by zero: return tarval_bad */
          if (get_Proj_proj(n)== 0) /* Div */
            res = tarval_div(ta, tb);
          else /* Mod */
@@ -611,24 +642,24 @@ transform_node (ir_node *n)
   switch (get_irn_opcode(n)) {
   case iro_Div: {
     ta = computed_value(n);
-    if (ta) {
+    if (ta != tarval_bad) {
       /* Turn Div into a tuple (mem, bad, value) */
       ir_node *mem = get_Div_mem(n);
       turn_into_tuple(n, 3);
       set_Tuple_pred(n, 0, mem);
       set_Tuple_pred(n, 1, new_Bad());
-      set_Tuple_pred(n, 2, new_Const(get_tv_mode(ta), ta));
+      set_Tuple_pred(n, 2, new_Const(get_tarval_mode(ta), ta));
     }
   } break;
   case iro_Mod: {
     ta = computed_value(n);
-    if (ta) {
+    if (ta != tarval_bad) {
       /* Turn Div into a tuple (mem, bad, value) */
       ir_node *mem = get_Mod_mem(n);
       turn_into_tuple(n, 3);
       set_Tuple_pred(n, 0, mem);
       set_Tuple_pred(n, 1, new_Bad());
-      set_Tuple_pred(n, 2, new_Const(get_tv_mode(ta), ta));
+      set_Tuple_pred(n, 2, new_Const(get_tarval_mode(ta), ta));
     }
   } break;
   case iro_DivMod: {
@@ -645,29 +676,29 @@ transform_node (ir_node *n)
       break;
 
     if (a == b) {
-      a = new_Const (mode, tarval_from_long (mode, 1));
-      b = new_Const (mode, tarval_from_long (mode, 0));
+      a = new_Const (mode, get_mode_one(mode));
+      b = new_Const (mode, get_mode_null(mode));
       evaluated = 1;
     } else {
       ta = value_of(a);
       tb = value_of(b);
 
-      if (tb) {
-       if (tarval_classify(tb) == 1) {
-         b = new_Const (mode, tarval_from_long (mode, 0));
+      if (tb != tarval_bad) {
+       if (tb == get_mode_one(get_tarval_mode(tb))) {
+         b = new_Const (mode, get_mode_null(mode));
          evaluated = 1;
-       } else if (ta) {
+       } else if (ta != tarval_bad) {
          tarval *resa, *resb;
           resa = tarval_div (ta, tb);
-          if (!resa) break; /* Causes exception!!! Model by replacing through
-                              Jmp for X result!? */
+          if (resa == tarval_bad) break; /* Causes exception!!! Model by replacing through
+                                           Jmp for X result!? */
           resb = tarval_mod (ta, tb);
-          if (!resb) break; /* Causes exception! */
+          if (resb == tarval_bad) break; /* Causes exception! */
          a = new_Const (mode, resa);
          b = new_Const (mode, resb);
          evaluated = 1;
        }
-      } else if (tarval_classify (ta) == 0) {
+      } else if (ta == get_mode_null(get_tarval_mode(ta))) {
         b = a;
        evaluated = 1;
       }
@@ -691,14 +722,14 @@ transform_node (ir_node *n)
     a = get_Cond_selector(n);
     ta = value_of(a);
 
-    if (ta &&
+    if ((ta != tarval_bad) &&
        (get_irn_mode(a) == mode_b) &&
        (get_opt_unreachable_code())) {
       /* It's a boolean Cond, branching on a boolean constant.
                 Replace it by a tuple (Bad, Jmp) or (Jmp, Bad) */
       jmp = new_r_Jmp(current_ir_graph, get_nodes_Block(n));
       turn_into_tuple(n, 2);
-      if (tv_val_b(ta) == 1)  /* GL: I hope this returns 1 if true */ {
+      if (ta == tarval_b_true) {
                set_Tuple_pred(n, 0, new_Bad());
                set_Tuple_pred(n, 1, jmp);
       } else {
@@ -707,7 +738,7 @@ transform_node (ir_node *n)
       }
       /* We might generate an endless loop, so keep it alive. */
       add_End_keepalive(get_irg_end(current_ir_graph), get_nodes_Block(n));
-    } else if (ta &&
+    } else if ((ta != tarval_bad) &&
               (get_irn_mode(a) == mode_Iu) &&
               (get_Cond_kind(n) == dense) &&
               (get_opt_unreachable_code())) {
@@ -759,7 +790,7 @@ transform_node (ir_node *n)
               && (get_Cond_kind(a) == dense)
               && (get_opt_unreachable_code())) {
       /* The Cond is a Switch on a Constant */
-      if (get_Proj_proj(n) == tv_val_uInt(value_of(a))) {
+      if (get_Proj_proj(n) == tarval_to_long(value_of(a))) {
         /* The always taken branch, reuse the existing Jmp. */
         if (!get_irn_link(a)) /* well, if it exists ;-> */
           set_irn_link(a, new_r_Jmp(current_ir_graph, get_nodes_Block(n)));
@@ -1028,10 +1059,10 @@ optimize_node (ir_node *n)
     if  (get_irn_op(n) != op_Const) {
       /* try to evaluate */
       tv = computed_value (n);
-      if ((get_irn_mode(n) != mode_T) && (tv != NULL)) {
+      if ((get_irn_mode(n) != mode_T) && (tv != tarval_bad)) {
         /* evaluation was succesful -- replace the node. */
        obstack_free (current_ir_graph->obst, n);
-       return new_Const (get_tv_mode (tv), tv);
+       return new_Const (get_tarval_mode (tv), tv);
       }
     }
   }
@@ -1105,9 +1136,9 @@ optimize_in_place_2 (ir_node *n)
     if  (get_irn_op(n) != op_Const) {
       /* try to evaluate */
       tv = computed_value (n);
-      if ((get_irn_mode(n) != mode_T) && (tv != NULL)) {
+      if ((get_irn_mode(n) != mode_T) && (tv != tarval_bad)) {
         /* evaluation was succesful -- replace the node. */
-       n = new_Const (get_tv_mode (tv), tv);
+       n = new_Const (get_tarval_mode (tv), tv);
        __dbg_info_merge_pair(n, old_n, dbg_const_eval);
        return n;
       }
index 5cf9e2e..6b6fc7a 100644 (file)
@@ -22,6 +22,7 @@
 /* All this is needed to build the constant node for methods: */
 # include "irprog_t.h"
 # include "ircons.h"
+# include "tv_t.h"
 
 /*******************************************************************/
 /** general                                                       **/
@@ -84,7 +85,7 @@ new_entity (type *owner, ident *name, type *type)
     res->variability = constant;
     rem = current_ir_graph;
     current_ir_graph = get_const_code_irg();
-    res->value = new_Const(mode_P, tarval_P_from_entity(res));
+    res->value = new_Const(mode_P, new_tarval_from_entity(res, mode_P));
     current_ir_graph = rem;
   } else {
     res->variability = uninitialized;
@@ -181,7 +182,7 @@ copy_entity_name (entity *old, ident *new_name) {
 
 void
 free_entity (entity *ent) {
-  free_tv_entity(ent);
+  free_tarval_entity(ent);
   free_entity_attrs(ent);
   free(ent);
 }
@@ -468,7 +469,7 @@ set_array_entity_values(entity *ent, tarval **values, int num_vals) {
   current_ir_graph = get_const_code_irg();
 
   for (i = 0; i < num_vals; i++) {
-    val = new_Const(get_tv_mode (values[i]), values[i]);
+    val = new_Const(get_tarval_mode (values[i]), values[i]);
     add_compound_ent_value(ent, val, get_array_element_entity(arrtp));
   }
   current_ir_graph = rem;
index 58eb75b..95040d4 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include "firm.h"
+#include "xprintf.h"
 
 /**
  * possible trvrfy() error codes
index 933064f..7c4137d 100644 (file)
@@ -156,7 +156,7 @@ void        set_type_mode(type *tp, ir_mode* m) {
 
   if ((tp->type_op == type_primitive) || (tp->type_op == type_enumeration)) {
     /* For pointer, primitive and enumeration size depends on the mode. */
-    tp->size = get_mode_size(m);
+    tp->size = get_mode_size(m)/8;
     tp->mode = m;
   }
 }
@@ -811,7 +811,7 @@ INLINE type *new_type_method (ident *name, int n_param, int n_res) {
   type *res;
   res = new_type(type_method, mode_P, name);
   res->state = layout_fixed;
-  res->size = get_mode_size(mode_P);
+  res->size = get_mode_size(mode_P)/8;
   res->attr.ma.n_params   = n_param;
   res->attr.ma.param_type = (type **) xmalloc (sizeof (type *) * n_param);
   res->attr.ma.n_res      = n_res;
@@ -1028,8 +1028,8 @@ set_array_bounds_int (type *array, int dimension, int lower_bound,
   ir_graph *rem = current_ir_graph;
   current_ir_graph = get_const_code_irg();
   set_array_bounds (array, dimension,
-                   new_Const(mode_Iu, tarval_from_long (mode_Iu, lower_bound)),
-                   new_Const(mode_Iu, tarval_from_long (mode_Iu, upper_bound)));
+                   new_Const(mode_Iu, new_tarval_from_long (lower_bound, mode_Iu)),
+                   new_Const(mode_Iu, new_tarval_from_long (upper_bound, mode_Iu )));
   current_ir_graph = rem;
 }
 INLINE void
@@ -1041,7 +1041,7 @@ void  set_array_lower_bound_int (type *array, int dimension, int lower_bound) {
   ir_graph *rem = current_ir_graph;
   current_ir_graph = get_const_code_irg();
   set_array_lower_bound  (array, dimension,
-                         new_Const(mode_Iu, tarval_from_long (mode_Iu, lower_bound)));
+                         new_Const(mode_Iu, new_tarval_from_long (lower_bound, mode_Iu)));
   current_ir_graph = rem;
 }
 INLINE void
@@ -1053,7 +1053,7 @@ void  set_array_upper_bound_int (type *array, int dimension, int upper_bound) {
   ir_graph *rem = current_ir_graph;
   current_ir_graph = get_const_code_irg();
   set_array_upper_bound  (array, dimension,
-                         new_Const(mode_Iu, tarval_from_long (mode_Iu, upper_bound)));
+                         new_Const(mode_Iu, new_tarval_from_long (upper_bound, mode_Iu)));
   current_ir_graph = rem;
 }
 ir_node * get_array_lower_bound  (type *array, int dimension) {
@@ -1177,7 +1177,7 @@ INLINE type *new_type_pointer           (ident *name, type *points_to) {
   type *res;
   res = new_type(type_pointer, mode_P, name);
   res->attr.pa.points_to = points_to;
-  res->size = get_mode_size(res->mode);
+  res->size = get_mode_size(res->mode)/8;
   res->state = layout_fixed;
   return res;
 }
@@ -1215,7 +1215,7 @@ INLINE type *new_type_primitive (ident *name, ir_mode *mode) {
   type *res;
   /* @@@ assert( mode_is_data(mode) && (!mode == mode_P)); */
   res = new_type(type_primitive, mode, name);
-  res->size = get_mode_size(mode);
+  res->size = get_mode_size(mode)/8;
   res->state = layout_fixed;
   return res;
 }
index eeb7e22..17eb094 100644 (file)
@@ -93,8 +93,8 @@ main(void)
 # define U_BOUND 9
   array_type = new_type_array(id_from_str("a", 1), N_DIMS, prim_t_int);
   set_array_bounds(array_type, 1,
-                  new_Const(mode_Iu, tarval_from_long (mode_Iu, L_BOUND)),
-                  new_Const(mode_Iu, tarval_from_long (mode_Iu, U_BOUND)));
+                  new_Const(mode_Iu, new_tarval_from_long (L_BOUND, mode_Iu)),
+                  new_Const(mode_Iu, new_tarval_from_long (U_BOUND, mode_Iu)));
   /* As the array is accessed by Sel nodes, we need information about
      the entity the node selects.  Entities of an array are it's elements
      which are, in this case, integers. */
@@ -109,7 +109,7 @@ main(void)
   /*   better: read bounds out of array type information */
   size = (U_BOUND - L_BOUND + 1) * get_mode_size(elt_type_mode);
   /*   make constant representing the size */
-  arr_size  = new_Const(mode_Iu, tarval_from_long (mode_Iu, size));
+  arr_size  = new_Const(mode_Iu, new_tarval_from_long (size, mode_Iu));
   /*   allocate and generate the Proj nodes. */
   array     = new_Alloc(get_store(), arr_size, (type*)array_type, stack_alloc);
   set_store(new_Proj(array, mode_M, 0));   /* make the changed memory visible */
@@ -121,7 +121,7 @@ main(void)
      by (three * elt_size), but this complicates some optimizations. The
      type information accessible via the entity allows to generate the
      pointer increment later. */
-  c3 = new_Const (mode_Iu, tarval_from_long (mode_Iu, 3));
+  c3 = new_Const (mode_Iu, new_tarval_from_long (3, mode_Iu));
   {
      ir_node *in[1];
      in[0] = c3;
index af8eb0e..cda2601 100644 (file)
@@ -84,8 +84,8 @@ main(void)
 # define U_BOUND 9
   array_type = new_type_array(id_from_str("a_tp", 4), N_DIMS, prim_t_int);
   set_array_bounds(array_type, 1,
-                  new_Const(mode_Iu, tarval_from_long (mode_Iu, L_BOUND)),
-                  new_Const(mode_Iu, tarval_from_long (mode_Iu, U_BOUND)));
+                  new_Const(mode_Iu, new_tarval_from_long (L_BOUND, mode_Iu)),
+                  new_Const(mode_Iu, new_tarval_from_long (U_BOUND, mode_Iu)));
   /* The array is an entity of the method, placed on the mehtod's own memory,
      the stack frame. */
   array_ent = new_entity(get_cur_frame_type(), id_from_str("a", 1), array_type);
@@ -105,7 +105,7 @@ main(void)
      array pointer by (three * elt_size), but this complicates some
      optimizations.) The type information accessible via the entity
      allows to generate the pointer increment later. */
-  c3 = new_Const (mode_Iu, tarval_from_long (mode_Iu, 3));
+  c3 = new_Const (mode_Iu, new_tarval_from_long (3, mode_Iu));
   {
      ir_node *in[1];
      in[0] = c3;
index 19e5082..45efbec 100644 (file)
@@ -78,7 +78,8 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* the string is entered in the constant table. const_str is a pointer to the string */
-  const_str = new_Const (mode_P, tarval_P_from_str ("Hello world!"));
+  /* length 13 because of the terminating NULL character */
+  const_str = new_Const (mode_P, new_tarval_from_str ("Hello world!", 13, mode_P));
 
   /* get the pointer to the procedure from the class type */
   /* this is how a pointer to be fixed by the linker is represented after
index dfbbcf6..bbaeaf0 100644 (file)
@@ -73,19 +73,19 @@ int main(int argc, char **argv)
 
   /* the expression that evaluates the condition */
   /* cmpGt = a > 2 */
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
   cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, Gt);
   cmpGt = new_Conv(cmpGt, mode_Is);
 
   /* cmpLt = a < 10 */
-  c10 = new_Const (mode_Is, tarval_from_long (mode_Is, 10));
+  c10 = new_Const (mode_Is, new_tarval_from_long (10, mode_Is));
   cmpLt = new_Proj(new_Cmp(get_value(0, mode_Is), c10), mode_b, Lt);
   cmpLt = new_Conv(cmpLt, mode_Is);
 
   /* cmpGt && cmpLt */
   and = new_And(cmpGt, cmpLt, mode_Is);
   /* compare result and 0 because we have no cast from integer to bool */
-  and = new_Cmp(and, new_Const (mode_Is, tarval_from_long (mode_Is, 0)));
+  and = new_Cmp(and, new_Const (mode_Is, new_tarval_from_long (0, mode_Is)));
   and = new_Proj(and, mode_b, Ne);
 
   /* the conditional branch */
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
   /* generate and fill the then block */
   b = new_immBlock ();
   add_in_edge (b, t);
-  set_value (0, new_Const (mode_Is, tarval_from_long (mode_Is, 1)));
+  set_value (0, new_Const (mode_Is, new_tarval_from_long (1, mode_Is)));
   mature_block (b);
   x_then = new_Jmp ();
 
index db52efb..928dbe9 100644 (file)
@@ -89,7 +89,11 @@ int main(int argc, char **argv)
   current_ir_graph = get_const_code_irg();
   /* The pointer to the dispatch table is constant. */
   /* The constant is the address of the given entity */
+<<<<<<< const_ent_example.c
+  n = new_Const(mode_P, new_tarval_from_entity(dipte, mode_P));
+=======
   n = new_Const(mode_P, tarval_P_from_entity(dipte));
+>>>>>>> 1.7
   set_entity_variability(diptpe, constant);
   set_atomic_ent_value(diptpe, n);
 
@@ -118,13 +122,13 @@ int main(int argc, char **argv)
   arre = new_entity(get_glob_type(), arrei, arrt);
   set_entity_variability(arre, constant);
   current_ir_graph = get_const_code_irg();
-  n = new_Const(mode_Is, tarval_from_long (mode_Is, 7));
+  n = new_Const(mode_Is, new_tarval_from_long (7, mode_Is));
   add_compound_ent_value(arre, n, arrelte);
-  n = new_Const(mode_Is, tarval_from_long (mode_Is, 2));
+  n = new_Const(mode_Is, new_tarval_from_long (2, mode_Is));
   add_compound_ent_value(arre, n, arrelte);
-  n = new_Const(mode_Is, tarval_from_long (mode_Is, 13));
+  n = new_Const(mode_Is, new_tarval_from_long (13, mode_Is));
   add_compound_ent_value(arre, n, arrelte);
-  n = new_Const(mode_Is, tarval_from_long (mode_Is, 92));
+  n = new_Const(mode_Is, new_tarval_from_long (92, mode_Is));
   add_compound_ent_value(arre, n, arrelte);
 }
   printf("Done building the graph.  Dumping it.\n");
index 66c21f4..d90f106 100644 (file)
@@ -57,8 +57,8 @@ main(void)
 
   irg = new_ir_graph (ent, 4);
 
-  a = new_Const (mode_Is, tarval_from_long (mode_Is, 7));
-  b = new_Const (mode_Is, tarval_from_long (mode_Is, 5));
+  a = new_Const (mode_Is, new_tarval_from_long (7, mode_Is));
+  b = new_Const (mode_Is, new_tarval_from_long (5, mode_Is));
 
   x = new_Jmp ();
   mature_block (get_irg_current_block(irg));
@@ -70,11 +70,11 @@ main(void)
   c = new_Proj(c, mode_Is, 2);
   */
 
-  c = new_Add (new_Const (mode_Is, tarval_from_long (mode_Is, 5)),
-              new_Const (mode_Is, tarval_from_long (mode_Is, 7)),
+  c = new_Add (new_Const (mode_Is, new_tarval_from_long (5, mode_Is)),
+              new_Const (mode_Is, new_tarval_from_long (7, mode_Is)),
               mode_Is);
-  d = new_Add (new_Const (mode_Is, tarval_from_long (mode_Is, 7)),
-              new_Const (mode_Is, tarval_from_long (mode_Is, 5)),
+  d = new_Add (new_Const (mode_Is, new_tarval_from_long (7, mode_Is)),
+              new_Const (mode_Is, new_tarval_from_long (5, mode_Is)),
               mode_Is);
 
   {
index 5a4d040..7493d7c 100644 (file)
@@ -85,8 +85,8 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* to make a condition  */
-  c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1));
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
+  c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
   set_value(0, c2);
 
   cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq));
index e4b0988..5f2fe46 100644 (file)
@@ -75,7 +75,7 @@ main(void)
 
   /* Generate two values */
   set_value (0, new_Proj(get_irg_args(irg), mode_Is, 0));
-  set_value (1, new_Const (mode_Is, tarval_from_long (mode_Is, 1)));
+  set_value (1, new_Const (mode_Is, new_tarval_from_long (1, mode_Is)));
 
   x = new_Jmp();
   mature_block (get_irg_current_block(irg));
@@ -83,8 +83,8 @@ main(void)
   /* generate a block for the loop header and the conditional branch */
   r = new_immBlock ();
   add_in_edge (r, x);
-  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 0)),
-                                new_Const (mode_Is, tarval_from_long (mode_Is, 0))),
+  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
+                                new_Const (mode_Is, new_tarval_from_long (0, mode_Is))),
                         mode_b, Eq));
   f = new_Proj (x, mode_X, 0);
   t = new_Proj (x, mode_X, 1);
@@ -104,7 +104,7 @@ main(void)
 
   /* set VAR_A to constant value */
   set_store (new_Proj (new_Store (get_store (),
-                                 new_Const (mode_P, tarval_P_from_str ("VAR_A")),
+                                 new_Const (mode_P, new_tarval_from_str ("VAR_A", 6, mode_P)), /* length 6 because of NULL */
                                  get_value(1, mode_Is)),
                        mode_M, 0));
 
index a3994e1..d2247f9 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 #define NUM_OF_LOCAL_VARS 0
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
-  tv = tarval_d_from_str ("12345678901234567890.1234567890", 31);
+  tv = new_tarval_from_str ("12345678901234567890.1234567890", 31, mode_D);
 
 
 
index 9e7ba99..1d15440 100644 (file)
@@ -89,15 +89,15 @@ main(void)
   set_value (a_pos, new_Proj (get_irg_args(irg), mode_Is, 0));
   /* Generate the constant and assign it to b. The assignment is resovled to a
      dataflow edge. */
-  set_value (b_pos, new_Const (mode_Is, tarval_from_long (mode_Is, 2)));
+  set_value (b_pos, new_Const (mode_Is, new_tarval_from_long (2, mode_Is)));
   /* We know all predecessors of the block and all set_values and set_stores are
      preformed.   We can mature the block.  */
   mature_block (get_irg_current_block(irg));
 
   /* Generate a conditional branch */
   cmp = new_Cmp(get_value(a_pos, mode_Is), get_value(b_pos, mode_Is)); /*
-  cmp = new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 2)),
-                new_Const (mode_Is, tarval_from_long (mode_Is, 2)));*/
+  cmp = new_Cmp(new_Const (mode_Is, new_tarval_from_long (2, mode_Is)),
+                new_Const (mode_Is, new_tarval_from_long (2, mode_Is)));*/
   x = new_Cond (new_Proj(cmp, mode_b, Eq));
   f = new_Proj (x, mode_X, 0);
   t = new_Proj (x, mode_X, 1);
@@ -106,7 +106,7 @@ main(void)
   r = new_immBlock ();
   add_in_edge (r, t);
   a = new_Sub(get_value(a_pos, mode_Is),
-              new_Const (mode_Is, tarval_from_long (mode_Is, 3)),
+              new_Const (mode_Is, new_tarval_from_long (3, mode_Is)),
              mode_Is);
   set_value (a_pos, a);
 
@@ -117,9 +117,9 @@ main(void)
   r = new_immBlock ();
   add_in_edge (r, f);
   a = new_Sub(get_value(a_pos, mode_Is),
-              new_Const (mode_Is, tarval_from_long (mode_Is, 3)),
+              new_Const (mode_Is, new_tarval_from_long (3, mode_Is)),
              mode_Is);
-  a = new_Add(a, new_Const (mode_Is, tarval_from_long (mode_Is, 5)), mode_Is);
+  a = new_Add(a, new_Const (mode_Is, new_tarval_from_long (5, mode_Is)), mode_Is);
   set_value (a_pos, a);
 
   mature_block (r);
index 056b25b..243b24f 100644 (file)
@@ -90,7 +90,7 @@ int main(int argc, char **argv)
   i_ptr = new_simpleSel(get_store(), get_irg_globals(irg), i_ent);
 
   store = new_Store (get_store(), i_ptr,
-                    new_Const(mode_Is, tarval_from_long (mode_Is, 2)));
+                    new_Const(mode_Is, new_tarval_from_long (2, mode_Is)));
   set_store(new_Proj(store, mode_M, 0));
 
   {
index cd1a478..eae8dd9 100644 (file)
@@ -74,15 +74,15 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* Generate two constants */
-  c0 = new_Const (mode_Is, tarval_from_long (mode_Is, 0));
-  c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1));
+  c0 = new_Const (mode_Is, new_tarval_from_long (0, mode_Is));
+  c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
 
   /* set a and b to constants */
   set_value (0, c0);  /* this (0) is variable a */
   set_value (1, c1);  /* this (1) is variable b */
 
   /* the expression that evaluates the condition */
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
   cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, Gt);
 
   /* the conditional branch */
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
   /* generate and fill the else block */
   b = new_immBlock ();
   add_in_edge (b, f);
-  set_value (1, new_Const (mode_Is, tarval_from_long (mode_Is, 2)));
+  set_value (1, new_Const (mode_Is, new_tarval_from_long (2, mode_Is)));
   mature_block (b);
   x_else = new_Jmp ();
 
index 2d1f424..dc4d48d 100644 (file)
@@ -78,7 +78,7 @@ main(void)
   set_value (a_pos, new_Proj (get_irg_args(irg), mode_Is, 0));
   /* Generate the constant and assign it to b. The assignment is resovled to a
      dataflow edge. */
-  set_value (b_pos, new_Const (mode_Is, tarval_from_long (mode_Is, 2)));
+  set_value (b_pos, new_Const (mode_Is, new_tarval_from_long (2, mode_Is)));
   /* We know all predecessors of the block and all set_values and set_stores are
      preformed.   We can mature the block.  */
   mature_block (get_irg_current_block(irg));
@@ -93,7 +93,7 @@ main(void)
   r = new_immBlock ();
   add_in_edge (r, t);
   a = new_Sub(get_value(a_pos, mode_Is),
-              new_Const (mode_Is, tarval_from_long (mode_Is, 3)),
+              new_Const (mode_Is, new_tarval_from_long (3, mode_Is)),
              mode_Is);
   set_value (a_pos, a);
 
index 7c60272..abb1fc7 100644 (file)
@@ -73,8 +73,8 @@ main(void)
   irg = new_ir_graph (ent, 4);
 
   /* Generate two constants */
-  set_value (0, new_Const (mode_Iu, tarval_from_long (mode_Iu, 0)));
-  set_value (1, new_Const (mode_Iu, tarval_from_long (mode_Iu, 1)));
+  set_value (0, new_Const (mode_Iu, new_tarval_from_long (0, mode_Iu)));
+  set_value (1, new_Const (mode_Iu, new_tarval_from_long (1, mode_Iu)));
   mature_block (get_irg_current_block(irg));
 
   /* Generate a conditional branch */
@@ -89,8 +89,8 @@ main(void)
   /* generate a block for the loop header and the conditional branch */
   r = new_immBlock ();
   add_in_edge (r, x);
-  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Iu, tarval_from_long (mode_Is, 0)),
-                                 new_Const (mode_Iu, tarval_from_long (mode_Is, 0))),
+  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Iu, new_tarval_from_long (0, mode_Is)),
+                                 new_Const (mode_Iu, new_tarval_from_long (0, mode_Is))),
                          mode_b, Eq));
   f = new_Proj (x, mode_X, 0);
   t = new_Proj (x, mode_X, 1);
index 96e27ab..c3ad7a8 100644 (file)
@@ -82,9 +82,9 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* two make two conditionals that represent a switch */
-  expr = new_Const (mode_Is, tarval_from_long (mode_Is, 0));
-  c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1));
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
+  expr = new_Const (mode_Is, new_tarval_from_long (0, mode_Is));
+  c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
 
   cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
index 6d8da57..b974c73 100644 (file)
@@ -77,10 +77,10 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* to make three conditionals  */
-  expr = new_Const (mode_Is, tarval_from_long (mode_Is, 0));
-  c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1));
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
-  c3 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
+  expr = new_Const (mode_Is, new_tarval_from_long (0, mode_Is));
+  c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
+  c3 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
 
   cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
index 5e2706b..d135625 100644 (file)
@@ -85,16 +85,16 @@ main(void)
 
   /* generate two constant pointers to string constants */
   /* this simulates two global variables, a and b point to these variables */
-  a = new_Const (mode_P, tarval_P_from_str ("VAR_A"));
-  b = new_Const (mode_P, tarval_P_from_str ("VAR_B"));
+  a = new_Const (mode_P, new_tarval_from_str ("VAR_A", 6, mode_P)); /* length 6 because of NULL terminator */
+  b = new_Const (mode_P, new_tarval_from_str ("VAR_B", 6, mode_P));
 
   /* set VAR_A and VAR_B to constant values */
   set_store (new_Proj (new_Store (get_store (), a,
-                                 new_Const (mode_Iu, tarval_from_long (mode_Is, 0))),
+                                 new_Const (mode_Iu, new_tarval_from_long (0, mode_Is))),
                        mode_M, 0));
 
   set_store (new_Proj (new_Store (get_store (), b,
-                                 new_Const (mode_Iu, tarval_from_long (mode_Is, 1))),
+                                 new_Const (mode_Iu, new_tarval_from_long (1, mode_Is))),
                        mode_M, 0));
 
   /* finish this first block */
@@ -122,7 +122,7 @@ main(void)
   x = new_Cond (
         new_Proj (
           new_Cmp (
-            new_Const (mode_Iu, tarval_from_long (mode_Is, 0)),
+            new_Const (mode_Iu, new_tarval_from_long (0, mode_Is)),
             x),
           mode_b, Gt));
 
index af2122c..b3aded4 100644 (file)
@@ -115,8 +115,8 @@ main(void)
   set_irp_main_irg(main_irg);
 
   /* Make the constants.  They are independent of a block. */
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
-  c5 = new_Const (mode_Is, tarval_from_long (mode_Is, 5));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
+  c5 = new_Const (mode_Is, new_tarval_from_long (5, mode_Is));
 
   /* There is only one block in main, it contains the allocation and the calls. */
   /* Allocate the defined object and generate the type information. */
@@ -215,7 +215,7 @@ main(void)
   set_value(0, self);
   par1 = new_Proj(get_irg_args(c_irg), mode_Is, 1);
   set_value(1, par1);
-  set_value(2, new_Const (mode_Is, tarval_from_long (mode_Is, 0)));
+  set_value(2, new_Const (mode_Is, new_tarval_from_long (0, mode_Is)));
 
   x = new_Jmp();
   mature_block (get_irg_current_block(c_irg));
@@ -223,11 +223,11 @@ main(void)
   /* generate a block for the loop header and the conditional branch */
   r = new_immBlock ();
   add_in_edge (r, x);
-  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 0)),
-                                new_Const (mode_Is, tarval_from_long (mode_Is, 0))),
+  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
+                                new_Const (mode_Is, new_tarval_from_long (0, mode_Is))),
                         mode_b, Eq));
 
-  /*  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 0)),
+  /*  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
                                 get_value(1, mode_Is)),
                                 mode_b, Eq));*/
   f = new_Proj (x, mode_X, 0);
index dcd5ca0..a29456b 100644 (file)
@@ -110,8 +110,8 @@ main(void)
   set_irp_main_irg(main_irg);
 
   /* Make the constants.  They are independent of a block. */
-  c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
-  c5 = new_Const (mode_Is, tarval_from_long (mode_Is, 5));
+  c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
+  c5 = new_Const (mode_Is, new_tarval_from_long (5, mode_Is));
 
   /* There is only one block in main, it contains the allocation and the calls. */
   /* Allocate the defined object and generate the type information. */
index 51a04e1..51ec8ad 100644 (file)
@@ -91,12 +91,12 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* to make a condition  */
-  c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1));
+  c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
   c2 = new_Proj (get_irg_args(irg), mode_Is, 0);
   set_value(1, c2);
 
   cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq));
-  set_value(0, new_Const (mode_Is, tarval_from_long (mode_Is, 6)));
+  set_value(0, new_Const (mode_Is, new_tarval_from_long (6, mode_Is)));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
   mature_block(get_irg_current_block(irg));
@@ -108,7 +108,7 @@ int main(int argc, char **argv)
   Block1 = new_immBlock();
   add_in_edge(Block1, t);
   mature_block(Block1);
-  set_value(0, new_Const (mode_Is, tarval_from_long (mode_Is, 5)));
+  set_value(0, new_Const (mode_Is, new_tarval_from_long (5, mode_Is)));
   jmp = new_Jmp();
   add_in_edge(endBlock, jmp);
 
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
   scndCondBlock = new_immBlock();
   add_in_edge(scndCondBlock, f);
   mature_block(scndCondBlock);
-  c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 3));
+  c1 = new_Const (mode_Is, new_tarval_from_long (3, mode_Is));
   cond = new_Cond(new_Proj(new_Cmp(c1, get_value(1, mode_Is)), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
index 6039d45..b49afbb 100644 (file)
@@ -69,7 +69,7 @@ main(void)
 
   /* Generate two values */
   set_value (0, new_Proj(get_irg_args(irg), mode_Is, 0));
-  set_value (1, new_Const (mode_Is, tarval_from_long (mode_Is, 1)));
+  set_value (1, new_Const (mode_Is, new_tarval_from_long (1, mode_Is)));
   x = new_Jmp();
   mature_block (get_irg_current_block(irg));
 
@@ -77,7 +77,7 @@ main(void)
   /* generate a block for the loop header and the conditional branch */
   r = new_immBlock ();
   add_in_edge (r, x);
-  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 0)),
+  x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, new_tarval_from_long (0, mode_Is)),
                                 get_value(1, mode_Is)),
                          mode_b, Eq));
   f = new_Proj (x, mode_X, 0);