From: Götz Lindenmaier Date: Wed, 26 Mar 2003 09:46:31 +0000 (+0000) Subject: Adapted to changes in tv and irmode X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=13588bfa29b57530c70851264dd5ea05184b9486;p=libfirm Adapted to changes in tv and irmode [r983] --- diff --git a/ir/adt/cookies.h b/ir/adt/cookies.h index 1517caa21..7a641a52f 100644 --- a/ir/adt/cookies.h +++ b/ir/adt/cookies.h @@ -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 diff --git a/ir/ana/cgana.c b/ir/ana/cgana.c index 016ce5b79..a5ac9efd2 100644 --- a/ir/ana/cgana.c +++ b/ir/ana/cgana.c @@ -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; } diff --git a/ir/common/firm.c b/ir/common/firm.c index 3fdc5dff2..c1bd93c09 100644 --- a/ir/common/firm.c +++ b/ir/common/firm.c @@ -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 */ diff --git a/ir/ident/ident.c b/ir/ident/ident.c index 22d15c233..e541c6f8f 100644 --- a/ir/ident/ident.c +++ b/ir/ident/ident.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "ident_t.h" #include "array.h" diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 52037bae5..5497c528f 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -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. */ diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index 0f20d7a6c..0bbec9c1c 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -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); } diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 02aa313dd..8012f8bef 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -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 * diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index a24ba9833..b33bcdfcb 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -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); diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 840883274..dd79853c6 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -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; } diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 5cf9e2ecc..6b6fc7aaf 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -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; diff --git a/ir/tr/trvrfy.h b/ir/tr/trvrfy.h index 58eb75be1..95040d442 100644 --- a/ir/tr/trvrfy.h +++ b/ir/tr/trvrfy.h @@ -18,6 +18,7 @@ */ #include "firm.h" +#include "xprintf.h" /** * possible trvrfy() error codes diff --git a/ir/tr/type.c b/ir/tr/type.c index 933064fca..7c4137d1a 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -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; } diff --git a/testprograms/array-heap_example.c b/testprograms/array-heap_example.c index eeb7e222a..17eb09408 100644 --- a/testprograms/array-heap_example.c +++ b/testprograms/array-heap_example.c @@ -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; diff --git a/testprograms/array-stack_example.c b/testprograms/array-stack_example.c index af8eb0ef5..cda260196 100644 --- a/testprograms/array-stack_example.c +++ b/testprograms/array-stack_example.c @@ -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; diff --git a/testprograms/call_str_example.c b/testprograms/call_str_example.c index 19e5082ac..45efbecbb 100644 --- a/testprograms/call_str_example.c +++ b/testprograms/call_str_example.c @@ -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 diff --git a/testprograms/cond_example.c b/testprograms/cond_example.c index dfbbcf6a2..bbaeaf0db 100644 --- a/testprograms/cond_example.c +++ b/testprograms/cond_example.c @@ -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 (); diff --git a/testprograms/const_ent_example.c b/testprograms/const_ent_example.c index db52efb73..928dbe928 100644 --- a/testprograms/const_ent_example.c +++ b/testprograms/const_ent_example.c @@ -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"); diff --git a/testprograms/const_eval_example.c b/testprograms/const_eval_example.c index 66c21f437..d90f1062b 100644 --- a/testprograms/const_eval_example.c +++ b/testprograms/const_eval_example.c @@ -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); { diff --git a/testprograms/dead_block_example.c b/testprograms/dead_block_example.c index 5a4d04002..7493d7c00 100644 --- a/testprograms/dead_block_example.c +++ b/testprograms/dead_block_example.c @@ -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)); diff --git a/testprograms/endless_loop.c b/testprograms/endless_loop.c index e4b098833..5f2fe4669 100644 --- a/testprograms/endless_loop.c +++ b/testprograms/endless_loop.c @@ -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)); diff --git a/testprograms/float_example.c b/testprograms/float_example.c index a3994e1a7..d2247f9d9 100644 --- a/testprograms/float_example.c +++ b/testprograms/float_example.c @@ -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); diff --git a/testprograms/global_cse.c b/testprograms/global_cse.c index 9e7ba99c0..1d1544066 100644 --- a/testprograms/global_cse.c +++ b/testprograms/global_cse.c @@ -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); diff --git a/testprograms/global_var_example.c b/testprograms/global_var_example.c index 056b25bb4..243b24f46 100644 --- a/testprograms/global_var_example.c +++ b/testprograms/global_var_example.c @@ -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)); { diff --git a/testprograms/if_else_example.c b/testprograms/if_else_example.c index cd1a4783b..eae8dd95e 100644 --- a/testprograms/if_else_example.c +++ b/testprograms/if_else_example.c @@ -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 (); diff --git a/testprograms/if_example.c b/testprograms/if_example.c index 2d1f424b0..dc4d48d3a 100644 --- a/testprograms/if_example.c +++ b/testprograms/if_example.c @@ -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); diff --git a/testprograms/if_while_example.c b/testprograms/if_while_example.c index 7c60272e5..abb1fc76a 100644 --- a/testprograms/if_while_example.c +++ b/testprograms/if_while_example.c @@ -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); diff --git a/testprograms/irr_cf_example.c b/testprograms/irr_cf_example.c index 96e27ab25..c3ad7a866 100644 --- a/testprograms/irr_cf_example.c +++ b/testprograms/irr_cf_example.c @@ -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); diff --git a/testprograms/irr_loop_example.c b/testprograms/irr_loop_example.c index 6d8da5733..b974c73a8 100644 --- a/testprograms/irr_loop_example.c +++ b/testprograms/irr_loop_example.c @@ -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); diff --git a/testprograms/memory_example.c b/testprograms/memory_example.c index 5e2706b43..d13562550 100644 --- a/testprograms/memory_example.c +++ b/testprograms/memory_example.c @@ -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)); diff --git a/testprograms/oo_inline_example.c b/testprograms/oo_inline_example.c index af2122c17..b3aded472 100644 --- a/testprograms/oo_inline_example.c +++ b/testprograms/oo_inline_example.c @@ -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); diff --git a/testprograms/oo_program_example.c b/testprograms/oo_program_example.c index dcd5ca0ea..a29456b31 100644 --- a/testprograms/oo_program_example.c +++ b/testprograms/oo_program_example.c @@ -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. */ diff --git a/testprograms/three_cfpred_example.c b/testprograms/three_cfpred_example.c index 51a04e13c..51ec8adc8 100644 --- a/testprograms/three_cfpred_example.c +++ b/testprograms/three_cfpred_example.c @@ -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); diff --git a/testprograms/while_example.c b/testprograms/while_example.c index 6039d4507..b49afbb01 100644 --- a/testprograms/while_example.c +++ b/testprograms/while_example.c @@ -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);