}
-/* @@@@ 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;
{
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:
{
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;
}
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);
+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
========================================
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
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");
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);
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");
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
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,
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"}
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}
}
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
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,
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
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"}
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}
}
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
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,
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
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"}