From b91411c9b9be13f1c99fbfc4da2529d154c6673c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 4 Jan 2010 20:31:55 +0000 Subject: [PATCH] Remove the CPAttrParentAsRoot code, which is unused, and inconvenient for a refactoring I'm working on. llvm-svn: 92503 --- llvm/include/llvm/Target/TargetSelectionDAG.td | 9 +-------- llvm/utils/TableGen/CodeGenTarget.cpp | 12 ------------ llvm/utils/TableGen/CodeGenTarget.h | 5 ----- llvm/utils/TableGen/DAGISelEmitter.cpp | 12 +++--------- 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/llvm/include/llvm/Target/TargetSelectionDAG.td b/llvm/include/llvm/Target/TargetSelectionDAG.td index 7f54f819af23..4b72f81eb1e8 100644 --- a/llvm/include/llvm/Target/TargetSelectionDAG.td +++ b/llvm/include/llvm/Target/TargetSelectionDAG.td @@ -843,11 +843,6 @@ class Pat : Pattern; // Complex pattern definitions. // -class CPAttribute; -// Pass the parent Operand as root to CP function rather -// than the root of the sub-DAG -def CPAttrParentAsRoot : CPAttribute; - // Complex patterns, e.g. X86 addressing mode, requires pattern matching code // in C++. NumOperands is the number of operands returned by the select function; // SelectFunc is the name of the function used to pattern match the max. pattern; @@ -855,12 +850,10 @@ def CPAttrParentAsRoot : CPAttribute; // e.g. X86 addressing mode - def addr : ComplexPattern<4, "SelectAddr", [add]>; // class ComplexPattern roots = [], list props = [], - list attrs = []> { + list roots = [], list props = []> { ValueType Ty = ty; int NumOperands = numops; string SelectFunc = fn; list RootNodes = roots; list Properties = props; - list Attributes = attrs; } diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 0edca7353a4a..797614ee45af 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -402,18 +402,6 @@ ComplexPattern::ComplexPattern(Record *R) { << "' on ComplexPattern '" << R->getName() << "'!\n"; exit(1); } - - // Parse the attributes. - Attributes = 0; - PropList = R->getValueAsListOfDefs("Attributes"); - for (unsigned i = 0, e = PropList.size(); i != e; ++i) - if (PropList[i]->getName() == "CPAttrParentAsRoot") { - Attributes |= 1 << CPAttrParentAsRoot; - } else { - errs() << "Unsupported pattern attribute '" << PropList[i]->getName() - << "' on ComplexPattern '" << R->getName() << "'!\n"; - exit(1); - } } //===----------------------------------------------------------------------===// diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h index da4b1cc20e59..07bc54d28daa 100644 --- a/llvm/utils/TableGen/CodeGenTarget.h +++ b/llvm/utils/TableGen/CodeGenTarget.h @@ -46,9 +46,6 @@ enum SDNP { SDNPMemOperand }; -// ComplexPattern attributes. -enum CPAttr { CPAttrParentAsRoot }; - /// getValueType - Return the MVT::SimpleValueType that the specified TableGen /// record corresponds to. MVT::SimpleValueType getValueType(Record *Rec); @@ -227,7 +224,6 @@ class ComplexPattern { std::string SelectFunc; std::vector RootNodes; unsigned Properties; // Node properties - unsigned Attributes; // Pattern attributes public: ComplexPattern() : NumOperands(0) {} ComplexPattern(Record *R); @@ -239,7 +235,6 @@ public: return RootNodes; } bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); } - bool hasAttribute(enum CPAttr Attr) const { return Attributes & (1 << Attr); } }; } // End llvm namespace diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index a901fd0f1285..a6bb2112c1ce 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -610,7 +610,7 @@ public: emitCheck(MaskPredicate + RootName + "0, Tmp" + utostr(NTmp) + ", INT64_C(" + itostr(II->getValue()) + "))"); - EmitChildMatchCode(N->getChild(0), N, RootName + utostr(0), RootName, + EmitChildMatchCode(N->getChild(0), N, RootName + utostr(0), ChainSuffix + utostr(0), FoundChain); return; } @@ -621,7 +621,7 @@ public: emitInit("SDValue " + RootName + utostr(OpNo) + " = " + RootName + ".getOperand(" +utostr(OpNo) + ");"); - EmitChildMatchCode(N->getChild(i), N, RootName + utostr(OpNo), RootName, + EmitChildMatchCode(N->getChild(i), N, RootName + utostr(OpNo), ChainSuffix + utostr(OpNo), FoundChain); } @@ -654,7 +654,6 @@ public: void EmitChildMatchCode(TreePatternNode *Child, TreePatternNode *Parent, const std::string &RootName, - const std::string &ParentRootName, const std::string &ChainSuffix, bool &FoundChain) { if (!Child->isLeaf()) { // If it's not a leaf, recursively match. @@ -719,12 +718,7 @@ public: emitCode("SDValue " + ChainName + ";"); } - std::string Code = Fn + "("; - if (CP->hasAttribute(CPAttrParentAsRoot)) { - Code += ParentRootName + ", "; - } else { - Code += "N, "; - } + std::string Code = Fn + "(N, "; if (CP->hasProperty(SDNPHasChain)) { std::string ParentName(RootName.begin(), RootName.end()-1); Code += ParentName + ", ";