[PATCH] D87279: [CFE] Fix handling of physical registers in inline assembly operands.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 04:56:52 PDT 2020
jonpa created this revision.
jonpa added reviewers: uweigand, craig.topper, ahatanak.
Herald added a subscriber: dexonsmith.
jonpa requested review of this revision.
Improve EmitAsmStmt() to
- Not tie physregs with the "+r" constraint, but instead add the hard register as an input constraint. This makes "+r" and "=r":"r" look the same in the output.
Background: Macro intensive code may contain inline assembly statements with multiple operands constrained to the same physreg. Such a case with the operand constraints "+r" : "r" currently triggers the TwoAddressInstructionPass assertion against any extra use of a tied register. Furthermore, TwoAddress will insert a COPY to that physreg even though isel has already done so (for the non-tied use), which may lead to a second redundant instruction currently.
A simple fix for this is to not emit tied physreg uses in the first place for the "+r" constraint, which is what this patch does.
- Give an error on multiple outputs to the same physical register.
This should be reported and this is also what GCC does.
https://reviews.llvm.org/D87279
Files:
clang/lib/CodeGen/CGStmt.cpp
clang/test/CodeGen/systemz-inline-asm-02.c
clang/test/CodeGen/systemz-inline-asm.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87279.290451.patch
Type: text/x-patch
Size: 3963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200908/640e8dd2/attachment.bin>
More information about the llvm-commits
mailing list