LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
Ops.td
Go to the documentation of this file.
1//===-- Ops.td ---------------------------------------------*- tablegen -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLZK_INCLUDE_OPS
11#define LLZK_INCLUDE_OPS
12
13include "llzk/Dialect/Include/IR/Dialect.td"
14
15include "mlir/IR/OpBase.td"
16include "mlir/IR/SymbolInterfaces.td"
17
18def LLZK_IncludeOp
19 : Op<IncludeDialect, "from", [HasParent<"::mlir::ModuleOp">, Symbol]> {
20 let summary = "include operation";
21 let description = [{
22 This operation imports the contents of another source file in place of itself.
23
24 Example:
25
26 ```llzk
27 include.from "lib.llzk" as @aliasName
28 ```
29 }];
30
31 let arguments = (ins SymbolNameAttr:$sym_name,
32 Arg<StrAttr, "source file to include">:$path);
33
34 let assemblyFormat = [{ $path `as` $sym_name attr-dict }];
35
36 let extraClassDeclaration = [{
37 static IncludeOp create(::mlir::Location, ::llvm::StringRef name, ::llvm::StringRef path);
38 static IncludeOp create(::mlir::Location, ::mlir::StringAttr name, ::mlir::StringAttr path);
39 /// Opens the module this include references but doesn't insert it into the parent module.
40 ::mlir::FailureOr<mlir::OwningOpRef<mlir::ModuleOp>> openModule();
41 /// Opens the module this include references and replace this include with that module.
42 ::mlir::FailureOr<mlir::ModuleOp> inlineAndErase();
43 }];
44}
45
46#endif // LLZK_INCLUDE_OPS