Skip to content

Commit 21006bc

Browse files
committed
Remove extension mechanism from BUfferizationState
1 parent 019f5b9 commit 21006bc

File tree

2 files changed

+0
-63
lines changed

2 files changed

+0
-63
lines changed

mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -582,71 +582,10 @@ class AnalysisState {
582582
/// bufferization process.
583583
class BufferizationState {
584584
public:
585-
/// Base class for BufferizationState extensions that allow BufferizationState
586-
/// to contain user-specified information in the state object. The extension
587-
/// mechanism of BufferizationState mirrors the one of OneShotAnalysisState.
588-
class Extension {
589-
public:
590-
/// Base virtual destructor.
591-
// Out-of-line definition ensures symbols are emitted in a single object
592-
// file.
593-
virtual ~Extension();
594-
595-
protected:
596-
/// Constructs an extension of the given state object.
597-
Extension(BufferizationState &state) : state(state) {}
598-
599-
/// Provides read-only access to the parent OneShotAnalysisState object.
600-
const BufferizationState &getBufferizationState() const { return state; }
601-
602-
private:
603-
/// Back-reference to the state that is being extended.
604-
BufferizationState &state;
605-
};
606-
607-
/// Adds a new Extension of the type specified as template parameter,
608-
/// constructing it with the arguments provided. The extension is owned by the
609-
/// BufferizationState. It is expected that the state does not already have an
610-
/// extension of the same type. Extension constructors are expected to take a
611-
/// reference to BufferizationState as first argument, automatically supplied
612-
/// by this call.
613-
template <typename Ty, typename... Args>
614-
Ty &addExtension(Args &&...args) {
615-
static_assert(std::is_base_of<Extension, Ty>::value,
616-
"only a class derived from "
617-
"BufferizationState::Extension is allowed");
618-
auto ptr = std::make_unique<Ty>(*this, std::forward<Args>(args)...);
619-
auto result = extensions.try_emplace(TypeID::get<Ty>(), std::move(ptr));
620-
assert(result.second && "extension already added");
621-
return *static_cast<Ty *>(result.first->second.get());
622-
}
623-
624-
/// Returns the extension of the specified type.
625-
template <typename Ty>
626-
Ty *getExtension() {
627-
static_assert(std::is_base_of<Extension, Ty>::value,
628-
"only a class derived from "
629-
"BufferizationState::Extension is allowed");
630-
auto iter = extensions.find(TypeID::get<Ty>());
631-
if (iter == extensions.end())
632-
return nullptr;
633-
return static_cast<Ty *>(iter->second.get());
634-
}
635-
636-
/// Returns the extension of the specified type.
637-
template <typename Ty>
638-
const Ty *getExtension() const {
639-
return const_cast<BufferizationState *>(this)->getExtension<Ty>();
640-
}
641-
642585
/// Get a reference to the collection of cached symbol tables.
643586
SymbolTableCollection &getSymbolTables();
644587

645588
private:
646-
/// Extensions attached to the state, identified by the TypeID of their type.
647-
/// Only one extension of any given type is allowed.
648-
DenseMap<TypeID, std::unique_ptr<Extension>> extensions;
649-
650589
/// The cached symbol tables.
651590
/// The user is expected to update / invalidate the cached symbol tables if
652591
/// the bufferized operation has the Symbol or SymbolTable traits.

mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ void AnalysisState::resetCache() {
125125
insideMutuallyExclusiveRegionsCache.clear();
126126
}
127127

128-
BufferizationState::Extension::~Extension() = default;
129-
130128
SymbolTableCollection &BufferizationState::getSymbolTables() {
131129
return symbolTables;
132130
}

0 commit comments

Comments
 (0)