return load_from_expression_addr(type, symconst, dbgi);
}
}
- case DECLARATION_TYPE_LOCAL_VARIABLE_ENTITY:
+ case DECLARATION_TYPE_LOCAL_VARIABLE_ENTITY: {
+ ir_entity *entity = declaration->v.entity;
+ ir_node *frame = get_irg_frame(current_ir_graph);
+ ir_node *store = get_store();
+ ir_node *sel = new_d_simpleSel(dbgi, store, frame, entity);
+
+ if(type->type == TYPE_ARRAY) {
+ return sel;
+ } else {
+ return load_from_expression_addr(type, sel, dbgi);
+ }
+ }
+
case DECLARATION_TYPE_COMPOUND_MEMBER:
case DECLARATION_TYPE_LABEL_BLOCK:
panic("not implemented reference type");
static void create_local_variable(declaration_t *declaration)
{
- bool needs_entity = declaration->address_taken;
-
assert(declaration->declaration_type == DECLARATION_TYPE_UNKNOWN);
+ bool needs_entity = declaration->address_taken;
+ type_t *type = declaration->type;
+ if(type->type == TYPE_ARRAY
+ || type->type == TYPE_COMPOUND_STRUCT
+ || type->type == TYPE_COMPOUND_UNION) {
+ needs_entity = true;
+ }
+
if(needs_entity) {
ir_type *frame_type = get_irg_frame_type(current_ir_graph);
create_declaration_entity(declaration,