mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-26 23:29:22 +00:00
Move vector type merging to a separate function in preparation for it getting
more complicated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127316 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
46033b0be1
commit
c9ecd14cee
@ -251,6 +251,7 @@ public:
|
||||
private:
|
||||
bool CanConvertToScalar(Value *V, uint64_t Offset);
|
||||
void MergeInType(const Type *In, uint64_t Offset);
|
||||
bool MergeInVectorType(const VectorType *VInTy, uint64_t Offset);
|
||||
void ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, uint64_t Offset);
|
||||
|
||||
Value *ConvertScalar_ExtractValue(Value *NV, const Type *ToType,
|
||||
@ -314,19 +315,8 @@ void ConvertToScalarInfo::MergeInType(const Type *In, uint64_t Offset) {
|
||||
// If the In type is a vector that is the same size as the alloca, see if it
|
||||
// matches the existing VecTy.
|
||||
if (const VectorType *VInTy = dyn_cast<VectorType>(In)) {
|
||||
// Remember if we saw a vector type.
|
||||
HadAVector = true;
|
||||
|
||||
if (VInTy->getBitWidth()/8 == AllocaSize && Offset == 0) {
|
||||
// If we're storing/loading a vector of the right size, allow it as a
|
||||
// vector. If this the first vector we see, remember the type so that
|
||||
// we know the element size. If this is a subsequent access, ignore it
|
||||
// even if it is a differing type but the same size. Worst case we can
|
||||
// bitcast the resultant vectors.
|
||||
if (VectorTy == 0)
|
||||
VectorTy = VInTy;
|
||||
if (MergeInVectorType(VInTy, Offset))
|
||||
return;
|
||||
}
|
||||
} else if (In->isFloatTy() || In->isDoubleTy() ||
|
||||
(In->isIntegerTy() && In->getPrimitiveSizeInBits() >= 8 &&
|
||||
isPowerOf2_32(In->getPrimitiveSizeInBits()))) {
|
||||
@ -349,6 +339,27 @@ void ConvertToScalarInfo::MergeInType(const Type *In, uint64_t Offset) {
|
||||
VectorTy = Type::getVoidTy(In->getContext());
|
||||
}
|
||||
|
||||
/// MergeInVectorType - Handles the vector case of MergeInType, returning true
|
||||
/// if the type was successfully merged and false otherwise.
|
||||
bool ConvertToScalarInfo::MergeInVectorType(const VectorType *VInTy,
|
||||
uint64_t Offset) {
|
||||
// Remember if we saw a vector type.
|
||||
HadAVector = true;
|
||||
|
||||
if (VInTy->getBitWidth()/8 == AllocaSize && Offset == 0) {
|
||||
// If we're storing/loading a vector of the right size, allow it as a
|
||||
// vector. If this the first vector we see, remember the type so that
|
||||
// we know the element size. If this is a subsequent access, ignore it
|
||||
// even if it is a differing type but the same size. Worst case we can
|
||||
// bitcast the resultant vectors.
|
||||
if (VectorTy == 0)
|
||||
VectorTy = VInTy;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// CanConvertToScalar - V is a pointer. If we can convert the pointee and all
|
||||
/// its accesses to a single vector type, return true and set VecTy to
|
||||
/// the new type. If we could convert the alloca into a single promotable
|
||||
|
Loading…
Reference in New Issue
Block a user