[cfe-commits] [patch][commit-after-review] asm comma-separated clobberlists

Eli Friedman eli.friedman at gmail.com
Wed Aug 12 12:26:40 PDT 2009


On Wed, Aug 12, 2009 at 12:16 PM, Eli Friedman<eli.friedman at gmail.com> wrote:
> On Wed, Aug 12, 2009 at 9:51 AM, Ryan Flynn<parseerror at gmail.com> wrote:
>> patch to handle commas in clobberlists like gcc does. i.e. "=A,A"
>>
>> the form "=AA" already appears to work, but the commas were causing
>> trouble in semantic validation ("," unrecognized) and in parsing
>> canonicalized asm (which already uses "," to separate constraints)
>>
>> error found in FreeBSD driver, but examples found elsewhere for 32-bit
>> targets handling 64-bit math, i.e.
>> http://gcc.gnu.org/ml/gcc-bugs/2000-02/msg00104.html (search for
>> "=A,A")
>>
>> passes all clang tests; i wanted a review because my asm-fu is weak.
>> let me know if this is horrible. thanks!
>
> This patch simply isn't correct.  Take something like the following on x86:
>
> int x,y;
> void a() {
> asm("add %0,%1" : "+r,m"(x) : "rm,r"(y));
> }
>
> With this patch, if I'm not mistaken, both operands will end up in
> memory, which is illegal.
>
> If you haven't seen them, docs are at
> http://gcc.gnu.org/onlinedocs/gcc/Multi_002dAlternative.html .

Oh, and one more thing I didn't mention: LLVM doesn't provide the
necessary support for implementing this properly, so implementing it
would be a lot of work.

-Eli




More information about the cfe-commits mailing list