Commit 96b4cd58 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Factorise code to make Syncs.

parent f1d435c6
......@@ -1867,9 +1867,7 @@ no_call_mem:
++in_arity;
/* construct memory input */
in[mem_pos] =
sync_arity == 1 ? sync_ins[0] :
new_r_Sync(new_block, sync_arity, sync_ins);
in[mem_pos] = be_make_Sync(new_block, sync_arity, sync_ins);
assert(in_arity <= (int)max_inputs);
......
......@@ -1862,10 +1862,8 @@ static ir_node *gen_Call(ir_node *node)
/* construct memory input */
if (sync_arity == 0) {
in[mem_pos] = new_mem;
} else if (sync_arity == 1) {
in[mem_pos] = sync_ins[0];
} else {
in[mem_pos] = new_r_Sync(new_block, sync_arity, sync_ins);
in[mem_pos] = be_make_Sync(new_block, sync_arity, sync_ins);
}
/* TODO: use a generic address matcher here */
......
......@@ -872,3 +872,10 @@ bool be_match_immediate(ir_node const *const node, ir_tarval **const tarval_out,
*reloc_kind_out = reloc_kind;
return true;
}
ir_node *be_make_Sync(ir_node *const block, int const arity, ir_node **const ins)
{
return
arity == 1 ? ins[0] :
new_r_Sync(block, arity, ins);
}
......@@ -173,4 +173,6 @@ ir_node *be_skip_sameconv(ir_node *node);
bool be_match_immediate(ir_node const *node, ir_tarval **tarval_out,
ir_entity **entity_out, unsigned *reloc_kind_out);
ir_node *be_make_Sync(ir_node *block, int arity, ir_node **ins);
#endif
......@@ -4994,10 +4994,7 @@ static ir_node *gen_Call(ir_node *node)
assert(sync_arity <= n_params + 1);
/* Memory input. */
ir_node *const memin =
sync_arity == 1 ? sync_ins[0] :
new_r_Sync(block, sync_arity, sync_ins);
in[n_ia32_Call_mem] = memin;
in[n_ia32_Call_mem] = be_make_Sync(block, sync_arity, sync_ins);
in_req[n_ia32_Call_mem] = arch_memory_req;
/* Count outputs. */
......
......@@ -1812,10 +1812,8 @@ static ir_node *gen_Call(ir_node *node)
/* construct memory input */
if (sync_arity == 0) {
in[mem_pos] = new_mem;
} else if (sync_arity == 1) {
in[mem_pos] = sync_ins[0];
} else {
in[mem_pos] = new_r_Sync(new_block, sync_arity, sync_ins);
in[mem_pos] = be_make_Sync(new_block, sync_arity, sync_ins);
}
if (is_Address(callee)) {
......
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