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

Reid Spencer reid at x10sys.com
Thu Feb 1 18:17:37 PST 2007



Changes in directory llvm/include/llvm/Support:

InstVisitor.h updated: 1.45 -> 1.46
PatternMatch.h updated: 1.17 -> 1.18
---
Log message:

Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to 
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


---
Diffs of the changes:  (+16 -17)

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


Index: llvm/include/llvm/Support/InstVisitor.h
diff -u llvm/include/llvm/Support/InstVisitor.h:1.45 llvm/include/llvm/Support/InstVisitor.h:1.46
--- llvm/include/llvm/Support/InstVisitor.h:1.45	Sat Dec 23 00:05:40 2006
+++ llvm/include/llvm/Support/InstVisitor.h	Thu Feb  1 20:16:21 2007
@@ -190,7 +190,6 @@
   RetTy visitBitCastInst(BitCastInst &I)            { DELEGATE(CastInst); }
   RetTy visitSelectInst(SelectInst &I)              { DELEGATE(Instruction); }
   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 visitInsertElementInst(InsertElementInst &I) { DELEGATE(Instruction); }


Index: llvm/include/llvm/Support/PatternMatch.h
diff -u llvm/include/llvm/Support/PatternMatch.h:1.17 llvm/include/llvm/Support/PatternMatch.h:1.18
--- llvm/include/llvm/Support/PatternMatch.h:1.17	Sat Jan 20 18:29:25 2007
+++ llvm/include/llvm/Support/PatternMatch.h	Thu Feb  1 20:16:21 2007
@@ -166,27 +166,27 @@
 }
 
 template<typename LHS, typename RHS>
-inline BinaryOp_match<LHS, RHS, Instruction::Shl, 
-                      ShiftInst> m_Shl(const LHS &L, const RHS &R) {
-  return BinaryOp_match<LHS, RHS, Instruction::Shl, ShiftInst>(L, R);
+inline BinaryOp_match<LHS, RHS, Instruction::Shl> m_Shl(const LHS &L, 
+                                                        const RHS &R) {
+  return BinaryOp_match<LHS, RHS, Instruction::Shl>(L, R);
 }
 
 template<typename LHS, typename RHS>
-inline BinaryOp_match<LHS, RHS, Instruction::LShr, 
-                      ShiftInst> m_LShr(const LHS &L, const RHS &R) {
-  return BinaryOp_match<LHS, RHS, Instruction::LShr, ShiftInst>(L, R);
+inline BinaryOp_match<LHS, RHS, Instruction::LShr> m_LShr(const LHS &L, 
+                                                          const RHS &R) {
+  return BinaryOp_match<LHS, RHS, Instruction::LShr>(L, R);
 }
 
 template<typename LHS, typename RHS>
-inline BinaryOp_match<LHS, RHS, Instruction::AShr, 
-                      ShiftInst> m_AShr(const LHS &L, const RHS &R) {
-  return BinaryOp_match<LHS, RHS, Instruction::AShr, ShiftInst>(L, R);
+inline BinaryOp_match<LHS, RHS, Instruction::AShr> m_AShr(const LHS &L, 
+                                                          const RHS &R) {
+  return BinaryOp_match<LHS, RHS, Instruction::AShr>(L, R);
 }
 
 //===----------------------------------------------------------------------===//
 // Matchers for either AShr or LShr .. for convenience
 //
-template<typename LHS_t, typename RHS_t, typename ConcreteTy = ShiftInst>
+template<typename LHS_t, typename RHS_t, typename ConcreteTy = BinaryOperator>
 struct Shr_match {
   LHS_t L;
   RHS_t R;
@@ -248,18 +248,18 @@
 };
 
 template<typename LHS, typename RHS>
-inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps>
-m_Shift(Instruction::OtherOps &Op, const LHS &L, const RHS &R) {
+inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps>
+m_Shift(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) {
   return BinaryOpClass_match<LHS, RHS, 
-                             ShiftInst, Instruction::OtherOps>(Op, L, R);
+                             BinaryOperator, Instruction::BinaryOps>(Op, L, R);
 }
 
 template<typename LHS, typename RHS>
-inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps>
+inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps>
 m_Shift(const LHS &L, const RHS &R) {
-  Instruction::OtherOps Op; 
+  Instruction::BinaryOps Op; 
   return BinaryOpClass_match<LHS, RHS, 
-                             ShiftInst, Instruction::OtherOps>(Op, L, R);
+                             BinaryOperator, Instruction::BinaryOps>(Op, L, R);
 }
 
 //===----------------------------------------------------------------------===//






More information about the llvm-commits mailing list