[all-commits] [llvm/llvm-project] 50cac2: Support output constraints on "asm goto"

Bill Wendling via All-commits all-commits at lists.llvm.org
Mon Feb 24 18:57:16 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 50cac248773c3a023e8f6ceb9938bdd5e9f15da2
      https://github.com/llvm/llvm-project/commit/50cac248773c3a023e8f6ceb9938bdd5e9f15da2
  Author: Bill Wendling <isanbard at gmail.com>
  Date:   2020-02-24 (Mon, 24 Feb 2020)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/include/clang/AST/Stmt.h
    M clang/include/clang/Basic/Features.def
    M clang/lib/AST/Stmt.cpp
    M clang/lib/Analysis/UninitializedValues.cpp
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/Parse/ParseStmtAsm.cpp
    M clang/lib/Sema/SemaStmtAsm.cpp
    A clang/test/Analysis/uninit-asm-goto.cpp
    M clang/test/CodeGen/asm-goto.c
    M clang/test/Parser/asm-goto.c
    M clang/test/Parser/asm-goto.cpp
    M clang/test/Sema/asm-goto.cpp

  Log Message:
  -----------
  Support output constraints on "asm goto"

Summary:
Clang's "asm goto" feature didn't initially support outputs constraints. That
was the same behavior as gcc's implementation. The decision by gcc not to
support outputs was based on a restriction in their IR regarding terminators.
LLVM doesn't restrict terminators from returning values (e.g. 'invoke'), so
it made sense to support this feature.

Output values are valid only on the 'fallthrough' path. If an output value's used
on an indirect branch, then it's 'poisoned'.

In theory, outputs *could* be valid on the 'indirect' paths, but it's very
difficult to guarantee that the original semantics would be retained. E.g.
because indirect labels could be used as data, we wouldn't be able to split
critical edges in situations where two 'callbr' instructions have the same
indirect label, because the indirect branch's destination would no longer be
the same.

Reviewers: jyknight, nickdesaulniers, hfinkel

Reviewed By: jyknight, nickdesaulniers

Subscribers: MaskRay, rsmith, hiraditya, llvm-commits, cfe-commits, craig.topper, rnk

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69876




More information about the All-commits mailing list