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

2007-06-14 Thread Chris Lattner


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.20 -> 1.21
---
Log message:

m_not should match vector not


---
Diffs of the changes:  (+5 -1)

 PatternMatch.h |6 +-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.20 
llvm/include/llvm/Support/PatternMatch.h:1.21
--- llvm/include/llvm/Support/PatternMatch.h:1.20   Fri Apr 13 13:12:09 2007
+++ llvm/include/llvm/Support/PatternMatch.hFri Jun 15 01:13:47 2007
@@ -329,8 +329,12 @@
   bool matchIfNot(Value *LHS, Value *RHS) {
 if (ConstantInt *CI = dyn_cast(RHS))
   return CI->isAllOnesValue() && L.match(LHS);
-else if (ConstantInt *CI = dyn_cast(LHS))
+if (ConstantInt *CI = dyn_cast(LHS))
   return CI->isAllOnesValue() && L.match(RHS);
+if (ConstantVector *CV = dyn_cast(RHS))
+  return CV->isAllOnesValue() && L.match(LHS);
+if (ConstantVector *CV = dyn_cast(LHS))
+  return CV->isAllOnesValue() && L.match(RHS);
 return false;
   }
 };



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-04-13 Thread Dan Gohman


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.19 -> 1.20
---
Log message:

Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.


---
Diffs of the changes:  (+3 -3)

 PatternMatch.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.19 
