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 /include | |
parent | d59ae907eea28285ece6696d6f3271b4ca578c0d (diff) | |
download | llvm-56243b89e7d5072d2d5498f806679d19ea483dac.tar.gz llvm-56243b89e7d5072d2d5498f806679d19ea483dac.tar.bz2 llvm-56243b89e7d5072d2d5498f806679d19ea483dac.tar.xz |
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 'include')
-rw-r--r-- | include/llvm/Constant.h | 6 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index f7d4dd2d32..11a02e080f 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -91,12 +91,6 @@ public: /// FIXME: This really should not be in VMCore. PossibleRelocationsTy getRelocationInfo() const; - /// 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 getVectorElements(SmallVectorImpl<Constant*> &Elts) const; - /// getAggregateElement - For aggregates (struct/array/vector) return the /// constant that corresponds to the specified element if possible, or null if /// not. This can return null if the element index is a ConstantExpr, or if diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 35cb025e94..c27c6fa097 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -1677,11 +1677,19 @@ public: /// 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 getMaskValue(unsigned i) const; + static int getMaskValue(Constant *Mask, unsigned i); + + int getMaskValue(unsigned i) const { + return getMaskValue(getMask(), i); + } /// getShuffleMask - Return the full mask for this instruction, where each /// element is the element number and undef's are returned as -1. - void getShuffleMask(SmallVectorImpl<int> &Mask) const; + static void getShuffleMask(Constant *Mask, SmallVectorImpl<int> &Result); + + void getShuffleMask(SmallVectorImpl<int> &Result) const { + return getShuffleMask(getMask(), Result); + } SmallVector<int, 16> getShuffleMask() const { SmallVector<int, 16> Mask; |