[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Instruction.h Instructions.h

2007-02-01 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.122 -> 1.123
Instruction.def updated: 1.28 -> 1.29
Instruction.h updated: 1.78 -> 1.79
Instructions.h updated: 1.52 -> 1.53
---
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:  (+56 -114)

 Constants.h |2 -
 Instruction.def |   70 +-
 Instruction.h   |   21 +++
 Instructions.h  |   77 
 4 files changed, 56 insertions(+), 114 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.122 llvm/include/llvm/Constants.h:1.123
--- llvm/include/llvm/Constants.h:1.122 Tue Jan 30 22:39:29 2007
+++ llvm/include/llvm/Constants.h   Thu Feb  1 20:16:21 2007
@@ -442,8 +442,6 @@
  Constant *C1, Constant *C2);
   static Constant *getCompareTy(unsigned short pred, Constant *C1, 
 Constant *C2);
-  static Constant *getShiftTy(const Type *Ty,
-  unsigned Opcode, Constant *C1, Constant *C2);
   static Constant *getSelectTy(const Type *Ty,
Constant *C1, Constant *C2, Constant *C3);
   static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.28 
llvm/include/llvm/Instruction.def:1.29
--- llvm/include/llvm/Instruction.def:1.28  Sat Dec 23 00:05:40 2006
+++ llvm/include/llvm/Instruction.def   Thu Feb  1 20:16:21 2007
@@ -114,49 +114,49 @@
 HANDLE_BINARY_INST(14, SRem , BinaryOperator)
 HANDLE_BINARY_INST(15, FRem , BinaryOperator)
 
-// Logical operators...
-HANDLE_BINARY_INST(16, And   , BinaryOperator)
-HANDLE_BINARY_INST(17, Or, BinaryOperator)
-HANDLE_BINARY_INST(18, Xor   , BinaryOperator)
-  LAST_BINARY_INST(18)
+// Logical operators (integer operands)
+HANDLE_BINARY_INST(16, Shl  , BinaryOperator) // Shift left  (logical)
+HANDLE_BINARY_INST(17, LShr , BinaryOperator) // Shift right (logical) 
+HANDLE_BINARY_INST(18, AShr , BinaryOperator) // shift right (arithmetic)
+HANDLE_BINARY_INST(19, And  , BinaryOperator)
+HANDLE_BINARY_INST(20, Or   , BinaryOperator)
+HANDLE_BINARY_INST(21, Xor  , BinaryOperator)
+  LAST_BINARY_INST(21)
 
 // Memory operators...
- FIRST_MEMORY_INST(19)
-HANDLE_MEMORY_INST(19, Malloc, MallocInst)  // Heap management instructions
-HANDLE_MEMORY_INST(20, Free  , FreeInst  )
-HANDLE_MEMORY_INST(21, Alloca, AllocaInst)  // Stack management
-HANDLE_MEMORY_INST(22, Load  , LoadInst  )  // Memory manipulation instrs
-HANDLE_MEMORY_INST(23, Store , StoreInst )
-HANDLE_MEMORY_INST(24, GetElementPtr, GetElementPtrInst)
-  LAST_MEMORY_INST(24)
+ FIRST_MEMORY_INST(22)
+HANDLE_MEMORY_INST(22, Malloc, MallocInst)  // Heap management instructions
+HANDLE_MEMORY_INST(23, Free  , FreeInst  )
+HANDLE_MEMORY_INST(24, Alloca, AllocaInst)  // Stack management
+HANDLE_MEMORY_INST(25, Load  , LoadInst  )  // Memory manipulation instrs
+HANDLE_MEMORY_INST(26, Store , StoreInst )
+HANDLE_MEMORY_INST(27, GetElementPtr, GetElementPtrInst)
+  LAST_MEMORY_INST(27)
 
 // Cast operators ...
 // NOTE: The order matters here because CastInst::isEliminableCastPair 
 // NOTE: (see Instructions.cpp) encodes a table based on this ordering.
