mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Define a helper function ConstantVector::getSplatValue for testing for
and working with broadcasted constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
efd4a5144b
commit
3b7cf0aaba
@ -438,6 +438,10 @@ public:
|
||||
/// @brief Determine if the value is all ones.
|
||||
bool isAllOnesValue() const;
|
||||
|
||||
/// getSplatValue - If this is a splat constant, meaning that all of the
|
||||
/// elements have the same value, return that value. Otherwise return NULL.
|
||||
Constant *getSplatValue();
|
||||
|
||||
virtual void destroyConstant();
|
||||
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
|
||||
|
||||
|
@ -1286,6 +1286,17 @@ bool ConstantVector::isAllOnesValue() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// getSplatValue - If this is a splat constant, where all of the
|
||||
/// elements have the same value, return that value. Otherwise return null.
|
||||
Constant *ConstantVector::getSplatValue() {
|
||||
// Check out first element.
|
||||
Constant *Elt = getOperand(0);
|
||||
// Then make sure all remaining elements point to the same value.
|
||||
for (unsigned I = 1, E = getNumOperands(); I < E; ++I)
|
||||
if (getOperand(I) != Elt) return 0;
|
||||
return Elt;
|
||||
}
|
||||
|
||||
//---- ConstantPointerNull::get() implementation...
|
||||
//
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user