summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-23 07:50:58 +0000
committerChris Lattner <sabre@nondot.org>2010-02-23 07:50:58 +0000
commitba1cff4450e22415bfcb960342e6d5a5918e530a (patch)
treef963aa4a1422e6bd08568b93e9905d6a3407ede1 /utils
parenta27234e290a4809c5a60e28e99f2870142ff3a55 (diff)
downloadllvm-ba1cff4450e22415bfcb960342e6d5a5918e530a.tar.gz
llvm-ba1cff4450e22415bfcb960342e6d5a5918e530a.tar.bz2
llvm-ba1cff4450e22415bfcb960342e6d5a5918e530a.tar.xz
add some #if 0'd out code for checking that named values in
input/output patterns have the same type. It turns out that this triggers all the time because we don't infer types between these boundaries. Until we do, don't turn this on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.cpp60
1 files changed, 41 insertions, 19 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index 3c7c2edae8..112a52d567 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -568,33 +568,36 @@ bool TreePatternNode::UpdateNodeType(const std::vector<unsigned char> &ExtVTs,
return true; // unreachable
}
+static std::string GetTypeName(unsigned char TypeID) {
+ switch (TypeID) {
+ case MVT::Other: return "Other";
+ case MVT::iAny: return "iAny";
+ case MVT::fAny: return "fAny";
+ case MVT::vAny: return "vAny";
+ case EEVT::isUnknown: return "isUnknown";
+ case MVT::iPTR: return "iPTR";
+ case MVT::iPTRAny: return "iPTRAny";
+ default:
+ std::string VTName = llvm::getName((MVT::SimpleValueType)TypeID);
+ // Strip off EVT:: prefix if present.
+ if (VTName.substr(0,5) == "MVT::")
+ VTName = VTName.substr(5);
+ return VTName;
+ }
+}
+
void TreePatternNode::print(raw_ostream &OS) const {
if (isLeaf()) {
OS << *getLeafValue();
} else {
- OS << "(" << getOperator()->getName();
+ OS << '(' << getOperator()->getName();
}
// FIXME: At some point we should handle printing all the value types for
// nodes that are multiply typed.
- switch (getExtTypeNum(0)) {
- case MVT::Other: OS << ":Other"; break;
- case MVT::iAny: OS << ":iAny"; break;
- case MVT::fAny : OS << ":fAny"; break;
- case MVT::vAny: OS << ":vAny"; break;
- case EEVT::isUnknown: ; /*OS << ":?";*/ break;
- case MVT::iPTR: OS << ":iPTR"; break;
- case MVT::iPTRAny: OS << ":iPTRAny"; break;
- default: {
- std::string VTName = llvm::getName(getTypeNum(0));
- // Strip off EVT:: prefix if present.
- if (VTName.substr(0,5) == "MVT::")
- VTName = VTName.substr(5);
- OS << ":" << VTName;
- break;
- }
- }
+ if (getExtTypeNum(0) != EEVT::isUnknown)
+ OS << ':' << GetTypeName(getExtTypeNum(0));
if (!isLeaf()) {
if (getNumChildren() != 0) {
@@ -2125,10 +2128,29 @@ void CodeGenDAGPatterns::AddPatternToMatch(const TreePattern *Pattern,
// Scan all of the named values in the destination pattern, rejecting them if
// they don't exist in the input pattern.
for (std::map<std::string, NameRecord>::iterator
- I = DstNames.begin(), E = DstNames.end(); I != E; ++I)
+ I = DstNames.begin(), E = DstNames.end(); I != E; ++I) {
if (SrcNames[I->first].first == 0)
Pattern->error("Pattern has input without matching name in output: $" +
I->first);
+
+#if 0
+ const std::vector<unsigned char> &SrcTypeVec =
+ SrcNames[I->first].first->getExtTypes();
+ const std::vector<unsigned char> &DstTypeVec =
+ I->second.first->getExtTypes();
+ if (SrcTypeVec == DstTypeVec) continue;
+
+ std::string SrcType, DstType;
+ for (unsigned i = 0, e = SrcTypeVec.size(); i != e; ++i)
+ SrcType += ":" + GetTypeName(SrcTypeVec[i]);
+ for (unsigned i = 0, e = DstTypeVec.size(); i != e; ++i)
+ DstType += ":" + GetTypeName(DstTypeVec[i]);
+
+ Pattern->error("Variable $" + I->first +
+ " has different types in source (" + SrcType +
+ ") and dest (" + DstType + ") pattern!");
+#endif
+ }
// Scan all of the named values in the source pattern, rejecting them if the
// name isn't used in the dest, and isn't used to tie two values together.