- FIRST_CAST_INST(25)
-HANDLE_CAST_INST(25, Trunc   , TruncInst   )  // Truncate integers
-HANDLE_CAST_INST(26, ZExt, ZExtInst)  // Zero extend integers
-HANDLE_CAST_INST(27, SExt, SExtInst)  // Sign extend integers
-HANDLE_CAST_INST(28, FPToUI  , FPToUIInst  )  // floating point -> UInt
-HANDLE_CAST_INST(29, FPToSI  , FPToSIInst  )  // floating point -> SInt
-HANDLE_CAST_INST(30, UIToFP  , UIToFPInst  )  // UInt -> floating point
-HANDLE_CAST_INST(31, SIToFP  , SIToFPInst  )  // SInt -> floating point
-HANDLE_CAST_INST(32, FPTrunc , FPTruncInst )  // Truncate floating point
-HANDLE_CAST_INST(33, FPExt   , FPExtInst   )  // Extend floating point
-HANDLE_CAST_INST(34, PtrToInt, PtrToIntInst)  // Pointer -> Integer
-HANDLE_CAST_INST(35, IntToPtr, IntToPtrInst)  // Integer -> Pointer
-HANDLE_CAST_INST(36, BitCast , BitCastInst )  // Type cast
-  LAST_CAST_INST(36)
+ FIRST_CAST_INST(28)
+HANDLE_CAST_INST(28, Trunc   , TruncInst   )  // Truncate integers
+HANDLE_CAST_INST(29, ZExt, ZExtInst)  // Zero extend integers
+HANDLE_CAST_INST(30, SExt, SExtInst)  // Sign extend integers
+HANDLE_CAST_INST(31, FPToUI  , FPToUIInst  )  // floating point -> UInt
+HANDLE_CAST_INST(32, FPToSI  , FPToSIInst  )  // floating point -> SInt
+HANDLE_CAST_INST(

[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Instructions.h

2006-11-07 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.93 -> 1.94
Instruction.def updated: 1.21 -> 1.22
Instructions.h updated: 1.44 -> 1.45
---
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:  (+24 -19)

 Constants.h |6 ++
 Instruction.def |   25 +
 Instructions.h  |   12 +---
 3 files changed, 24 insertions(+), 19 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.93 llvm/include/llvm/Constants.h:1.94
--- llvm/include/llvm/Constants.h:1.93  Wed Nov  1 19:53:58 2006
+++ llvm/include/llvm/Constants.h   Wed Nov  8 00:47:32 2006
@@ -564,10 +564,8 @@
   static Constant *getSetLE(Constant *C1, Constant *C2);
   static Constant *getSetGE(Constant *C1, Constant *C2);
   static Constant *getShl(Constant *C1, Constant *C2);
-  static Constant *getShr(Constant *C1, Constant *C2);
-
-  static Constant *getUShr(Constant *C1, Constant *C2); // unsigned shr
-  static Constant *getSShr(Constant *C1, Constant *C2); // signed shr
+  static Constant *getLShr(Constant *C1, Constant *C2);
+  static Constant *getAShr(Constant *C1, Constant *C2);
 
   /// Getelementptr form.  std::vector is only accepted for 
convenience:
   /// all elements must be Constant's.


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.21 
llvm/include/llvm/Instruction.def:1.22
--- llvm/include/llvm/Instruction.def:1.21  Wed Nov  1 19:53:58 2006
+++ llvm/include/llvm/Instruction.def   Wed Nov  8 00:47:32 2006
@@ -15,8 +15,8 @@
 
 // NOTE: NO INCLUDE GUARD DESIRED!
 
-// Provide definitions of macros so that users of this file do not have to 
define
-// everything to use it...
+// Provide definitions of macros so that users of this file do not have to 
+// define everything to use it...
 //
 #ifndef FIRST_TERM_INST
 #define FIRST_TERM_INST(num)
@@ -129,16 +129,17 @@
 HANDLE_OTHER_INST(31, PHI, PHINode)  // PHI node instruction
 HANDLE_OTHER_INST(32, Cast   , CastInst   )  // Type cast
 HANDLE_OTHER_INST(33, Call   , CallInst   )  // Call a function
-HANDLE_OTHER_INST(34, Shl, ShiftInst  )  // Shift operations
-HANDLE_OTHER_INST(35, Shr, ShiftInst  )
-HANDLE_OTHER_INST(36, Select , SelectInst )  // select instruction
-HANDLE_OTHER_INST(37, UserOp1, Instruction)  // May be used internally in a 
pass
-HANDLE_OTHER_INST(38, UserOp2, Instruction)
-HANDLE_OTHER_INST(39, VAArg  , VAArgInst  )  // vaarg instruction
-HANDLE_OTHER_INST(40, ExtractElement, ExtractElementInst)// extract from 
vector.
-HANDLE_OTHER_INST(41, InsertElement, InsertElementInst)  // insert into vector
-HANDLE_OTHER_INST(42, ShuffleVector, ShuffleVectorInst)  // shuffle two 
vectors.
-  LAST_OTHER_INST(42)
+HANDLE_OTHER_INST(34, Shl, ShiftInst  )  // Shift Left operations (logical)
+HANDLE_OTHER_INST(35, LShr   , ShiftInst  )  // Logical Shift right (unsigned) 
+HANDLE_OTHER_INST(36, AShr   , ShiftInst  )  // Arithmetic shift right (signed)
+HANDLE_OTHER_INST(37, Select , SelectInst )  // select instruction
+HANDLE_OTHER_INST(38, UserOp1, Instruction)  // May be used internally in a 
pass
+HANDLE_OTHER_INST(39, UserOp2, Instruction)  // Internal to passes only
+HANDLE_OTHER_INST(40, VAArg  , VAArgInst  )  // vaarg instruction
+HANDLE_OTHER_INST(41, ExtractElement, ExtractElementInst)// extract from 
vector.
+HANDLE_OTHER_INST(42, InsertElement, InsertElementInst)  // insert into vector
+HANDLE_OTHER_INST(43, ShuffleVector, ShuffleVectorInst)  // shuffle two 
vectors.
+  LAST_OTHER_INST(43)
 
 #undef  FIRST_TERM_INST
 #undef HANDLE_TERM_INST


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.44 
llvm/include/llvm/Instructions.h:1.45
--- llvm/include/llvm/Instructions.h:1.44   Thu Oct  5 01:24:58 2006
+++ llvm/include/llvm/Instructions.hWed Nov  8 00:47:32 2006
@@ -604,7 +604,8 @@
 Ops[1].init(SI.Ops[1], this);
   }
   void init(OtherOps Opcode, Value *S, Value *SA) {
-assert((Opcode == Shl || Opcode == Shr) && "ShiftInst Opcode invalid!");
+assert((Opcode == Shl || Opcode == LShr || Opcode == AShr) && 
+  "ShiftInst Opcode invalid!");
 Ops[0].init(S, this);
 Ops[1].init(SA, this);
   }
@@ -638,7 +639,11 @@
 
   /// isLogicalShift - Return true if this is a logical shift left or a logical
   /// shift right.
-  bool isLogicalShift() const;
+  bool isLogicalShift() const {
+unsigned opcode = getOpcode();
+return opcode == Instruction::Shl || opcode == Instruction::LShr;
+  }
+
 
   /// isArithmeticShift - Return true if this is a sign-extending shift right
   /// operation.
@@ -652,7 +657,8 @@
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ShiftInst *) { return true; }
   static inline bool class

