aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/TargetInfo.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-06-28 18:20:53 +0000
committerEric Christopher <echristo@apple.com>2011-06-28 18:20:53 +0000
commitde31fd7eeebdc64fb043463e7f515dab8eccac8d (patch)
treeb69231ba2b0eb6492e12412c964b1bee6996f59e /lib/Basic/TargetInfo.cpp
parentbf9eb88792e022e54a658657bf22e1925948e384 (diff)
Split out logic for valid clobbers and valid inline asm registers.
Fixes rdar://9281377 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134016 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r--lib/Basic/TargetInfo.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 2d4c4a9791..30a9bdb317 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -181,6 +181,14 @@ static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) {
return Name;
}
+/// isValidClobber - Returns whether the passed in string is
+/// a valid clobber in an inline asm statement. This is used by
+/// Sema.
+bool TargetInfo::isValidClobber(llvm::StringRef Name) const {
+ return (isValidGCCRegisterName(Name) ||
+ Name == "memory" || Name == "cc");
+}
+
/// isValidGCCRegisterName - Returns whether the passed in string
/// is a valid register name according to GCC. This is used by Sema for
/// inline asm statements.
@@ -194,9 +202,6 @@ bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const {
// Get rid of any register prefix.
Name = removeGCCRegisterPrefix(Name);
- if (Name == "memory" || Name == "cc")
- return true;
-
getGCCRegNames(Names, NumNames);
// If we have a number it maps to an entry in the register name array.