diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-11-27 01:05:10 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-11-27 01:05:10 +0000 |
commit | 3da59db637a887474c1b1346c1f3ccf53b6c4663 (patch) | |
tree | b061e2133efdb9ea9bb334c1b15ceea881bb88f8 /include/llvm/Support/PatternMatch.h | |
parent | 5fed9b90447a9a95a1f670ccd9c23aea8c937451 (diff) |
For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PatternMatch.h')
-rw-r--r-- | include/llvm/Support/PatternMatch.h | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 56f7a9c4f9..2974ad39d4 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -10,7 +10,7 @@ // This file provides a simple and efficient mechanism for performing general // tree-based pattern matches on the LLVM IR. The power of these routines is // that it allows you to write concise patterns that are expressive and easy to -// understand. The other major advantage of this is that is allows to you +// understand. The other major advantage of this is that it allows you to // trivially capture/bind elements in the pattern to variables. For example, // you can do something like this: // @@ -336,38 +336,6 @@ template<typename LHS> inline not_match<LHS> m_Not(const LHS &L) { return L; } -template<typename Op_t> -struct cast_match { - Op_t Op; - const Type **DestTy; - - cast_match(const Op_t &op, const Type **destTy) : Op(op), DestTy(destTy) {} - - template<typename OpTy> - bool match(OpTy *V) { - if (CastInst *I = dyn_cast<CastInst>(V)) { - if (DestTy) *DestTy = I->getType(); - return Op.match(I->getOperand(0)); - } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) { - if (CE->getOpcode() == Instruction::Cast) { - if (DestTy) *DestTy = CE->getType(); - return Op.match(CE->getOperand(0)); - } - } - return false; - } -}; - -template<typename Op_t> -inline cast_match<Op_t> m_Cast(const Op_t &Op, const Type *&Ty) { - return cast_match<Op_t>(Op, &Ty); -} -template<typename Op_t> -inline cast_match<Op_t> m_Cast(const Op_t &Op) { - return cast_match<Op_t>(Op, 0); -} - - //===----------------------------------------------------------------------===// // Matchers for control flow // |