[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def

2006-11-01 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.92 -> 1.93
Instruction.def updated: 1.20 -> 1.21
---
Log message:

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


---
Diffs of the changes:  (+44 -40)

 Constants.h |4 ++
 Instruction.def |   80 
 2 files changed, 44 insertions(+), 40 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.92 llvm/include/llvm/Constants.h:1.93
--- llvm/include/llvm/Constants.h:1.92  Thu Oct 26 14:13:30 2006
+++ llvm/include/llvm/Constants.h   Wed Nov  1 19:53:58 2006
@@ -551,7 +551,9 @@
   static Constant *getUDiv(Constant *C1, Constant *C2);
   static Constant *getSDiv(Constant *C1, Constant *C2);
   static Constant *getFDiv(Constant *C1, Constant *C2);
-  static Constant *getRem(Constant *C1, Constant *C2);
+  static Constant *getURem(Constant *C1, Constant *C2); // unsigned rem
+  static Constant *getSRem(Constant *C1, Constant *C2); // signed rem
+  static Constant *getFRem(Constant *C1, Constant *C2);
   static Constant *getAnd(Constant *C1, Constant *C2);
   static Constant *getOr(Constant *C1, Constant *C2);
   static Constant *getXor(Constant *C1, Constant *C2);


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.20 
llvm/include/llvm/Instruction.def:1.21
--- llvm/include/llvm/Instruction.def:1.20  Thu Oct 26 01:15:43 2006
+++ llvm/include/llvm/Instruction.def   Wed Nov  1 19:53:58 2006
@@ -90,53 +90,55 @@
 
 // Standard binary operators...
  FIRST_BINARY_INST( 7)
-HANDLE_BINARY_INST( 7, Add   , BinaryOperator)
-HANDLE_BINARY_INST( 8, Sub   , BinaryOperator)
-HANDLE_BINARY_INST( 9, Mul   , BinaryOperator)
-HANDLE_BINARY_INST(10, UDiv  , BinaryOperator)
-HANDLE_BINARY_INST(11, SDiv  , BinaryOperator)
-HANDLE_BINARY_INST(12, FDiv  , BinaryOperator)
-HANDLE_BINARY_INST(13, Rem   , BinaryOperator)
+HANDLE_BINARY_INST( 7, Add  , BinaryOperator)
+HANDLE_BINARY_INST( 8, Sub  , BinaryOperator)
+HANDLE_BINARY_INST( 9, Mul  , BinaryOperator)
+HANDLE_BINARY_INST(10, UDiv , BinaryOperator)
+HANDLE_BINARY_INST(11, SDiv , BinaryOperator)
+HANDLE_BINARY_INST(12, FDiv , BinaryOperator)
+HANDLE_BINARY_INST(13, URem , BinaryOperator)
+HANDLE_BINARY_INST(14, SRem , BinaryOperator)
+HANDLE_BINARY_INST(15, FRem , BinaryOperator)
 
 // Logical operators...
-HANDLE_BINARY_INST(14, And   , BinaryOperator)
-HANDLE_BINARY_INST(15, Or, BinaryOperator)
-HANDLE_BINARY_INST(16, Xor   , BinaryOperator)
+HANDLE_BINARY_INST(16, And   , BinaryOperator)
+HANDLE_BINARY_INST(17, Or, BinaryOperator)
+HANDLE_BINARY_INST(18, Xor   , BinaryOperator)
 
 // Binary comparison operators...
-HANDLE_BINARY_INST(17, SetEQ , SetCondInst)
-HANDLE_BINARY_INST(18, SetNE , SetCondInst)
-HANDLE_BINARY_INST(19, SetLE , SetCondInst)
-HANDLE_BINARY_INST(20, SetGE , SetCondInst)
-HANDLE_BINARY_INST(21, SetLT , SetCondInst)
-HANDLE_BINARY_INST(22, SetGT , SetCondInst)
-  LAST_BINARY_INST(22)
+HANDLE_BINARY_INST(19, SetEQ , SetCondInst)
+HANDLE_BINARY_INST(20, SetNE , SetCondInst)
+HANDLE_BINARY_INST(21, SetLE , SetCondInst)
+HANDLE_BINARY_INST(22, SetGE , SetCondInst)
+HANDLE_BINARY_INST(23, SetLT , SetCondInst)
+HANDLE_BINARY_INST(24, SetGT , SetCondInst)
+  LAST_BINARY_INST(24)
 
 // Memory operators...
- FIRST_MEMORY_INST(23)
-HANDLE_MEMORY_INST(23, Malloc, MallocInst)  // Heap management instructions
-HANDLE_MEMORY_INST(24, Free  , FreeInst  )
-HANDLE_MEMORY_INST(25, Alloca, AllocaInst)  // Stack management
-HANDLE_MEMORY_INST(26, Load  , LoadInst  )  // Memory manipulation instrs
-HANDLE_MEMORY_INST(27, Store , StoreInst )
-HANDLE_MEMORY_INST(28, GetElementPtr, GetElementPtrInst)
-  LAST_MEMORY_INST(28)
+ FIRST_MEMORY_INST(25)
+HANDLE_MEMORY_INST(25, Malloc, MallocInst)  // Heap management instructions
+HANDLE_MEMORY_INST(26, Free  , FreeInst  )
+HANDLE_MEMORY_INST(27, Alloca, AllocaInst)  // Stack management
+HANDLE_MEMORY_INST(28, Load  , LoadInst  )  // Memory manipulation instrs
+HANDLE_MEMORY_INST(29, Store , StoreInst )
+HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst)
+  LAST_MEMORY_INST(30)
 
 // Other operators...
