forked from OSchip/llvm-project
[PatternMatch] Generalize brc_match (NFC).
Preparation for D68013. llvm-svn: 372881
This commit is contained in:
parent
71472a3eec
commit
f8067c7f7c
|
@ -1334,11 +1334,13 @@ struct br_match {
|
||||||
|
|
||||||
inline br_match m_UnconditionalBr(BasicBlock *&Succ) { return br_match(Succ); }
|
inline br_match m_UnconditionalBr(BasicBlock *&Succ) { return br_match(Succ); }
|
||||||
|
|
||||||
template <typename Cond_t> struct brc_match {
|
template <typename Cond_t, typename TrueBlock_t, typename FalseBlock_t>
|
||||||
|
struct brc_match {
|
||||||
Cond_t Cond;
|
Cond_t Cond;
|
||||||
BasicBlock *&T, *&F;
|
TrueBlock_t T;
|
||||||
|
FalseBlock_t F;
|
||||||
|
|
||||||
brc_match(const Cond_t &C, BasicBlock *&t, BasicBlock *&f)
|
brc_match(const Cond_t &C, const TrueBlock_t &t, const FalseBlock_t &f)
|
||||||
: Cond(C), T(t), F(f) {}
|
: Cond(C), T(t), F(f) {}
|
||||||
|
|
||||||
template <typename OpTy> bool match(OpTy *V) {
|
template <typename OpTy> bool match(OpTy *V) {
|
||||||
|
@ -1353,8 +1355,9 @@ template <typename Cond_t> struct brc_match {
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Cond_t>
|
template <typename Cond_t>
|
||||||
inline brc_match<Cond_t> m_Br(const Cond_t &C, BasicBlock *&T, BasicBlock *&F) {
|
inline brc_match<Cond_t, BasicBlock *&, BasicBlock *&>
|
||||||
return brc_match<Cond_t>(C, T, F);
|
m_Br(const Cond_t &C, BasicBlock *&T, BasicBlock *&F) {
|
||||||
|
return brc_match<Cond_t, BasicBlock *&, BasicBlock *&>(C, T, F);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
Loading…
Reference in New Issue