From 760356ab155a0d884324c867a1f9a78a79c0b5a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Mon, 11 Aug 2003 15:18:13 +0000 Subject: [PATCH] added output of array bound nodes to vcg [r1643] --- ir/ir/irdump.c | 10 ++++++- ir/tr/type.c | 1 + ir/tr/type.h | 2 +- ir/tv/IeeeCC754/readme.usage | 7 +++++ testprograms/array-heap_example.c | 6 ++-- testprograms/array-stack_example.c | 9 ++++-- .../ARRAY-HEAP_EXAMPLE_main-type.vcg | 22 +++++++++------ .../ARRAY-STACK_EXAMPLE_main-all.vcg | 28 +++++++++++-------- testprograms/ref-results/main-type.vcg | 26 ++++++++++------- 9 files changed, 75 insertions(+), 36 deletions(-) diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index dd4f1aad4..0ee1de0ba 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -561,7 +561,6 @@ static void dump_node2type_edges (ir_node *n, void *env) } -/* @@@@ Does not work as someone kills the visited flag. */ static void dump_const_expression(ir_node *value) { ir_graph *rem = current_ir_graph; int rem_dump_const_local = dump_const_local; @@ -781,6 +780,15 @@ dump_type_info (type_or_ent *tore, void *env) { { PRINT_TYPE_TYPE_EDGE(tp,get_array_element_type(tp),ARR_ELT_TYPE_EDGE_ATTR); PRINT_TYPE_ENT_EDGE(tp,get_array_element_entity(tp),ARR_ENT_EDGE_ATTR); + for (i = 0; i < get_array_n_dimensions(tp); i++) { + ir_node *upper = get_array_upper_bound(tp, i); + ir_node *lower = get_array_lower_bound(tp, i); + PRINT_NODE_TYPE_EDGE(upper, tp, "label: \"upper %d\"", get_array_order(tp, i)); + PRINT_NODE_TYPE_EDGE(lower, tp, "label: \"lower %d\"", get_array_order(tp, i)); + dump_const_expression(upper); + dump_const_expression(lower); + } + } break; case tpo_enumeration: { diff --git a/ir/tr/type.c b/ir/tr/type.c index 95ddd2879..10640e561 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -1097,6 +1097,7 @@ set_array_bounds (type *array, int dimension, ir_node * lower_bound, assert(array && (array->type_op == type_array)); assert(lower_bound && "lower_bound node may not be NULL."); assert(upper_bound && "upper_bound node may not be NULL."); + assert(dimension < array->attr.aa.n_dimensions && dimension >= 0); array->attr.aa.lower_bound[dimension] = lower_bound; array->attr.aa.upper_bound[dimension] = upper_bound; } diff --git a/ir/tr/type.h b/ir/tr/type.h index e9e6d0e9d..9e558fd2f 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -648,7 +648,7 @@ void set_array_lower_bound (type *array, int dimension, ir_node *lower_bound); void set_array_lower_bound_int (type *array, int dimension, int lower_bound); void set_array_upper_bound (type *array, int dimension, ir_node *upper_bound); void set_array_upper_bound_int (type *array, int dimension, int lower_bound); -/* returns true is lower bound != Unknown */ +/* returns true if lower bound != Unknown */ int has_array_lower_bound (type *array, int dimension); ir_node * get_array_lower_bound (type *array, int dimension); int has_array_upper_bound (type *array, int dimension); diff --git a/ir/tv/IeeeCC754/readme.usage b/ir/tv/IeeeCC754/readme.usage index 959d09572..298ee1e43 100644 --- a/ir/tv/IeeeCC754/readme.usage +++ b/ir/tv/IeeeCC754/readme.usage @@ -1,3 +1,10 @@ +IeeeCC754 tests the correct implementation of the ieee floating +point constant evaluation. + +Call make; make test to run the test. + +Or do the test by hand: + How to call the driver program IeeeCC754 ======================================== diff --git a/testprograms/array-heap_example.c b/testprograms/array-heap_example.c index fff4171c7..d0b776fb0 100644 --- a/testprograms/array-heap_example.c +++ b/testprograms/array-heap_example.c @@ -85,19 +85,20 @@ main(void) proc_main = new_type_method(id_from_str("ARRAY-HEAP_EXAMPLE_main", 23), 0, 1); set_method_res_type(proc_main, 0, (type *)prim_t_int); proc_main_e = new_entity ((type*)owner, id_from_str ("ARRAY-HEAP_EXAMPLE_main", 23), (type *)proc_main); - main_irg = new_ir_graph (proc_main_e, 4); /* make type information for the array and set the bounds */ # define N_DIMS 1 # define L_BOUND 0 # define U_BOUND 9 + current_ir_graph = get_const_code_irg(); array_type = new_type_array(id_from_str("a", 1), N_DIMS, prim_t_int); - set_array_bounds(array_type, 1, + set_array_bounds(array_type, 0, 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. */ + main_irg = new_ir_graph (proc_main_e, 4); array_ent = get_array_element_entity(array_type); /* Allocate the array. All program known variables that @@ -155,6 +156,7 @@ main(void) printf("Dumping the graph and a type graph.\n"); dump_ir_block_graph (main_irg); dump_type_graph(main_irg); + dump_all_types(); printf("use xvcg to view these graphs:\n"); printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); diff --git a/testprograms/array-stack_example.c b/testprograms/array-stack_example.c index cda260196..6e8580265 100644 --- a/testprograms/array-stack_example.c +++ b/testprograms/array-stack_example.c @@ -76,16 +76,18 @@ main(void) set_method_res_type(proc_main, 0, prim_t_int); proc_main_e = new_entity (owner, id_from_str ("main", 4), proc_main); - main_irg = new_ir_graph (proc_main_e, 4); - /* make type information for the array and set the bounds */ # define N_DIMS 1 # define L_BOUND 0 # 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, + current_ir_graph = get_const_code_irg(); + set_array_bounds(array_type, 0, new_Const(mode_Iu, new_tarval_from_long (L_BOUND, mode_Iu)), new_Const(mode_Iu, new_tarval_from_long (U_BOUND, mode_Iu))); + + main_irg = new_ir_graph (proc_main_e, 4); + /* 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); @@ -140,6 +142,7 @@ main(void) dump_ir_block_graph (main_irg); dump_type_graph(main_irg); dump_ir_block_graph_w_types(main_irg); + dump_all_types(); printf("Use xvcg to view these graphs:\n"); printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); diff --git a/testprograms/ref-results/ARRAY-HEAP_EXAMPLE_main-type.vcg b/testprograms/ref-results/ARRAY-HEAP_EXAMPLE_main-type.vcg index aed912d3c..ba386e0b1 100644 --- a/testprograms/ref-results/ARRAY-HEAP_EXAMPLE_main-type.vcg +++ b/testprograms/ref-results/ARRAY-HEAP_EXAMPLE_main-type.vcg @@ -17,9 +17,9 @@ classname 10: "Array Element Type" classname 11: "Overwrites" classname 12: "Member" -node: {title: "e29" label: "ent a_elem_ent" color: yellow +node: {title: "e15" label: "ent a_elem_ent" color: yellow info1: " -id: e29 +id: e15 allocation: automatic allocated visibility: local variability: uninitialized @@ -29,12 +29,18 @@ name: a_elem_ent ld_name: a_a_elem_ent offset: -1" } -edge: { sourcename: "e29" targetname: "t10"class: 3 label: "type" color: red} -node: {title: "t28" label: "array a" info1: "state: layout_undefined +edge: { sourcename: "e15" targetname: "t10"class: 3 label: "type" color: red} +node: {title: "t14" label: "array a" info1: "state: layout_undefined size: -1B, "} -edge: { sourcename: "t28" targetname: "t10"class: 10 label: "arr elt tp" color:green} -edge: { sourcename: "t28" targetname: "e29"class: 10 label: "arr ent" color: green} +edge: { sourcename: "t14" targetname: "t10"class: 10 label: "arr elt tp" color:green} +edge: { sourcename: "t14" targetname: "e15"class: 10 label: "arr ent" color: green} +edge: { sourcename: "n16" targetname: "t14"label: "upper 0"} +edge: { sourcename: "n17" targetname: "t14"label: "lower 0"} +node: {title: "n16" label: "0x9Iu 16" color: yellow info1: "visited: 1 +"} +node: {title: "n17" label: "0x0Iu 17" color: yellow info1: "visited: 1 +"} node: {title: "t10" label: "primitive int" info1: "state: layout_fixed, mode: Is, size: 4B, @@ -50,7 +56,7 @@ peculiarity: existent name: ARRAY-HEAP_EXAMPLE_main ld_name: GlobalType_ARRAY-HEAP_EXAMPLE_main offset: -1 -irg = g26" +irg = g30" } edge: { sourcename: "e13" targetname: "t11"class: 3 label: "type" color: red} edge: { sourcename: "e13" targetname: "n12"label: "value 0"} @@ -65,7 +71,7 @@ mode: P, size: 4B, "} edge: { sourcename: "t11" targetname: "t10"class: 6 label: "res 0" color: green} -node: {title: "t14" label: "class ARRAY-HEAP_EXAMPLE_mainframe_tp" info1: "state: layout_undefined +node: {title: "t18" label: "class ARRAY-HEAP_EXAMPLE_mainframe_tp" info1: "state: layout_undefined size: -1B, " color: green} } diff --git a/testprograms/ref-results/ARRAY-STACK_EXAMPLE_main-all.vcg b/testprograms/ref-results/ARRAY-STACK_EXAMPLE_main-all.vcg index 4acb75a3a..f2ed0d615 100644 --- a/testprograms/ref-results/ARRAY-STACK_EXAMPLE_main-all.vcg +++ b/testprograms/ref-results/ARRAY-STACK_EXAMPLE_main-all.vcg @@ -69,9 +69,9 @@ edge: {sourcename: "n57" targetname: "n50" label: "0" color: blue} node: {title: "n61" label: "Bad 61" info1: "visited: 0 "} -node: {title: "e30" label: "ent a_tp_elem_ent" color: yellow +node: {title: "e16" label: "ent a_tp_elem_ent" color: yellow info1: " -id: e30 +id: e16 allocation: automatic allocated visibility: local variability: uninitialized @@ -81,12 +81,18 @@ name: a_tp_elem_ent ld_name: a_tp_a_tp_elem_ent offset: -1" } -edge: { sourcename: "e30" targetname: "t10"class: 3 label: "type" color: red} -node: {title: "t29" label: "array a_tp" info1: "state: layout_undefined +edge: { sourcename: "e16" targetname: "t10"class: 3 label: "type" color: red} +node: {title: "t15" label: "array a_tp" info1: "state: layout_undefined size: -1B, "} -edge: { sourcename: "t29" targetname: "t10"class: 10 label: "arr elt tp" color:green} -edge: { sourcename: "t29" targetname: "e30"class: 10 label: "arr ent" color: green} +edge: { sourcename: "t15" targetname: "t10"class: 10 label: "arr elt tp" color:green} +edge: { sourcename: "t15" targetname: "e16"class: 10 label: "arr ent" color: green} +edge: { sourcename: "n17" targetname: "t15"label: "upper 0"} +edge: { sourcename: "n18" targetname: "t15"label: "lower 0"} +node: {title: "n17" label: "0x9Iu 17" color: yellow info1: "visited: 2 +"} +node: {title: "n18" label: "0x0Iu 18" color: yellow info1: "visited: 2 +"} node: {title: "t10" label: "primitive int" info1: "state: layout_fixed, mode: Is, size: 4B, @@ -103,11 +109,11 @@ name: a ld_name: mainframe_tp_a offset: -1" } -edge: { sourcename: "e33" targetname: "t29"class: 3 label: "type" color: red} -node: {title: "t15" label: "class mainframe_tp" info1: "state: layout_undefined +edge: { sourcename: "e33" targetname: "t15"class: 3 label: "type" color: red} +node: {title: "t19" label: "class mainframe_tp" info1: "state: layout_undefined size: -1B, " color: green} -edge: { sourcename: "t15" targetname: "e33"class: 12 label: "member" color:blue} +edge: { sourcename: "t19" targetname: "e33"class: 12 label: "member" color:blue} node: {title: "e14" label: "ent main" color: yellow info1: " id: e14 @@ -119,7 +125,7 @@ peculiarity: existent name: main ld_name: ARRAY-STACK_EXAMPLE_main offset: -1 -irg = g27" +irg = g31" } edge: { sourcename: "e14" targetname: "t12"class: 3 label: "type" color: red} edge: { sourcename: "e14" targetname: "n13"label: "value 0"} @@ -134,6 +140,6 @@ mode: P, size: 4B, "} edge: { sourcename: "t12" targetname: "t10"class: 6 label: "res 0" color: green} -edge: { sourcename: "n53" targetname: "e30"class: 2 priority: 2 linestyle: dotted} +edge: { sourcename: "n53" targetname: "e16"class: 2 priority: 2 linestyle: dotted} edge: { sourcename: "n55" targetname: "e33"class: 2 priority: 2 linestyle: dotted} } diff --git a/testprograms/ref-results/main-type.vcg b/testprograms/ref-results/main-type.vcg index 38bd72049..5866fbc8b 100644 --- a/testprograms/ref-results/main-type.vcg +++ b/testprograms/ref-results/main-type.vcg @@ -17,9 +17,9 @@ classname 10: "Array Element Type" classname 11: "Overwrites" classname 12: "Member" -node: {title: "e30" label: "ent a_tp_elem_ent" color: yellow +node: {title: "e16" label: "ent a_tp_elem_ent" color: yellow info1: " -id: e30 +id: e16 allocation: automatic allocated visibility: local variability: uninitialized @@ -29,12 +29,18 @@ name: a_tp_elem_ent ld_name: a_tp_a_tp_elem_ent offset: -1" } -edge: { sourcename: "e30" targetname: "t10"class: 3 label: "type" color: red} -node: {title: "t29" label: "array a_tp" info1: "state: layout_undefined +edge: { sourcename: "e16" targetname: "t10"class: 3 label: "type" color: red} +node: {title: "t15" label: "array a_tp" info1: "state: layout_undefined size: -1B, "} -edge: { sourcename: "t29" targetname: "t10"class: 10 label: "arr elt tp" color:green} -edge: { sourcename: "t29" targetname: "e30"class: 10 label: "arr ent" color: green} +edge: { sourcename: "t15" targetname: "t10"class: 10 label: "arr elt tp" color:green} +edge: { sourcename: "t15" targetname: "e16"class: 10 label: "arr ent" color: green} +edge: { sourcename: "n17" targetname: "t15"label: "upper 0"} +edge: { sourcename: "n18" targetname: "t15"label: "lower 0"} +node: {title: "n17" label: "0x9Iu 17" color: yellow info1: "visited: 1 +"} +node: {title: "n18" label: "0x0Iu 18" color: yellow info1: "visited: 1 +"} node: {title: "t10" label: "primitive int" info1: "state: layout_fixed, mode: Is, size: 4B, @@ -51,11 +57,11 @@ name: a ld_name: mainframe_tp_a offset: -1" } -edge: { sourcename: "e33" targetname: "t29"class: 3 label: "type" color: red} -node: {title: "t15" label: "class mainframe_tp" info1: "state: layout_undefined +edge: { sourcename: "e33" targetname: "t15"class: 3 label: "type" color: red} +node: {title: "t19" label: "class mainframe_tp" info1: "state: layout_undefined size: -1B, " color: green} -edge: { sourcename: "t15" targetname: "e33"class: 12 label: "member" color:blue} +edge: { sourcename: "t19" targetname: "e33"class: 12 label: "member" color:blue} node: {title: "e14" label: "ent main" color: yellow info1: " id: e14 @@ -67,7 +73,7 @@ peculiarity: existent name: main ld_name: ARRAY-STACK_EXAMPLE_main offset: -1 -irg = g27" +irg = g31" } edge: { sourcename: "e14" targetname: "t12"class: 3 label: "type" color: red} edge: { sourcename: "e14" targetname: "n13"label: "value 0"} -- 2.20.1