Commit 0d0c27e9 authored by Matthias Braun's avatar Matthias Braun
Browse files

do not cache types in global variables

(or multiple ir_init/ir_finishs will fail)
parent afe65912
......@@ -629,6 +629,7 @@ struct ir_prog {
ir_type *none_type; /**< unique 'none'-type */
ir_type *code_type; /**< unique 'code'-type */
ir_type *unknown_type; /**< unique 'unknown'-type */
ir_type *byte_type; /**< type for a 'byte' */
ident **global_asms; /**< An array of global ASM insertions. */
/* -- states of and access to generated information -- */
......
......@@ -2026,20 +2026,19 @@ ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment,
char buf[32];
int offset, frame_size;
static unsigned area_cnt = 0;
static ir_type *a_byte = NULL;
assert(is_frame_type(frame_type));
assert(get_type_state(frame_type) == layout_fixed);
assert(get_type_alignment_bytes(frame_type) > 0);
set_type_state(frame_type, layout_undefined);
if (! a_byte)
a_byte = new_type_primitive(mode_Bu);
if (irp->byte_type == NULL)
irp->byte_type = new_type_primitive(mode_Bu);
snprintf(buf, sizeof(buf), "area%u", area_cnt++);
name = new_id_from_str(buf);
tp = new_type_array(1, a_byte);
tp = new_type_array(1, irp->byte_type);
set_array_bounds_int(tp, 0, 0, size);
set_type_alignment_bytes(tp, alignment);
set_type_size_bytes(tp, size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment