MLLIF
a MLIR-based Language to Language Interoperability Flyover
Loading...
Searching...
No Matches
TypeReg.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Yeong-won Seo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
20
21// Include all type implementations
24
25namespace mllif::mlir {
26
27 template <typename TInit, typename... T>
28 class TypeReg {
29 public:
30 static auto From(const ::mlir::Type &type, std::shared_ptr<::mlir::ModuleOp> module) -> std::shared_ptr<Type> {
31 if (auto t = TInit::From(type, module)) {
32 return t;
33 }
34 if constexpr (sizeof...(T) > 0) {
35 return TypeReg<T...>::From(type, module);
36 }
37 return nullptr;
38 }
39 };
40
41 // Ignore IDE error - Compilation may success
42 using Types = TypeReg<
44 >;
45} // namespace mllif::mlir
static auto From(const ::mlir::Type &type, std::shared_ptr<::mlir::ModuleOp > module) -> std::shared_ptr< Type >
Definition TypeReg.h:30
TypeReg< # 1 "/github/workspace/mllif/Frontend/MLIR/include/mllif/Frontend/MLIR/Types.inc" 1 ::mllif::mlir::builtin::BuiltinType, ::mllif::mlir::cir::CIRType# 43 "/github/workspace/mllif/Frontend/MLIR/include/mllif/Frontend/MLIR/TypeReg.h" 2 > Types
Definition TypeReg.h:42