Skip to content

Commit

Permalink
[TableGen] Remove getHash support from DAGISelMatcher. It hasn't been…
Browse files Browse the repository at this point in the history
… used for some time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268706 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed May 6, 2016
1 parent 489f3e9 commit 4714294
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 95 deletions.
48 changes: 0 additions & 48 deletions utils/TableGen/DAGISelMatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,44 +283,6 @@ void CompleteMatchMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "Dst = " << *Pattern.getDstPattern() << "\n";
}

// getHashImpl Implementation.

unsigned CheckPatternPredicateMatcher::getHashImpl() const {
return HashString(Predicate);
}

unsigned CheckPredicateMatcher::getHashImpl() const {
return HashString(getPredicate().getFnName());
}

unsigned CheckOpcodeMatcher::getHashImpl() const {
return HashString(Opcode.getEnumName());
}

unsigned CheckCondCodeMatcher::getHashImpl() const {
return HashString(CondCodeName);
}

unsigned CheckValueTypeMatcher::getHashImpl() const {
return HashString(TypeName);
}

unsigned EmitStringIntegerMatcher::getHashImpl() const {
return HashString(Val) ^ VT;
}

template<typename It>
static unsigned HashUnsigneds(It I, It E) {
unsigned Result = 0;
for (; I != E; ++I)
Result = (Result<<3) ^ *I;
return Result;
}

unsigned EmitMergeInputChainsMatcher::getHashImpl() const {
return HashUnsigneds(ChainNodes.begin(), ChainNodes.end());
}

bool CheckOpcodeMatcher::isEqualImpl(const Matcher *M) const {
// Note: pointer equality isn't enough here, we have to check the enum names
// to ensure that the nodes are for the same opcode.
Expand All @@ -337,20 +299,10 @@ bool EmitNodeMatcherCommon::isEqualImpl(const Matcher *m) const {
M->NumFixedArityOperands == NumFixedArityOperands;
}

unsigned EmitNodeMatcherCommon::getHashImpl() const {
return (HashString(OpcodeName) << 4) | Operands.size();
}


void EmitNodeMatcher::anchor() { }

void MorphNodeToMatcher::anchor() { }

unsigned CompleteMatchMatcher::getHashImpl() const {
return HashUnsigneds(Results.begin(), Results.end()) ^
((unsigned)(intptr_t)&Pattern << 8);
}

// isContradictoryImpl Implementations.

static bool TypesAreContradictory(MVT::SimpleValueType T1,
Expand Down
47 changes: 0 additions & 47 deletions utils/TableGen/DAGISelMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ class Matcher {
return isEqualImpl(M);
}

unsigned getHash() const {
// Clear the high bit so we don't conflict with tombstones etc.
return ((getHashImpl() << 4) ^ getKind()) & (~0U>>1);
}

/// isSafeToReorderWithPatternPredicate - Return true if it is safe to sink a
/// PatternPredicate node past this one.
virtual bool isSafeToReorderWithPatternPredicate() const {
Expand Down Expand Up @@ -180,7 +175,6 @@ class Matcher {
protected:
virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0;
virtual bool isEqualImpl(const Matcher *M) const = 0;
virtual unsigned getHashImpl() const = 0;
virtual bool isContradictoryImpl(const Matcher *M) const { return false; }
};

Expand Down Expand Up @@ -227,7 +221,6 @@ class ScopeMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return false; }
unsigned getHashImpl() const override { return 12312; }
};

/// RecordMatcher - Save the current node in the operand list.
Expand All @@ -254,7 +247,6 @@ class RecordMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return true; }
unsigned getHashImpl() const override { return 0; }
};

/// RecordChildMatcher - Save a numbered child of the current node, or fail
Expand Down Expand Up @@ -291,7 +283,6 @@ class RecordChildMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<RecordChildMatcher>(M)->getChildNo() == getChildNo();
}
unsigned getHashImpl() const override { return getChildNo(); }
};

/// RecordMemRefMatcher - Save the current node's memref.
Expand All @@ -308,7 +299,6 @@ class RecordMemRefMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return true; }
unsigned getHashImpl() const override { return 0; }
};


Expand All @@ -327,7 +317,6 @@ class CaptureGlueInputMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return true; }
unsigned getHashImpl() const override { return 0; }
};

/// MoveChildMatcher - This tells the interpreter to move into the
Expand All @@ -350,7 +339,6 @@ class MoveChildMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<MoveChildMatcher>(M)->getChildNo() == getChildNo();
}
unsigned getHashImpl() const override { return getChildNo(); }
};

