LLZK
3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Toggle main menu visibility
Loading...
Searching...
No Matches
AttributeHelper.cpp
Go to the documentation of this file.
1
//===-- AttributeHelper.cpp -------------------------------------*- C++ -*-===//
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
#include "
llzk/Dialect/LLZK/IR/AttributeHelper.h
"
11
12
#include "
llzk/Util/TypeHelper.h
"
13
14
using namespace
mlir
;
15
16
namespace
llzk
{
17
18
// Adapted from AsmPrinter::printStrippedAttrOrType(), but without printing type.
19
void
printAttrs
(AsmPrinter &printer, ArrayRef<Attribute> attrs,
const
StringRef &separator) {
20
llvm::interleave(attrs, printer.getStream(), [&printer](Attribute a) {
21
if (auto intAttr = llvm::dyn_cast_if_present<IntegerAttr>(a)) {
22
if (isDynamic(intAttr)) {
23
printer.getStream() <<
"?"
;
24
return;
25
}
26
}
27
if (succeeded(printer.printAlias(a))) {
28
return;
29
}
30
raw_ostream &os = printer.getStream();
31
uint64_t posPrior = os.tell();
32
printer.printAttributeWithoutType(a);
33
// Fallback to printing with prefix if the above failed to write anything to the output stream.
34
if (posPrior == os.tell()) {
35
printer << a;
36
}
37
}, separator);
38
}
39
40
}
// namespace llzk
AttributeHelper.h
TypeHelper.h
llzk
Definition
AnalysisPassEnums.cpp:19
llzk::printAttrs
void printAttrs(AsmPrinter &printer, ArrayRef< Attribute > attrs, const StringRef &separator)
Definition
AttributeHelper.cpp:19
mlir
Definition
ValueModel.h:30
lib
Dialect
LLZK
IR
AttributeHelper.cpp
Generated by
1.17.0
Copyright 2025 Veridise Inc. under the Apache License v2.0. Copyright 2026 Project LLZK under the Apache License v2.0.