Commit 704244ab authored by sebastian.buchwald1's avatar sebastian.buchwald1
Browse files

Set appropriate modes when creating parameter stores.

This fixes backend/sparc_mode.c on SPARC and ARM.
parent 282248ea
......@@ -695,21 +695,25 @@ static void create_stores_for_type(ir_graph *irg, ir_type *type)
if (arg == IR_VA_START_PARAMETER_NUMBER)
continue;
ir_node *addr = new_r_Member(start_block, frame, entity);
if (entity->attr.parameter.doubleword_low_mode != NULL) {
ir_mode *mode = entity->attr.parameter.doubleword_low_mode;
ir_node *val0 = new_r_Proj(args, mode, arg);
ir_node *val1 = new_r_Proj(args, mode, arg+1);
ir_node *store0 = new_r_Store(start_block, mem, addr, val0,
tp, cons_none);
ir_node *mem0 = new_r_Proj(store0, mode_M, pn_Store_M);
size_t offset = get_mode_size_bits(mode)/8;
ir_mode *mode_ref = get_irn_mode(addr);
ir_mode *mode_offs = get_reference_offset_mode(mode_ref);
ir_node *cnst = new_r_Const_long(irg, mode_offs, offset);
ir_node *next_addr = new_r_Add(start_block, addr, cnst, mode_ref);
ir_node *store1 = new_r_Store(start_block, mem0, next_addr, val1,
tp, cons_none);
ir_node *addr = new_r_Member(start_block, frame, entity);
ir_type *mt = get_entity_type(get_irg_entity(irg));
ir_type *param_type0 = get_method_param_type(mt, arg);
if (entity->attr.parameter.is_lowered_doubleword) {
ir_type *param_type1 = get_method_param_type(mt, arg + 1);
ir_mode *m0 = get_type_mode(param_type0);
ir_mode *m1 = get_type_mode(param_type1);
ir_node *val0 = new_r_Proj(args, m0, arg);
ir_node *val1 = new_r_Proj(args, m1, arg + 1);
ir_node *store0 = new_r_Store(start_block, mem, addr, val0,
tp, cons_none);
ir_node *mem0 = new_r_Proj(store0, mode_M, pn_Store_M);
size_t offset = get_mode_size_bytes(m0);
ir_mode *mode_ref = get_irn_mode(addr);
ir_mode *mode_offs = get_reference_offset_mode(mode_ref);
ir_node *cnst = new_r_Const_long(irg, mode_offs, offset);
ir_node *next_addr = new_r_Add(start_block, addr, cnst, mode_ref);
ir_node *store1 = new_r_Store(start_block, mem0, next_addr, val1,
tp, cons_none);
mem = new_r_Proj(store1, mode_M, pn_Store_M);
if (first_store == NULL)
first_store = store0;
......
......@@ -1525,9 +1525,8 @@ static void fix_parameter_entities(ir_graph *irg, ir_type *orig_mtp)
* know which is/was a lowered doubleword.
* So we just mark/remember it for later */
if (entity != NULL) {
assert(entity->attr.parameter.doubleword_low_mode == NULL);
entity->attr.parameter.doubleword_low_mode
= env.p.word_unsigned;
assert(!entity->attr.parameter.is_lowered_doubleword);
entity->attr.parameter.is_lowered_doubleword = true;
}
}
}
......
......@@ -132,13 +132,13 @@ typedef struct parameter_ent_attr {
compound_member_ent_attr base; /**< a parameter is also a compound_member
of the frame type. */
size_t number; /**< corresponding parameter number */
ir_mode *doubleword_low_mode;/**< entity is a lowered doubleword parameter,
so additional stores because of calling
convention are correctly performed.
Matze: This is a hack. In an ideal
wor^H^H^Hlibfirm we would first establish
calling conventions and then perform doubleword
lowering...) */
bool is_lowered_doubleword; /**< entity is a lowered doubleword parameter,
so additional stores because of calling
convention are correctly performed.
Matze: This is a hack. In an ideal
wor^H^H^Hlibfirm we would first establish
calling conventions and then perform doubleword
lowering...) */
} parameter_ent_attr;
typedef struct alias_ent_attr {
......
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