[PATCH] D115471: [clang] number labels in asm goto strings after tied inputs
Nick Desaulniers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 9 14:40:25 PST 2021
nickdesaulniers created this revision.
nickdesaulniers added reviewers: void, efriedma, jyknight, craig.topper.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
I noticed that the following case would compile in Clang but not GCC:
void *x(void) {
void *p = &&foo;
asm goto ("# %0\n\t# %l1":"+r"(p):::foo);
foo:;
return p;
}
Changing the output template above from %l2 would compile in GCC but not
Clang.
This demonstrates that when using tied outputs (say via the "+r" output
constraint), the hidden inputs occur or are numbered BEFORE the labels,
at least with GCC.
For the sake of compatibility, I think it's worthwhile to just make this
change.
It's better to use symbolic names for compatibility (especially now
between released version of Clang that support asm goto with outputs).
ie. %l1 from the above would be %l[foo].
Also, I cleaned up some cruft in GCCAsmStmt::getNamedOperand. AFAICT,
NumPlusOperands was no longer used, though I couldn't find which commit
didn't clean that up correctly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115471
Files:
clang/lib/AST/Stmt.cpp
clang/lib/CodeGen/CGStmt.cpp
clang/test/CodeGen/asm-goto.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115471.393288.patch
Type: text/x-patch
Size: 5694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211209/361f72d9/attachment.bin>
More information about the cfe-commits
mailing list