Regen configure
[oota-llvm.git] / include / llvm / Support / PatternMatch.h
1 //===-- llvm/Support/PatternMatch.h - Match on the LLVM IR ------*- C++ -*-===//
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 // This file provides a simple and efficient mechanism for performing general
11 // tree-based pattern matches on the LLVM IR.  The power of these routines is
12 // that it allows you to write concise patterns that are expressive and easy to
13 // understand.  The other major advantage of this is that it allows you to
14 // trivially capture/bind elements in the pattern to variables.  For example,
15 // you can do something like this:
16 //
17 //  Value *Exp = ...
18 //  Value *X, *Y;  ConstantInt *C1, *C2;      // (X & C1) | (Y & C2)
19 //  if (match(Exp, m_Or(m_And(m_Value(X), m_ConstantInt(C1)),
20 //                      m_And(m_Value(Y), m_ConstantInt(C2))))) {
21 //    ... Pattern is matched and variables are bound ...
22 //  }
23 //
24 // This is primarily useful to things like the instruction combiner, but can
25 // also be useful for static analysis tools or code generators.
26 //
27 //===----------------------------------------------------------------------===//
28
29 #ifndef LLVM_SUPPORT_PATTERNMATCH_H
30 #define LLVM_SUPPORT_PATTERNMATCH_H
31
32 #include "llvm/Constants.h"
33 #include "llvm/Instructions.h"
34
35 namespace llvm {
36 namespace PatternMatch {
37
38 template<typename Val, typename Pattern>
39 bool match(Val *V, const Pattern &P) {
40   return const_cast<Pattern&>(P).match(V);
41 }
42
43 template<typename Class>
44 struct leaf_ty {
45   template<typename ITy>
46   bool match(ITy *V) { return isa<Class>(V); }
47 };
48
49 /// m_Value() - Match an arbitrary value and ignore it.
50 inline leaf_ty<Value> m_Value() { return leaf_ty<Value>(); }
51 /// m_ConstantInt() - Match an arbitrary ConstantInt and ignore it.
52 inline leaf_ty<ConstantInt> m_ConstantInt() { return leaf_ty<ConstantInt>(); }
53
54 template<int64_t Val>
55 struct constantint_ty {
56   template<typename ITy>
57   bool match(ITy *V) {
58     if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
59       const APInt &CIV = CI->getValue();
60       if (Val >= 0)
61         return CIV == static_cast<uint64_t>(Val);
62       // If Val is negative, and CI is shorter than it, truncate to the right
63       // number of bits.  If it is larger, then we have to sign extend.  Just
64       // compare their negated values.
65       return -CIV == -Val;
66     }
67     return false;
68   }
69 };
70
71 /// m_ConstantInt(int64_t) - Match a ConstantInt with a specific value
72 /// and ignore it.
73 template<int64_t Val>
74 inline constantint_ty<Val> m_ConstantInt() {
75   return constantint_ty<Val>();
76 }
77
78 struct zero_ty {
79   template<typename ITy>
80   bool match(ITy *V) {
81     if (const Constant *C = dyn_cast<Constant>(V))
82       return C->isNullValue();
83     return false;
84   }
85 };
86
87 /// m_Zero() - Match an arbitrary zero/null constant.
88 inline zero_ty m_Zero() { return zero_ty(); }
89
90 struct one_ty {
91   template<typename ITy>
92   bool match(ITy *V) {
93     if (const ConstantInt *C = dyn_cast<ConstantInt>(V))
94       return C->isOne();
95     return false;
96   }
97 };
98
99 /// m_One() - Match an integer 1.
100 inline one_ty m_One() { return one_ty(); }
101   
102 struct all_ones_ty {
103   template<typename ITy>
104   bool match(ITy *V) {
105     if (const ConstantInt *C = dyn_cast<ConstantInt>(V))
106       return C->isAllOnesValue();
107     if (const ConstantVector *C = dyn_cast<ConstantVector>(V))
108       return C->isAllOnesValue();
109     return false;
110   }
111 };
112
113 /// m_AllOnes() - Match an integer or vector with all bits set to true.
114 inline all_ones_ty m_AllOnes() { return all_ones_ty(); }
115
116
117 template<typename Class>
118 struct bind_ty {
119   Class *&VR;
120   bind_ty(Class *&V) : VR(V) {}
121
122   template<typename ITy>
123   bool match(ITy *V) {
124     if (Class *CV = dyn_cast<Class>(V)) {
125       VR = CV;
126       return true;
127     }
128     return false;
129   }
130 };
131
132 /// m_Value - Match a value, capturing it if we match.
133 inline bind_ty<Value> m_Value(Value *&V) { return V; }
134
135 /// m_ConstantInt - Match a ConstantInt, capturing the value if we match.
136 inline bind_ty<ConstantInt> m_ConstantInt(ConstantInt *&CI) { return CI; }
137
138 /// specificval_ty - Match a specified Value*.
139 struct specificval_ty {
140   const Value *Val;
141   specificval_ty(const Value *V) : Val(V) {}
142
143   template<typename ITy>
144   bool match(ITy *V) {
145     return V == Val;
146   }
147 };
148
149 /// m_Specific - Match if we have a specific specified value.
150 inline specificval_ty m_Specific(const Value *V) { return V; }
151
152
153 //===----------------------------------------------------------------------===//
154 // Matchers for specific binary operators.
155 //
156
157 template<typename LHS_t, typename RHS_t,
158          unsigned Opcode, typename ConcreteTy = BinaryOperator>
159 struct BinaryOp_match {
160   LHS_t L;
161   RHS_t R;
162
163   BinaryOp_match(const LHS_t &LHS, const RHS_t &RHS) : L(LHS), R(RHS) {}
164
165   template<typename OpTy>
166   bool match(OpTy *V) {
167     if (V->getValueID() == Value::InstructionVal + Opcode) {
168       ConcreteTy *I = cast<ConcreteTy>(V);
169       return I->getOpcode() == Opcode && L.match(I->getOperand(0)) &&
170              R.match(I->getOperand(1));
171     }
172     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
173       return CE->getOpcode() == Opcode && L.match(CE->getOperand(0)) &&
174              R.match(CE->getOperand(1));
175     return false;
176   }
177 };
178
179 template<typename LHS, typename RHS>
180 inline BinaryOp_match<LHS, RHS, Instruction::Add> m_Add(const LHS &L,
181                                                         const RHS &R) {
182   return BinaryOp_match<LHS, RHS, Instruction::Add>(L, R);
183 }
184
185 template<typename LHS, typename RHS>
186 inline BinaryOp_match<LHS, RHS, Instruction::FAdd> m_FAdd(const LHS &L,
187                                                           const RHS &R) {
188   return BinaryOp_match<LHS, RHS, Instruction::FAdd>(L, R);
189 }
190
191 template<typename LHS, typename RHS>
192 inline BinaryOp_match<LHS, RHS, Instruction::Sub> m_Sub(const LHS &L,
193                                                         const RHS &R) {
194   return BinaryOp_match<LHS, RHS, Instruction::Sub>(L, R);
195 }
196
197 template<typename LHS, typename RHS>
198 inline BinaryOp_match<LHS, RHS, Instruction::FSub> m_FSub(const LHS &L,
199                                                           const RHS &R) {
200   return BinaryOp_match<LHS, RHS, Instruction::FSub>(L, R);
201 }
202
203 template<typename LHS, typename RHS>
204 inline BinaryOp_match<LHS, RHS, Instruction::Mul> m_Mul(const LHS &L,
205                                                         const RHS &R) {
206   return BinaryOp_match<LHS, RHS, Instruction::Mul>(L, R);
207 }
208
209 template<typename LHS, typename RHS>
210 inline BinaryOp_match<LHS, RHS, Instruction::FMul> m_FMul(const LHS &L,
211                                                           const RHS &R) {
212   return BinaryOp_match<LHS, RHS, Instruction::FMul>(L, R);
213 }
214
215 template<typename LHS, typename RHS>
216 inline BinaryOp_match<LHS, RHS, Instruction::UDiv> m_UDiv(const LHS &L,
217                                                         const RHS &R) {
218   return BinaryOp_match<LHS, RHS, Instruction::UDiv>(L, R);
219 }
220
221 template<typename LHS, typename RHS>
222 inline BinaryOp_match<LHS, RHS, Instruction::SDiv> m_SDiv(const LHS &L,
223                                                         const RHS &R) {
224   return BinaryOp_match<LHS, RHS, Instruction::SDiv>(L, R);
225 }
226
227 template<typename LHS, typename RHS>
228 inline BinaryOp_match<LHS, RHS, Instruction::FDiv> m_FDiv(const LHS &L,
229                                                         const RHS &R) {
230   return BinaryOp_match<LHS, RHS, Instruction::FDiv>(L, R);
231 }
232
233 template<typename LHS, typename RHS>
234 inline BinaryOp_match<LHS, RHS, Instruction::URem> m_URem(const LHS &L,
235                                                           const RHS &R) {
236   return BinaryOp_match<LHS, RHS, Instruction::URem>(L, R);
237 }
238
239 template<typename LHS, typename RHS>
240 inline BinaryOp_match<LHS, RHS, Instruction::SRem> m_SRem(const LHS &L,
241                                                           const RHS &R) {
242   return BinaryOp_match<LHS, RHS, Instruction::SRem>(L, R);
243 }
244
245 template<typename LHS, typename RHS>
246 inline BinaryOp_match<LHS, RHS, Instruction::FRem> m_FRem(const LHS &L,
247                                                         const RHS &R) {
248   return BinaryOp_match<LHS, RHS, Instruction::FRem>(L, R);
249 }
250
251 template<typename LHS, typename RHS>
252 inline BinaryOp_match<LHS, RHS, Instruction::And> m_And(const LHS &L,
253                                                         const RHS &R) {
254   return BinaryOp_match<LHS, RHS, Instruction::And>(L, R);
255 }
256
257 template<typename LHS, typename RHS>
258 inline BinaryOp_match<LHS, RHS, Instruction::Or> m_Or(const LHS &L,
259                                                       const RHS &R) {
260   return BinaryOp_match<LHS, RHS, Instruction::Or>(L, R);
261 }
262
263 template<typename LHS, typename RHS>
264 inline BinaryOp_match<LHS, RHS, Instruction::Xor> m_Xor(const LHS &L,
265                                                         const RHS &R) {
266   return BinaryOp_match<LHS, RHS, Instruction::Xor>(L, R);
267 }
268
269 template<typename LHS, typename RHS>
270 inline BinaryOp_match<LHS, RHS, Instruction::Shl> m_Shl(const LHS &L,
271                                                         const RHS &R) {
272   return BinaryOp_match<LHS, RHS, Instruction::Shl>(L, R);
273 }
274
275 template<typename LHS, typename RHS>
276 inline BinaryOp_match<LHS, RHS, Instruction::LShr> m_LShr(const LHS &L,
277                                                           const RHS &R) {
278   return BinaryOp_match<LHS, RHS, Instruction::LShr>(L, R);
279 }
280
281 template<typename LHS, typename RHS>
282 inline BinaryOp_match<LHS, RHS, Instruction::AShr> m_AShr(const LHS &L,
283                                                           const RHS &R) {
284   return BinaryOp_match<LHS, RHS, Instruction::AShr>(L, R);
285 }
286
287 //===----------------------------------------------------------------------===//
288 // Matchers for either AShr or LShr .. for convenience
289 //
290 template<typename LHS_t, typename RHS_t, typename ConcreteTy = BinaryOperator>
291 struct Shr_match {
292   LHS_t L;
293   RHS_t R;
294
295   Shr_match(const LHS_t &LHS, const RHS_t &RHS) : L(LHS), R(RHS) {}
296
297   template<typename OpTy>
298   bool match(OpTy *V) {
299     if (V->getValueID() == Value::InstructionVal + Instruction::LShr ||
300         V->getValueID() == Value::InstructionVal + Instruction::AShr) {
301       ConcreteTy *I = cast<ConcreteTy>(V);
302       return (I->getOpcode() == Instruction::AShr ||
303               I->getOpcode() == Instruction::LShr) &&
304              L.match(I->getOperand(0)) &&
305              R.match(I->getOperand(1));
306     }
307     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
308       return (CE->getOpcode() == Instruction::LShr ||
309               CE->getOpcode() == Instruction::AShr) &&
310              L.match(CE->getOperand(0)) &&
311              R.match(CE->getOperand(1));
312     return false;
313   }
314 };
315
316 template<typename LHS, typename RHS>
317 inline Shr_match<LHS, RHS> m_Shr(const LHS &L, const RHS &R) {
318   return Shr_match<LHS, RHS>(L, R);
319 }
320
321 //===----------------------------------------------------------------------===//
322 // Matchers for binary classes
323 //
324
325 template<typename LHS_t, typename RHS_t, typename Class, typename OpcType>
326 struct BinaryOpClass_match {
327   OpcType *Opcode;
328   LHS_t L;
329   RHS_t R;
330
331   BinaryOpClass_match(OpcType &Op, const LHS_t &LHS,
332                       const RHS_t &RHS)
333     : Opcode(&Op), L(LHS), R(RHS) {}
334   BinaryOpClass_match(const LHS_t &LHS, const RHS_t &RHS)
335     : Opcode(0), L(LHS), R(RHS) {}
336
337   template<typename OpTy>
338   bool match(OpTy *V) {
339     if (Class *I = dyn_cast<Class>(V))
340       if (L.match(I->getOperand(0)) &&
341           R.match(I->getOperand(1))) {
342         if (Opcode)
343           *Opcode = I->getOpcode();
344         return true;
345       }
346 #if 0  // Doesn't handle constantexprs yet!
347     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
348       return CE->getOpcode() == Opcode && L.match(CE->getOperand(0)) &&
349              R.match(CE->getOperand(1));
350 #endif
351     return false;
352   }
353 };
354
355 template<typename LHS, typename RHS>
356 inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps>
357 m_Shift(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) {
358   return BinaryOpClass_match<LHS, RHS,
359                              BinaryOperator, Instruction::BinaryOps>(Op, L, R);
360 }
361
362 template<typename LHS, typename RHS>
363 inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps>
364 m_Shift(const LHS &L, const RHS &R) {
365   return BinaryOpClass_match<LHS, RHS,
366                              BinaryOperator, Instruction::BinaryOps>(L, R);
367 }
368
369 //===----------------------------------------------------------------------===//
370 // Matchers for CmpInst classes
371 //
372
373 template<typename LHS_t, typename RHS_t, typename Class, typename PredicateTy>
374 struct CmpClass_match {
375   PredicateTy &Predicate;
376   LHS_t L;
377   RHS_t R;
378
379   CmpClass_match(PredicateTy &Pred, const LHS_t &LHS,
380                  const RHS_t &RHS)
381     : Predicate(Pred), L(LHS), R(RHS) {}
382
383   template<typename OpTy>
384   bool match(OpTy *V) {
385     if (Class *I = dyn_cast<Class>(V))
386       if (L.match(I->getOperand(0)) &&
387           R.match(I->getOperand(1))) {
388         Predicate = I->getPredicate();
389         return true;
390       }
391     return false;
392   }
393 };
394
395 template<typename LHS, typename RHS>
396 inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>
397 m_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
398   return CmpClass_match<LHS, RHS,
399                         ICmpInst, ICmpInst::Predicate>(Pred, L, R);
400 }
401
402 template<typename LHS, typename RHS>
403 inline CmpClass_match<LHS, RHS, FCmpInst, FCmpInst::Predicate>
404 m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
405   return CmpClass_match<LHS, RHS,
406                         FCmpInst, FCmpInst::Predicate>(Pred, L, R);
407 }
408
409 //===----------------------------------------------------------------------===//
410 // Matchers for SelectInst classes
411 //
412
413 template<typename Cond_t, typename LHS_t, typename RHS_t>
414 struct SelectClass_match {
415   Cond_t C;
416   LHS_t L;
417   RHS_t R;
418
419   SelectClass_match(const Cond_t &Cond, const LHS_t &LHS,
420                     const RHS_t &RHS)
421     : C(Cond), L(LHS), R(RHS) {}
422
423   template<typename OpTy>
424   bool match(OpTy *V) {
425     if (SelectInst *I = dyn_cast<SelectInst>(V))
426       return C.match(I->getOperand(0)) &&
427              L.match(I->getOperand(1)) &&
428              R.match(I->getOperand(2));
429     return false;
430   }
431 };
432
433 template<typename Cond, typename LHS, typename RHS>
434 inline SelectClass_match<Cond, LHS, RHS>
435 m_Select(const Cond &C, const LHS &L, const RHS &R) {
436   return SelectClass_match<Cond, LHS, RHS>(C, L, R);
437 }
438
439 /// m_SelectCst - This matches a select of two constants, e.g.:
440 ///    m_SelectCst<-1, 0>(m_Value(V))
441 template<int64_t L, int64_t R, typename Cond>
442 inline SelectClass_match<Cond, constantint_ty<L>, constantint_ty<R> >
443 m_SelectCst(const Cond &C) {
444   return SelectClass_match<Cond, constantint_ty<L>,
445                            constantint_ty<R> >(C, m_ConstantInt<L>(),
446                                            m_ConstantInt<R>());
447 }
448
449
450 //===----------------------------------------------------------------------===//
451 // Matchers for CastInst classes
452 //
453
454 template<typename Op_t, unsigned Opcode>
455 struct CastClass_match {
456   Op_t Op;
457
458   CastClass_match(const Op_t &OpMatch) : Op(OpMatch) {}
459
460   template<typename OpTy>
461   bool match(OpTy *V) {
462     if (CastInst *I = dyn_cast<CastInst>(V))
463       return I->getOpcode() == Opcode && Op.match(I->getOperand(0));
464     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
465       return CE->getOpcode() == Opcode && Op.match(CE->getOperand(0));
466     return false;
467   }
468 };
469
470 /// m_BitCast
471 template<typename OpTy>
472 inline CastClass_match<OpTy, Instruction::BitCast>
473 m_BitCast(const OpTy &Op) {
474   return CastClass_match<OpTy, Instruction::BitCast>(Op);
475 }
476   
477 /// m_PtrToInt
478 template<typename OpTy>
479 inline CastClass_match<OpTy, Instruction::PtrToInt>
480 m_PtrToInt(const OpTy &Op) {
481   return CastClass_match<OpTy, Instruction::PtrToInt>(Op);
482 }
483
484 /// m_Trunc
485 template<typename OpTy>
486 inline CastClass_match<OpTy, Instruction::Trunc>
487 m_Trunc(const OpTy &Op) {
488   return CastClass_match<OpTy, Instruction::Trunc>(Op);
489 }
490
491 /// m_SExt
492 template<typename OpTy>
493 inline CastClass_match<OpTy, Instruction::SExt>
494 m_SExt(const OpTy &Op) {
495   return CastClass_match<OpTy, Instruction::SExt>(Op);
496 }
497
498 /// m_ZExt
499 template<typename OpTy>
500 inline CastClass_match<OpTy, Instruction::ZExt>
501 m_ZExt(const OpTy &Op) {
502   return CastClass_match<OpTy, Instruction::ZExt>(Op);
503 }
504   
505
506 //===----------------------------------------------------------------------===//
507 // Matchers for unary operators
508 //
509
510 template<typename LHS_t>
511 struct not_match {
512   LHS_t L;
513
514   not_match(const LHS_t &LHS) : L(LHS) {}
515
516   template<typename OpTy>
517   bool match(OpTy *V) {
518     if (Instruction *I = dyn_cast<Instruction>(V))
519       if (I->getOpcode() == Instruction::Xor)
520         return matchIfNot(I->getOperand(0), I->getOperand(1));
521     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
522       if (CE->getOpcode() == Instruction::Xor)
523         return matchIfNot(CE->getOperand(0), CE->getOperand(1));
524     if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
525       return L.match(ConstantExpr::getNot(CI));
526     return false;
527   }
528 private:
529   bool matchIfNot(Value *LHS, Value *RHS) {
530     if (ConstantInt *CI = dyn_cast<ConstantInt>(RHS))
531       return CI->isAllOnesValue() && L.match(LHS);
532     if (ConstantInt *CI = dyn_cast<ConstantInt>(LHS))
533       return CI->isAllOnesValue() && L.match(RHS);
534     if (ConstantVector *CV = dyn_cast<ConstantVector>(RHS))
535       return CV->isAllOnesValue() && L.match(LHS);
536     if (ConstantVector *CV = dyn_cast<ConstantVector>(LHS))
537       return CV->isAllOnesValue() && L.match(RHS);
538     return false;
539   }
540 };
541
542 template<typename LHS>
543 inline not_match<LHS> m_Not(const LHS &L) { return L; }
544
545
546 template<typename LHS_t>
547 struct neg_match {
548   LHS_t L;
549
550   neg_match(const LHS_t &LHS) : L(LHS) {}
551
552   template<typename OpTy>
553   bool match(OpTy *V) {
554     if (Instruction *I = dyn_cast<Instruction>(V))
555       if (I->getOpcode() == Instruction::Sub)
556         return matchIfNeg(I->getOperand(0), I->getOperand(1));
557     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
558       if (CE->getOpcode() == Instruction::Sub)
559         return matchIfNeg(CE->getOperand(0), CE->getOperand(1));
560     if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
561       return L.match(ConstantExpr::getNeg(CI));
562     return false;
563   }
564 private:
565   bool matchIfNeg(Value *LHS, Value *RHS) {
566     return LHS == ConstantFP::getZeroValueForNegation(LHS->getType()) &&
567            L.match(RHS);
568   }
569 };
570
571 template<typename LHS>
572 inline neg_match<LHS> m_Neg(const LHS &L) { return L; }
573
574
575 template<typename LHS_t>
576 struct fneg_match {
577   LHS_t L;
578
579   fneg_match(const LHS_t &LHS) : L(LHS) {}
580
581   template<typename OpTy>
582   bool match(OpTy *V) {
583     if (Instruction *I = dyn_cast<Instruction>(V))
584       if (I->getOpcode() == Instruction::FSub)
585         return matchIfFNeg(I->getOperand(0), I->getOperand(1));
586     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
587       if (CE->getOpcode() == Instruction::FSub)
588         return matchIfFNeg(CE->getOperand(0), CE->getOperand(1));
589     if (ConstantFP *CF = dyn_cast<ConstantFP>(V))
590       return L.match(ConstantExpr::getFNeg(CF));
591     return false;
592   }
593 private:
594   bool matchIfFNeg(Value *LHS, Value *RHS) {
595     return LHS == ConstantFP::getZeroValueForNegation(LHS->getType()) &&
596            L.match(RHS);
597   }
598 };
599
600 template<typename LHS>
601 inline fneg_match<LHS> m_FNeg(const LHS &L) { return L; }
602
603
604 //===----------------------------------------------------------------------===//
605 // Matchers for control flow
606 //
607
608 template<typename Cond_t>
609 struct brc_match {
610   Cond_t Cond;
611   BasicBlock *&T, *&F;
612   brc_match(const Cond_t &C, BasicBlock *&t, BasicBlock *&f)
613     : Cond(C), T(t), F(f) {
614   }
615
616   template<typename OpTy>
617   bool match(OpTy *V) {
618     if (BranchInst *BI = dyn_cast<BranchInst>(V))
619       if (BI->isConditional()) {
620         if (Cond.match(BI->getCondition())) {
621           T = BI->getSuccessor(0);
622           F = BI->getSuccessor(1);
623           return true;
624         }
625       }
626     return false;
627   }
628 };
629
630 template<typename Cond_t>
631 inline brc_match<Cond_t> m_Br(const Cond_t &C, BasicBlock *&T, BasicBlock *&F) {
632   return brc_match<Cond_t>(C, T, F);
633 }
634
635 } // end namespace PatternMatch
636 } // end namespace llvm
637
638 #endif