- FIRST_OTHER_INST(29)
-HANDLE_OTHER_INST(29, PHI, PHINode)  // PHI node instruction
-HANDLE_OTHER_INST(30, Cast   , CastInst   )  // Type cast
-HANDLE_OTHER_INST(31, Call   , CallInst   )  // Call a function
-HANDLE_OTHER_INST(32, Shl, ShiftInst  )  // Shift operations
-HANDLE_OTHER_INST(33, Shr, ShiftInst  )
-HANDLE_OTHER_INST(34, Select , SelectInst )  // select instruction
-HANDLE_OTHER_INST(35, UserOp1, Instruction)  // May be used internally in a 
pass
-HANDLE_OTHER_INST(36, UserOp2, Instruction)
-HANDLE_OTHER_INST(37, VAArg  , VAArgInst  )  // vaarg instruction
-HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)// extract from 
vector.
-HANDLE_OTHER_INST(39, InsertElement, InsertElementInst)  // insert into vector
-HANDLE_OTHER_INST(40, ShuffleVector, Shuf

[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def

2006-10-25 Thread Reid Spencer


Changes in directory llvm/include/llvm:

Constants.h updated: 1.90 -> 1.91
Instruction.def updated: 1.19 -> 1.20
---
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:  (+31 -31)

 Constants.h |4 ++-
 Instruction.def |   58 +++-
 2 files changed, 31 insertions(+), 31 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.90 llvm/include/llvm/Constants.h:1.91
--- llvm/include/llvm/Constants.h:1.90  Fri Oct 20 02:24:55 2006
+++ llvm/include/llvm/Constants.h   Thu Oct 26 01:15:43 2006
@@ -543,7 +543,9 @@
   static Constant *getAdd(Constant *C1, Constant *C2);
   static Constant *getSub(Constant *C1, Constant *C2);
   static Constant *getMul(Constant *C1, Constant *C2);
-  static Constant *getDiv(Constant *C1, Constant *C2);
+  static Constant *getUDiv(Constant *C1, Constant *C2);
+  static Constant *getSDiv(Constant *C1, Constant *C2);
+  static Constant *getFDiv(Constant *C1, Constant *C2);
   static Constant *getRem(Constant *C1, Constant *C2);
   static Constant *getAnd(Constant *C1, Constant *C2);
   static Constant *getOr(Constant *C1, Constant *C2);


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.19 
llvm/include/llvm/Instruction.def:1.20
--- llvm/include/llvm/Instruction.def:1.19  Fri Apr  7 20:15:18 2006
+++ llvm/include/llvm/Instruction.def   Thu Oct 26 01:15:43 2006
@@ -93,45 +93,43 @@
 HANDLE_BINARY_INST( 7, Add   , BinaryOperator)
 HANDLE_BINARY_INST( 8, Sub   , BinaryOperator)
 HANDLE_BINARY_INST( 9, Mul   , BinaryOperator)
-HANDLE_BINARY_INST(10, Div   , BinaryOperator)
-HANDLE_BINARY_INST(11, Rem   , BinaryOperator)
+HANDLE_BINARY_INST(10, UDiv  , BinaryOperator)
+HANDLE_BINARY_INST(11, SDiv  , BinaryOperator)
+HANDLE_BINARY_INST(12, FDiv  , BinaryOperator)
+HANDLE_BINARY_INST(13, Rem   , BinaryOperator)
 
 // Logical operators...
-HANDLE_BINARY_INST(12, And   , BinaryOperator)
-HANDLE_BINARY_INST(13, Or, BinaryOperator)
-HANDLE_BINARY_INST(14, Xor   , BinaryOperator)
+HANDLE_BINARY_INST(14, And   , BinaryOperator)
+HANDLE_BINARY_INST(15, Or, BinaryOperator)
+HANDLE_BINARY_INST(16, Xor   , BinaryOperator)
 
 // Binary comparison operators...
-HANDLE_BINARY_INST(15, SetEQ , SetCondInst)
-HANDLE_BINARY_INST(16, SetNE , SetCondInst)
-HANDLE_BINARY_INST(17, SetLE , SetCondInst)
-HANDLE_BINARY_INST(18, SetGE , SetCondInst)
-HANDLE_BINARY_INST(19, SetLT , SetCondInst)
-HANDLE_BINARY_INST(20, SetGT , SetCondInst)
-  LAST_BINARY_INST(20)
+HANDLE_BINARY_INST(17, SetEQ , SetCondInst)
+HANDLE_BINARY_INST(18, SetNE , SetCondInst)
+HANDLE_BINARY_INST(19, SetLE , SetCondInst)
+HANDLE_BINARY_INST(20, SetGE , SetCondInst)
+HANDLE_BINARY_INST(21, SetLT , SetCondInst)
+HANDLE_BINARY_INST(22, SetGT , SetCondInst)
+  LAST_BINARY_INST(22)
 
 // Memory operators...
- FIRST_MEMORY_INST(21)
-HANDLE_MEMORY_INST(21, Malloc, MallocInst)  // Heap management instructions
-HANDLE_MEMORY_INST(22, Free  , FreeInst  )
-HANDLE_MEMORY_INST(23, Alloca, AllocaInst)  // Stack management
-HANDLE_MEMORY_INST(24, Load  , LoadInst  )  // Memory manipulation instrs
-HANDLE_MEMORY_INST(25, Store , StoreInst )
-HANDLE_MEMORY_INST(26, GetElementPtr, GetElementPtrInst)
-  LAST_MEMORY_INST(26)
+ FIRST_MEMORY_INST(23)
+HANDLE_MEMORY_INST(23, Malloc, MallocInst)  // Heap management instructions
+HANDLE_MEMORY_INST(24, Free  , FreeInst  )
+HANDLE_MEMORY_INST(25, Alloca, AllocaInst)  // Stack management
+HANDLE_MEMORY_INST(26, Load  , LoadInst  )  // Memory manipulation instrs
+HANDLE_MEMORY_INST(27, Store , StoreInst )
+HANDLE_MEMORY_INST(28, GetElementPtr, GetElementPtrInst)
+  LAST_MEMORY_INST(28)
 
 // Other operators...
- FIRST_OTHER_INST(27)
-HANDLE_OTHER_INST(27, PHI, PHINode)  // PHI node instruction
-HANDLE_OTHER_INST(28, Cast   , CastInst   )  // Type cast
-HANDLE_OTHER_INST(29, Call   , CallInst   )  // Call a function
-
-HANDLE_OTHER_INST(30, Shl, ShiftInst  )  // Shift operations
-HANDLE_OTHER_INST(31, Shr, ShiftInst  )
-// 32 -> Empty slot used to be used for vanext in llvm 1.5 and before.
-// 33 -> Empty slot used to be used for vaarg in llvm 1.5 and before.
+ FIRST_OTHER_INST(29)
+HANDLE_OTHER_INST(29, PHI, PHINode)  // PHI node instruction
+HANDLE_OTHER_INST(30, Cast   , CastInst   )  // Type cast
+HANDLE_OTHER_INST(31, Call   , CallInst   )  // Call a function
+HANDLE_OTHER_INST(32, Shl, ShiftInst  )  // Shift operations
+HANDLE_OTHER_INST(33, Shr, ShiftInst  )
 HANDLE_OTHER_INST(34, Select , SelectInst )  // select instruction
-
 HANDLE_OTHER_INST(35, UserOp1, Instruction)  // May be used internally in a 
pass
 HANDLE_OTHER_INST(36, UserOp2, Instruction)
 HANDLE_OTHER_INST(37, VAArg  , VAArgInst  )  // vaarg instruction


[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Instructions.h

2006-04-07 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Constants.h updated: 1.78 -> 1.79
Instruction.def updated: 1.18 -> 1.19
Instructions.h updated: 1.31 -> 1.32
---
Log message:

Add a new shufflevector instruction


---
Diffs of the changes:  (+70 -19)

 Constants.h |   15 +---
 Instruction.def |7 +++--
 Instructions.h  |   67 ++--
 3 files changed, 70 insertions(+), 19 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.78 llvm/include/llvm/Constants.h:1.79
--- llvm/include/llvm/Constants.h:1.78  Tue Feb  7 00:17:10 2006
+++ llvm/include/llvm/Constants.h   Fri Apr  7 20:15:18 2006
@@ -524,6 +524,8 @@
Constant *Idx);
   static Constant *getInsertElementTy(const Type *Ty, Constant *Val,
   Constant *Elt, Constant *Idx);
+  static Constant *getShuffleVectorTy(const Type *Ty, Constant *V1,
+  Constant *V2, Constant *Mask);
 
 public:
   // Static methods to construct a ConstantExpr of different kinds.  Note that
@@ -591,15 +593,10 @@
   static Constant *getGetElementPtr(Constant *C,
 const std::vector &IdxList);
 
-  /// Extractelement form.
-  ///
-  static Constant *getExtractElement(Constant *Val, Constant *Idx);
-
-  /// Insertelement form.
-  ///
-  static Constant *getInsertElement(Constant *Val, Constant *Elt, 
-Constant *Idx);
-
+  static Constant *getExtractElement(Constant *Vec, Constant *Idx);
+  static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant 
*Idx);
+  static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant 
*Mask);
+  
   /// isNullValue - Return true if this is the value that would be returned by
   /// getNullValue.
   virtual bool isNullValue() const { return false; }


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.18 
llvm/include/llvm/Instruction.def:1.19
--- llvm/include/llvm/Instruction.def:1.18  Tue Jan 17 14:05:59 2006
+++ llvm/include/llvm/Instruction.def   Fri Apr  7 20:15:18 2006
@@ -135,9 +135,10 @@
 HANDLE_OTHER_INST(35, UserOp1, Instruction)  // May be used internally in a 
