@@ -35,73 +35,73 @@ using TypeBuilderFunc = mlir::Type (*)(mlir::MLIRContext *);
3535
3636// / Get the LLVM IR dialect model for building a particular C++ type, `T`.
3737template <typename T>
38- TypeBuilderFunc getModel ();
38+ static TypeBuilderFunc getModel ();
3939
4040template <>
41- TypeBuilderFunc getModel<void *>() {
41+ constexpr TypeBuilderFunc getModel<void *>() {
4242 return [](mlir::MLIRContext *context) -> mlir::Type {
4343 return mlir::LLVM::LLVMPointerType::get (context);
4444 };
4545}
4646template <>
47- TypeBuilderFunc getModel<unsigned >() {
47+ constexpr TypeBuilderFunc getModel<unsigned >() {
4848 return [](mlir::MLIRContext *context) -> mlir::Type {
4949 return mlir::IntegerType::get (context, sizeof (unsigned ) * 8 );
5050 };
5151}
5252template <>
53- TypeBuilderFunc getModel<int >() {
53+ constexpr TypeBuilderFunc getModel<int >() {
5454 return [](mlir::MLIRContext *context) -> mlir::Type {
5555 return mlir::IntegerType::get (context, sizeof (int ) * 8 );
5656 };
5757}
5858template <>
59- TypeBuilderFunc getModel<unsigned long >() {
59+ constexpr TypeBuilderFunc getModel<unsigned long >() {
6060 return [](mlir::MLIRContext *context) -> mlir::Type {
6161 return mlir::IntegerType::get (context, sizeof (unsigned long ) * 8 );
6262 };
6363}
6464template <>
65- TypeBuilderFunc getModel<unsigned long long >() {
65+ constexpr TypeBuilderFunc getModel<unsigned long long >() {
6666 return [](mlir::MLIRContext *context) -> mlir::Type {
6767 return mlir::IntegerType::get (context, sizeof (unsigned long long ) * 8 );
6868 };
6969}
7070template <>
71- TypeBuilderFunc getModel<long long >() {
71+ constexpr TypeBuilderFunc getModel<long long >() {
7272 return [](mlir::MLIRContext *context) -> mlir::Type {
7373 return mlir::IntegerType::get (context, sizeof (long long ) * 8 );
7474 };
7575}
7676template <>
77- TypeBuilderFunc getModel<Fortran::ISO::CFI_rank_t>() {
77+ constexpr TypeBuilderFunc getModel<Fortran::ISO::CFI_rank_t>() {
7878 return [](mlir::MLIRContext *context) -> mlir::Type {
7979 return mlir::IntegerType::get (context,
8080 sizeof (Fortran::ISO::CFI_rank_t) * 8 );
8181 };
8282}
8383template <>
84- TypeBuilderFunc getModel<Fortran::ISO::CFI_type_t>() {
84+ constexpr TypeBuilderFunc getModel<Fortran::ISO::CFI_type_t>() {
8585 return [](mlir::MLIRContext *context) -> mlir::Type {
8686 return mlir::IntegerType::get (context,
8787 sizeof (Fortran::ISO::CFI_type_t) * 8 );
8888 };
8989}
9090template <>
91- TypeBuilderFunc getModel<long >() {
91+ constexpr TypeBuilderFunc getModel<long >() {
9292 return [](mlir::MLIRContext *context) -> mlir::Type {
9393 return mlir::IntegerType::get (context, sizeof (long ) * 8 );
9494 };
9595}
9696template <>
97- TypeBuilderFunc getModel<Fortran::ISO::CFI_dim_t>() {
97+ constexpr TypeBuilderFunc getModel<Fortran::ISO::CFI_dim_t>() {
9898 return [](mlir::MLIRContext *context) -> mlir::Type {
9999 auto indexTy = getModel<Fortran::ISO::CFI_index_t>()(context);
100100 return mlir::LLVM::LLVMArrayType::get (indexTy, 3 );
101101 };
102102}
103103template <>
104- TypeBuilderFunc
104+ constexpr TypeBuilderFunc
105105getModel<Fortran::ISO::cfi_internal::FlexibleArray<Fortran::ISO::CFI_dim_t>>() {
106106 return getModel<Fortran::ISO::CFI_dim_t>();
107107}
0 commit comments