Commit b50a024d by Richard Kenner

(expand_asm_operands): Properly handle output that can't be directly

written into.

From-SVN: r9272
parent d161fae4
...@@ -1402,6 +1402,7 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) ...@@ -1402,6 +1402,7 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++) for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
{ {
tree val = TREE_VALUE (tail); tree val = TREE_VALUE (tail);
tree type = TREE_TYPE (val);
tree val1; tree val1;
int j; int j;
int found_equal; int found_equal;
...@@ -1429,31 +1430,29 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) ...@@ -1429,31 +1430,29 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
return; return;
} }
/* If an output operand is not a variable or indirect ref, /* If an output operand is not a decl or indirect ref,
or a part of one, make a temporary to act as an intermediate. Make the asm insn
create a SAVE_EXPR which is a pseudo-reg write into that, then our caller will copy it to the real output
to act as an intermediate temporary. operand. Likewise for promoted variables. */
Make the asm insn write into that, then copy it to
the real output operand. */
while (TREE_CODE (val) == COMPONENT_REF if (TREE_CODE (val) == INDIRECT_REF
|| TREE_CODE (val) == ARRAY_REF) || (TREE_CODE_CLASS (TREE_CODE (val)) == 'd'
val = TREE_OPERAND (val, 0); && ! (GET_CODE (DECL_RTL (val)) == REG
&& GET_MODE (DECL_RTL (val)) != TYPE_MODE (type))))
if (TREE_CODE (val) != VAR_DECL output_rtx[i] = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode, 0);
&& TREE_CODE (val) != PARM_DECL else
&& TREE_CODE (val) != INDIRECT_REF)
{ {
TREE_VALUE (tail) = save_expr (TREE_VALUE (tail)); if (TYPE_MODE (type) == BLKmode)
/* If it's a constant, print error now so don't crash later. */
if (TREE_CODE (TREE_VALUE (tail)) != SAVE_EXPR)
{ {
error ("invalid output in `asm'"); output_rtx[i] = assign_stack_temp (BLKmode,
return; int_size_in_bytes (type), 0);
MEM_IN_STRUCT_P (output_rtx[i]) = AGGREGATE_TYPE_P (type);
} }
} else
output_rtx[i] = gen_reg_rtx (TYPE_MODE (type));
output_rtx[i] = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode, 0); TREE_VALUE (tail) = make_tree (type, output_rtx[i]);
}
} }
if (ninputs + noutputs > MAX_RECOG_OPERANDS) if (ninputs + noutputs > MAX_RECOG_OPERANDS)
......
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