From 6ed168c29789db8edf25c87f2da9164c49a5512c Mon Sep 17 00:00:00 2001 From: Matthias Heil Date: Wed, 4 Dec 2002 11:21:34 +0000 Subject: [PATCH] Changed testprograms to work with new tarval interface [r529] --- testprograms/array-heap_example.c | 16 ++++----- testprograms/array-stack_example.c | 12 +++---- testprograms/call_str_example.c | 4 +-- testprograms/cond_example.c | 24 +++++++------- testprograms/const_ent_example.c | 14 ++++---- testprograms/const_eval_example.c | 22 ++++++------- testprograms/dead_block_example.c | 8 ++--- testprograms/endless_loop.c | 22 ++++++------- testprograms/float_example.c | 4 +-- testprograms/global_cse.c | 28 ++++++++-------- testprograms/global_var_example.c | 4 +-- testprograms/if_else_example.c | 18 +++++------ testprograms/if_example.c | 16 ++++----- testprograms/if_while_example.c | 18 +++++------ testprograms/inheritance_example.c | 2 +- testprograms/irr_cf_example.c | 6 ++-- testprograms/irr_loop_example.c | 8 ++--- testprograms/memory_example.c | 18 +++++------ testprograms/oo_inline_example.c | 50 ++++++++++++++--------------- testprograms/oo_program_example.c | 32 +++++++++--------- testprograms/three_cfpred_example.c | 16 ++++----- testprograms/while_example.c | 18 +++++------ 22 files changed, 180 insertions(+), 180 deletions(-) diff --git a/testprograms/array-heap_example.c b/testprograms/array-heap_example.c index 6bd331c29..9c07f244c 100644 --- a/testprograms/array-heap_example.c +++ b/testprograms/array-heap_example.c @@ -76,7 +76,7 @@ main(void) This is the modeling appropriate for other languages. Mode_i says that all integers shall be implemented as a 32 bit integer value. */ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); printf("\nCreating an IR graph: ARRAY-HEAP_EXAMPLE...\n"); @@ -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_I, tarval_from_long (mode_I, L_BOUND)), - new_Const(mode_I, tarval_from_long (mode_I, U_BOUND))); + new_Const(mode_Iu, tarval_from_long (mode_Iu, L_BOUND)), + new_Const(mode_Iu, tarval_from_long (mode_Iu, U_BOUND))); /* 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,11 +109,11 @@ 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_I, tarval_from_long (mode_I, size)); + arr_size = new_Const(mode_Iu, tarval_from_long (mode_Iu, size)); /* 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 */ - array_ptr = new_Proj(array, mode_p, 2); /* remember the pointer to the array */ + array_ptr = new_Proj(array, mode_P, 2); /* remember the pointer to the array */ /* Now the "real" program: */ /* Load element 3 of the array. For this first generate the pointer to this @@ -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_I, tarval_from_long (mode_I, 3)); + c3 = new_Const (mode_Iu, tarval_from_long (mode_Iu, 3)); { ir_node *in[1]; in[0] = c3; @@ -129,7 +129,7 @@ main(void) } val = new_Load(get_store(), elt); set_store(new_Proj(val, mode_M, 0)); - val = new_Proj(val, mode_i, 2); + val = new_Proj(val, mode_Is, 2); /* return the result of procedure main */ { @@ -158,5 +158,5 @@ main(void) printf("use xvcg to view these graphs:\n"); printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); - return (1); + return (0); } diff --git a/testprograms/array-stack_example.c b/testprograms/array-stack_example.c index e0655e0b5..715354370 100644 --- a/testprograms/array-stack_example.c +++ b/testprograms/array-stack_example.c @@ -68,7 +68,7 @@ main(void) This is the modeling appropriate for other languages. Mode_i says that all language-integers shall be implemented as a 32 bit processor-integer value. */ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* build typeinformation of procedure main */ owner = new_type_class (id_from_str ("ARRAY-STACK_EXAMPLE", 19)); @@ -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_I, tarval_from_long (mode_I, L_BOUND)), - new_Const(mode_I, tarval_from_long (mode_I, U_BOUND))); + new_Const(mode_Iu, tarval_from_long (mode_Iu, L_BOUND)), + new_Const(mode_Iu, tarval_from_long (mode_Iu, U_BOUND))); /* 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_I, tarval_from_long (mode_I, 3)); + c3 = new_Const (mode_Iu, tarval_from_long (mode_Iu, 3)); { ir_node *in[1]; in[0] = c3; @@ -113,7 +113,7 @@ main(void) } val = new_Load(get_store(), elt); set_store(new_Proj(val, mode_M, 0)); - val = new_Proj(val, mode_i, 2); + val = new_Proj(val, mode_Is, 2); /* return the result of procedure main */ { @@ -143,5 +143,5 @@ main(void) printf("Use xvcg to view these graphs:\n"); printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); - return (1); + return (0); } diff --git a/testprograms/call_str_example.c b/testprograms/call_str_example.c index 70202fb6a..b61bf2b4e 100644 --- a/testprograms/call_str_example.c +++ b/testprograms/call_str_example.c @@ -41,7 +41,7 @@ int main(int argc, char **argv) string_ptr = new_type_pointer ( id_from_str ("ptr_to_string", 13), new_type_array (id_from_str ("char_arr", 8), 1, - new_type_primitive (id_from_str("char", 4), mode_c))); + new_type_primitive (id_from_str("char", 4), mode_Bu))); /* FIRM was designed for oo languages where all methods belong to a class. * For imperative languages like C we view a program as a large class containing * all functions of the program as methods in this class. This class is @@ -78,7 +78,7 @@ 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!")); + const_str = new_Const (mode_P, tarval_P_from_str ("Hello world!")); /* 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 04798d85e..5d1c73f06 100644 --- a/testprograms/cond_example.c +++ b/testprograms/cond_example.c @@ -38,7 +38,7 @@ int main(int argc, char **argv) init_firm (); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* FIRM was designed for oo languages where all methods belong to a class. * For imperative languages like C we view a file as a large class containing @@ -65,26 +65,26 @@ int main(int argc, char **argv) irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS); /* get the first argument a of method main - see irgraph.h */ - arg1 = new_Proj(get_irg_args(irg), mode_i, 0); + arg1 = new_Proj(get_irg_args(irg), mode_Is, 0); /* arg1 as first first local variable - makes things simple */ set_value(0, arg1); /* the expression that evaluates the condition */ /* cmpGt = a > 2 */ - c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); - cmpGt = new_Proj(new_Cmp(get_value(0, mode_i), c2), mode_b, Gt); - cmpGt = new_Conv(cmpGt, mode_i); + c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2)); + 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_i, tarval_from_long (mode_i, 10)); - cmpLt = new_Proj(new_Cmp(get_value(0, mode_i), c10), mode_b, Lt); - cmpLt = new_Conv(cmpLt, mode_i); + c10 = new_Const (mode_Is, tarval_from_long (mode_Is, 10)); + 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_i); + 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_i, tarval_from_long (mode_i, 0))); + and = new_Cmp(and, new_Const (mode_Is, tarval_from_long (mode_Is, 0))); and = new_Proj(and, mode_b, Ne); /* the conditional branch */ @@ -97,7 +97,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_i, tarval_from_long (mode_i, 1))); + set_value (0, new_Const (mode_Is, tarval_from_long (mode_Is, 1))); mature_block (b); x_then = new_Jmp (); @@ -110,7 +110,7 @@ int main(int argc, char **argv) /* Generate the return node into current region. */ { ir_node *in[1]; /* this is the array containing the return parameters */ - in[0] = get_value(0, mode_i); + in[0] = get_value(0, mode_Is); x = new_Return (get_store(), 1, in); } /* Now generate all instructions for this block and all its predecessor blocks diff --git a/testprograms/const_ent_example.c b/testprograms/const_ent_example.c index 5ee7ae86c..f2e16d1a9 100644 --- a/testprograms/const_ent_example.c +++ b/testprograms/const_ent_example.c @@ -66,7 +66,7 @@ int main(int argc, char **argv) /** make the type information needed */ /* Language defined types */ - intt = new_type_primitive(inti, mode_i); + intt = new_type_primitive(inti, mode_Is); /* Program defined types */ Ct = new_type_class(Ci); ft = new_type_method(fti, 0, 0); /* 0 parameters, 0 results */ @@ -89,7 +89,7 @@ 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 */ - n = new_Const(mode_p, tarval_p_from_entity(dipte)); + n = new_Const(mode_P, tarval_p_from_entity(dipte)); set_entity_variability(diptpe, constant); set_atomic_ent_value(diptpe, n); @@ -109,7 +109,7 @@ int main(int argc, char **argv) /** The array type **/ /* Don't reuse int type so that graph layout is better readable */ - intt = new_type_primitive(inti, mode_i); + intt = new_type_primitive(inti, mode_Is); arrt = new_type_array(arrti, 1, intt); set_array_bounds_int(arrt, 0, 0, 4); arrelte = get_array_element_entity(arrt); @@ -118,13 +118,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_i, tarval_from_long (mode_i, 7)); + n = new_Const(mode_Is, tarval_from_long (mode_Is, 7)); add_compound_ent_value(arre, n, arrelte); - n = new_Const(mode_i, tarval_from_long (mode_i, 2)); + n = new_Const(mode_Is, tarval_from_long (mode_Is, 2)); add_compound_ent_value(arre, n, arrelte); - n = new_Const(mode_i, tarval_from_long (mode_i, 13)); + n = new_Const(mode_Is, tarval_from_long (mode_Is, 13)); add_compound_ent_value(arre, n, arrelte); - n = new_Const(mode_i, tarval_from_long (mode_i, 92)); + n = new_Const(mode_Is, tarval_from_long (mode_Is, 92)); 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 ba20d8f37..2bbe5b51c 100644 --- a/testprograms/const_eval_example.c +++ b/testprograms/const_eval_example.c @@ -41,7 +41,7 @@ main(void) init_firm (); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* Try both optimizations: */ set_opt_constant_folding(1); @@ -56,8 +56,8 @@ main(void) irg = new_ir_graph (ent, 4); - a = new_Const (mode_i, tarval_from_long (mode_i, 7)); - b = new_Const (mode_i, tarval_from_long (mode_i, 5)); + a = new_Const (mode_Is, tarval_from_long (mode_Is, 7)); + b = new_Const (mode_Is, tarval_from_long (mode_Is, 5)); x = new_Jmp (); mature_block (get_irg_current_block(irg)); @@ -65,16 +65,16 @@ main(void) /* To test const eval on DivMod c = new_DivMod(get_store(), a, b); set_store(new_Proj(c, mode_M, 0)); - d = new_Proj(c, mode_i, 3); - c = new_Proj(c, mode_i, 2); + d = new_Proj(c, mode_Is, 3); + c = new_Proj(c, mode_Is, 2); */ - c = new_Add (new_Const (mode_i, tarval_from_long (mode_i, 5)), - new_Const (mode_i, tarval_from_long (mode_i, 7)), - mode_i); - d = new_Add (new_Const (mode_i, tarval_from_long (mode_i, 7)), - new_Const (mode_i, tarval_from_long (mode_i, 5)), - mode_i); + c = new_Add (new_Const (mode_Is, tarval_from_long (mode_Is, 5)), + new_Const (mode_Is, tarval_from_long (mode_Is, 7)), + 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)), + mode_Is); { ir_node *in[2]; diff --git a/testprograms/dead_block_example.c b/testprograms/dead_block_example.c index cee4b0ce0..966210678 100644 --- a/testprograms/dead_block_example.c +++ b/testprograms/dead_block_example.c @@ -58,7 +58,7 @@ int main(int argc, char **argv) init_firm (); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* FIRM was designed for oo languages where all methods belong to a class. * For imperative languages like C we view a file as a large class containing @@ -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_i, tarval_from_long (mode_i, 1)); - c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); + c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1)); + c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2)); set_value(0, c2); cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq)); @@ -121,7 +121,7 @@ int main(int argc, char **argv) switch_block(endBlock); { ir_node *in[1]; - in[0] = get_value(0, mode_i); + in[0] = get_value(0, mode_Is); get_store(); x = new_Return (get_store(), 1, in); } diff --git a/testprograms/endless_loop.c b/testprograms/endless_loop.c index 5ec603940..01e0c2c3b 100644 --- a/testprograms/endless_loop.c +++ b/testprograms/endless_loop.c @@ -55,7 +55,7 @@ main(void) set_opt_global_cse(0); set_opt_dead_node_elimination (1); - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); #define METHODNAME "main_tp" #define NRARGS 1 @@ -74,8 +74,8 @@ main(void) irg = new_ir_graph (ent, 4); /* Generate two values */ - set_value (0, new_Proj(get_irg_args(irg), mode_i, 0)); - set_value (1, new_Const (mode_i, tarval_from_long (mode_i, 1))); + 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))); 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_i, tarval_from_long (mode_i, 0)), - new_Const (mode_i, tarval_from_long (mode_i, 0))), + 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))), mode_b, Eq)); f = new_Proj (x, mode_X, 0); t = new_Proj (x, mode_X, 1); @@ -98,14 +98,14 @@ main(void) /* The code in the loop body, as we are dealing with local variables only the dataflow edges are manipulated. */ - set_value (2, get_value (0, mode_i)); - set_value (0, get_value (1, mode_i)); - set_value (1, get_value (2, mode_i)); + set_value (2, get_value (0, mode_Is)); + set_value (0, get_value (1, mode_Is)); + set_value (1, get_value (2, mode_Is)); /* set VAR_A to constant value */ set_store (new_Proj (new_Store (get_store (), - new_Const (mode_p, tarval_p_from_str ("VAR_A")), - get_value(1, mode_i)), + new_Const (mode_P, tarval_P_from_str ("VAR_A")), + get_value(1, mode_Is)), mode_M, 0)); mature_block (b); @@ -118,7 +118,7 @@ main(void) { ir_node *in[1]; - in[0] = new_Sub (get_value (0, mode_i), get_value (1, mode_i), mode_i); + in[0] = new_Sub (get_value (0, mode_Is), get_value (1, mode_Is), mode_Is); x = new_Return (get_store (), 1, in); } diff --git a/testprograms/float_example.c b/testprograms/float_example.c index 3fc0248f4..c8cf6f0bd 100644 --- a/testprograms/float_example.c +++ b/testprograms/float_example.c @@ -52,7 +52,7 @@ int main(int argc, char **argv) #define NRARGS 0 #define NRES 1 /* The type of the method */ - prim_t_dbl = new_type_primitive(id_from_str ("dbl", 3), mode_d); + prim_t_dbl = new_type_primitive(id_from_str ("dbl", 3), mode_D); proc_main = new_type_method(id_from_str(METHODNAME, strlen(METHODNAME)), NRARGS, NRES); set_method_res_type(proc_main, 0, prim_t_dbl); @@ -80,7 +80,7 @@ int main(int argc, char **argv) { ir_node *in[1]; /* this is the array containing the return parameters */ - in[0] = new_Const(mode_d, tv); + in[0] = new_Const(mode_D, tv); x = new_Return (get_store(), 1, in); } /* Now we generated all instructions for this block and all its predecessor diff --git a/testprograms/global_cse.c b/testprograms/global_cse.c index 386b594e2..d81b393e6 100644 --- a/testprograms/global_cse.c +++ b/testprograms/global_cse.c @@ -69,7 +69,7 @@ main(void) /* The type int. This type is necessary to model the result and parameters the procedure. */ #define PRIM_NAME "int" - typ = new_type_primitive(id_from_str(PRIM_NAME, strlen(PRIM_NAME)), mode_i); + typ = new_type_primitive(id_from_str(PRIM_NAME, strlen(PRIM_NAME)), mode_Is); /* The parameter and result types of the procedure. */ set_method_param_type(proc_main, 0, typ); set_method_res_type(proc_main, 0, typ); @@ -86,18 +86,18 @@ main(void) /* Get the procedure parameter and assign it to the parameter variable a. */ - set_value (a_pos, new_Proj (get_irg_args(irg), mode_i, 0)); + 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_i, tarval_from_long (mode_i, 2))); + set_value (b_pos, new_Const (mode_Is, tarval_from_long (mode_Is, 2))); /* 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_i), get_value(b_pos, mode_i)); /* - cmp = new_Cmp(new_Const (mode_i, tarval_from_long (mode_i, 2)), - new_Const (mode_i, tarval_from_long (mode_i, 2)));*/ + 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)));*/ x = new_Cond (new_Proj(cmp, mode_b, Eq)); f = new_Proj (x, mode_X, 0); t = new_Proj (x, mode_X, 1); @@ -105,9 +105,9 @@ main(void) /* generate and fill the then block */ r = new_immBlock (); add_in_edge (r, t); - a = new_Sub(get_value(a_pos, mode_i), - new_Const (mode_i, tarval_from_long (mode_i, 3)), - mode_i); + a = new_Sub(get_value(a_pos, mode_Is), + new_Const (mode_Is, tarval_from_long (mode_Is, 3)), + mode_Is); set_value (a_pos, a); mature_block (r); @@ -116,10 +116,10 @@ main(void) /* generate the else block */ r = new_immBlock (); add_in_edge (r, f); - a = new_Sub(get_value(a_pos, mode_i), - new_Const (mode_i, tarval_from_long (mode_i, 3)), - mode_i); - a = new_Add(a, new_Const (mode_i, tarval_from_long (mode_i, 5)), mode_i); + a = new_Sub(get_value(a_pos, mode_Is), + new_Const (mode_Is, tarval_from_long (mode_Is, 3)), + mode_Is); + a = new_Add(a, new_Const (mode_Is, tarval_from_long (mode_Is, 5)), mode_Is); set_value (a_pos, a); mature_block (r); @@ -133,7 +133,7 @@ main(void) /* The Return statement */ { ir_node *in[1], *store ; - in[0] = get_value (a_pos, mode_i); + in[0] = get_value (a_pos, mode_Is); store = get_store(); x = new_Return (store, 1, in); diff --git a/testprograms/global_var_example.c b/testprograms/global_var_example.c index 816b248d3..503f1ea1b 100644 --- a/testprograms/global_var_example.c +++ b/testprograms/global_var_example.c @@ -50,7 +50,7 @@ int main(int argc, char **argv) This is the modeling appropriate for other languages. Mode_i says that all integers shall be implemented as a 32 bit integer value. */ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* FIRM was designed for oo languages where all methods belong to a class. * For imperative languages like C we view a file or compilation unit as @@ -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_i, tarval_from_long (mode_i, 2))); + new_Const(mode_Is, tarval_from_long (mode_Is, 2))); set_store(new_Proj(store, mode_M, 0)); { diff --git a/testprograms/if_else_example.c b/testprograms/if_else_example.c index 3be3a83d5..fd1345296 100644 --- a/testprograms/if_else_example.c +++ b/testprograms/if_else_example.c @@ -47,7 +47,7 @@ int main(int argc, char **argv) init_firm (); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* FIRM was designed for oo languages where all methods belong to a class. * For imperative languages like C we view a file as a large class containing @@ -74,16 +74,16 @@ int main(int argc, char **argv) irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS); /* Generate two constants */ - c0 = new_Const (mode_i, tarval_from_long (mode_i, 0)); - c1 = new_Const (mode_i, tarval_from_long (mode_i, 1)); + c0 = new_Const (mode_Is, tarval_from_long (mode_Is, 0)); + c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1)); /* 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_i, tarval_from_long (mode_i, 2)); - cmpGt = new_Proj(new_Cmp(get_value(0, mode_i), c2), mode_b, Gt); + c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2)); + cmpGt = new_Proj(new_Cmp(get_value(0, mode_Is), c2), mode_b, Gt); /* the conditional branch */ x = new_Cond (cmpGt); @@ -95,14 +95,14 @@ int main(int argc, char **argv) /* generate and fill the then block */ b = new_immBlock (); add_in_edge (b, t); - set_value (0, get_value(1, mode_i)); + set_value (0, get_value(1, mode_Is)); mature_block (b); x_then = new_Jmp (); /* generate and fill the else block */ b = new_immBlock (); add_in_edge (b, f); - set_value (1, new_Const (mode_i, tarval_from_long (mode_i, 2))); + set_value (1, new_Const (mode_Is, tarval_from_long (mode_Is, 2))); mature_block (b); x_else = new_Jmp (); @@ -114,8 +114,8 @@ int main(int argc, char **argv) /* Generate the return node into current region. */ { ir_node *in[2]; /* this is the array containing the return parameters */ - in[0] = get_value(0, mode_i); - in[1] = get_value(1, mode_i); + in[0] = get_value(0, mode_Is); + in[1] = get_value(1, mode_Is); x = new_Return (get_store(), 2, in); } /* Now generate all instructions for this block and all its predecessor diff --git a/testprograms/if_example.c b/testprograms/if_example.c index 794db2cfc..daf1b9cff 100644 --- a/testprograms/if_example.c +++ b/testprograms/if_example.c @@ -58,7 +58,7 @@ main(void) /* The type int. This type is necessary to model the result and parameters the procedure. */ #define PRIM_NAME "int" - typ = new_type_primitive(id_from_str(PRIM_NAME, strlen(PRIM_NAME)), mode_i); + typ = new_type_primitive(id_from_str(PRIM_NAME, strlen(PRIM_NAME)), mode_Is); /* The parameter and result types of the procedure. */ set_method_param_type(proc_main, 0, typ); set_method_res_type(proc_main, 0, typ); @@ -75,16 +75,16 @@ main(void) /* Get the procedure parameter and assign it to the parameter variable a. */ - set_value (a_pos, new_Proj (get_irg_args(irg), mode_i, 0)); + 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_i, tarval_from_long (mode_i, 2))); + set_value (b_pos, new_Const (mode_Is, tarval_from_long (mode_Is, 2))); /* 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_i), get_value(b_pos, mode_i)); + cmp = new_Cmp(get_value(a_pos, mode_Is), get_value(b_pos, 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); @@ -92,9 +92,9 @@ main(void) /* generate and fill the then block */ r = new_immBlock (); add_in_edge (r, t); - a = new_Sub(get_value(a_pos, mode_i), - new_Const (mode_i, tarval_from_long (mode_i, 3)), - mode_i); + a = new_Sub(get_value(a_pos, mode_Is), + new_Const (mode_Is, tarval_from_long (mode_Is, 3)), + mode_Is); set_value (a_pos, a); mature_block (r); @@ -108,7 +108,7 @@ main(void) /* The Return statement */ { ir_node *in[1], *store ; - in[0] = get_value (a_pos, mode_i); + in[0] = get_value (a_pos, mode_Is); store = get_store(); x = new_Return (store, 1, in); diff --git a/testprograms/if_while_example.c b/testprograms/if_while_example.c index 0e6a18a62..ad423a900 100644 --- a/testprograms/if_while_example.c +++ b/testprograms/if_while_example.c @@ -56,7 +56,7 @@ main(void) set_opt_dead_node_elimination (1); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_I); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Iu); #define METHODNAME "main" #define NRARGS 0 @@ -72,8 +72,8 @@ main(void) irg = new_ir_graph (ent, 4); /* Generate two constants */ - set_value (0, new_Const (mode_I, tarval_from_long (mode_I, 0))); - set_value (1, new_Const (mode_I, tarval_from_long (mode_I, 1))); + 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))); mature_block (get_irg_current_block(irg)); /* Generate a conditional branch */ @@ -88,8 +88,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_I, tarval_from_long (mode_i, 0)), - new_Const (mode_I, tarval_from_long (mode_i, 0))), + 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))), mode_b, Eq)); f = new_Proj (x, mode_X, 0); t = new_Proj (x, mode_X, 1); @@ -104,9 +104,9 @@ main(void) /* the code in the loop body, as we are dealing with local variables only the dataflow edges are manipulated */ - set_value (2, get_value (0, mode_I)); - set_value (0, get_value (1, mode_I)); - set_value (1, get_value (2, mode_I)); + set_value (2, get_value (0, mode_Iu)); + set_value (0, get_value (1, mode_Iu)); + set_value (1, get_value (2, mode_Iu)); mature_block (b); /* generate the return block */ @@ -116,7 +116,7 @@ main(void) { ir_node *in[1]; - in[0] = new_Sub (get_value (0, mode_I), get_value (1, mode_I), mode_I); + in[0] = new_Sub (get_value (0, mode_Iu), get_value (1, mode_Iu), mode_Iu); x = new_Return (get_store (), 1, in); } diff --git a/testprograms/inheritance_example.c b/testprograms/inheritance_example.c index c823b9fb4..561ae165c 100644 --- a/testprograms/inheritance_example.c +++ b/testprograms/inheritance_example.c @@ -63,7 +63,7 @@ int main(int argc, char **argv) /** make the type information needed */ /* Language defined types */ - intt = new_type_primitive(inti, mode_I); + intt = new_type_primitive(inti, mode_Iu); /* Program defined types */ it = new_type_class(ii); /* The fact that this is an interface is of no interest. It's just a class without diff --git a/testprograms/irr_cf_example.c b/testprograms/irr_cf_example.c index 3ba342059..691aba7c2 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_i, tarval_from_long (mode_i, 0)); - c1 = new_Const (mode_i, tarval_from_long (mode_i, 1)); - c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); + 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)); 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 f7546c1dd..485881e37 100644 --- a/testprograms/irr_loop_example.c +++ b/testprograms/irr_loop_example.c @@ -76,10 +76,10 @@ int main(int argc, char **argv) irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS); /* to make three conditionals */ - expr = new_Const (mode_i, tarval_from_long (mode_i, 0)); - c1 = new_Const (mode_i, tarval_from_long (mode_i, 1)); - c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); - c3 = new_Const (mode_i, tarval_from_long (mode_i, 2)); + 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)); 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 c571c8720..c56ef8f66 100644 --- a/testprograms/memory_example.c +++ b/testprograms/memory_example.c @@ -71,7 +71,7 @@ main(void) set_opt_dead_node_elimination (1); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_I); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Iu); /* a class to get started with, containing the main procedure */ owner = new_type_class (id_from_str ("MEMORY_EXAMPLE", 14)); @@ -84,16 +84,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, tarval_P_from_str ("VAR_A")); + b = new_Const (mode_P, tarval_P_from_str ("VAR_B")); /* set VAR_A and VAR_B to constant values */ set_store (new_Proj (new_Store (get_store (), a, - new_Const (mode_I, tarval_from_long (mode_i, 0))), + new_Const (mode_Iu, tarval_from_long (mode_Is, 0))), mode_M, 0)); set_store (new_Proj (new_Store (get_store (), b, - new_Const (mode_I, tarval_from_long (mode_i, 1))), + new_Const (mode_Iu, tarval_from_long (mode_Is, 1))), mode_M, 0)); /* finish this first block */ @@ -108,11 +108,11 @@ main(void) /* load the value and make it's effects visible. */ x = new_Load (get_store (), a); set_store (new_Proj (x, mode_M, 0)); - x = new_Proj(x, mode_I, 2); + x = new_Proj(x, mode_Iu, 2); /* the same again: load the value and make it's effects visible. */ y = new_Load (get_store (), b); set_store (new_Proj (y, mode_M, 0)); - y = new_Proj(y, mode_I, 2); + y = new_Proj(y, mode_Iu, 2); /* store the exchanged values. */ set_store (new_Proj (new_Store (get_store (), a, y), mode_M, 0)); set_store (new_Proj (new_Store (get_store (), b, x), mode_M, 0)); @@ -121,7 +121,7 @@ main(void) x = new_Cond ( new_Proj ( new_Cmp ( - new_Const (mode_I, tarval_from_long (mode_i, 0)), + new_Const (mode_Iu, tarval_from_long (mode_Is, 0)), x), mode_b, Gt)); @@ -138,7 +138,7 @@ main(void) { ir_node *in[1]; x = new_Load (get_store (), a); - in[0] = new_Proj (x, mode_I, 2); + in[0] = new_Proj (x, mode_Iu, 2); x = new_Return (new_Proj(x, mode_M, 0), 1, in); } diff --git a/testprograms/oo_inline_example.c b/testprograms/oo_inline_example.c index 2821b88da..69bdb2531 100644 --- a/testprograms/oo_inline_example.c +++ b/testprograms/oo_inline_example.c @@ -67,7 +67,7 @@ main(void) set_opt_dead_node_elimination(1); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /*** Make type information for the class (PRIMA). ***/ /* The type of the class */ @@ -115,26 +115,26 @@ main(void) set_irp_main_irg(main_irg); /* Make the constants. They are independent of a block. */ - c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); - c5 = new_Const (mode_i, tarval_from_long (mode_i, 5)); + c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2)); + c5 = new_Const (mode_Is, tarval_from_long (mode_Is, 5)); /* There is only one block in main, it contains the allocation and the calls. */ /* Allocate the defined object and generate the type information. */ obj_size = new_SymConst((type_or_id_p)class_prima, size); obj_o = new_Alloc(get_store(), obj_size, class_prima, heap_alloc); set_store(new_Proj(obj_o, mode_M, 0)); /* make the changed memory visible */ - obj_o = new_Proj(obj_o, mode_p, 2); /* remember the pointer to the object */ + obj_o = new_Proj(obj_o, mode_P, 2); /* remember the pointer to the object */ set_value(o_pos, obj_o); /* Get the pointer to the procedure from the object. */ proc_ptr = new_simpleSel(get_store(), /* The memory containing the object. */ - get_value(o_pos, mode_p),/* The pointer to the object. */ + get_value(o_pos, mode_P),/* The pointer to the object. */ proc_set_a_e ); /* The feature to select. */ /* Call procedure set_a, first built array with parameters. */ { ir_node *in[2]; - in[0] = get_value(o_pos, mode_p); + in[0] = get_value(o_pos, mode_P); in[1] = c2; set_a_call = new_Call(get_store(), proc_ptr, 2, in, proc_set_a); @@ -143,12 +143,12 @@ main(void) set_store(new_Proj(set_a_call, mode_M, 0)); /* Get the pointer to the nest procedure from the object. */ - proc_ptr = new_simpleSel(get_store(), get_value(o_pos, mode_p), proc_c_e); + proc_ptr = new_simpleSel(get_store(), get_value(o_pos, mode_P), proc_c_e); /* call procedure c, first built array with parameters */ { ir_node *in[2]; - in[0] = get_value(o_pos, mode_p); + in[0] = get_value(o_pos, mode_P); in[1] = c5; c_call = new_Call(get_store(), proc_ptr, 2, in, proc_c); } @@ -156,7 +156,7 @@ main(void) set_store(new_Proj(c_call, mode_M, 0)); /* Get the result of the procedure: select the result tuple from the call, then the proper result from the tuple. */ - res = new_Proj(new_Proj(c_call, mode_T, 2), mode_i, 0); + res = new_Proj(new_Proj(c_call, mode_T, 2), mode_Is, 0); /* return the results of procedure main */ { @@ -182,9 +182,9 @@ main(void) self_pos = 0; e_pos = 1; /* get the procedure parameter */ - self = new_Proj(get_irg_args(set_a_irg), mode_p, 0); + self = new_Proj(get_irg_args(set_a_irg), mode_P, 0); set_value(self_pos, self); - par1 = new_Proj(get_irg_args(set_a_irg), mode_i, 1); + par1 = new_Proj(get_irg_args(set_a_irg), mode_Is, 1); set_value(e_pos, par1); /* Create and select the entity to set */ a_ptr = new_simpleSel(get_store(), self, a_e); @@ -211,11 +211,11 @@ main(void) c_irg = new_ir_graph (proc_c_e, 5); /* get the procedure parameter */ - self = new_Proj(get_irg_args(c_irg), mode_p, 0); + self = new_Proj(get_irg_args(c_irg), mode_P, 0); set_value(0, self); - par1 = new_Proj(get_irg_args(c_irg), mode_i, 1); + par1 = new_Proj(get_irg_args(c_irg), mode_Is, 1); set_value(1, par1); - set_value(2, new_Const (mode_i, tarval_from_long (mode_i, 0))); + set_value(2, new_Const (mode_Is, tarval_from_long (mode_Is, 0))); x = new_Jmp(); mature_block (get_irg_current_block(c_irg)); @@ -223,12 +223,12 @@ 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_i, tarval_from_long (mode_i, 0)), - new_Const (mode_i, tarval_from_long (mode_i, 0))), + 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))), mode_b, Eq)); - /* x = new_Cond (new_Proj(new_Cmp(new_Const (mode_i, tarval_from_long (mode_i, 0)), - get_value(1, mode_i)), + /* x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 0)), + get_value(1, mode_Is)), mode_b, Eq));*/ f = new_Proj (x, mode_X, 0); t = new_Proj (x, mode_X, 1); @@ -240,11 +240,11 @@ main(void) /* The code in the loop body, as we are dealing with local variables only the dataflow edges are manipulated. */ - set_value (3, get_value (1, mode_i)); - set_value (1, get_value (2, mode_i)); - set_value (2, get_value (3, mode_i)); + set_value (3, get_value (1, mode_Is)); + set_value (1, get_value (2, mode_Is)); + set_value (2, get_value (3, mode_Is)); a_ptr = new_simpleSel(get_store(), self, a_e); - set_store(new_Store(get_store(), a_ptr, get_value(2, mode_i))); + set_store(new_Store(get_store(), a_ptr, get_value(2, mode_Is))); x = new_Jmp (); add_in_edge(r, x); mature_block (b); @@ -257,12 +257,12 @@ main(void) a_ptr = new_simpleSel(get_store(), self, a_e); a_val = new_Load(get_store(), a_ptr); set_store(new_Proj(a_val, mode_M, 0)); - a_val = new_Proj(a_val, mode_i, 2); + a_val = new_Proj(a_val, mode_Is, 2); /* return the result */ { ir_node *in[1]; - in[0] = new_Add(par1, a_val, mode_i); + in[0] = new_Add(par1, a_val, mode_Is); x = new_Return (get_store (), 1, in); } @@ -300,5 +300,5 @@ main(void) printf("Use xvcg to view these graphs:\n"); printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); - return (1); + return (0); } diff --git a/testprograms/oo_program_example.c b/testprograms/oo_program_example.c index 75caa394c..8339fa130 100644 --- a/testprograms/oo_program_example.c +++ b/testprograms/oo_program_example.c @@ -62,7 +62,7 @@ main(void) set_opt_dead_node_elimination(1); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /*** Make type information for the class (PRIMA). ***/ /* The type of the class */ @@ -110,26 +110,26 @@ main(void) set_irp_main_irg(main_irg); /* Make the constants. They are independent of a block. */ - c2 = new_Const (mode_i, tarval_from_long (mode_i, 2)); - c5 = new_Const (mode_i, tarval_from_long (mode_i, 5)); + c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2)); + c5 = new_Const (mode_Is, tarval_from_long (mode_Is, 5)); /* There is only one block in main, it contains the allocation and the calls. */ /* Allocate the defined object and generate the type information. */ obj_size = new_SymConst((type_or_id_p)class_prima, size); obj_o = new_Alloc(get_store(), obj_size, class_prima, heap_alloc); set_store(new_Proj(obj_o, mode_M, 0)); /* make the changed memory visible */ - obj_o = new_Proj(obj_o, mode_p, 2); /* remember the pointer to the object */ + obj_o = new_Proj(obj_o, mode_P, 2); /* remember the pointer to the object */ set_value(o_pos, obj_o); /* Get the pointer to the procedure from the object. */ proc_ptr = new_simpleSel(get_store(), /* The memory containing the object. */ - get_value(o_pos, mode_p),/* The pointer to the object. */ + get_value(o_pos, mode_P),/* The pointer to the object. */ proc_set_a_e ); /* The feature to select. */ /* Call procedure set_a, first built array with parameters. */ { ir_node *in[2]; - in[0] = get_value(o_pos, mode_p); + in[0] = get_value(o_pos, mode_P); in[1] = c2; call = new_Call(get_store(), proc_ptr, 2, in, proc_set_a); } @@ -137,12 +137,12 @@ main(void) set_store(new_Proj(call, mode_M, 0)); /* Get the pointer to the nest procedure from the object. */ - proc_ptr = new_simpleSel(get_store(), get_value(o_pos, mode_p), proc_c_e); + proc_ptr = new_simpleSel(get_store(), get_value(o_pos, mode_P), proc_c_e); /* call procedure c, first built array with parameters */ { ir_node *in[2]; - in[0] = get_value(o_pos, mode_p); + in[0] = get_value(o_pos, mode_P); in[1] = c5; call = new_Call(get_store(), proc_ptr, 2, in, proc_c); } @@ -150,7 +150,7 @@ main(void) set_store(new_Proj(call, mode_M, 0)); /* Get the result of the procedure: select the result tuple from the call, then the proper result from the tuple. */ - res = new_Proj(new_Proj(call, mode_T, 2), mode_i, 0); + res = new_Proj(new_Proj(call, mode_T, 2), mode_Is, 0); /* return the results of procedure main */ { @@ -176,9 +176,9 @@ main(void) self_pos = 0; e_pos = 1; /* get the procedure parameter */ - self = new_Proj(get_irg_args(set_a_irg), mode_p, 0); + self = new_Proj(get_irg_args(set_a_irg), mode_P, 0); set_value(self_pos, self); - par1 = new_Proj(get_irg_args(set_a_irg), mode_i, 1); + par1 = new_Proj(get_irg_args(set_a_irg), mode_Is, 1); set_value(e_pos, par1); /* Create and select the entity to set */ a_ptr = new_simpleSel(get_store(), self, a_e); @@ -205,19 +205,19 @@ main(void) c_irg = new_ir_graph (proc_c_e, 2); /* get the procedure parameter */ - self = new_Proj(get_irg_args(c_irg), mode_p, 0); - par1 = new_Proj(get_irg_args(c_irg), mode_i, 1); + self = new_Proj(get_irg_args(c_irg), mode_P, 0); + par1 = new_Proj(get_irg_args(c_irg), mode_Is, 1); /* Select the entity and load the value */ a_ptr = new_simpleSel(get_store(), self, a_e); a_val = new_Load(get_store(), a_ptr); set_store(new_Proj(a_val, mode_M, 0)); - a_val = new_Proj(a_val, mode_i, 2); + a_val = new_Proj(a_val, mode_Is, 2); /* return the result */ { ir_node *in[1]; - in[0] = new_Add(par1, a_val, mode_i); + in[0] = new_Add(par1, a_val, mode_Is); x = new_Return (get_store (), 1, in); } @@ -246,5 +246,5 @@ main(void) printf("Use xvcg to view these graphs:\n"); printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); - return (1); + return (0); } diff --git a/testprograms/three_cfpred_example.c b/testprograms/three_cfpred_example.c index 971b32586..4702029f9 100644 --- a/testprograms/three_cfpred_example.c +++ b/testprograms/three_cfpred_example.c @@ -64,7 +64,7 @@ int main(int argc, char **argv) set_optimize(1); /*** Make basic type information for primitive type int. ***/ - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); /* FIRM was designed for oo languages where all methods belong to a class. * For imperative languages like C we view a file as a large class containing @@ -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_i, tarval_from_long (mode_i, 1)); - c2 = new_Proj (get_irg_args(irg), mode_i, 0); + c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1)); + 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_i, tarval_from_long (mode_i, 6))); + set_value(0, new_Const (mode_Is, tarval_from_long (mode_Is, 6))); 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_i, tarval_from_long (mode_i, 5))); + set_value(0, new_Const (mode_Is, tarval_from_long (mode_Is, 5))); jmp = new_Jmp(); add_in_edge(endBlock, jmp); @@ -116,8 +116,8 @@ int main(int argc, char **argv) scndCondBlock = new_immBlock(); add_in_edge(scndCondBlock, f); mature_block(scndCondBlock); - c1 = new_Const (mode_i, tarval_from_long (mode_i, 3)); - cond = new_Cond(new_Proj(new_Cmp(c1, get_value(1, mode_i)), mode_b, Eq)); + c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 3)); + 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); mature_block(get_irg_current_block(irg)); @@ -140,7 +140,7 @@ int main(int argc, char **argv) switch_block(endBlock); { ir_node *in[1]; - in[0] = get_value(0, mode_i); + in[0] = get_value(0, mode_Is); x = new_Return (get_store(), 1, in); } mature_block (get_irg_current_block(irg)); diff --git a/testprograms/while_example.c b/testprograms/while_example.c index 0a86f073f..f31406f3b 100644 --- a/testprograms/while_example.c +++ b/testprograms/while_example.c @@ -49,7 +49,7 @@ main(void) set_opt_cse(1); set_opt_dead_node_elimination (1); - prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_i); + prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is); #define METHODNAME "main_tp" #define NRARGS 1 @@ -68,8 +68,8 @@ main(void) irg = new_ir_graph (ent, 4); /* Generate two values */ - set_value (0, new_Proj(get_irg_args(irg), mode_i, 0)); - set_value (1, new_Const (mode_i, tarval_from_long (mode_i, 1))); + 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))); x = new_Jmp(); mature_block (get_irg_current_block(irg)); @@ -77,8 +77,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_i, tarval_from_long (mode_i, 0)), - get_value(1, mode_i)), + x = new_Cond (new_Proj(new_Cmp(new_Const (mode_Is, tarval_from_long (mode_Is, 0)), + get_value(1, mode_Is)), mode_b, Eq)); f = new_Proj (x, mode_X, 0); t = new_Proj (x, mode_X, 1); @@ -92,9 +92,9 @@ main(void) /* The code in the loop body, as we are dealing with local variables only the dataflow edges are manipulated. */ - set_value (2, get_value (0, mode_i)); - set_value (0, get_value (1, mode_i)); - set_value (1, get_value (2, mode_i)); + set_value (2, get_value (0, mode_Is)); + set_value (0, get_value (1, mode_Is)); + set_value (1, get_value (2, mode_Is)); mature_block (b); mature_block (r); @@ -105,7 +105,7 @@ main(void) { ir_node *in[1]; - in[0] = new_Sub (get_value (0, mode_i), get_value (1, mode_i), mode_i); + in[0] = new_Sub (get_value (0, mode_Is), get_value (1, mode_Is), mode_Is); x = new_Return (get_store (), 1, in); } -- 2.20.1