[llvm-commits] [llvm] r49559 - in /llvm/branches/ggreif/use-diet: include/llvm/Instructions.h lib/VMCore/Instructions.cpp
Gabor Greif
ggreif at gmail.com
Fri Apr 11 14:00:18 PDT 2008
Author: ggreif
Date: Fri Apr 11 16:00:17 2008
New Revision: 49559
URL: http://llvm.org/viewvc/llvm-project?rev=49559&view=rev
Log:
OperandTraits for ShuffleVectorInst
Modified:
llvm/branches/ggreif/use-diet/include/llvm/Instructions.h
llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp
Modified: llvm/branches/ggreif/use-diet/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Instructions.h?rev=49559&r1=49558&r2=49559&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Instructions.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Instructions.h Fri Apr 11 16:00:17 2008
@@ -1346,7 +1346,8 @@
}
/// Transparently provide more efficient getOperand methods.
- const Value *getOperand(unsigned i) const {
+ DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
+ /* const Value *getOperand(unsigned i) const {
assert(i < 3 && "getOperand() out of range!");
return OperandList[i];
}
@@ -1358,7 +1359,7 @@
assert(i < 3 && "setOperand() out of range!");
OperandList[i] = Val;
}
- unsigned getNumOperands() const { return 3; }
+ unsigned getNumOperands() const { return 3; }*/
/// getMaskValue - Return the index from the shuffle mask for the specified
/// output result. This is either -1 if the element is undef or a number less
@@ -1375,6 +1376,11 @@
}
};
+template <>
+struct OperandTraits<ShuffleVectorInst> : FixedNumOperandTraits<3> {
+};
+
+DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorInst, Value)
//===----------------------------------------------------------------------===//
// PHINode Class
Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp?rev=49559&r1=49558&r2=49559&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp Fri Apr 11 16:00:17 2008
@@ -1221,7 +1221,9 @@
//===----------------------------------------------------------------------===//
ShuffleVectorInst::ShuffleVectorInst(const ShuffleVectorInst &SV)
- : Instruction(SV.getType(), ShuffleVector, /*Ops*/NULL, 3) {
+ : Instruction(SV.getType(), ShuffleVector,
+ OperandTraits<ShuffleVectorInst>::op_begin(this),
+ OperandTraits<ShuffleVectorInst>::operands(this)) {
Op<0>().init(SV.Op<0>(), this);
Op<1>().init(SV.Op<1>(), this);
Op<2>().init(SV.Op<2>(), this);
@@ -1230,7 +1232,10 @@
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const std::string &Name,
Instruction *InsertBefore)
- : Instruction(V1->getType(), ShuffleVector, /*Ops*/NULL, 3, InsertBefore) {
+ : Instruction(V1->getType(), ShuffleVector,
+ OperandTraits<ShuffleVectorInst>::op_begin(this),
+ OperandTraits<ShuffleVectorInst>::operands(this),
+ InsertBefore) {
assert(isValidOperands(V1, V2, Mask) &&
"Invalid shuffle vector instruction operands!");
Op<0>().init(V1, this);
@@ -1242,7 +1247,10 @@
ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const std::string &Name,
BasicBlock *InsertAtEnd)
- : Instruction(V1->getType(), ShuffleVector, /*Ops*/NULL, 3, InsertAtEnd) {
+ : Instruction(V1->getType(), ShuffleVector,
+ OperandTraits<ShuffleVectorInst>::op_begin(this),
+ OperandTraits<ShuffleVectorInst>::operands(this),
+ InsertAtEnd) {
assert(isValidOperands(V1, V2, Mask) &&
"Invalid shuffle vector instruction operands!");
More information about the llvm-commits
mailing list