summaryrefslogtreecommitdiff
path: root/lib/Basic/TargetInfo.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-06-21 00:05:20 +0000
committerEric Christopher <echristo@apple.com>2011-06-21 00:05:20 +0000
commitcfd323d0d4476dd4ff64097c91b114067ecaa82b (patch)
tree9fad5f1ee1e29ff3ce9975da7607c9a919d26188 /lib/Basic/TargetInfo.cpp
parent8e2ce7fdf9e8033b77788662a9c3f61334eb5daf (diff)
downloadclang-cfd323d0d4476dd4ff64097c91b114067ecaa82b.tar.gz
clang-cfd323d0d4476dd4ff64097c91b114067ecaa82b.tar.bz2
clang-cfd323d0d4476dd4ff64097c91b114067ecaa82b.tar.xz
Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers. Fixes part of rdar://9425559 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133485 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r--lib/Basic/TargetInfo.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index dcf0cb4237..2d4c4a9791 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -212,6 +212,20 @@ bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const {
return true;
}
+ // Check any additional names that we have.
+ const AddlRegName *AddlNames;
+ unsigned NumAddlNames;
+ getGCCAddlRegNames(AddlNames, NumAddlNames);
+ for (unsigned i = 0; i < NumAddlNames; i++)
+ for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
+ if (!AddlNames[i].Names[j])
+ break;
+ // Make sure the register that the additional name is for is within
+ // the bounds of the register names from above.
+ if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < NumNames)
+ return true;
+ }
+
// Now check aliases.
const GCCRegAlias *Aliases;
unsigned NumAliases;
@@ -251,6 +265,20 @@ TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef Name) const {
}
}
+ // Check any additional names that we have.
+ const AddlRegName *AddlNames;
+ unsigned NumAddlNames;
+ getGCCAddlRegNames(AddlNames, NumAddlNames);
+ for (unsigned i = 0; i < NumAddlNames; i++)
+ for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
+ if (!AddlNames[i].Names[j])
+ break;
+ // Make sure the register that the additional name is for is within
+ // the bounds of the register names from above.
+ if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < NumNames)
+ return Name;
+ }
+
// Now check aliases.
const GCCRegAlias *Aliases;
unsigned NumAliases;