pass
 HANDLE_OTHER_INST(36, UserOp2, Instruction)
 HANDLE_OTHER_INST(37, VAArg  , VAArgInst  )  // vaarg instruction
-HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)  // extract packed 
element
-HANDLE_OTHER_INST(39, InsertElement, InsertElementInst)  // insert element 
into packed vector
-  LAST_OTHER_INST(39)
+HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)// extract from 
vector.
+HANDLE_OTHER_INST(39, InsertElement, InsertElementInst)  // insert into vector
+HANDLE_OTHER_INST(40, ShuffleVector, ShuffleVectorInst)  // shuffle two 
vectors.
+  LAST_OTHER_INST(40)
 
 #undef  FIRST_TERM_INST
 #undef HANDLE_TERM_INST


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.31 
llvm/include/llvm/Instructions.h:1.32
--- llvm/include/llvm/Instructions.h:1.31   Tue Jan 17 14:05:59 2006
+++ llvm/include/llvm/Instructions.hFri Apr  7 20:15:18 2006
@@ -733,10 +733,10 @@
   }
 
 public:
-  ExtractElementInst(Value *Val, Value *Index,
- const std::string &Name = "", Instruction *InsertBefore = 
0);
-  ExtractElementInst(Value *Val, Value *Index,
- const std::string &Name, BasicBlock *InsertAtEnd);
+  ExtractElementInst(Value *Vec, Value *Idx, const std::string &Name = "",
+ Instruction *InsertBefore = 0);
+  ExtractElementInst(Value *Vec, Value *Idx, const std::string &Name,
+ BasicBlock *InsertAtEnd);
 
   virtual ExtractElementInst *clone() const;
 
