PR 27528: Expanding constant asm operands
Ian Lance Taylor
iant@google.com
Thu Nov 9 17:24:00 GMT 2006
Richard Sandiford <richard@codesourcery.com> writes:
> Note that EXPAND_INITIALIZER doesn't actually cause non-initialisers
> to be rejected, so we still deal gracefully with bogus code like:
>
> int x;
> asm volatile ("..." :: "i" (x));
But note that this is valid and actually used:
static inline void my_favorite_insn(int x) __attribute__ ((always_inline));
static inline void my_favorite_insn(int x)
{
asm volatile ("insn %0" :: "i" (x));
}
int
foo()
{
my_favorite_insn (1);
my_favorite_insn (2);
}
Here we can count on the inliner to give the asm a constant. In some
cases this may require compiling with optimization, but that is
acceptable for some embedded targets which is where this kind of thing
is typically used.
I don't think your patch will break this, but let's be sure. If you
add a test case for this, and confirm that it still works with your
patch, then your patch is OK.
Thanks.
Ian
More information about the Gcc-patches
mailing list