Loading [MathJax]/extensions/tex2jax.js
CIRCT 22.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ApplyLoweringOptions.cpp
Go to the documentation of this file.
1//===- ApplyLoweringOptions.cpp - Test pass for adding lowering options ---===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Pass for testing purposes to apply lowering options ot a module.
10//
11//===----------------------------------------------------------------------===//
12
18#include "mlir/Pass/Pass.h"
19
20namespace circt {
21#define GEN_PASS_DEF_TESTAPPLYLOWERINGOPTION
22#include "circt/Conversion/Passes.h.inc"
23} // namespace circt
24
25using namespace circt;
26namespace {
27
28struct TestApplyLoweringOptionPass
29 : public circt::impl::TestApplyLoweringOptionBase<
30 TestApplyLoweringOptionPass> {
31 using Base::Base;
32
33 void runOnOperation() override {
34 if (!optionsString.hasValue()) {
35 markAllAnalysesPreserved();
36 return;
37 }
38 LoweringOptions opts(optionsString, [this](llvm::Twine tw) {
39 getOperation().emitError(tw);
40 signalPassFailure();
41 });
42 opts.setAsAttribute(getOperation());
43 }
44};
45} // namespace
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Options which control the emission from CIRCT to Verilog.
void setAsAttribute(mlir::ModuleOp module)
Write the verilog emitter options to a module's attributes.