@@ -780,9 +780,9 @@
   }
 
 public:
-  InsertElementInst(Value *Val, Value *Elt, Value *Index,
-const std::string &Name = "", Instruction *InsertBefore = 
0);
-  InsertElementInst(Value *Val, Value *Elt,  Value *Index,
+  InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
+const std::string &Name = "",Instruction *InsertBefore = 
0);
+  InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
 const std::string &Name, BasicBlock *InsertAtEnd);
 
   virtual InsertElementInst *clone() const;
@@ -811,6 +811,59 @@
 };
 
 
//===--===//
+//   ShuffleVectorInst Class
+//===--===//
+
+/// ShuffleVectorInst - This instruction constructs a fixed permutation of two
+/// input vectors.
+///
+class ShuffleVectorInst : public Instruction {
+  Use Ops[3];
+  ShuffleVectorInst(const ShuffleVectorInst &IE) : 
+Instruction(IE.getType(), ShuffleVector, Ops, 3) {
+  Ops[0].init(IE.Ops[0], this);
+  Ops[1].init(IE.Ops[1], this);
+  Ops[2].init(IE.Ops[2], this);

[llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Instructions.h

2006-01-10 Thread Robert L. Bocchino Jr.


Changes in directory llvm/include/llvm:

Constants.h updated: 1.75 -> 1.76
Instruction.def updated: 1.16 -> 1.17
Instructions.h updated: 1.29 -> 1.30
---
Log message:

Added an instruction and constant expression for the extractelement
operation.


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

 Constants.h |6 ++
 Instruction.def |3 ++-
 Instructions.h  |   46 ++
 3 files changed, 54 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.75 llvm/include/llvm/Constants.h:1.76
--- llvm/include/llvm/Constants.h:1.75  Tue Oct  4 13:12:13 2005
+++ llvm/include/llvm/Constants.h   Tue Jan 10 13:03:58 2006
@@ -521,6 +521,8 @@
Constant *C1, Constant *C2, Constant *C3);
   static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
   const std::vector &IdxList);
+  static Constant *getExtractElementTy(const Type *Ty, Constant *Val,
+   Constant *Idx);
 
 public:
   // Static methods to construct a ConstantExpr of different kinds.  Note that
@@ -587,6 +589,10 @@
 const std::vector &IdxList);
   static Constant *getGetElementPtr(Constant *C,
 const std::vector &IdxList);
