diff options
author | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2018-04-30 09:11:08 +0000 |
---|---|---|
committer | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2018-04-30 09:11:08 +0000 |
commit | 4388e8f820106c1f6151e337586d4f011c1090cb (patch) | |
tree | 27936d3ea75075842888776429e978e22e986360 /include/clang/Basic/TargetInfo.h | |
parent | ef91bd38cd94e34b4b0a30e225e507f5c10087d3 (diff) |
[Targets] Implement getConstraintRegister for ARM and AArch64
Summary:
The getConstraintRegister method is used by semantic checking of
inline assembly statements in order to diagnose conflicts between
clobber list and input/output lists. Currently ARM and AArch64 don't
override getConstraintRegister, so conflicts between registers
assigned to variables in asm labels and clobber lists are not
diagnosed. Such conflicts can cause assertion failures in the back end
and even miscompilations.
This patch implements getConstraintRegister for ARM and AArch64
targets. Since these targets don't have single-register constraints,
the implementation is trivial and just returns the register specified
in an asm label (if any).
Reviewers: eli.friedman, javed.absar, thopre
Reviewed By: thopre
Subscribers: rengolin, eraman, rogfer01, myatsina, kristof.beyls, cfe-commits, chrib
Differential Revision: https://reviews.llvm.org/D45965
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetInfo.h')
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 8fbda351ff..ddf737c744 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -629,6 +629,12 @@ public: StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical = false) const; + /// \brief Extracts a register from the passed constraint (if it is a + /// single-register constraint) and the asm label expression related to a + /// variable in the input or output list of an inline asm statement. + /// + /// This function is used by Sema in order to diagnose conflicts between + /// the clobber list and the input/output lists. virtual StringRef getConstraintRegister(StringRef Constraint, StringRef Expression) const { return ""; |