A Protobuf-based implementation for the CIR (Clang IR) dialect of MLIR (Multi-Level IR).
cir-tac provides a Protocol Buffers model for working with CIR dialect code. The project enables efficient representation and manipulation of MLIR modules, including functions, blocks, operations, and type systems.
- CMake 3.x or higher
- Protocol Buffers compiler (protoc)
- LLVM/Clang build with CIR support
- Ninja build system
First, build clangir by following these steps:
git clone [email protected]:llvm/clangir.git
cd clangir/llvm
mkdir build && cd build
cmake -GNinja \
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DCLANG_ENABLE_CIR=ON ..
ninja
After building clangir, build this project:
mkdir build && cd build
cmake -DCLANGIR_BUILD_DIR=${PATH_TO_CLANGIR_BUILD} .. && make
Where PATH_TO_CLANGIR_BUILD
is the path to your clangir build directory (e.g., .../clangir/llvm/build
).
proto/model.proto
- Core module and function definitionsproto/type.proto
- Type system definitionsproto/op.proto
- Operation definitionsproto/attr.proto
- Attribute system definitionsproto/enum.proto
- Enumeration definitionsproto/setup.proto
- Setup definitions
tools/cir-ser-proto/
- Serialization tool for CIR Protocol Buffers- Provides functionality for serializing CIR modules to Protocol Buffer format
The build process generates Protocol Buffers files for each .proto
definition:
build/proto/*.pb.cc
- Generated C++ source filesbuild/proto/*.pb.h
- Generated C++ headers
- C++ code follows LLVM coding standards
- Protocol Buffers definitions use
snake_case
for field names
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the terms included in the LICENSE file.