+
+  /// Extractelement form.
+  ///
+  static Constant *getExtractElement(Constant *Val, Constant *Idx);
 
   /// isNullValue - Return true if this is the value that would be returned by
   /// getNullValue.


Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.16 
llvm/include/llvm/Instruction.def:1.17
--- llvm/include/llvm/Instruction.def:1.16  Fri Jun 24 13:17:33 2005
+++ llvm/include/llvm/Instruction.def   Tue Jan 10 13:03:58 2006
@@ -135,7 +135,8 @@
 HANDLE_OTHER_INST(35, UserOp1, Instruction)  // May be used internally in a 
pass
 HANDLE_OTHER_INST(36, UserOp2, Instruction)
 HANDLE_OTHER_INST(37, VAArg  , VAArgInst  )  // vaarg instruction
-  LAST_OTHER_INST(37)
+HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)  // extract packed 
element
+  LAST_OTHER_INST(38)
 
 #undef  FIRST_TERM_INST
 #undef HANDLE_TERM_INST


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.29 
llvm/include/llvm/Instructions.h:1.30
--- llvm/include/llvm/Instructions.h:1.29   Sat Nov  5 15:58:30 2005
+++ llvm/include/llvm/Instructions.hTue Jan 10 13:03:58 2006
@@ -718,6 +718,52 @@
 };
 
 
