* Added an explicit type field to ComplexPattern.

* Renamed MatchingNodes to RootNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24636 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2005-12-08 02:14:08 +00:00
parent ec693f77c0
commit 3aa39f439a
3 changed files with 12 additions and 9 deletions

View File

@ -335,7 +335,9 @@ unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const {
// ComplexPattern implementation // ComplexPattern implementation
// //
ComplexPattern::ComplexPattern(Record *R) { ComplexPattern::ComplexPattern(Record *R) {
NumOperands = R->getValueAsInt("NumOperands"); Ty = ::getValueType(R->getValueAsDef("Ty"));
SelectFunc = R->getValueAsString("SelectFunc"); NumOperands = R->getValueAsInt("NumOperands");
MatchingNodes = R->getValueAsListOfDefs("MatchingNodes"); SelectFunc = R->getValueAsString("SelectFunc");
RootNodes = R->getValueAsListOfDefs("RootNodes");
} }

View File

@ -160,17 +160,19 @@ public:
/// ComplexPattern - ComplexPattern info, corresponding to the ComplexPattern /// ComplexPattern - ComplexPattern info, corresponding to the ComplexPattern
/// tablegen class in TargetSelectionDAG.td /// tablegen class in TargetSelectionDAG.td
class ComplexPattern { class ComplexPattern {
MVT::ValueType Ty;
unsigned NumOperands; unsigned NumOperands;
std::string SelectFunc; std::string SelectFunc;
std::vector<Record*> MatchingNodes; std::vector<Record*> RootNodes;
public: public:
ComplexPattern() : NumOperands(0) {}; ComplexPattern() : NumOperands(0) {};
ComplexPattern(Record *R); ComplexPattern(Record *R);
MVT::ValueType getValueType() const { return Ty; }
unsigned getNumOperands() const { return NumOperands; } unsigned getNumOperands() const { return NumOperands; }
const std::string &getSelectFunc() const { return SelectFunc; } const std::string &getSelectFunc() const { return SelectFunc; }
const std::vector<Record*> &getMatchingNodes() const { const std::vector<Record*> &getRootNodes() const {
return MatchingNodes; return RootNodes;
} }
}; };

View File

@ -478,8 +478,7 @@ static unsigned char getIntrinsicType(Record *R, bool NotRegisters,
// Using a VTSDNode or CondCodeSDNode. // Using a VTSDNode or CondCodeSDNode.
return MVT::Other; return MVT::Other;
} else if (R->isSubClassOf("ComplexPattern")) { } else if (R->isSubClassOf("ComplexPattern")) {
const CodeGenTarget &T = TP.getDAGISelEmitter().getTargetInfo(); return TP.getDAGISelEmitter().getComplexPattern(R).getValueType();
return T.getPointerType();
} else if (R->getName() == "node") { } else if (R->getName() == "node") {
// Placeholder. // Placeholder.
return MVT::isUnknown; return MVT::isUnknown;
@ -2256,7 +2255,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
dynamic_cast<IntInit*>(Node->getLeafValue())) { dynamic_cast<IntInit*>(Node->getLeafValue())) {
PatternsByOpcode[getSDNodeNamed("imm")].push_back(&PatternsToMatch[i]); PatternsByOpcode[getSDNodeNamed("imm")].push_back(&PatternsToMatch[i]);
} else if ((CP = NodeGetComplexPattern(Node, *this))) { } else if ((CP = NodeGetComplexPattern(Node, *this))) {
std::vector<Record*> OpNodes = CP->getMatchingNodes(); std::vector<Record*> OpNodes = CP->getRootNodes();
for (unsigned j = 0, e = OpNodes.size(); j != e; j++) { for (unsigned j = 0, e = OpNodes.size(); j != e; j++) {
PatternsByOpcode[OpNodes[j]].insert(PatternsByOpcode[OpNodes[j]].begin(), PatternsByOpcode[OpNodes[j]].insert(PatternsByOpcode[OpNodes[j]].begin(),
&PatternsToMatch[i]); &PatternsToMatch[i]);