diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-26 02:51:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-26 02:51:13 +0000 |
commit | cf12970bd0ae061efca85f7d28829410c94bfc5a (patch) | |
tree | f0188b5640bdbbb7b9f013075e5c84d2e0869742 /llvm/lib/VMCore/Instructions.cpp | |
parent | 24e9afff4345b331c8eab721741c3d6cf6600bbf (diff) | |
download | bcm5719-llvm-cf12970bd0ae061efca85f7d28829410c94bfc5a.tar.gz bcm5719-llvm-cf12970bd0ae061efca85f7d28829410c94bfc5a.zip |
eliminate the Constant::getVectorElements method. There are better (and
more robust) ways to do what it was doing now. Also, add static methods
for decoding a ShuffleVector mask.
llvm-svn: 149028
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 1de7c01c0d5..a0fb91aada1 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -1625,11 +1625,11 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, /// 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 /// than 2*numelements. -int ShuffleVectorInst::getMaskValue(unsigned i) const { - assert(i < getType()->getNumElements() && "Index out of range"); - if (ConstantDataSequential *CDS =dyn_cast<ConstantDataSequential>(getMask())) +int ShuffleVectorInst::getMaskValue(Constant *Mask, unsigned i) { + assert(i < Mask->getType()->getVectorNumElements() && "Index out of range"); + if (ConstantDataSequential *CDS =dyn_cast<ConstantDataSequential>(Mask)) return CDS->getElementAsInteger(i); - Constant *C = getMask()->getAggregateElement(i); + Constant *C = Mask->getAggregateElement(i); if (isa<UndefValue>(C)) return -1; return cast<ConstantInt>(C)->getZExtValue(); @@ -1637,15 +1637,15 @@ int ShuffleVectorInst::getMaskValue(unsigned i) const { /// getShuffleMask - Return the full mask for this instruction, where each /// element is the element number and undef's are returned as -1. -void ShuffleVectorInst::getShuffleMask(SmallVectorImpl<int> &Result) const { - unsigned NumElts = getType()->getNumElements(); +void ShuffleVectorInst::getShuffleMask(Constant *Mask, + SmallVectorImpl<int> &Result) { + unsigned NumElts = Mask->getType()->getVectorNumElements(); - if (ConstantDataSequential *CDS=dyn_cast<ConstantDataSequential>(getMask())) { + if (ConstantDataSequential *CDS=dyn_cast<ConstantDataSequential>(Mask)) { for (unsigned i = 0; i != NumElts; ++i) Result.push_back(CDS->getElementAsInteger(i)); return; } - Constant *Mask = getMask(); for (unsigned i = 0; i != NumElts; ++i) { Constant *C = Mask->getAggregateElement(i); Result.push_back(isa<UndefValue>(C) ? -1 : |