diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-25 00:05:55 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-25 00:05:55 +0000 |
commit | a0b9ce03880b7dbab766ec80817eb17a20eba508 (patch) | |
tree | 285becf92ea1e0c73c19952bef97f8b194039a5e /lib/Basic/Targets.cpp | |
parent | 53aec2a2770afc242c70fd88975cd0ea389087c0 (diff) |
Add some support for diagnosing possibly mismatched constraint, type size and
modifiers. (From an idea by Eric...)
<rdar://problem/12284092>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r-- | lib/Basic/Targets.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index ba96185f72..960a2858e4 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -3315,6 +3315,29 @@ public: } return R; } + virtual bool validateConstraintModifier(StringRef Constraint, + const char Modifier, + unsigned Size) const { + // Strip off constraint modifiers. + while (Constraint[0] == '=' || + Constraint[0] == '+' || + Constraint[0] == '&') + Constraint = Constraint.substr(1); + + switch (Constraint[0]) { + default: break; + case 'r': { + switch (Modifier) { + default: return Size == 32; + case 'q': + // A register of size 32 cannot fit a vector type. + return false; + } + } + } + + return true; + } virtual const char *getClobbers() const { // FIXME: Is this really right? return ""; |