//===--===//
+//ExtractElementInst Class
+//===--===//
+
+/// ExtractElementInst - This instruction extracts a single (scalar)
+/// element from a PackedType value
+///
+class ExtractElementInst : public Instruction {
+  Use Ops[2];
+  ExtractElementInst(const ExtractElementInst &EI) : 
+Instruction(EI.getType(), ExtractElement, Ops, 2) {
+Ops[0].init(EI.Ops[0], this);
+Ops[1].init(EI.Ops[1], this);
+  }
+
+public:
+  ExtractElementInst(Value *Val, Value *Index,
+   const std::string &Name = "", Instruction *InsertBefore = 0);
+  ExtractElementInst(Value *Val, Value *Index,
+   const std::string &Name, BasicBlock *InsertAtEnd);
+
+  virtual ExtractElementInst *clone() const;
+
+  virtual bool mayWriteToMemory() const { return false; }
+
+  /// Transparently provide more efficient getOperand methods.
+  Value *getOperand(unsigned i) const {
+assert(i < 2 && "getOperand() out of range!");
+return Ops[i];
+  }
+  void setOperand(unsigned i, Value *Val) {
+assert(i < 2 && "setOperand() out of range!");
+Ops[i] = Val;
+  }
+  unsigned getNumOperands() const { return 2; }
+
+  // Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const ExtractElementInst *) { return true; }
+  static inline bool classof(const Instruction *I) {
+return I->getOpcode() == Instruction::ExtractElement;
+  }
+  static inline bool classof(const Value *V) {
+return isa(V) && classof(cast(V));
+  }
+};
+
+//===--===//
 //   PHINode Class
 
//===--===//
 



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