aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2009-03-25 23:28:33 +0000
committerJim Grosbach <grosbach@apple.com>2009-03-25 23:28:33 +0000
commit54f302272c6bf98638d224949be8bd23a120ba48 (patch)
tree3733df5e4b9b52d08e3713e2a25167cd9b185700 /utils
parente597282fe57a6d085edd2131b78bed5145cbfa8f (diff)
downloadexternal_llvm-54f302272c6bf98638d224949be8bd23a120ba48.zip
external_llvm-54f302272c6bf98638d224949be8bd23a120ba48.tar.gz
external_llvm-54f302272c6bf98638d224949be8bd23a120ba48.tar.bz2
Modify getRegisterValueType() to allow for a register being in mutliple
register classes. Before, MVT::Other would be returned anytime a reg was in multiple register classes. Now, MVT::Other is only returned if the types for those register classes differ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 4351352..aad21fe 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -175,12 +175,33 @@ struct PatternSortingPredicate {
}
};
-/// getRegisterValueType - Look up and return the first ValueType of specified
-/// RegisterClass record
+/// getRegisterValueType - Look up and return the ValueType of the specified
+/// register. If the register is a member of multiple register classes which
+/// have different associated types, return MVT::Other.
static MVT::SimpleValueType getRegisterValueType(Record *R, const CodeGenTarget &T) {
- if (const CodeGenRegisterClass *RC = T.getRegisterClassForRegister(R))
- return RC->getValueTypeNum(0);
- return MVT::Other;
+ int FoundRC = 0;
+ MVT::SimpleValueType VT = MVT::Other;
+ const std::vector<CodeGenRegisterClass> &RCs = T.getRegisterClasses();
+ std::vector<CodeGenRegisterClass>::const_iterator RC;
+ std::vector<Record*>::const_iterator Element;
+
+ for (RC = RCs.begin() ; RC != RCs.end() ; RC++) {
+ Element = find((*RC).Elements.begin(), (*RC).Elements.end(), R);
+ if (Element != (*RC).Elements.end()) {
+ if (!FoundRC) {
+ FoundRC = 1;
+ VT = (*RC).getValueTypeNum(0);
+ } else {
+ // In multiple RC's
+ if (VT != (*RC).getValueTypeNum(0)) {
+ // Types of the RC's do not agree. Return MVT::Other. The
+ // target is responsible for handling this.
+ return MVT::Other;
+ }
+ }
+ }
+ }
+ return VT;
}