[PATCH] D79778: [CodeGen] Remove buggy handling of input operands in inline asm

Victor Campos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 01:34:53 PDT 2020


vhscampos added a comment.

This effort is to specifically address this bug: https://bugs.llvm.org/show_bug.cgi?id=34165

  void fn(int fd, int arg)
  {
    register int r7 __asm__("r7") = 54;
    __asm__ __volatile__ ( "svc 0" : : "r"(r7), "r"(fd), "r"(arg) : "memory");
  }

gcc does provide such functionality. For example, the code above errors out in gcc.

In the case of writing the fixed register in the string itself, gcc and clang are already equivalent.

1. r7 is in the string and in the clobber list. Clang and gcc give a diagnostic message.

  void foo() {
    volatile int a;
    __asm__ __volatile("mov r7, %0" : : "r"(a) : "r7");
  }



1. r7 is in the string, but not in the clobber list. Clang and gcc give no message.



  void foo() {
    volatile int a;
    __asm__ __volatile("mov r7, %0" : : "r"(a) : );
  }

I look forward to hearing your thoughts on this. Thanks


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79778/new/

https://reviews.llvm.org/D79778





More information about the llvm-commits mailing list