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 | 56243b89e7d5072d2d5498f806679d19ea483dac (patch) | |
tree | 7ed46c29b55e989af4fc74144faa99542547e436 /lib/VMCore/Constants.cpp | |
parent | d59ae907eea28285ece6696d6f3271b4ca578c0d (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r-- | lib/VMCore/Constants.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index f5239e1569..2530b63d8a 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -312,36 +312,6 @@ Constant::PossibleRelocationsTy Constant::getRelocationInfo() const { return Result; } - -/// getVectorElements - This method, which is only valid on constant of vector -/// type, returns the elements of the vector in the specified smallvector. -/// This handles breaking down a vector undef into undef elements, etc. For -/// constant exprs and other cases we can't handle, we return an empty vector. -void Constant::getVectorElements(SmallVectorImpl<Constant*> &Elts) const { - assert(getType()->isVectorTy() && "Not a vector constant!"); - - if (const ConstantVector *CV = dyn_cast<ConstantVector>(this)) { - for (unsigned i = 0, e = CV->getNumOperands(); i != e; ++i) - Elts.push_back(CV->getOperand(i)); - return; - } - - VectorType *VT = cast<VectorType>(getType()); - if (isa<ConstantAggregateZero>(this)) { - Elts.assign(VT->getNumElements(), - Constant::getNullValue(VT->getElementType())); - return; - } - - if (isa<UndefValue>(this)) { - Elts.assign(VT->getNumElements(), UndefValue::get(VT->getElementType())); - return; - } - - // Unknown type, must be constant expr etc. -} - - /// removeDeadUsersOfConstant - If the specified constantexpr is dead, remove /// it. This involves recursively eliminating any dead users of the /// constantexpr. |