From 0d0c27e9e49cfcf538d1bd0020c13c38fd138bcd Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 10 Jan 2012 13:10:22 +0100 Subject: [PATCH] do not cache types in global variables (or multiple ir_init/ir_finishs will fail) --- ir/ir/irtypes.h | 1 + ir/tr/type.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ir/ir/irtypes.h b/ir/ir/irtypes.h index d7eecb757..f73b99c20 100644 --- a/ir/ir/irtypes.h +++ b/ir/ir/irtypes.h @@ -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 -- */ diff --git a/ir/tr/type.c b/ir/tr/type.c index 4e0812640..abf559f7b 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -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); -- 2.20.1