- 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_Bu)));
+ /* An unsinged 8 bit type */
+ U8 = new_type_primitive (new_id_from_chars("char", 4), mode_Bu);
+ /* An array containing unsigned 8 bit elements. */
+ U8array = new_type_array (new_id_from_chars("char_arr", 8), 1, U8);
+ string_ptr = new_type_pointer (new_id_from_chars ("ptr_to_string", 13), U8array);
+
+ /* Make a global entity that represents the constant String. */
+ const_str = new_entity(get_glob_type(), new_id_from_str("constStr"), U8array);
+ set_entity_variability(const_str, variability_constant);
+ for (i = 0; i < strlen(str); i++) {
+ tarval *val = new_tarval_from_long(str[i], mode_Bu);
+ ir_node *con = new_Const(mode_Bu, val);
+ add_compound_ent_value(const_str, con, get_array_element_entity(U8array));
+ }
+