mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-09 12:04:02 +00:00
[IR] Teach the ArrayRef<int> form of IRBuilder::CreateShuffleVector to use ConstantDataVector.
This will be used in a follow up commit to simplify code in clang that creates a ConstantDataVector and calls the other form. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65123b902b
commit
159551729d
@ -725,6 +725,7 @@ public:
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<uint8_t> Elts);
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<uint16_t> Elts);
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<uint32_t> Elts);
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<int32_t> Elts);
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts);
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<float> Elts);
|
||||
static Constant *get(LLVMContext &Context, ArrayRef<double> Elts);
|
||||
|
@ -1648,11 +1648,7 @@ public:
|
||||
|
||||
Value *CreateShuffleVector(Value *V1, Value *V2, ArrayRef<int> IntMask,
|
||||
const Twine &Name = "") {
|
||||
size_t MaskSize = IntMask.size();
|
||||
SmallVector<Constant*, 8> MaskVec(MaskSize);
|
||||
for (size_t i = 0; i != MaskSize; ++i)
|
||||
MaskVec[i] = getInt32(IntMask[i]);
|
||||
Value *Mask = ConstantVector::get(MaskVec);
|
||||
Value *Mask = ConstantDataVector::get(Context, IntMask);
|
||||
return CreateShuffleVector(V1, V2, Mask, Name);
|
||||
}
|
||||
|
||||
|
@ -2500,6 +2500,11 @@ Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint32_t> Elts)
|
||||
const char *Data = reinterpret_cast<const char *>(Elts.data());
|
||||
return getImpl(StringRef(const_cast<char *>(Data), Elts.size()*4), Ty);
|
||||
}
|
||||
Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<int32_t> Elts){
|
||||
Type *Ty = VectorType::get(Type::getInt32Ty(Context), Elts.size());
|
||||
const char *Data = reinterpret_cast<const char *>(Elts.data());
|
||||
return getImpl(StringRef(const_cast<char *>(Data), Elts.size()*4), Ty);
|
||||
}
|
||||
Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef<uint64_t> Elts){
|
||||
Type *Ty = VectorType::get(Type::getInt64Ty(Context), Elts.size());
|
||||
const char *Data = reinterpret_cast<const char *>(Elts.data());
|
||||
|
Loading…
x
Reference in New Issue
Block a user