[llvm-commits] CVS: llvm/include/llvm/Support/InstVisitor.h PatternMatch.h

Reid Spencer reid at x10sys.com
Sun Nov 26 17:06:25 PST 2006



Changes in directory llvm/include/llvm/Support:

InstVisitor.h updated: 1.42 -> 1.43
PatternMatch.h updated: 1.13 -> 1.14
---
Log message:

For PR950: http://llvm.org/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.


---
Diffs of the changes:  (+2 -35)

 InstVisitor.h  |    3 +--
 PatternMatch.h |   34 +---------------------------------
 2 files changed, 2 insertions(+), 35 deletions(-)


Index: llvm/include/llvm/Support/InstVisitor.h
diff -u llvm/include/llvm/Support/InstVisitor.h:1.42 llvm/include/llvm/Support/InstVisitor.h:1.43
--- llvm/include/llvm/Support/InstVisitor.h:1.42	Sun Nov 19 19:22:35 2006
+++ llvm/include/llvm/Support/InstVisitor.h	Sun Nov 26 19:05:09 2006
@@ -143,7 +143,6 @@
   void visitFunction  (Function &F) {}
   void visitBasicBlock(BasicBlock &BB) {}
 
-
   // Define instruction specific visitor functions that can be overridden to
   // handle SPECIFIC instructions.  These functions automatically define
   // visitMul to proxy to visitBinaryOperator for instance in case the user does
@@ -183,7 +182,7 @@
   RetTy visitCallInst(CallInst     &I)              { DELEGATE(Instruction); }
   RetTy visitShiftInst(ShiftInst   &I)              { DELEGATE(Instruction); }
   RetTy visitVAArgInst(VAArgInst   &I)              { DELEGATE(Instruction); }
-  RetTy visitExtractElementInst(ExtractElementInst &I) { DELEGATE(Instruction); }
+  RetTy visitExtractElementInst(ExtractElementInst &I) { DELEGATE(Instruction);}
   RetTy visitInsertElementInst(InsertElementInst &I) { DELEGATE(Instruction); }
   RetTy visitShuffleVectorInst(ShuffleVectorInst &I) { DELEGATE(Instruction); }
 


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.13 llvm/include/llvm/Support/PatternMatch.h:1.14
--- llvm/include/llvm/Support/PatternMatch.h:1.13	Wed Nov  8 00:47:32 2006
+++ llvm/include/llvm/Support/PatternMatch.h	Sun Nov 26 19:05:09 2006
@@ -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 @@
 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
 //






More information about the llvm-commits mailing list