blob: 3d73262ef881d8980de4d5c74c1be20b8cdf4c96 [file] [log] [blame]
Chris Lattnere7d6e3c2010-02-15 08:04:42 +00001//===- DAGISelMatcher.h - Representation of DAG pattern matcher -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef TBLGEN_DAGISELMATCHER_H
11#define TBLGEN_DAGISELMATCHER_H
12
Chris Lattnerfdbdc8c2010-02-16 07:21:10 +000013#include "llvm/CodeGen/ValueTypes.h"
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000014#include "llvm/ADT/OwningPtr.h"
15#include "llvm/ADT/StringRef.h"
Chris Lattner3163ca52010-02-21 03:22:59 +000016#include "llvm/ADT/SmallVector.h"
Chris Lattnerfdbdc8c2010-02-16 07:21:10 +000017#include "llvm/Support/Casting.h"
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000018
19namespace llvm {
20 class CodeGenDAGPatterns;
Chris Lattner9a515172010-02-25 02:04:40 +000021 class Matcher;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000022 class PatternToMatch;
23 class raw_ostream;
24 class ComplexPattern;
Chris Lattnerddfb5222010-02-18 22:03:03 +000025 class Record;
Chris Lattnere9f720b2010-02-27 21:48:43 +000026 class SDNodeInfo;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000027
Chris Lattner9a515172010-02-25 02:04:40 +000028Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern,
29 const CodeGenDAGPatterns &CGP);
30Matcher *OptimizeMatcher(Matcher *Matcher);
31void EmitMatcherTable(const Matcher *Matcher, raw_ostream &OS);
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000032
33
Chris Lattner9a515172010-02-25 02:04:40 +000034/// Matcher - Base class for all the the DAG ISel Matcher representation
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000035/// nodes.
Chris Lattner9a515172010-02-25 02:04:40 +000036class Matcher {
Chris Lattner78039ec2010-02-18 02:53:41 +000037 // The next matcher node that is executed after this one. Null if this is the
38 // last stage of a match.
Chris Lattner9a515172010-02-25 02:04:40 +000039 OwningPtr<Matcher> Next;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000040public:
41 enum KindTy {
Chris Lattner3163ca52010-02-21 03:22:59 +000042 // Matcher state manipulation.
Chris Lattnerac10e4f2010-02-25 01:56:48 +000043 Scope, // Push a checking scope.
Chris Lattner3163ca52010-02-21 03:22:59 +000044 RecordNode, // Record the current node.
Chris Lattner3ee1bc42010-02-24 07:31:45 +000045 RecordChild, // Record a child of the current node.
Chris Lattner3163ca52010-02-21 03:22:59 +000046 RecordMemRef, // Record the memref in the current node.
47 CaptureFlagInput, // If the current node has an input flag, save it.
48 MoveChild, // Move current node to specified child.
49 MoveParent, // Move current node to parent.
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000050
Chris Lattnerddfb5222010-02-18 22:03:03 +000051 // Predicate checking.
Chris Lattner3163ca52010-02-21 03:22:59 +000052 CheckSame, // Fail if not same as prev match.
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000053 CheckPatternPredicate,
Chris Lattner3163ca52010-02-21 03:22:59 +000054 CheckPredicate, // Fail if node predicate fails.
55 CheckOpcode, // Fail if not opcode.
Chris Lattnerf58c08e2010-02-22 22:30:37 +000056 CheckMultiOpcode, // Fail if not in opcode list.
Chris Lattner3163ca52010-02-21 03:22:59 +000057 CheckType, // Fail if not correct type.
Chris Lattner3c664b32010-02-24 20:15:25 +000058 CheckChildType, // Fail if child has wrong type.
Chris Lattner3163ca52010-02-21 03:22:59 +000059 CheckInteger, // Fail if wrong val.
60 CheckCondCode, // Fail if not condcode.
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000061 CheckValueType,
62 CheckComplexPat,
63 CheckAndImm,
Chris Lattner9de39482010-02-16 06:10:58 +000064 CheckOrImm,
Chris Lattner283adcb2010-02-17 06:23:39 +000065 CheckFoldableChainNode,
Chris Lattnerddfb5222010-02-18 22:03:03 +000066 CheckChainCompatible,
67
68 // Node creation/emisssion.
Chris Lattner3163ca52010-02-21 03:22:59 +000069 EmitInteger, // Create a TargetConstant
70 EmitStringInteger, // Create a TargetConstant from a string.
71 EmitRegister, // Create a register.
72 EmitConvertToTarget, // Convert a imm/fpimm to target imm/fpimm
73 EmitMergeInputChains, // Merge together a chains for an input.
74 EmitCopyToReg, // Emit a copytoreg into a physreg.
75 EmitNode, // Create a DAG node
76 EmitNodeXForm, // Run a SDNodeXForm
Chris Lattner69f60c82010-02-24 05:33:42 +000077 MarkFlagResults, // Indicate which interior nodes have flag results.
Chris Lattner7a1dab42010-02-28 02:31:26 +000078 CompleteMatch, // Finish a match and update the results.
79 SelectNodeTo // Build a node, finish a match and update results.
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000080 };
81 const KindTy Kind;
Chris Lattner3b31c982010-02-18 02:49:24 +000082
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000083protected:
Chris Lattner9a515172010-02-25 02:04:40 +000084 Matcher(KindTy K) : Kind(K) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000085public:
Chris Lattner9a515172010-02-25 02:04:40 +000086 virtual ~Matcher() {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000087
88 KindTy getKind() const { return Kind; }
Chris Lattner3b31c982010-02-18 02:49:24 +000089
Chris Lattner9a515172010-02-25 02:04:40 +000090 Matcher *getNext() { return Next.get(); }
91 const Matcher *getNext() const { return Next.get(); }
92 void setNext(Matcher *C) { Next.reset(C); }
93 Matcher *takeNext() { return Next.take(); }
Chris Lattner3ee1bc42010-02-24 07:31:45 +000094
Chris Lattner9a515172010-02-25 02:04:40 +000095 OwningPtr<Matcher> &getNextPtr() { return Next; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000096
Chris Lattner9a515172010-02-25 02:04:40 +000097 static inline bool classof(const Matcher *) { return true; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +000098
Chris Lattner136ab782010-02-25 06:49:58 +000099 bool isEqual(const Matcher *M) const {
100 if (getKind() != M->getKind()) return false;
101 return isEqualImpl(M);
102 }
103
104 unsigned getHash() const {
Chris Lattner54ee7362010-02-26 07:35:27 +0000105 // Clear the high bit so we don't conflict with tombstones etc.
106 return ((getHashImpl() << 4) ^ getKind()) & (~0U>>1);
Chris Lattner136ab782010-02-25 06:49:58 +0000107 }
108
Chris Lattnerf4950d02010-02-27 06:22:57 +0000109 /// isSafeToReorderWithPatternPredicate - Return true if it is safe to sink a
110 /// PatternPredicate node past this one.
111 virtual bool isSafeToReorderWithPatternPredicate() const {
112 return false;
113 }
114
Chris Lattnerddfd5ab2010-02-27 07:49:13 +0000115 /// isContradictory - Return true of these two matchers could never match on
116 /// the same node.
117 bool isContradictory(const Matcher *Other) const {
118 // Since this predicate is reflexive, we canonicalize the ordering so that
119 // we always match a node against nodes with kinds that are greater or equal
120 // to them. For example, we'll pass in a CheckType node as an argument to
121 // the CheckOpcode method, not the other way around.
122 if (getKind() < Other->getKind())
123 return isContradictoryImpl(Other);
124 return Other->isContradictoryImpl(this);
125 }
126
Chris Lattner392b1bf2010-02-25 06:53:39 +0000127 void print(raw_ostream &OS, unsigned indent = 0) const;
Chris Lattnerddfd5ab2010-02-27 07:49:13 +0000128 void printOne(raw_ostream &OS) const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000129 void dump() const;
Chris Lattner3b31c982010-02-18 02:49:24 +0000130protected:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000131 virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0;
Chris Lattner136ab782010-02-25 06:49:58 +0000132 virtual bool isEqualImpl(const Matcher *M) const = 0;
133 virtual unsigned getHashImpl() const = 0;
Chris Lattnerddfd5ab2010-02-27 07:49:13 +0000134 virtual bool isContradictoryImpl(const Matcher *M) const { return false; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000135};
136
Chris Lattner42363662010-02-25 19:00:39 +0000137/// ScopeMatcher - This attempts to match each of its children to find the first
138/// one that successfully matches. If one child fails, it tries the next child.
139/// If none of the children match then this check fails. It never has a 'next'.
Chris Lattner9a515172010-02-25 02:04:40 +0000140class ScopeMatcher : public Matcher {
Chris Lattner42363662010-02-25 19:00:39 +0000141 SmallVector<Matcher*, 4> Children;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000142public:
Chris Lattner42363662010-02-25 19:00:39 +0000143 ScopeMatcher(Matcher *const *children, unsigned numchildren)
144 : Matcher(Scope), Children(children, children+numchildren) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000145 }
Chris Lattner42363662010-02-25 19:00:39 +0000146 virtual ~ScopeMatcher();
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000147
Chris Lattner42363662010-02-25 19:00:39 +0000148 unsigned getNumChildren() const { return Children.size(); }
149
150 Matcher *getChild(unsigned i) { return Children[i]; }
151 const Matcher *getChild(unsigned i) const { return Children[i]; }
152
153 void resetChild(unsigned i, Matcher *N) {
154 delete Children[i];
155 Children[i] = N;
156 }
157
158 Matcher *takeChild(unsigned i) {
159 Matcher *Res = Children[i];
160 Children[i] = 0;
161 return Res;
162 }
Chris Lattner54ee7362010-02-26 07:35:27 +0000163
164 void setNumChildren(unsigned NC) {
165 if (NC < Children.size()) {
166 // delete any children we're about to lose pointers to.
167 for (unsigned i = NC, e = Children.size(); i != e; ++i)
168 delete Children[i];
169 }
170 Children.resize(NC);
171 }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000172
Chris Lattner9a515172010-02-25 02:04:40 +0000173 static inline bool classof(const Matcher *N) {
Chris Lattnerac10e4f2010-02-25 01:56:48 +0000174 return N->getKind() == Scope;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000175 }
176
Chris Lattner136ab782010-02-25 06:49:58 +0000177private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000178 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000179 virtual bool isEqualImpl(const Matcher *M) const { return false; }
Chris Lattner42363662010-02-25 19:00:39 +0000180 virtual unsigned getHashImpl() const { return 12312; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000181};
182
Chris Lattner9a515172010-02-25 02:04:40 +0000183/// RecordMatcher - Save the current node in the operand list.
184class RecordMatcher : public Matcher {
Chris Lattner56cf88d2010-02-17 01:03:09 +0000185 /// WhatFor - This is a string indicating why we're recording this. This
186 /// should only be used for comment generation not anything semantic.
187 std::string WhatFor;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000188public:
Chris Lattner9a515172010-02-25 02:04:40 +0000189 RecordMatcher(const std::string &whatfor)
190 : Matcher(RecordNode), WhatFor(whatfor) {}
Chris Lattner56cf88d2010-02-17 01:03:09 +0000191
Chris Lattner086ca522010-02-17 01:27:29 +0000192 const std::string &getWhatFor() const { return WhatFor; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000193
Chris Lattner9a515172010-02-25 02:04:40 +0000194 static inline bool classof(const Matcher *N) {
Chris Lattnerddfb5222010-02-18 22:03:03 +0000195 return N->getKind() == RecordNode;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000196 }
197
Chris Lattnerf4950d02010-02-27 06:22:57 +0000198 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
Chris Lattner136ab782010-02-25 06:49:58 +0000199private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000200 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000201 virtual bool isEqualImpl(const Matcher *M) const { return true; }
202 virtual unsigned getHashImpl() const { return 0; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000203};
204
Chris Lattner9a515172010-02-25 02:04:40 +0000205/// RecordChildMatcher - Save a numbered child of the current node, or fail
Chris Lattner3ee1bc42010-02-24 07:31:45 +0000206/// the match if it doesn't exist. This is logically equivalent to:
207/// MoveChild N + RecordNode + MoveParent.
Chris Lattner9a515172010-02-25 02:04:40 +0000208class RecordChildMatcher : public Matcher {
Chris Lattner3ee1bc42010-02-24 07:31:45 +0000209 unsigned ChildNo;
210
211 /// WhatFor - This is a string indicating why we're recording this. This
212 /// should only be used for comment generation not anything semantic.
213 std::string WhatFor;
214public:
Chris Lattner9a515172010-02-25 02:04:40 +0000215 RecordChildMatcher(unsigned childno, const std::string &whatfor)
216 : Matcher(RecordChild), ChildNo(childno), WhatFor(whatfor) {}
Chris Lattner3ee1bc42010-02-24 07:31:45 +0000217
218 unsigned getChildNo() const { return ChildNo; }
219 const std::string &getWhatFor() const { return WhatFor; }
220
Chris Lattner9a515172010-02-25 02:04:40 +0000221 static inline bool classof(const Matcher *N) {
Chris Lattner3ee1bc42010-02-24 07:31:45 +0000222 return N->getKind() == RecordChild;
223 }
224
Chris Lattnerf4950d02010-02-27 06:22:57 +0000225 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
226
Chris Lattner136ab782010-02-25 06:49:58 +0000227private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000228 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000229 virtual bool isEqualImpl(const Matcher *M) const {
230 return cast<RecordChildMatcher>(M)->getChildNo() == getChildNo();
231 }
232 virtual unsigned getHashImpl() const { return getChildNo(); }
Chris Lattner3ee1bc42010-02-24 07:31:45 +0000233};
234
Chris Lattner9a515172010-02-25 02:04:40 +0000235/// RecordMemRefMatcher - Save the current node's memref.
236class RecordMemRefMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000237public:
Chris Lattner9a515172010-02-25 02:04:40 +0000238 RecordMemRefMatcher() : Matcher(RecordMemRef) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000239
Chris Lattner9a515172010-02-25 02:04:40 +0000240 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000241 return N->getKind() == RecordMemRef;
242 }
243
Chris Lattnerf4950d02010-02-27 06:22:57 +0000244 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
245
Chris Lattner136ab782010-02-25 06:49:58 +0000246private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000247 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000248 virtual bool isEqualImpl(const Matcher *M) const { return true; }
249 virtual unsigned getHashImpl() const { return 0; }
Chris Lattner3163ca52010-02-21 03:22:59 +0000250};
251
252
Chris Lattner9a515172010-02-25 02:04:40 +0000253/// CaptureFlagInputMatcher - If the current record has a flag input, record
Chris Lattner3163ca52010-02-21 03:22:59 +0000254/// it so that it is used as an input to the generated code.
Chris Lattner9a515172010-02-25 02:04:40 +0000255class CaptureFlagInputMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000256public:
Chris Lattner9a515172010-02-25 02:04:40 +0000257 CaptureFlagInputMatcher() : Matcher(CaptureFlagInput) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000258
Chris Lattner9a515172010-02-25 02:04:40 +0000259 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000260 return N->getKind() == CaptureFlagInput;
261 }
262
Chris Lattnerf4950d02010-02-27 06:22:57 +0000263 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
264
Chris Lattner136ab782010-02-25 06:49:58 +0000265private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000266 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000267 virtual bool isEqualImpl(const Matcher *M) const { return true; }
268 virtual unsigned getHashImpl() const { return 0; }
Chris Lattner3163ca52010-02-21 03:22:59 +0000269};
270
Chris Lattner9a515172010-02-25 02:04:40 +0000271/// MoveChildMatcher - This tells the interpreter to move into the
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000272/// specified child node.
Chris Lattner9a515172010-02-25 02:04:40 +0000273class MoveChildMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000274 unsigned ChildNo;
275public:
Chris Lattner9a515172010-02-25 02:04:40 +0000276 MoveChildMatcher(unsigned childNo) : Matcher(MoveChild), ChildNo(childNo) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000277
278 unsigned getChildNo() const { return ChildNo; }
279
Chris Lattner9a515172010-02-25 02:04:40 +0000280 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000281 return N->getKind() == MoveChild;
282 }
283
Chris Lattnerf4950d02010-02-27 06:22:57 +0000284 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
285
Chris Lattner136ab782010-02-25 06:49:58 +0000286private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000287 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000288 virtual bool isEqualImpl(const Matcher *M) const {
289 return cast<MoveChildMatcher>(M)->getChildNo() == getChildNo();
290 }
291 virtual unsigned getHashImpl() const { return getChildNo(); }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000292};
293
Chris Lattner9a515172010-02-25 02:04:40 +0000294/// MoveParentMatcher - This tells the interpreter to move to the parent
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000295/// of the current node.
Chris Lattner9a515172010-02-25 02:04:40 +0000296class MoveParentMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000297public:
Chris Lattner9a515172010-02-25 02:04:40 +0000298 MoveParentMatcher() : Matcher(MoveParent) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000299
Chris Lattner9a515172010-02-25 02:04:40 +0000300 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000301 return N->getKind() == MoveParent;
302 }
303
Chris Lattnerf4950d02010-02-27 06:22:57 +0000304 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
305
Chris Lattner136ab782010-02-25 06:49:58 +0000306private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000307 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000308 virtual bool isEqualImpl(const Matcher *M) const { return true; }
309 virtual unsigned getHashImpl() const { return 0; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000310};
311
Chris Lattner9a515172010-02-25 02:04:40 +0000312/// CheckSameMatcher - This checks to see if this node is exactly the same
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000313/// node as the specified match that was recorded with 'Record'. This is used
314/// when patterns have the same name in them, like '(mul GPR:$in, GPR:$in)'.
Chris Lattner9a515172010-02-25 02:04:40 +0000315class CheckSameMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000316 unsigned MatchNumber;
317public:
Chris Lattner9a515172010-02-25 02:04:40 +0000318 CheckSameMatcher(unsigned matchnumber)
Chris Lattner136ab782010-02-25 06:49:58 +0000319 : Matcher(CheckSame), MatchNumber(matchnumber) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000320
321 unsigned getMatchNumber() const { return MatchNumber; }
322
Chris Lattner9a515172010-02-25 02:04:40 +0000323 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000324 return N->getKind() == CheckSame;
325 }
326
Chris Lattnerf4950d02010-02-27 06:22:57 +0000327 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
328
Chris Lattner136ab782010-02-25 06:49:58 +0000329private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000330 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000331 virtual bool isEqualImpl(const Matcher *M) const {
332 return cast<CheckSameMatcher>(M)->getMatchNumber() == getMatchNumber();
333 }
334 virtual unsigned getHashImpl() const { return getMatchNumber(); }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000335};
336
Chris Lattner9a515172010-02-25 02:04:40 +0000337/// CheckPatternPredicateMatcher - This checks the target-specific predicate
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000338/// to see if the entire pattern is capable of matching. This predicate does
339/// not take a node as input. This is used for subtarget feature checks etc.
Chris Lattner9a515172010-02-25 02:04:40 +0000340class CheckPatternPredicateMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000341 std::string Predicate;
342public:
Chris Lattner9a515172010-02-25 02:04:40 +0000343 CheckPatternPredicateMatcher(StringRef predicate)
Chris Lattner136ab782010-02-25 06:49:58 +0000344 : Matcher(CheckPatternPredicate), Predicate(predicate) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000345
346 StringRef getPredicate() const { return Predicate; }
347
Chris Lattner9a515172010-02-25 02:04:40 +0000348 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000349 return N->getKind() == CheckPatternPredicate;
350 }
351
Chris Lattnerf4950d02010-02-27 06:22:57 +0000352 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
353
Chris Lattner136ab782010-02-25 06:49:58 +0000354private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000355 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000356 virtual bool isEqualImpl(const Matcher *M) const {
357 return cast<CheckPatternPredicateMatcher>(M)->getPredicate() == Predicate;
358 }
359 virtual unsigned getHashImpl() const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000360};
361
Chris Lattner9a515172010-02-25 02:04:40 +0000362/// CheckPredicateMatcher - This checks the target-specific predicate to
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000363/// see if the node is acceptable.
Chris Lattner9a515172010-02-25 02:04:40 +0000364class CheckPredicateMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000365 StringRef PredName;
366public:
Chris Lattner9a515172010-02-25 02:04:40 +0000367 CheckPredicateMatcher(StringRef predname)
368 : Matcher(CheckPredicate), PredName(predname) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000369
370 StringRef getPredicateName() const { return PredName; }
371
Chris Lattner9a515172010-02-25 02:04:40 +0000372 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000373 return N->getKind() == CheckPredicate;
374 }
375
Chris Lattnerf4950d02010-02-27 06:22:57 +0000376 // TODO: Ok?
377 //virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
378
Chris Lattner136ab782010-02-25 06:49:58 +0000379private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000380 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000381 virtual bool isEqualImpl(const Matcher *M) const {
382 return cast<CheckPredicateMatcher>(M)->PredName == PredName;
383 }
384 virtual unsigned getHashImpl() const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000385};
386
387
Chris Lattner9a515172010-02-25 02:04:40 +0000388/// CheckOpcodeMatcher - This checks to see if the current node has the
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000389/// specified opcode, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000390class CheckOpcodeMatcher : public Matcher {
Chris Lattnere9f720b2010-02-27 21:48:43 +0000391 const SDNodeInfo &Opcode;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000392public:
Chris Lattnere9f720b2010-02-27 21:48:43 +0000393 CheckOpcodeMatcher(const SDNodeInfo &opcode)
394 : Matcher(CheckOpcode), Opcode(opcode) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000395
Chris Lattnere9f720b2010-02-27 21:48:43 +0000396 const SDNodeInfo &getOpcode() const { return Opcode; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000397
Chris Lattner9a515172010-02-25 02:04:40 +0000398 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000399 return N->getKind() == CheckOpcode;
400 }
401
Chris Lattnerf4950d02010-02-27 06:22:57 +0000402 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
403
Chris Lattner136ab782010-02-25 06:49:58 +0000404private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000405 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000406 virtual bool isEqualImpl(const Matcher *M) const {
Chris Lattnere9f720b2010-02-27 21:48:43 +0000407 return &cast<CheckOpcodeMatcher>(M)->Opcode == &Opcode;
Chris Lattner136ab782010-02-25 06:49:58 +0000408 }
409 virtual unsigned getHashImpl() const;
Chris Lattnerddfd5ab2010-02-27 07:49:13 +0000410 virtual bool isContradictoryImpl(const Matcher *M) const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000411};
412
Chris Lattner9a515172010-02-25 02:04:40 +0000413/// CheckMultiOpcodeMatcher - This checks to see if the current node has one
Chris Lattnerf58c08e2010-02-22 22:30:37 +0000414/// of the specified opcode, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000415class CheckMultiOpcodeMatcher : public Matcher {
Chris Lattnere9f720b2010-02-27 21:48:43 +0000416 SmallVector<const SDNodeInfo*, 4> Opcodes;
Chris Lattnerf58c08e2010-02-22 22:30:37 +0000417public:
Chris Lattnere9f720b2010-02-27 21:48:43 +0000418 CheckMultiOpcodeMatcher(const SDNodeInfo * const *opcodes, unsigned numops)
419 : Matcher(CheckMultiOpcode), Opcodes(opcodes, opcodes+numops) {}
Chris Lattnerf58c08e2010-02-22 22:30:37 +0000420
Chris Lattnere9f720b2010-02-27 21:48:43 +0000421 unsigned getNumOpcodes() const { return Opcodes.size(); }
422 const SDNodeInfo &getOpcode(unsigned i) const { return *Opcodes[i]; }
Chris Lattnerf58c08e2010-02-22 22:30:37 +0000423
Chris Lattner9a515172010-02-25 02:04:40 +0000424 static inline bool classof(const Matcher *N) {
Chris Lattnerf58c08e2010-02-22 22:30:37 +0000425 return N->getKind() == CheckMultiOpcode;
426 }
427
Chris Lattnerf4950d02010-02-27 06:22:57 +0000428 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
429
Chris Lattner136ab782010-02-25 06:49:58 +0000430private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000431 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000432 virtual bool isEqualImpl(const Matcher *M) const {
Chris Lattnere9f720b2010-02-27 21:48:43 +0000433 return cast<CheckMultiOpcodeMatcher>(M)->Opcodes == Opcodes;
Chris Lattner136ab782010-02-25 06:49:58 +0000434 }
435 virtual unsigned getHashImpl() const;
Chris Lattnerf58c08e2010-02-22 22:30:37 +0000436};
437
438
439
Chris Lattner9a515172010-02-25 02:04:40 +0000440/// CheckTypeMatcher - This checks to see if the current node has the
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000441/// specified type, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000442class CheckTypeMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000443 MVT::SimpleValueType Type;
444public:
Chris Lattner9a515172010-02-25 02:04:40 +0000445 CheckTypeMatcher(MVT::SimpleValueType type)
446 : Matcher(CheckType), Type(type) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000447
448 MVT::SimpleValueType getType() const { return Type; }
449
Chris Lattner9a515172010-02-25 02:04:40 +0000450 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000451 return N->getKind() == CheckType;
452 }
453
Chris Lattnerf4950d02010-02-27 06:22:57 +0000454 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
455
Chris Lattner136ab782010-02-25 06:49:58 +0000456private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000457 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000458 virtual bool isEqualImpl(const Matcher *M) const {
Chris Lattner2d0e0792010-02-26 08:05:36 +0000459 return cast<CheckTypeMatcher>(M)->Type == Type;
Chris Lattner136ab782010-02-25 06:49:58 +0000460 }
461 virtual unsigned getHashImpl() const { return Type; }
Chris Lattnerddfd5ab2010-02-27 07:49:13 +0000462 virtual bool isContradictoryImpl(const Matcher *M) const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000463};
Chris Lattner3c664b32010-02-24 20:15:25 +0000464
Chris Lattner9a515172010-02-25 02:04:40 +0000465/// CheckChildTypeMatcher - This checks to see if a child node has the
Chris Lattner3c664b32010-02-24 20:15:25 +0000466/// specified type, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000467class CheckChildTypeMatcher : public Matcher {
Chris Lattner3c664b32010-02-24 20:15:25 +0000468 unsigned ChildNo;
469 MVT::SimpleValueType Type;
470public:
Chris Lattner9a515172010-02-25 02:04:40 +0000471 CheckChildTypeMatcher(unsigned childno, MVT::SimpleValueType type)
472 : Matcher(CheckChildType), ChildNo(childno), Type(type) {}
Chris Lattner3c664b32010-02-24 20:15:25 +0000473
474 unsigned getChildNo() const { return ChildNo; }
475 MVT::SimpleValueType getType() const { return Type; }
476
Chris Lattner9a515172010-02-25 02:04:40 +0000477 static inline bool classof(const Matcher *N) {
Chris Lattner3c664b32010-02-24 20:15:25 +0000478 return N->getKind() == CheckChildType;
479 }
480
Chris Lattnerf4950d02010-02-27 06:22:57 +0000481 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
482
Chris Lattner136ab782010-02-25 06:49:58 +0000483private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000484 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000485 virtual bool isEqualImpl(const Matcher *M) const {
486 return cast<CheckChildTypeMatcher>(M)->ChildNo == ChildNo &&
487 cast<CheckChildTypeMatcher>(M)->Type == Type;
488 }
489 virtual unsigned getHashImpl() const { return (Type << 3) | ChildNo; }
Chris Lattnerddfd5ab2010-02-27 07:49:13 +0000490 virtual bool isContradictoryImpl(const Matcher *M) const;
Chris Lattner3c664b32010-02-24 20:15:25 +0000491};
492
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000493
Chris Lattner9a515172010-02-25 02:04:40 +0000494/// CheckIntegerMatcher - This checks to see if the current node is a
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000495/// ConstantSDNode with the specified integer value, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000496class CheckIntegerMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000497 int64_t Value;
498public:
Chris Lattner9a515172010-02-25 02:04:40 +0000499 CheckIntegerMatcher(int64_t value)
500 : Matcher(CheckInteger), Value(value) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000501
502 int64_t getValue() const { return Value; }
503
Chris Lattner9a515172010-02-25 02:04:40 +0000504 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000505 return N->getKind() == CheckInteger;
506 }
507
Chris Lattnerf4950d02010-02-27 06:22:57 +0000508 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
509
Chris Lattner136ab782010-02-25 06:49:58 +0000510private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000511 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000512 virtual bool isEqualImpl(const Matcher *M) const {
513 return cast<CheckIntegerMatcher>(M)->Value == Value;
514 }
515 virtual unsigned getHashImpl() const { return Value; }
Chris Lattner086af322010-02-27 08:11:15 +0000516 virtual bool isContradictoryImpl(const Matcher *M) const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000517};
518
Chris Lattner9a515172010-02-25 02:04:40 +0000519/// CheckCondCodeMatcher - This checks to see if the current node is a
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000520/// CondCodeSDNode with the specified condition, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000521class CheckCondCodeMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000522 StringRef CondCodeName;
523public:
Chris Lattner9a515172010-02-25 02:04:40 +0000524 CheckCondCodeMatcher(StringRef condcodename)
525 : Matcher(CheckCondCode), CondCodeName(condcodename) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000526
527 StringRef getCondCodeName() const { return CondCodeName; }
528
Chris Lattner9a515172010-02-25 02:04:40 +0000529 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000530 return N->getKind() == CheckCondCode;
531 }
532
Chris Lattnerf4950d02010-02-27 06:22:57 +0000533 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
534
Chris Lattner136ab782010-02-25 06:49:58 +0000535private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000536 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000537 virtual bool isEqualImpl(const Matcher *M) const {
538 return cast<CheckCondCodeMatcher>(M)->CondCodeName == CondCodeName;
539 }
540 virtual unsigned getHashImpl() const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000541};
542
Chris Lattner9a515172010-02-25 02:04:40 +0000543/// CheckValueTypeMatcher - This checks to see if the current node is a
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000544/// VTSDNode with the specified type, if not it fails to match.
Chris Lattner9a515172010-02-25 02:04:40 +0000545class CheckValueTypeMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000546 StringRef TypeName;
547public:
Chris Lattner9a515172010-02-25 02:04:40 +0000548 CheckValueTypeMatcher(StringRef type_name)
549 : Matcher(CheckValueType), TypeName(type_name) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000550
551 StringRef getTypeName() const { return TypeName; }
552
Chris Lattner9a515172010-02-25 02:04:40 +0000553 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000554 return N->getKind() == CheckValueType;
555 }
556
Chris Lattnerf4950d02010-02-27 06:22:57 +0000557 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
558
Chris Lattner136ab782010-02-25 06:49:58 +0000559private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000560 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000561 virtual bool isEqualImpl(const Matcher *M) const {
562 return cast<CheckValueTypeMatcher>(M)->TypeName == TypeName;
563 }
564 virtual unsigned getHashImpl() const;
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000565};
566
567
568
Chris Lattner9a515172010-02-25 02:04:40 +0000569/// CheckComplexPatMatcher - This node runs the specified ComplexPattern on
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000570/// the current node.
Chris Lattner9a515172010-02-25 02:04:40 +0000571class CheckComplexPatMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000572 const ComplexPattern &Pattern;
573public:
Chris Lattner9a515172010-02-25 02:04:40 +0000574 CheckComplexPatMatcher(const ComplexPattern &pattern)
575 : Matcher(CheckComplexPat), Pattern(pattern) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000576
Chris Lattnerdc429fd2010-02-17 00:31:50 +0000577 const ComplexPattern &getPattern() const { return Pattern; }
578
Chris Lattner9a515172010-02-25 02:04:40 +0000579 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000580 return N->getKind() == CheckComplexPat;
581 }
582
Chris Lattnerf4950d02010-02-27 06:22:57 +0000583 // Not safe to move a pattern predicate past a complex pattern.
584 virtual bool isSafeToReorderWithPatternPredicate() const { return false; }
585
Chris Lattner136ab782010-02-25 06:49:58 +0000586private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000587 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000588 virtual bool isEqualImpl(const Matcher *M) const {
589 return &cast<CheckComplexPatMatcher>(M)->Pattern == &Pattern;
590 }
591 virtual unsigned getHashImpl() const {
592 return (unsigned)(intptr_t)&Pattern;
593 }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000594};
595
Chris Lattner9a515172010-02-25 02:04:40 +0000596/// CheckAndImmMatcher - This checks to see if the current node is an 'and'
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000597/// with something equivalent to the specified immediate.
Chris Lattner9a515172010-02-25 02:04:40 +0000598class CheckAndImmMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000599 int64_t Value;
600public:
Chris Lattner9a515172010-02-25 02:04:40 +0000601 CheckAndImmMatcher(int64_t value)
602 : Matcher(CheckAndImm), Value(value) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000603
604 int64_t getValue() const { return Value; }
605
Chris Lattner9a515172010-02-25 02:04:40 +0000606 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000607 return N->getKind() == CheckAndImm;
608 }
609
Chris Lattnerf4950d02010-02-27 06:22:57 +0000610 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
611
Chris Lattner136ab782010-02-25 06:49:58 +0000612private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000613 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000614 virtual bool isEqualImpl(const Matcher *M) const {
615 return cast<CheckAndImmMatcher>(M)->Value == Value;
616 }
617 virtual unsigned getHashImpl() const { return Value; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000618};
619
Chris Lattner9a515172010-02-25 02:04:40 +0000620/// CheckOrImmMatcher - This checks to see if the current node is an 'and'
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000621/// with something equivalent to the specified immediate.
Chris Lattner9a515172010-02-25 02:04:40 +0000622class CheckOrImmMatcher : public Matcher {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000623 int64_t Value;
624public:
Chris Lattner9a515172010-02-25 02:04:40 +0000625 CheckOrImmMatcher(int64_t value)
626 : Matcher(CheckOrImm), Value(value) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000627
628 int64_t getValue() const { return Value; }
629
Chris Lattner9a515172010-02-25 02:04:40 +0000630 static inline bool classof(const Matcher *N) {
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000631 return N->getKind() == CheckOrImm;
632 }
633
Chris Lattnerf4950d02010-02-27 06:22:57 +0000634 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
635
Chris Lattner136ab782010-02-25 06:49:58 +0000636private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000637 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000638 virtual bool isEqualImpl(const Matcher *M) const {
639 return cast<CheckOrImmMatcher>(M)->Value == Value;
640 }
641 virtual unsigned getHashImpl() const { return Value; }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000642};
Chris Lattner9de39482010-02-16 06:10:58 +0000643
Chris Lattner9a515172010-02-25 02:04:40 +0000644/// CheckFoldableChainNodeMatcher - This checks to see if the current node
Chris Lattnerc6dc8f62010-02-16 19:15:55 +0000645/// (which defines a chain operand) is safe to fold into a larger pattern.
Chris Lattner9a515172010-02-25 02:04:40 +0000646class CheckFoldableChainNodeMatcher : public Matcher {
Chris Lattner9de39482010-02-16 06:10:58 +0000647public:
Chris Lattner9a515172010-02-25 02:04:40 +0000648 CheckFoldableChainNodeMatcher()
649 : Matcher(CheckFoldableChainNode) {}
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000650
Chris Lattner9a515172010-02-25 02:04:40 +0000651 static inline bool classof(const Matcher *N) {
Chris Lattnerc6dc8f62010-02-16 19:15:55 +0000652 return N->getKind() == CheckFoldableChainNode;
Chris Lattner9de39482010-02-16 06:10:58 +0000653 }
Chris Lattnere7d6e3c2010-02-15 08:04:42 +0000654
Chris Lattnerf4950d02010-02-27 06:22:57 +0000655 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
656
Chris Lattner136ab782010-02-25 06:49:58 +0000657private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000658 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000659 virtual bool isEqualImpl(const Matcher *M) const { return true; }
660 virtual unsigned getHashImpl() const { return 0; }
Chris Lattner9de39482010-02-16 06:10:58 +0000661};
662
Chris Lattner9a515172010-02-25 02:04:40 +0000663/// CheckChainCompatibleMatcher - Verify that the current node's chain
Chris Lattner283adcb2010-02-17 06:23:39 +0000664/// operand is 'compatible' with the specified recorded node's.
Chris Lattner9a515172010-02-25 02:04:40 +0000665class CheckChainCompatibleMatcher : public Matcher {
Chris Lattner283adcb2010-02-17 06:23:39 +0000666 unsigned PreviousOp;
667public:
Chris Lattner9a515172010-02-25 02:04:40 +0000668 CheckChainCompatibleMatcher(unsigned previousop)
669 : Matcher(CheckChainCompatible), PreviousOp(previousop) {}
Chris Lattner283adcb2010-02-17 06:23:39 +0000670
671 unsigned getPreviousOp() const { return PreviousOp; }
672
Chris Lattner9a515172010-02-25 02:04:40 +0000673 static inline bool classof(const Matcher *N) {
Chris Lattner283adcb2010-02-17 06:23:39 +0000674 return N->getKind() == CheckChainCompatible;
675 }
676
Chris Lattnerf4950d02010-02-27 06:22:57 +0000677 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
678
Chris Lattner136ab782010-02-25 06:49:58 +0000679private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000680 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000681 virtual bool isEqualImpl(const Matcher *M) const {
Chris Lattner50c0b362010-02-26 08:06:02 +0000682 return cast<CheckChainCompatibleMatcher>(M)->PreviousOp == PreviousOp;
Chris Lattner136ab782010-02-25 06:49:58 +0000683 }
684 virtual unsigned getHashImpl() const { return PreviousOp; }
Chris Lattner283adcb2010-02-17 06:23:39 +0000685};
686
Chris Lattner9a515172010-02-25 02:04:40 +0000687/// EmitIntegerMatcher - This creates a new TargetConstant.
688class EmitIntegerMatcher : public Matcher {
Chris Lattnerddfb5222010-02-18 22:03:03 +0000689 int64_t Val;
690 MVT::SimpleValueType VT;
691public:
Chris Lattner9a515172010-02-25 02:04:40 +0000692 EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt)
693 : Matcher(EmitInteger), Val(val), VT(vt) {}
Chris Lattner283adcb2010-02-17 06:23:39 +0000694
Chris Lattner7043e0a2010-02-19 07:49:56 +0000695 int64_t getValue() const { return Val; }
Chris Lattnerddfb5222010-02-18 22:03:03 +0000696 MVT::SimpleValueType getVT() const { return VT; }
697
Chris Lattner9a515172010-02-25 02:04:40 +0000698 static inline bool classof(const Matcher *N) {
Chris Lattnerddfb5222010-02-18 22:03:03 +0000699 return N->getKind() == EmitInteger;
700 }
701
Chris Lattner136ab782010-02-25 06:49:58 +0000702private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000703 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000704 virtual bool isEqualImpl(const Matcher *M) const {
705 return cast<EmitIntegerMatcher>(M)->Val == Val &&
706 cast<EmitIntegerMatcher>(M)->VT == VT;
707 }
708 virtual unsigned getHashImpl() const { return (Val << 4) | VT; }
Chris Lattnerddfb5222010-02-18 22:03:03 +0000709};
Chris Lattner3163ca52010-02-21 03:22:59 +0000710
Chris Lattner9a515172010-02-25 02:04:40 +0000711/// EmitStringIntegerMatcher - A target constant whose value is represented
Chris Lattner3163ca52010-02-21 03:22:59 +0000712/// by a string.
Chris Lattner9a515172010-02-25 02:04:40 +0000713class EmitStringIntegerMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000714 std::string Val;
715 MVT::SimpleValueType VT;
716public:
Chris Lattner9a515172010-02-25 02:04:40 +0000717 EmitStringIntegerMatcher(const std::string &val, MVT::SimpleValueType vt)
718 : Matcher(EmitStringInteger), Val(val), VT(vt) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000719
720 const std::string &getValue() const { return Val; }
721 MVT::SimpleValueType getVT() const { return VT; }
722
Chris Lattner9a515172010-02-25 02:04:40 +0000723 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000724 return N->getKind() == EmitStringInteger;
725 }
726
Chris Lattner136ab782010-02-25 06:49:58 +0000727private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000728 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000729 virtual bool isEqualImpl(const Matcher *M) const {
730 return cast<EmitStringIntegerMatcher>(M)->Val == Val &&
731 cast<EmitStringIntegerMatcher>(M)->VT == VT;
732 }
733 virtual unsigned getHashImpl() const;
Chris Lattner3163ca52010-02-21 03:22:59 +0000734};
Chris Lattnerddfb5222010-02-18 22:03:03 +0000735
Chris Lattner9a515172010-02-25 02:04:40 +0000736/// EmitRegisterMatcher - This creates a new TargetConstant.
737class EmitRegisterMatcher : public Matcher {
Chris Lattnerddfb5222010-02-18 22:03:03 +0000738 /// Reg - The def for the register that we're emitting. If this is null, then
739 /// this is a reference to zero_reg.
740 Record *Reg;
741 MVT::SimpleValueType VT;
742public:
Chris Lattner9a515172010-02-25 02:04:40 +0000743 EmitRegisterMatcher(Record *reg, MVT::SimpleValueType vt)
744 : Matcher(EmitRegister), Reg(reg), VT(vt) {}
Chris Lattnerddfb5222010-02-18 22:03:03 +0000745
746 Record *getReg() const { return Reg; }
747 MVT::SimpleValueType getVT() const { return VT; }
748
Chris Lattner9a515172010-02-25 02:04:40 +0000749 static inline bool classof(const Matcher *N) {
Chris Lattnerddfb5222010-02-18 22:03:03 +0000750 return N->getKind() == EmitRegister;
751 }
752
Chris Lattner136ab782010-02-25 06:49:58 +0000753private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000754 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000755 virtual bool isEqualImpl(const Matcher *M) const {
756 return cast<EmitRegisterMatcher>(M)->Reg == Reg &&
757 cast<EmitRegisterMatcher>(M)->VT == VT;
758 }
759 virtual unsigned getHashImpl() const {
760 return ((unsigned)(intptr_t)Reg) << 4 | VT;
761 }
Chris Lattnerddfb5222010-02-18 22:03:03 +0000762};
Chris Lattner3163ca52010-02-21 03:22:59 +0000763
Chris Lattner9a515172010-02-25 02:04:40 +0000764/// EmitConvertToTargetMatcher - Emit an operation that reads a specified
Chris Lattner3163ca52010-02-21 03:22:59 +0000765/// recorded node and converts it from being a ISD::Constant to
766/// ISD::TargetConstant, likewise for ConstantFP.
Chris Lattner9a515172010-02-25 02:04:40 +0000767class EmitConvertToTargetMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000768 unsigned Slot;
769public:
Chris Lattner9a515172010-02-25 02:04:40 +0000770 EmitConvertToTargetMatcher(unsigned slot)
771 : Matcher(EmitConvertToTarget), Slot(slot) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000772
773 unsigned getSlot() const { return Slot; }
774
Chris Lattner9a515172010-02-25 02:04:40 +0000775 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000776 return N->getKind() == EmitConvertToTarget;
777 }
778
Chris Lattner136ab782010-02-25 06:49:58 +0000779private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000780 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000781 virtual bool isEqualImpl(const Matcher *M) const {
782 return cast<EmitConvertToTargetMatcher>(M)->Slot == Slot;
783 }
784 virtual unsigned getHashImpl() const { return Slot; }
Chris Lattner3163ca52010-02-21 03:22:59 +0000785};
786
Chris Lattner9a515172010-02-25 02:04:40 +0000787/// EmitMergeInputChainsMatcher - Emit a node that merges a list of input
Chris Lattner3163ca52010-02-21 03:22:59 +0000788/// chains together with a token factor. The list of nodes are the nodes in the
789/// matched pattern that have chain input/outputs. This node adds all input
790/// chains of these nodes if they are not themselves a node in the pattern.
Chris Lattner9a515172010-02-25 02:04:40 +0000791class EmitMergeInputChainsMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000792 SmallVector<unsigned, 3> ChainNodes;
793public:
Chris Lattner9a515172010-02-25 02:04:40 +0000794 EmitMergeInputChainsMatcher(const unsigned *nodes, unsigned NumNodes)
795 : Matcher(EmitMergeInputChains), ChainNodes(nodes, nodes+NumNodes) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000796
797 unsigned getNumNodes() const { return ChainNodes.size(); }
798
799 unsigned getNode(unsigned i) const {
800 assert(i < ChainNodes.size());
801 return ChainNodes[i];
802 }
803
Chris Lattner9a515172010-02-25 02:04:40 +0000804 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000805 return N->getKind() == EmitMergeInputChains;
806 }
807
Chris Lattner136ab782010-02-25 06:49:58 +0000808private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000809 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000810 virtual bool isEqualImpl(const Matcher *M) const {
811 return cast<EmitMergeInputChainsMatcher>(M)->ChainNodes == ChainNodes;
812 }
813 virtual unsigned getHashImpl() const;
Chris Lattner3163ca52010-02-21 03:22:59 +0000814};
815
Chris Lattner9a515172010-02-25 02:04:40 +0000816/// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg,
Chris Lattner3163ca52010-02-21 03:22:59 +0000817/// pushing the chain and flag results.
818///
Chris Lattner9a515172010-02-25 02:04:40 +0000819class EmitCopyToRegMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000820 unsigned SrcSlot; // Value to copy into the physreg.
821 Record *DestPhysReg;
822public:
Chris Lattner9a515172010-02-25 02:04:40 +0000823 EmitCopyToRegMatcher(unsigned srcSlot, Record *destPhysReg)
824 : Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000825
826 unsigned getSrcSlot() const { return SrcSlot; }
827 Record *getDestPhysReg() const { return DestPhysReg; }
828
Chris Lattner9a515172010-02-25 02:04:40 +0000829 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000830 return N->getKind() == EmitCopyToReg;
831 }
832
Chris Lattner136ab782010-02-25 06:49:58 +0000833private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000834 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000835 virtual bool isEqualImpl(const Matcher *M) const {
836 return cast<EmitCopyToRegMatcher>(M)->SrcSlot == SrcSlot &&
837 cast<EmitCopyToRegMatcher>(M)->DestPhysReg == DestPhysReg;
838 }
839 virtual unsigned getHashImpl() const {
840 return SrcSlot ^ ((unsigned)(intptr_t)DestPhysReg << 4);
841 }
Chris Lattner3163ca52010-02-21 03:22:59 +0000842};
843
844
845
Chris Lattner9a515172010-02-25 02:04:40 +0000846/// EmitNodeXFormMatcher - Emit an operation that runs an SDNodeXForm on a
Chris Lattner3163ca52010-02-21 03:22:59 +0000847/// recorded node and records the result.
Chris Lattner9a515172010-02-25 02:04:40 +0000848class EmitNodeXFormMatcher : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000849 unsigned Slot;
850 Record *NodeXForm;
851public:
Chris Lattner9a515172010-02-25 02:04:40 +0000852 EmitNodeXFormMatcher(unsigned slot, Record *nodeXForm)
853 : Matcher(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {}
Chris Lattner3163ca52010-02-21 03:22:59 +0000854
855 unsigned getSlot() const { return Slot; }
856 Record *getNodeXForm() const { return NodeXForm; }
857
Chris Lattner9a515172010-02-25 02:04:40 +0000858 static inline bool classof(const Matcher *N) {
Chris Lattner3163ca52010-02-21 03:22:59 +0000859 return N->getKind() == EmitNodeXForm;
860 }
861
Chris Lattner136ab782010-02-25 06:49:58 +0000862private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000863 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000864 virtual bool isEqualImpl(const Matcher *M) const {
865 return cast<EmitNodeXFormMatcher>(M)->Slot == Slot &&
866 cast<EmitNodeXFormMatcher>(M)->NodeXForm == NodeXForm;
867 }
868 virtual unsigned getHashImpl() const {
869 return Slot ^ ((unsigned)(intptr_t)NodeXForm << 4);
870 }
Chris Lattner3163ca52010-02-21 03:22:59 +0000871};
Chris Lattnerddfb5222010-02-18 22:03:03 +0000872
Chris Lattner7a1dab42010-02-28 02:31:26 +0000873/// EmitNodeMatcherCommon - Common class shared between EmitNode and
874/// SelectNodeTo.
875class EmitNodeMatcherCommon : public Matcher {
Chris Lattner3163ca52010-02-21 03:22:59 +0000876 std::string OpcodeName;
877 const SmallVector<MVT::SimpleValueType, 3> VTs;
878 const SmallVector<unsigned, 6> Operands;
879 bool HasChain, HasFlag, HasMemRefs;
Chris Lattnerddfb5222010-02-18 22:03:03 +0000880
Chris Lattner3163ca52010-02-21 03:22:59 +0000881 /// NumFixedArityOperands - If this is a fixed arity node, this is set to -1.
882 /// If this is a varidic node, this is set to the number of fixed arity
883 /// operands in the root of the pattern. The rest are appended to this node.
884 int NumFixedArityOperands;
885public:
Chris Lattner7a1dab42010-02-28 02:31:26 +0000886 EmitNodeMatcherCommon(const std::string &opcodeName,
887 const MVT::SimpleValueType *vts, unsigned numvts,
888 const unsigned *operands, unsigned numops,
889 bool hasChain, bool hasFlag, bool hasmemrefs,
890 int numfixedarityoperands, bool isSelectNodeTo)
891 : Matcher(isSelectNodeTo ? SelectNodeTo : EmitNode), OpcodeName(opcodeName),
Chris Lattner3163ca52010-02-21 03:22:59 +0000892 VTs(vts, vts+numvts), Operands(operands, operands+numops),
893 HasChain(hasChain), HasFlag(hasFlag), HasMemRefs(hasmemrefs),
894 NumFixedArityOperands(numfixedarityoperands) {}
895
Chris Lattner7a1dab42010-02-28 02:31:26 +0000896 bool isSelectNodeTo() const { return getKind() == SelectNodeTo; }
897
Chris Lattner3163ca52010-02-21 03:22:59 +0000898 const std::string &getOpcodeName() const { return OpcodeName; }
899
900 unsigned getNumVTs() const { return VTs.size(); }
901 MVT::SimpleValueType getVT(unsigned i) const {
902 assert(i < VTs.size());
903 return VTs[i];
904 }
905
906 unsigned getNumOperands() const { return Operands.size(); }
907 unsigned getOperand(unsigned i) const {
908 assert(i < Operands.size());
909 return Operands[i];
910 }
911
912 bool hasChain() const { return HasChain; }
913 bool hasFlag() const { return HasFlag; }
914 bool hasMemRefs() const { return HasMemRefs; }
915 int getNumFixedArityOperands() const { return NumFixedArityOperands; }
Chris Lattnerddfb5222010-02-18 22:03:03 +0000916
Chris Lattner9a515172010-02-25 02:04:40 +0000917 static inline bool classof(const Matcher *N) {
Chris Lattner7a1dab42010-02-28 02:31:26 +0000918 return N->getKind() == EmitNode || N->getKind() == SelectNodeTo;
Chris Lattnerddfb5222010-02-18 22:03:03 +0000919 }
920
Chris Lattner136ab782010-02-25 06:49:58 +0000921private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000922 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000923 virtual bool isEqualImpl(const Matcher *M) const;
924 virtual unsigned getHashImpl() const;
Chris Lattnerddfb5222010-02-18 22:03:03 +0000925};
Chris Lattnerb085ea12010-02-21 06:03:07 +0000926
Chris Lattner7a1dab42010-02-28 02:31:26 +0000927/// EmitNodeMatcher - This signals a successful match and generates a node.
928class EmitNodeMatcher : public EmitNodeMatcherCommon {
929public:
930 EmitNodeMatcher(const std::string &opcodeName,
931 const MVT::SimpleValueType *vts, unsigned numvts,
932 const unsigned *operands, unsigned numops,
933 bool hasChain, bool hasFlag, bool hasmemrefs,
934 int numfixedarityoperands)
935 : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
936 hasFlag, hasmemrefs, numfixedarityoperands, false)
937 {}
938
939 static inline bool classof(const Matcher *N) {
940 return N->getKind() == EmitNode;
941 }
942
943};
944
945class SelectNodeToMatcher : public EmitNodeMatcherCommon {
946 const PatternToMatch &Pattern;
947public:
948 SelectNodeToMatcher(const std::string &opcodeName,
949 const MVT::SimpleValueType *vts, unsigned numvts,
950 const unsigned *operands, unsigned numops,
951 bool hasChain, bool hasFlag, bool hasmemrefs,
952 int numfixedarityoperands, const PatternToMatch &pattern)
953 : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
954 hasFlag, hasmemrefs, numfixedarityoperands, true),
955 Pattern(pattern) {
956 }
957
958 const PatternToMatch &getPattern() const { return Pattern; }
959
960 static inline bool classof(const Matcher *N) {
961 return N->getKind() == SelectNodeTo;
962 }
963};
964
Chris Lattner9a515172010-02-25 02:04:40 +0000965/// MarkFlagResultsMatcher - This node indicates which non-root nodes in the
966/// pattern produce flags. This allows CompleteMatchMatcher to update them
Chris Lattner69f60c82010-02-24 05:33:42 +0000967/// with the output flag of the resultant code.
Chris Lattner9a515172010-02-25 02:04:40 +0000968class MarkFlagResultsMatcher : public Matcher {
Chris Lattner69f60c82010-02-24 05:33:42 +0000969 SmallVector<unsigned, 3> FlagResultNodes;
970public:
Chris Lattner9a515172010-02-25 02:04:40 +0000971 MarkFlagResultsMatcher(const unsigned *nodes, unsigned NumNodes)
972 : Matcher(MarkFlagResults), FlagResultNodes(nodes, nodes+NumNodes) {}
Chris Lattner69f60c82010-02-24 05:33:42 +0000973
974 unsigned getNumNodes() const { return FlagResultNodes.size(); }
975
976 unsigned getNode(unsigned i) const {
977 assert(i < FlagResultNodes.size());
978 return FlagResultNodes[i];
979 }
980
Chris Lattner9a515172010-02-25 02:04:40 +0000981 static inline bool classof(const Matcher *N) {
Chris Lattner69f60c82010-02-24 05:33:42 +0000982 return N->getKind() == MarkFlagResults;
983 }
984
Chris Lattner136ab782010-02-25 06:49:58 +0000985private:
Chris Lattner392b1bf2010-02-25 06:53:39 +0000986 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +0000987 virtual bool isEqualImpl(const Matcher *M) const {
988 return cast<MarkFlagResultsMatcher>(M)->FlagResultNodes == FlagResultNodes;
989 }
990 virtual unsigned getHashImpl() const;
Chris Lattner69f60c82010-02-24 05:33:42 +0000991};
992
Chris Lattner9a515172010-02-25 02:04:40 +0000993/// CompleteMatchMatcher - Complete a match by replacing the results of the
Chris Lattnerb085ea12010-02-21 06:03:07 +0000994/// pattern with the newly generated nodes. This also prints a comment
995/// indicating the source and dest patterns.
Chris Lattner9a515172010-02-25 02:04:40 +0000996class CompleteMatchMatcher : public Matcher {
Chris Lattnerb085ea12010-02-21 06:03:07 +0000997 SmallVector<unsigned, 2> Results;
Chris Lattner3163ca52010-02-21 03:22:59 +0000998 const PatternToMatch &Pattern;
999public:
Chris Lattner9a515172010-02-25 02:04:40 +00001000 CompleteMatchMatcher(const unsigned *results, unsigned numresults,
Chris Lattnerb085ea12010-02-21 06:03:07 +00001001 const PatternToMatch &pattern)
Chris Lattner9a515172010-02-25 02:04:40 +00001002 : Matcher(CompleteMatch), Results(results, results+numresults),
Chris Lattnerb085ea12010-02-21 06:03:07 +00001003 Pattern(pattern) {}
1004
1005 unsigned getNumResults() const { return Results.size(); }
1006 unsigned getResult(unsigned R) const { return Results[R]; }
Chris Lattner3163ca52010-02-21 03:22:59 +00001007 const PatternToMatch &getPattern() const { return Pattern; }
1008
Chris Lattner9a515172010-02-25 02:04:40 +00001009 static inline bool classof(const Matcher *N) {
Chris Lattnerb085ea12010-02-21 06:03:07 +00001010 return N->getKind() == CompleteMatch;
Chris Lattner3163ca52010-02-21 03:22:59 +00001011 }
1012
Chris Lattner136ab782010-02-25 06:49:58 +00001013private:
Chris Lattner392b1bf2010-02-25 06:53:39 +00001014 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
Chris Lattner136ab782010-02-25 06:49:58 +00001015 virtual bool isEqualImpl(const Matcher *M) const {
1016 return cast<CompleteMatchMatcher>(M)->Results == Results &&
1017 &cast<CompleteMatchMatcher>(M)->Pattern == &Pattern;
1018 }
1019 virtual unsigned getHashImpl() const;
Chris Lattner3163ca52010-02-21 03:22:59 +00001020};
Chris Lattner7a1dab42010-02-28 02:31:26 +00001021
Chris Lattnere7d6e3c2010-02-15 08:04:42 +00001022} // end namespace llvm
1023
1024#endif