1 //===-- mlir-c/StandardDialect.h - C API for Standard dialect -----*- C -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 4 // Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This header declares the C interface for registering and accessing the 11 // Standard dialect. A dialect should be registered with a context to make it 12 // available to users of the context. These users must load the dialect 13 // before using any of its attributes, operations or types. Parser and pass 14 // manager can load registered dialects automatically. 15 // 16 //===----------------------------------------------------------------------===// 17 18 #ifndef MLIR_C_STANDARDDIALECT_H 19 #define MLIR_C_STANDARDDIALECT_H 20 21 #include "mlir-c/IR.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** Registers the Standard dialect with the given context. This allows the 28 * dialect to be loaded dynamically if needed when parsing. */ 29 MLIR_CAPI_EXPORTED void mlirContextRegisterStandardDialect(MlirContext context); 30 31 /** Loads the Standard dialect into the given context. The dialect does _not_ 32 * have to be registered in advance. */ 33 MLIR_CAPI_EXPORTED MlirDialect 34 mlirContextLoadStandardDialect(MlirContext context); 35 36 /// Returns the namespace of the Standard dialect, suitable for loading it. 37 MLIR_CAPI_EXPORTED MlirStringRef mlirStandardDialectGetNamespace(); 38 39 #ifdef __cplusplus 40 } 41 #endif 42 43 #endif // MLIR_C_STANDARDDIALECT_H 44