summaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-09 03:21:56 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-09 03:21:56 +0000
commit68b956aec6b292f374113dec0c1ee1fcf5ef54f4 (patch)
tree09f0b6ed28e40cc9846facf74e75892be87ef0f1 /gcc/stmt.c
parente8e65fad8274ae621b1348b71c01a77b64d799fc (diff)
downloadgcc-68b956aec6b292f374113dec0c1ee1fcf5ef54f4.tar.gz
* expr.h (EXPAND_MEMORY): New.
* expr.c (expand_expr): Check it. * stmt.c (expand_asm_operands): Provide it when the constraint requires a memory. Warn for memory input constraints without a memory operand. * gcc.dg/20011029-2.c: Fix the array reference. * gcc.dg/asm-7.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67645 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index f8942adea8a..3407f33be4c 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1748,7 +1748,9 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
val = TREE_VALUE (tail);
type = TREE_TYPE (val);
- op = expand_expr (val, NULL_RTX, VOIDmode, 0);
+ op = expand_expr (val, NULL_RTX, VOIDmode,
+ (allows_mem && !allows_reg
+ ? EXPAND_MEMORY : EXPAND_NORMAL));
/* Never pass a CONCAT to an ASM. */
if (GET_CODE (op) == CONCAT)
@@ -1763,38 +1765,35 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
else if (!allows_mem)
warning ("asm operand %d probably doesn't match constraints",
i + noutputs);
- else if (CONSTANT_P (op))
- {
- op = force_const_mem (TYPE_MODE (type), op);
- op = validize_mem (op);
- }
- else if (GET_CODE (op) == REG
- || GET_CODE (op) == SUBREG
- || GET_CODE (op) == ADDRESSOF
- || GET_CODE (op) == CONCAT)
- {
- tree qual_type = build_qualified_type (type,
- (TYPE_QUALS (type)
- | TYPE_QUAL_CONST));
- rtx memloc = assign_temp (qual_type, 1, 1, 1);
- memloc = validize_mem (memloc);
- emit_move_insn (memloc, op);
- op = memloc;
- }
-
else if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
{
/* We won't recognize volatile memory as available a
memory_operand at this point. Ignore it. */
}
- else if (queued_subexp_p (op))
- ;
else
- /* ??? Leave this only until we have experience with what
- happens in combine and elsewhere when constraints are
- not satisfied. */
- warning ("asm operand %d probably doesn't match constraints",
- i + noutputs);
+ {
+ warning ("asm operand %d uses deprecated memory input "
+ "without lvalue", i + noutputs);
+
+ if (CONSTANT_P (op))
+ {
+ op = force_const_mem (TYPE_MODE (type), op);
+ op = validize_mem (op);
+ }
+ else if (GET_CODE (op) == REG
+ || GET_CODE (op) == SUBREG
+ || GET_CODE (op) == ADDRESSOF
+ || GET_CODE (op) == CONCAT)
+ {
+ tree qual_type = build_qualified_type (type,
+ (TYPE_QUALS (type)
+ | TYPE_QUAL_CONST));
+ rtx memloc = assign_temp (qual_type, 1, 1, 1);
+ memloc = validize_mem (memloc);
+ emit_move_insn (memloc, op);
+ op = memloc;
+ }
+ }
}
generating_concat_p = old_generating_concat_p;