aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm/Support/TypeSize.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/Support/TypeSize.h')
-rw-r--r--llvm/include/llvm/Support/TypeSize.h23
1 files changed, 9 insertions, 14 deletions
diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index d277affdbb23..30bbbd7db8c9 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -27,6 +27,10 @@
namespace llvm {
+/// Reports a diagnostic message to indicate an invalid size request has been
+/// done on a scalable vector. This function may not return.
+void reportInvalidSizeRequest(const char *Msg);
+
template <typename LeafTy> struct LinearPolyBaseTypeTraits {};
//===----------------------------------------------------------------------===//
@@ -231,13 +235,13 @@ public:
}
/// Add \p RHS to the value at the univariate dimension.
- LeafTy getWithIncrement(ScalarTy RHS) {
+ LeafTy getWithIncrement(ScalarTy RHS) const {
return static_cast<LeafTy>(
UnivariateLinearPolyBase(Value + RHS, UnivariateDim));
}
/// Subtract \p RHS from the value at the univariate dimension.
- LeafTy getWithDecrement(ScalarTy RHS) {
+ LeafTy getWithDecrement(ScalarTy RHS) const {
return static_cast<LeafTy>(
UnivariateLinearPolyBase(Value - RHS, UnivariateDim));
}
@@ -381,6 +385,7 @@ template <> struct LinearPolyBaseTypeTraits<ElementCount> {
class ElementCount : public LinearPolySize<ElementCount> {
public:
+ ElementCount() : LinearPolySize(LinearPolySize::getNull()) {}
ElementCount(const LinearPolySize<ElementCount> &V) : LinearPolySize(V) {}
@@ -445,17 +450,7 @@ public:
// else
// bail out early for scalable vectors and use getFixedValue()
// }
- operator ScalarTy() const {
-#ifdef STRICT_FIXED_SIZE_VECTORS
- return getFixedValue();
-#else
- if (isScalable())
- WithColor::warning() << "Compiler has made implicit assumption that "
- "TypeSize is not scalable. This may or may not "
- "lead to broken code.\n";
- return getKnownMinValue();
-#endif
- }
+ operator ScalarTy() const;
// Additional operators needed to avoid ambiguous parses
// because of the implicit conversion hack.
@@ -528,4 +523,4 @@ template <> struct DenseMapInfo<ElementCount> {
} // end namespace llvm
-#endif // LLVM_SUPPORT_TypeSize_H
+#endif // LLVM_SUPPORT_TYPESIZE_H