[PATCH] D58821: Inline asm constraints: allow ICE-like pointers for the "n" constraint (PR40890)

Joerg Sonnenberger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 15:39:34 PST 2019


joerg added a comment.

The other problem is that we don't use the CFG machinery to prune dead branches. Consider the x86 in/out instructions: one variant takes an immediate, the other a register. The classic way to deal with that is something like

  static inline void outl(unsigned port, uint32_t value)
  {
    if (__builtin_constant_p(port) && port < 0x100) {
      __asm volatile("outl %0,%w1" : : "a" (data), "id" (port));
    } else {
     __asm volatile("outl %0,%w1" : : "a" (data), "d" (port));
    }
  }

This fails with the new asm constraint checks, since the dead branch is never pruned. For other architectures it makes an even greater difference. The main reason it is a show stopper: there is no sane workaround that doesn't regress code quality.


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

https://reviews.llvm.org/D58821





More information about the cfe-commits mailing list