mirror of git://gcc.gnu.org/git/gcc.git
re PR inline-asm/11676 (operand to volatile asm incorrectly removed)
PR inline-asm/11676
* cse.c (count_reg_usage): Handle asm_operands properly.
From-SVN: r69816
This commit is contained in:
parent
cd65f08202
commit
a6c14a644c
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-07-26 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
PR inline-asm/11676
|
||||||
|
* cse.c (count_reg_usage): Handle asm_operands properly.
|
||||||
|
|
||||||
2003-07-26 Roger Sayle <roger@eyesopen.com>
|
2003-07-26 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
* builtins.def (DEF_FALLBACK_BUILTIN): Delete.
|
* builtins.def (DEF_FALLBACK_BUILTIN): Delete.
|
||||||
|
|
|
||||||
10
gcc/cse.c
10
gcc/cse.c
|
|
@ -7384,6 +7384,16 @@ count_reg_usage (rtx x, int *counts, rtx dest, int incr)
|
||||||
count_reg_usage (XEXP (x, 1), counts, NULL_RTX, incr);
|
count_reg_usage (XEXP (x, 1), counts, NULL_RTX, incr);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case ASM_OPERANDS:
|
||||||
|
/* If the asm is volatile, then this insn cannot be deleted,
|
||||||
|
and so the inputs *must* be live. */
|
||||||
|
if (MEM_VOLATILE_P (x))
|
||||||
|
dest = NULL_RTX;
|
||||||
|
/* Iterate over just the inputs, not the constraints as well. */
|
||||||
|
for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
|
||||||
|
count_reg_usage (ASM_OPERANDS_INPUT (x, i), counts, dest, incr);
|
||||||
|
return;
|
||||||
|
|
||||||
case INSN_LIST:
|
case INSN_LIST:
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* PR inline-asm/11676 */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O -Wall" } */
|
||||||
|
|
||||||
|
void foo(void)
|
||||||
|
{
|
||||||
|
long x = 0;
|
||||||
|
asm volatile ("" : "=r"(x) : "r"(x)); /* { dg-bogus "uninitialized" } */
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* PR inline-asm/11676 */
|
||||||
|
/* { dg-do run { target i?86-*-* } } */
|
||||||
|
/* { dg-options "-O2" } */
|
||||||
|
|
||||||
|
static int bar(int x) __asm__("bar");
|
||||||
|
static int __attribute__((regparm(1), noinline, used))
|
||||||
|
bar(int x)
|
||||||
|
{
|
||||||
|
if (x != 0)
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __attribute__((regparm(1), noinline))
|
||||||
|
foo(int x)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
__asm__ __volatile__("call bar" : "=a"(x) : "a"(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
foo(1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue