From 007a4acece71e8fe449984c215d61fcf00007c1c Mon Sep 17 00:00:00 2001 From: River Riddle Date: Tue, 30 Apr 2019 18:15:48 -0700 Subject: [PATCH] Remove NumericAttr. Now that all attributes contain a type, this subclass is no longer necessary. -- PiperOrigin-RevId: 246061024 --- mlir/include/mlir/IR/Attributes.h | 24 +++++++----------------- mlir/lib/IR/Attributes.cpp | 9 --------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h index 9d09c38..1819518 100644 --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -172,19 +172,9 @@ public: static bool kindof(Kind kind) { return kind == Attribute::Kind::Unit; } }; -/// Numeric attributes are (vector/tensor of) bool, integer, or floating-point -/// constants. For all the attributes, we can only build constant op out of -/// numeric attributes. -class NumericAttr : public Attribute { +class BoolAttr : public Attribute { public: using Attribute::Attribute; - - static bool kindof(Kind kind); -}; - -class BoolAttr : public NumericAttr { -public: - using NumericAttr::NumericAttr; using ImplType = detail::BoolAttributeStorage; using ValueType = bool; @@ -196,9 +186,9 @@ public: static bool kindof(Kind kind) { return kind == Kind::Bool; } }; -class IntegerAttr : public NumericAttr { +class IntegerAttr : public Attribute { public: - using NumericAttr::NumericAttr; + using Attribute::Attribute; using ImplType = detail::IntegerAttributeStorage; using ValueType = APInt; @@ -213,9 +203,9 @@ public: static bool kindof(Kind kind) { return kind == Kind::Integer; } }; -class FloatAttr : public NumericAttr { +class FloatAttr : public Attribute { public: - using NumericAttr::NumericAttr; + using Attribute::Attribute; using ImplType = detail::FloatAttributeStorage; using ValueType = APFloat; @@ -344,9 +334,9 @@ public: }; /// A base attribute that represents a reference to a vector or tensor constant. -class ElementsAttr : public NumericAttr { +class ElementsAttr : public Attribute { public: - using NumericAttr::NumericAttr; + using Attribute::Attribute; VectorOrTensorType getType() const; diff --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp index aa1127c..b05dfdb 100644 --- a/mlir/lib/IR/Attributes.cpp +++ b/mlir/lib/IR/Attributes.cpp @@ -79,15 +79,6 @@ UnitAttr UnitAttr::get(MLIRContext *context) { } //===----------------------------------------------------------------------===// -// NumericAttr -//===----------------------------------------------------------------------===// - -bool NumericAttr::kindof(Kind kind) { - return BoolAttr::kindof(kind) || IntegerAttr::kindof(kind) || - FloatAttr::kindof(kind) || ElementsAttr::kindof(kind); -} - -//===----------------------------------------------------------------------===// // BoolAttr //===----------------------------------------------------------------------===// -- 2.7.4