As discussed on IRC, add VectorTargetTransform::getNumberOfParts
to provide a stable interface to the vector legalization splitting factor.
llvm-svn: 166751
virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src,
unsigned Alignment,
unsigned AddressSpace) const;
+
+ virtual unsigned getNumberOfParts(Type *Tp) const;
};
} // end llvm namespace
return 1;
}
+ /// Returns the number of pieces into which the provided type must be
+ /// split during legalization. Zero is returned when the answer is unknown.
+ virtual unsigned getNumberOfParts(Type *Tp) const {
+ return 0;
+ }
};
} // End llvm namespace
// Assume that all loads of legal types cost 1.
return LT.first;
}
+
+unsigned
+VectorTargetTransformImpl::getNumberOfParts(Type *Tp) const {
+ std::pair<unsigned, EVT> LT =
+ getTypeLegalizationCost(Tp->getContext(), TLI->getValueType(Tp));
+ return LT.first;
+}
+