Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions include/llvm-dialects/Dialect/OpSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ class OpSet final {

// Construct an OpSet from a set of dialect ops, given as template
// arguments.
template <typename... OpTs> static const OpSet get() {
static OpSet set;
(... && appendT<OpTs>(set));
template <typename... OpTs> static const OpSet &get() {
static const auto set = ([]() {
OpSet set;
(void)(... && ([&set]() {
set.tryInsertOp(OpDescription::get<OpTs>());
return true;
})());
return set;
})();
return set;
}

Expand Down Expand Up @@ -169,15 +175,6 @@ class OpSet final {
}

private:
// Generates an `OpDescription` for a given `OpT`, extracts the
// internal operation representation and collects it in the set.
template <typename OpT> static bool appendT(OpSet &set) {
static OpDescription desc = OpDescription::get<OpT>();
set.tryInsertOp(desc);

return true;
}

// Checks if `mnemonic` can be described by any of the stored dialect
// operations.
bool isMatchingDialectOp(llvm::StringRef mnemonic) const {
Expand Down