2015-05-11 Richard Henderson <rth@redhat.com>
+ * gimplify.c (gimplify_asm_expr): Set gimple_asm_volatile_p
+ if noutputs is zero.
+ * cfgexpand.c (expand_asm_stmt): Use gimple_asm_volatile_p unchanged.
+
* cfgexpand.c (expand_asm_operands): Merge into...
(expand_asm_stmt): ... here.
for (i = 0; i < noutputs; ++i)
orig_outputs[i] = TREE_VALUE (gimple_asm_output_op (stmt, i));
- bool vol = gimple_asm_volatile_p (stmt);
-
rtvec argvec, constraintvec, labelvec;
rtx body;
int ninout;
int old_generating_concat_p = generating_concat_p;
rtx_code_label *fallthru_label = NULL;
- /* An ASM with no outputs needs to be treated as volatile, for now. */
- if (noutputs == 0)
- vol = 1;
-
if (! check_operand_nalternatives (outputs, inputs))
return;
empty_string, 0, argvec, constraintvec,
labelvec, locus);
- MEM_VOLATILE_P (body) = vol;
+ MEM_VOLATILE_P (body) = gimple_asm_volatile_p (stmt);
/* Eval the inputs and put them into ARGVEC.
Put their constraints into ASM_INPUTs and store in CONSTRAINTS. */
ggc_strdup (constraints[i]),
i, argvec, constraintvec, labelvec, locus));
- MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;
+ MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i)))
+ = gimple_asm_volatile_p (stmt);
}
/* If there are no outputs (but there are some clobbers)
stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)),
inputs, outputs, clobbers, labels);
- gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr));
+ gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr) || noutputs == 0);
gimple_asm_set_input (stmt, ASM_INPUT_P (expr));
gimplify_seq_add_stmt (pre_p, stmt);