/// MoveParentMatcher - This tells the interpreter to move to the parent
Expand All @@ -368,7 +356,6 @@ class MoveParentMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return true; }
unsigned getHashImpl() const override { return 0; }
};

/// CheckSameMatcher - This checks to see if this node is exactly the same
Expand All @@ -393,7 +380,6 @@ class CheckSameMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckSameMatcher>(M)->getMatchNumber() == getMatchNumber();
}
unsigned getHashImpl() const override { return getMatchNumber(); }
};

/// CheckChildSameMatcher - This checks to see if child node is exactly the same
Expand Down Expand Up @@ -421,7 +407,6 @@ class CheckChildSameMatcher : public Matcher {
return cast<CheckChildSameMatcher>(M)->ChildNo == ChildNo &&
cast<CheckChildSameMatcher>(M)->MatchNumber == MatchNumber;
}
unsigned getHashImpl() const override { return (MatchNumber << 2) | ChildNo; }
};

/// CheckPatternPredicateMatcher - This checks the target-specific predicate
Expand All @@ -446,7 +431,6 @@ class CheckPatternPredicateMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckPatternPredicateMatcher>(M)->getPredicate() == Predicate;
}
unsigned getHashImpl() const override;
};

/// CheckPredicateMatcher - This checks the target-specific predicate to
Expand All @@ -470,7 +454,6 @@ class CheckPredicateMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckPredicateMatcher>(M)->Pred == Pred;
}
unsigned getHashImpl() const override;
};


Expand All @@ -493,7 +476,6 @@ class CheckOpcodeMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override;
unsigned getHashImpl() const override;
bool isContradictoryImpl(const Matcher *M) const override;
};

Expand Down Expand Up @@ -521,7 +503,6 @@ class SwitchOpcodeMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return false; }
unsigned getHashImpl() const override { return 4123; }
};

/// CheckTypeMatcher - This checks to see if the current node has the
Expand All @@ -547,7 +528,6 @@ class CheckTypeMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckTypeMatcher>(M)->Type == Type;
}
unsigned getHashImpl() const override { return Type; }
bool isContradictoryImpl(const Matcher *M) const override;
};

Expand Down Expand Up @@ -575,7 +555,6 @@ class SwitchTypeMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return false; }
unsigned getHashImpl() const override { return 4123; }
};


Expand Down Expand Up @@ -603,7 +582,6 @@ class CheckChildTypeMatcher : public Matcher {
return cast<CheckChildTypeMatcher>(M)->ChildNo == ChildNo &&
cast<CheckChildTypeMatcher>(M)->Type == Type;
}
unsigned getHashImpl() const override { return (Type << 3) | ChildNo; }
bool isContradictoryImpl(const Matcher *M) const override;
};

Expand All @@ -629,7 +607,6 @@ class CheckIntegerMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckIntegerMatcher>(M)->Value == Value;
}
unsigned getHashImpl() const override { return Value; }
bool isContradictoryImpl(const Matcher *M) const override;
};

Expand Down Expand Up @@ -657,7 +634,6 @@ class CheckChildIntegerMatcher : public Matcher {
return cast<CheckChildIntegerMatcher>(M)->ChildNo == ChildNo &&
cast<CheckChildIntegerMatcher>(M)->Value == Value;
}
unsigned getHashImpl() const override { return (Value << 3) | ChildNo; }
bool isContradictoryImpl(const Matcher *M) const override;
};

Expand All @@ -682,7 +658,6 @@ class CheckCondCodeMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckCondCodeMatcher>(M)->CondCodeName == CondCodeName;
}
unsigned getHashImpl() const override;
};

/// CheckValueTypeMatcher - This checks to see if the current node is a
Expand All @@ -706,7 +681,6 @@ class CheckValueTypeMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckValueTypeMatcher>(M)->TypeName == TypeName;
}
unsigned getHashImpl() const override;
bool isContradictoryImpl(const Matcher *M) const override;
};

Expand Down Expand Up @@ -752,9 +726,6 @@ class CheckComplexPatMatcher : public Matcher {
return &cast<CheckComplexPatMatcher>(M)->Pattern == &Pattern &&
cast<CheckComplexPatMatcher>(M)->MatchNumber == MatchNumber;
}
unsigned getHashImpl() const override {
return (unsigned)(intptr_t)&Pattern ^ MatchNumber;
}
};

/// CheckAndImmMatcher - This checks to see if the current node is an 'and'
Expand All @@ -778,7 +749,6 @@ class CheckAndImmMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckAndImmMatcher>(M)->Value == Value;
}
unsigned getHashImpl() const override { return Value; }
};

/// CheckOrImmMatcher - This checks to see if the current node is an 'and'
Expand All @@ -802,7 +772,6 @@ class CheckOrImmMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<CheckOrImmMatcher>(M)->Value == Value;
}
unsigned getHashImpl() const override { return Value; }
};

/// CheckFoldableChainNodeMatcher - This checks to see if the current node
Expand All @@ -821,7 +790,6 @@ class CheckFoldableChainNodeMatcher : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override { return true; }
unsigned getHashImpl() const override { return 0; }
};

/// EmitIntegerMatcher - This creates a new TargetConstant.
Expand All @@ -845,7 +813,6 @@ class EmitIntegerMatcher : public Matcher {
return cast<EmitIntegerMatcher>(M)->Val == Val &&
cast<EmitIntegerMatcher>(M)->VT == VT;
}
unsigned getHashImpl() const override { return (Val << 4) | VT; }
};

/// EmitStringIntegerMatcher - A target constant whose value is represented
Expand All @@ -870,7 +837,6 @@ class EmitStringIntegerMatcher : public Matcher {
return cast<EmitStringIntegerMatcher>(M)->Val == Val &&
cast<EmitStringIntegerMatcher>(M)->VT == VT;
}
unsigned getHashImpl() const override;
};

/// EmitRegisterMatcher - This creates a new TargetConstant.
Expand All @@ -896,9 +862,6 @@ class EmitRegisterMatcher : public Matcher {
return cast<EmitRegisterMatcher>(M)->Reg == Reg &&
cast<EmitRegisterMatcher>(M)->VT == VT;
}
unsigned getHashImpl() const override {
return ((unsigned)(intptr_t)Reg) << 4 | VT;
}
};

/// EmitConvertToTargetMatcher - Emit an operation that reads a specified
Expand All @@ -921,7 +884,6 @@ class EmitConvertToTargetMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<EmitConvertToTargetMatcher>(M)->Slot == Slot;
}
unsigned getHashImpl() const override { return Slot; }
};

/// EmitMergeInputChainsMatcher - Emit a node that merges a list of input
Expand Down Expand Up @@ -950,7 +912,6 @@ class EmitMergeInputChainsMatcher : public Matcher {
bool isEqualImpl(const Matcher *M) const override {
return cast<EmitMergeInputChainsMatcher>(M)->ChainNodes == ChainNodes;
}
unsigned getHashImpl() const override;
};

/// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg,
Expand All @@ -976,9 +937,6 @@ class EmitCopyToRegMatcher : public Matcher {
return cast<EmitCopyToRegMatcher>(M)->SrcSlot == SrcSlot &&
cast<EmitCopyToRegMatcher>(M)->DestPhysReg == DestPhysReg;
}
unsigned getHashImpl() const override {
return SrcSlot ^ ((unsigned)(intptr_t)DestPhysReg << 4);
}
};


Expand All @@ -1005,9 +963,6 @@ class EmitNodeXFormMatcher : public Matcher {
return cast<EmitNodeXFormMatcher>(M)->Slot == Slot &&
cast<EmitNodeXFormMatcher>(M)->NodeXForm == NodeXForm;
}
unsigned getHashImpl() const override {
return Slot ^ ((unsigned)(intptr_t)NodeXForm << 4);
}
};

/// EmitNodeMatcherCommon - Common class shared between EmitNode and
Expand Down Expand Up @@ -1065,7 +1020,6 @@ class EmitNodeMatcherCommon : public Matcher {
private:
void printImpl(raw_ostream &OS, unsigned indent) const override;
bool isEqualImpl(const Matcher *M) const override;
unsigned getHashImpl() const override;
};

/// EmitNodeMatcher - This signals a successful match and generates a node.
Expand Down Expand Up @@ -1141,7 +1095,6 @@ class CompleteMatchMatcher : public Matcher {
return cast<CompleteMatchMatcher>(M)->Results == Results &&
&cast<CompleteMatchMatcher>(M)->Pattern == &Pattern;
}
unsigned getHashImpl() const override;
};

} // end namespace llvm
Expand Down

0 comments on commit 4714294

Please sign in to comment.