summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2014-09-17 23:35:14 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2014-09-17 23:35:14 +0000
commit31c6d3b71e4b15afcf3300336b5da0bb9de3855a (patch)
tree5d682fe22e8ac94504abc261c0d213e619e01602 /clang/lib/Basic/Targets.cpp
parent61570df7158a7b8248fed90eced0caebd9238cb8 (diff)
downloadbcm5719-llvm-31c6d3b71e4b15afcf3300336b5da0bb9de3855a.tar.gz
bcm5719-llvm-31c6d3b71e4b15afcf3300336b5da0bb9de3855a.zip
[X86, inline-asm] Check that the input size is correct for constraints R, q, Q,
S, D, A, y, x, f, t, and u. This is a follow-up patch for r167717. rdar://problem/11846140 rdar://problem/17476970 llvm-svn: 217994
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 916fc11b560..d7832e30372 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -1899,6 +1899,9 @@ public:
}
bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const override;
+
+ bool validateInputSize(StringRef Constraint, unsigned Size) const override;
+
std::string convertConstraint(const char *&Constraint) const override;
const char *getClobbers() const override {
return "~{dirflag},~{fpsr},~{flags}";
@@ -3049,6 +3052,21 @@ X86TargetInfo::validateAsmConstraint(const char *&Name,
}
}
+bool X86TargetInfo::validateInputSize(StringRef Constraint,
+ unsigned Size) const {
+ switch (Constraint[0]) {
+ default: break;
+ case 'y':
+ return Size <= 64;
+ case 'x':
+ case 'f':
+ case 't':
+ case 'u':
+ return Size <= 128;
+ }
+
+ return true;
+}
std::string
X86TargetInfo::convertConstraint(const char *&Constraint) const {
@@ -3109,14 +3127,21 @@ public:
unsigned Size) const override {
switch (Constraint[0]) {
default: break;
+ case 'R':
+ case 'q':
+ case 'Q':
case 'a':
case 'b':
case 'c':
case 'd':
+ case 'S':
+ case 'D':
return Size <= 32;
+ case 'A':
+ return Size <= 64;
}
- return true;
+ return X86TargetInfo::validateInputSize(Constraint, Size);
}
};
} // end anonymous namespace
OpenPOWER on IntegriCloud