llvm/include/llvm/Support/PatternMatch.h:1.20
--- llvm/include/llvm/Support/PatternMatch.h:1.19   Mon Feb 12 18:37:50 2007
+++ llvm/include/llvm/Support/PatternMatch.hFri Apr 13 13:12:09 2007
@@ -81,7 +81,7 @@
 
   template
   bool match(OpTy *V) {
-if (V->getValueType() == Value::InstructionVal + Opcode) {
+if (V->getValueID() == Value::InstructionVal + Opcode) {
   ConcreteTy *I = cast(V);
   return I->getOpcode() == Opcode && L.match(I->getOperand(0)) &&
  R.match(I->getOperand(1));
@@ -195,8 +195,8 @@
 
   template
   bool match(OpTy *V) {
-if (V->getValueType() == Value::InstructionVal + Instruction::LShr ||
-V->getValueType() == Value::InstructionVal + Instruction::AShr) {
+if (V->getValueID() == Value::InstructionVal + Instruction::LShr ||
+V->getValueID() == Value::InstructionVal + Instruction::AShr) {
   ConcreteTy *I = cast(V);
   return (I->getOpcode() == Instruction::AShr ||
   I->getOpcode() == Instruction::LShr) &&



___
llvm-commits mailing list
[EMAIL PROTECTED]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-02-12 Thread Andrew Lenharth


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.18 -> 1.19
---
Log message:

I love non-deturminism.  Returning objects with references to stack objects is 
a bad idea (TM).

---
Diffs of the changes:  (+7 -5)

 PatternMatch.h |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.18 
llvm/include/llvm/Support/PatternMatch.h:1.19
--- llvm/include/llvm/Support/PatternMatch.h:1.18   Thu Feb  1 20:16:21 2007
+++ llvm/include/llvm/Support/PatternMatch.hMon Feb 12 18:37:50 2007
@@ -223,19 +223,22 @@
 
 template
 struct BinaryOpClass_match {
-  OpcType &Opcode;
+  OpcType *Opcode;
   LHS_t L;
   RHS_t R;
 
   BinaryOpClass_match(OpcType &Op, const LHS_t &LHS,
   const RHS_t &RHS)
-: Opcode(Op), L(LHS), R(RHS) {}
+: Opcode(&Op), L(LHS), R(RHS) {}
+  BinaryOpClass_match(const LHS_t &LHS, const RHS_t &RHS)
+: Opcode(0), L(LHS), R(RHS) {}
 
   template
   bool match(OpTy *V) {
 if (Class *I = dyn_cast(V))
   if (L.match(I->getOperand(0)) && R.match(I->getOperand(1))) {
-Opcode = I->getOpcode();
+if (Opcode)
+  *Opcode = I->getOpcode();
 return true;
   }
 #if 0  // Doesn't handle constantexprs yet!
@@ -257,9 +260,8 @@
 template
 inline BinaryOpClass_match
 m_Shift(const LHS &L, const RHS &R) {
-  Instruction::BinaryOps Op; 
   return BinaryOpClass_match(Op, L, R);
+ BinaryOperator, Instruction::BinaryOps>(L, R);
 }
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2007-01-20 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.16 -> 1.17
---
Log message:

For PR970: http://llvm.org/PR970 :
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!


---
Diffs of the changes:  (+0 -31)

 PatternMatch.h |   31 ---
 1 files changed, 31 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.16 
llvm/include/llvm/Support/PatternMatch.h:1.17
--- llvm/include/llvm/Support/PatternMatch.h:1.16   Thu Jan 11 06:24:13 2007
+++ llvm/include/llvm/Support/PatternMatch.hSat Jan 20 18:29:25 2007
@@ -306,37 +306,6 @@
 //
 
 template
-struct neg_match {
-  LHS_t L;
-
-  neg_match(const LHS_t &LHS) : L(LHS) {}
-
-  template
-  bool match(OpTy *V) {
-if (Instruction *I = dyn_cast(V))
-  if (I->getOpcode() == Instruction::Sub)
-return matchIfNeg(I->getOperand(0), I->getOperand(1));
-if (ConstantExpr *CE = dyn_cast(V))
-  if (CE->getOpcode() == Instruction::Sub)
-return matchIfNeg(CE->getOperand(0), CE->getOperand(1));
-if (ConstantInt *CI = dyn_cast(V))
-  return L.match(ConstantExpr::getNeg(CI));
-return false;
-  }
-private:
-  bool matchIfNeg(Value *LHS, Value *RHS) {
-if (!LHS->getType()->isFloatingPoint())
-  return LHS == Constant::getNullValue(LHS->getType()) && L.match(RHS);
-else
-  return LHS == ConstantFP::get(LHS->getType(), -0.0) && L.match(RHS);
-  }
-};
-
-template
-inline neg_match m_Neg(const LHS &L) { return L; }
-
-
-template
 struct not_match {
   LHS_t L;
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-11-07 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.12 -> 1.13
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch converts the old SHR instruction into two instructions, 
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


---
Diffs of the changes:  (+43 -3)

 PatternMatch.h |   46 +++---
 1 files changed, 43 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.12 
llvm/include/llvm/Support/PatternMatch.h:1.13
--- llvm/include/llvm/Support/PatternMatch.h:1.12   Mon Nov  6 12:47:14 2006
+++ llvm/include/llvm/Support/PatternMatch.hWed Nov  8 00:47:32 2006
@@ -172,9 +172,49 @@
 }
 
 template
-inline BinaryOp_match m_Shr(const LHS &L, const RHS &R) {
-  return BinaryOp_match(L, R);
+inline BinaryOp_match m_LShr(const LHS &L, const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+template
+inline BinaryOp_match m_AShr(const LHS &L, const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+//===--===//
+// Matchers for either AShr or LShr .. for convenience
+//
+template
+struct Shr_match {
+  LHS_t L;
+  RHS_t R;
+
+  Shr_match(const LHS_t &LHS, const RHS_t &RHS) : L(LHS), R(RHS) {}
+
+  template
+  bool match(OpTy *V) {
+if (V->getValueType() == Value::InstructionVal + Instruction::LShr ||
+V->getValueType() == Value::InstructionVal + Instruction::AShr) {
+  ConcreteTy *I = cast(V);
+  return (I->getOpcode() == Instruction::AShr ||
+  I->getOpcode() == Instruction::LShr) &&
+ L.match(I->getOperand(0)) &&
+ R.match(I->getOperand(1));
+}
+if (ConstantExpr *CE = dyn_cast(V))
+  return (CE->getOpcode() == Instruction::LShr ||
+  CE->getOpcode() == Instruction::AShr) &&
+ L.match(CE->getOperand(0)) &&
+ R.match(CE->getOperand(1));
+return false;
+  }
+};
+
+template
+inline Shr_match m_Shr(const LHS &L, const RHS &R) {
+  return Shr_match(L, R);
 }
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-11-06 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.11 -> 1.12
---
Log message:

Fix a small bug noticed on code review.


---
Diffs of the changes:  (+1 -1)

 PatternMatch.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.11 
llvm/include/llvm/Support/PatternMatch.h:1.12
--- llvm/include/llvm/Support/PatternMatch.h:1.11   Wed Nov  1 19:53:58 2006
+++ llvm/include/llvm/Support/PatternMatch.hMon Nov  6 12:47:14 2006
@@ -310,7 +310,7 @@
   return Op.match(I->getOperand(0));
 } else if (ConstantExpr *CE = dyn_cast(V)) {
   if (CE->getOpcode() == Instruction::Cast) {
-if (DestTy) *DestTy = I->getType();
+if (DestTy) *DestTy = CE->getType();
 return Op.match(CE->getOperand(0));
   }
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-11-01 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.10 -> 1.11
---
Log message:

For PR950: http://llvm.org/PR950 :
Replace the REM instruction with UREM, SREM and FREM.


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

 PatternMatch.h |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.10 
llvm/include/llvm/Support/PatternMatch.h:1.11
--- llvm/include/llvm/Support/PatternMatch.h:1.10   Thu Oct 26 01:15:43 2006
+++ llvm/include/llvm/Support/PatternMatch.hWed Nov  1 19:53:58 2006
@@ -130,9 +130,21 @@
 }
 
 template
-inline BinaryOp_match m_Rem(const LHS &L,
+inline BinaryOp_match m_URem(const LHS &L,
+  const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+template
+inline BinaryOp_match m_SRem(const LHS &L,
+  const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+template
+inline BinaryOp_match m_FRem(const LHS &L,
 const RHS &R) {
-  return BinaryOp_match(L, R);
+  return BinaryOp_match(L, R);
 }
 
 template



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-10-25 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.9 -> 1.10
---
Log message:

For PR950: http://llvm.org/PR950 :
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.


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

 PatternMatch.h |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.9 
llvm/include/llvm/Support/PatternMatch.h:1.10
--- llvm/include/llvm/Support/PatternMatch.h:1.9Mon Sep 18 00:17:11 2006
+++ llvm/include/llvm/Support/PatternMatch.hThu Oct 26 01:15:43 2006
@@ -112,9 +112,21 @@
 }
 
 template
-inline BinaryOp_match m_Div(const LHS &L,
+inline BinaryOp_match m_UDiv(const LHS &L,
 const RHS &R) {
-  return BinaryOp_match(L, R);
+  return BinaryOp_match(L, R);
+}
+
+template
+inline BinaryOp_match m_SDiv(const LHS &L,
+const RHS &R) {
+  return BinaryOp_match(L, R);
+}
+
+template
+inline BinaryOp_match m_FDiv(const LHS &L,
+const RHS &R) {
+  return BinaryOp_match(L, R);
 }
 
 template



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-09-17 Thread Chris Lattner


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.8 -> 1.9
---
Log message:

Add support for pattern matching cast operations


---
Diffs of the changes:  (+33 -0)

 PatternMatch.h |   33 +
 1 files changed, 33 insertions(+)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.8 
llvm/include/llvm/Support/PatternMatch.h:1.9
--- llvm/include/llvm/Support/PatternMatch.h:1.8Thu Jun 15 14:25:28 2006
+++ llvm/include/llvm/Support/PatternMatch.hMon Sep 18 00:17:11 2006
@@ -271,6 +271,39 @@
 template
 inline not_match m_Not(const LHS &L) { return L; }
 
+
+template
+struct cast_match {
+  Op_t Op;
+  const Type **DestTy;
+  
+  cast_match(const Op_t &op, const Type **destTy) : Op(op), DestTy(destTy) {}
+  
+  template
+  bool match(OpTy *V) {
+if (CastInst *I = dyn_cast(V)) {
+  if (DestTy) *DestTy = I->getType();
+  return Op.match(I->getOperand(0));
+} else if (ConstantExpr *CE = dyn_cast(V)) {
+  if (CE->getOpcode() == Instruction::Cast) {
+if (DestTy) *DestTy = I->getType();
+return Op.match(CE->getOperand(0));
+  }
+}
+return false;
+  }
+};
+
+template
+inline cast_match m_Cast(const Op_t &Op, const Type *&Ty) {
+  return cast_match(Op, &Ty);
+}
+template
+inline cast_match m_Cast(const Op_t &Op) {
+  return cast_match(Op, 0);
+}
+
+
 
//===--===//
 // Matchers for control flow
 //



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-06-15 Thread Chris Lattner


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.7 -> 1.8
---
Log message:

Add some more matcher classes for shifts.


---
Diffs of the changes:  (+21 -6)

 PatternMatch.h |   27 +--
 1 files changed, 21 insertions(+), 6 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.7 
llvm/include/llvm/Support/PatternMatch.h:1.8
--- llvm/include/llvm/Support/PatternMatch.h:1.7Mon Feb 13 17:06:39 2006
+++ llvm/include/llvm/Support/PatternMatch.hThu Jun 15 14:25:28 2006
@@ -68,7 +68,7 @@
 inline bind_ty m_ConstantInt(ConstantInt *&CI) { return CI; }
 
 
//===--===//
-// Matchers for specific binary operators
+// Matchers for specific binary operators.
 //
 
 template
+template
 struct BinaryOpClass_match {
-  Instruction::BinaryOps &Opcode;
+  OpcType &Opcode;
   LHS_t L;
   RHS_t R;
 
-  BinaryOpClass_match(Instruction::BinaryOps &Op, const LHS_t &LHS,
+  BinaryOpClass_match(OpcType &Op, const LHS_t &LHS,
   const RHS_t &RHS)
 : Opcode(Op), L(LHS), R(RHS) {}
 
@@ -184,11 +184,26 @@
 };
 
 template
-inline BinaryOpClass_match
+inline BinaryOpClass_match
 m_SetCond(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) {
-  return BinaryOpClass_match(Op, L, R);
+  return BinaryOpClass_match(Op, L, R);
 }
 
+template
+inline BinaryOpClass_match
+m_Shift(Instruction::OtherOps &Op, const LHS &L, const RHS &R) {
+  return BinaryOpClass_match(Op, L, R);
+}
+
+template
+inline BinaryOpClass_match
+m_Shift(const LHS &L, const RHS &R) {
+  Instruction::OtherOps Op; 
+  return BinaryOpClass_match(Op, L, R);
+}
 
 
//===--===//
 // Matchers for unary operators



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-02-13 Thread Chris Lattner


Changes in directory llvm/include/llvm/Support:

PatternMatch.h updated: 1.6 -> 1.7
---
Log message:

Fix typo that caused build failures for things trying to use m_Or.


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

 PatternMatch.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.6 
llvm/include/llvm/Support/PatternMatch.h:1.7
--- llvm/include/llvm/Support/PatternMatch.h:1.6Tue Sep 27 01:38:05 2005
+++ llvm/include/llvm/Support/PatternMatch.hMon Feb 13 17:06:39 2006
@@ -130,8 +130,8 @@
 }
 
 template
-inline BinaryOp_match m_Or(const LHS &L,
-   const RHS &R) {
+inline BinaryOp_match m_Or(const LHS &L,
+  const RHS &R) {
   return BinaryOp_match(L, R);
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits