Home | History | Annotate | Download | only in TableGen

Lines Matching refs:Matcher

1 //===- DAGISelMatcher.h - Representation of DAG pattern matcher -*- C++ -*-===//
22 class Matcher;
31 Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern,unsigned Variant,
33 void OptimizeMatcher(std::unique_ptr<Matcher> &Matcher,
35 void EmitMatcherTable(const Matcher *Matcher, const CodeGenDAGPatterns &CGP,
39 /// Matcher - Base class for all the DAG ISel Matcher representation
41 class Matcher {
42 // The next matcher node that is executed after this one. Null if this is the
44 std::unique_ptr<Matcher> Next;
48 // Matcher state manipulation.
92 Matcher(KindTy K) : Kind(K) {}
94 virtual ~Matcher() {}
98 Matcher *getNext() { return Next.get(); }
99 const Matcher *getNext() const { return Next.get(); }
100 void setNext(Matcher *C) { Next.reset(C); }
101 Matcher *takeNext() { return Next.release(); }
103 std::unique_ptr<Matcher> &getNextPtr() { return Next; }
105 bool isEqual(const Matcher *M) const {
155 Matcher *unlinkNode(Matcher *Other);
157 /// canMoveBefore - Return true if this matcher is the same as Other, or if
158 /// we can move this matcher past all of the nodes in-between Other and this
160 bool canMoveBefore(const Matcher *Other) const;
162 /// canMoveBeforeNode - Return true if it is safe to move the current matcher
164 bool canMoveBeforeNode(const Matcher *Other) const;
168 bool isContradictory(const Matcher *Other) const {
183 virtual bool isEqualImpl(const Matcher *M) const = 0;
185 virtual bool isContradictoryImpl(const Matcher *M) const { return false; }
191 class ScopeMatcher : public Matcher {
192 SmallVector<Matcher*, 4> Children;
194 ScopeMatcher(ArrayRef<Matcher *> children)
195 : Matcher(Scope), Children(children.begin(), children.end()) {
201 Matcher *getChild(unsigned i) { return Children[i]; }
202 const Matcher *getChild(unsigned i) const { return Children[i]; }
204 void resetChild(unsigned i, Matcher *N) {
209 Matcher *takeChild(unsigned i) {
210 Matcher *Res = Children[i];
224 static inline bool classof(const Matcher *N) {
230 bool isEqualImpl(const Matcher *M) const override { return false; }
235 class RecordMatcher : public Matcher {
245 : Matcher(RecordNode), WhatFor(whatfor), ResultNo(resultNo) {}
250 static inline bool classof(const Matcher *N) {
257 bool isEqualImpl(const Matcher *M) const override { return true; }
264 class RecordChildMatcher : public Matcher {
277 : Matcher(RecordChild), ChildNo(childno), WhatFor(whatfor),
284 static inline bool classof(const Matcher *N) {
292 bool isEqualImpl(const Matcher *M) const override {
299 class RecordMemRefMatcher : public Matcher {
301 RecordMemRefMatcher() : Matcher(RecordMemRef) {}
303 static inline bool classof(const Matcher *N) {
311 bool isEqualImpl(const Matcher *M) const override { return true; }
318 class CaptureGlueInputMatcher : public Matcher {
320 CaptureGlueInputMatcher() : Matcher(CaptureGlueInput) {}
322 static inline bool classof(const Matcher *N) {
330 bool isEqualImpl(const Matcher *M) const override { return true; }
336 class MoveChildMatcher : public Matcher {
339 MoveChildMatcher(unsigned childNo) : Matcher(MoveChild), ChildNo(childNo) {}
343 static inline bool classof(const Matcher *N) {
351 bool isEqualImpl(const Matcher *M) const override {
359 class MoveParentMatcher : public Matcher {
361 MoveParentMatcher() : Matcher(MoveParent) {}
363 static inline bool classof(const Matcher *N) {
371 bool isEqualImpl(const Matcher *M) const override { return true; }
378 class CheckSameMatcher : public Matcher {
382 : Matcher(CheckSame), MatchNumber(matchnumber) {}
386 static inline bool classof(const Matcher *N) {
394 bool isEqualImpl(const Matcher *M) const override {
403 class CheckChildSameMatcher : public Matcher {
408 : Matcher(CheckChildSame), ChildNo(childno), MatchNumber(matchnumber) {}
413 static inline bool classof(const Matcher *N) {
421 bool isEqualImpl(const Matcher *M) const override {
431 class CheckPatternPredicateMatcher : public Matcher {
435 : Matcher(CheckPatternPredicate), Predicate(predicate) {}
439 static inline bool classof(const Matcher *N) {
447 bool isEqualImpl(const Matcher *M) const override {
455 class CheckPredicateMatcher : public Matcher {
462 static inline bool classof(const Matcher *N) {
471 bool isEqualImpl(const Matcher *M) const override {
480 class CheckOpcodeMatcher : public Matcher {
484 : Matcher(CheckOpcode), Opcode(opcode) {}
488 static inline bool classof(const Matcher *N) {
496 bool isEqualImpl(const Matcher *M) const override;
498 bool isContradictoryImpl(const Matcher *M) const override;
502 /// to one matcher per opcode. If the opcode doesn't match any of the cases,
505 class SwitchOpcodeMatcher : public Matcher {
506 SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
508 SwitchOpcodeMatcher(ArrayRef<std::pair<const SDNodeInfo*, Matcher*> > cases)
509 : Matcher(SwitchOpcode), Cases(cases.begin(), cases.end()) {}
512 static inline bool classof(const Matcher *N) {
519 Matcher *getCaseMatcher(unsigned i) { return Cases[i].second; }
520 const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
524 bool isEqualImpl(const Matcher *M) const override { return false; }
530 class CheckTypeMatcher : public Matcher {
535 : Matcher(CheckType), Type(type), ResNo(resno) {}
540 static inline bool classof(const Matcher *N) {
548 bool isEqualImpl(const Matcher *M) const override {
552 bool isContradictoryImpl(const Matcher *M) const override;
556 /// to one matcher per case. If the type doesn't match any of the cases,
559 class SwitchTypeMatcher : public Matcher {
560 SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
562 SwitchTypeMatcher(ArrayRef<std::pair<MVT::SimpleValueType, Matcher*> > cases)
563 : Matcher(SwitchType), Cases(cases.begin(), cases.end()) {}
566 static inline bool classof(const Matcher *N) {
573 Matcher *getCaseMatcher(unsigned i) { return Cases[i].second; }
574 const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
578 bool isEqualImpl(const Matcher *M) const override { return false; }
585 class CheckChildTypeMatcher : public Matcher {
590 : Matcher(CheckChildType), ChildNo(childno), Type(type) {}
595 static inline bool classof(const Matcher *N) {
603 bool isEqualImpl(const Matcher *M) const override {
608 bool isContradictoryImpl(const Matcher *M) const override;
614 class CheckIntegerMatcher : public Matcher {
618 : Matcher(CheckInteger), Value(value) {}
622 static inline bool classof(const Matcher *N) {
630 bool isEqualImpl(const Matcher *M) const override {
634 bool isContradictoryImpl(const Matcher *M) const override;
639 class CheckChildIntegerMatcher : public Matcher {
644 : Matcher(CheckChildInteger), ChildNo(childno), Value(value) {}
649 static inline bool classof(const Matcher *N) {
657 bool isEqualImpl(const Matcher *M) const override {
662 bool isContradictoryImpl(const Matcher *M) const override;
667 class CheckCondCodeMatcher : public Matcher {
671 : Matcher(CheckCondCode), CondCodeName(condcodename) {}
675 static inline bool classof(const Matcher *N) {
683 bool isEqualImpl(const Matcher *M) const override {
691 class CheckValueTypeMatcher : public Matcher {
695 : Matcher(CheckValueType), TypeName(type_name) {}
699 static inline bool classof(const Matcher *N) {
707 bool isEqualImpl(const Matcher *M) const override {
711 bool isContradictoryImpl(const Matcher *M) const override;
718 class CheckComplexPatMatcher : public Matcher {
734 : Matcher(CheckComplexPat), Pattern(pattern), MatchNumber(matchnumber),
743 static inline bool classof(const Matcher *N) {
752 bool isEqualImpl(const Matcher *M) const override {
763 class CheckAndImmMatcher : public Matcher {
767 : Matcher(CheckAndImm), Value(value) {}
771 static inline bool classof(const Matcher *N) {
779 bool isEqualImpl(const Matcher *M) const override {
787 class CheckOrImmMatcher : public Matcher {
791 : Matcher(CheckOrImm), Value(value) {}
795 static inline bool classof(const Matcher *N) {
803 bool isEqualImpl(const Matcher *M) const override {
811 class CheckFoldableChainNodeMatcher : public Matcher {
814 : Matcher(CheckFoldableChainNode) {}
816 static inline bool classof(const Matcher *N) {
824 bool isEqualImpl(const Matcher *M) const override { return true; }
829 class EmitIntegerMatcher : public Matcher {
834 : Matcher(EmitInteger), Val(val), VT(vt) {}
839 static inline bool classof(const Matcher *N) {
845 bool isEqualImpl(const Matcher *M) const override {
854 class EmitStringIntegerMatcher : public Matcher {
859 : Matcher(EmitStringInteger), Val(val), VT(vt) {}
864 static inline bool classof(const Matcher *N) {
870 bool isEqualImpl(const Matcher *M) const override {
878 class EmitRegisterMatcher : public Matcher {
885 : Matcher(EmitRegister), Reg(reg), VT(vt) {}
890 static inline bool classof(const Matcher *N) {
896 bool isEqualImpl(const Matcher *M) const override {
908 class EmitConvertToTargetMatcher : public Matcher {
912 : Matcher(EmitConvertToTarget), Slot(slot) {}
916 static inline bool classof(const Matcher *N) {
922 bool isEqualImpl(const Matcher *M) const override {
932 class EmitMergeInputChainsMatcher : public Matcher {
936 : Matcher(EmitMergeInputChains), ChainNodes(nodes.begin(), nodes.end()) {}
945 static inline bool classof(const Matcher *N) {
951 bool isEqualImpl(const Matcher *M) const override {
960 class EmitCopyToRegMatcher : public Matcher {
965 : Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
970 static inline bool classof(const Matcher *N) {
976 bool isEqualImpl(const Matcher *M) const override {
989 class EmitNodeXFormMatcher : public Matcher {
994 : Matcher(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {}
999 static inline bool classof(const Matcher *N) {
1005 bool isEqualImpl(const Matcher *M) const override {
1016 class EmitNodeMatcherCommon : public Matcher {
1033 : Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), OpcodeName(opcodeName),
1062 static inline bool classof(const Matcher *N) {
1068 bool isEqualImpl(const Matcher *M) const override;
1090 static inline bool classof(const Matcher *N) {
1114 static inline bool classof(const Matcher *N) {
1122 class MarkGlueResultsMatcher : public Matcher {
1126 : Matcher(MarkGlueResults), GlueResultNodes(nodes.begin(), nodes.end()) {}
1135 static inline bool classof(const Matcher *N) {
1141 bool isEqualImpl(const Matcher *M) const override {
1150 class CompleteMatchMatcher : public Matcher {
1156 : Matcher(CompleteMatch), Results(results.begin(), results.end()),
1163 static inline bool classof(const Matcher *N) {
1169 bool isEqualImpl(const Matcher *M) const override {