CIRCT
22.0.0git
Loading...
Searching...
No Matches
lib
Dialect
FIRRTL
Transforms
LowerIntrinsics.cpp
Go to the documentation of this file.
1
//===- LowerIntrinsics.cpp - Lower Intrinsics -------------------*- C++ -*-===//
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
// This file defines the LowerIntrinsics pass. This pass processes FIRRTL
10
// generic intrinsic operations and rewrites to their implementation.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "
circt/Dialect/FIRRTL/FIRRTLIntrinsics.h
"
15
#include "
circt/Dialect/FIRRTL/Passes.h
"
16
#include "mlir/Pass/Pass.h"
17
18
namespace
circt
{
19
namespace
firrtl {
20
#define GEN_PASS_DEF_LOWERINTRINSICS
21
#include "circt/Dialect/FIRRTL/Passes.h.inc"
22
}
// namespace firrtl
23
}
// namespace circt
24
25
using namespace
circt
;
26
using namespace
firrtl;
27
28
//===----------------------------------------------------------------------===//
29
// Pass Infrastructure
30
//===----------------------------------------------------------------------===//
31
32
namespace
{
33
struct
LowerIntrinsicsPass
34
:
public
circt::firrtl::impl::LowerIntrinsicsBase<LowerIntrinsicsPass> {
35
LogicalResult initialize(MLIRContext *
context
)
override
;
36
void
runOnOperation()
override
;
37
38
std::shared_ptr<IntrinsicLowerings> lowering;
39
};
40
}
// namespace
41
42
/// Initialize the conversions for use during execution.
43
LogicalResult LowerIntrinsicsPass::initialize(MLIRContext *
context
) {
44
IntrinsicLowerings
lowering(
context
);
45
46
IntrinsicLoweringInterfaceCollection
loweringCollection(
context
);
47
loweringCollection.populateIntrinsicLowerings(lowering);
48
49
this->lowering = std::make_shared<IntrinsicLowerings>(std::move(lowering));
50
return
success();
51
}
52
53
// This is the main entrypoint for the lowering pass.
54
void
LowerIntrinsicsPass::runOnOperation() {
55
auto
result = lowering->lower(getOperation());
56
if
(failed(result))
57
return
signalPassFailure();
58
59
numConverted += *result;
60
61
if
(*result == 0)
62
markAllAnalysesPreserved();
63
}
Passes.h
context
static std::unique_ptr< Context > context
Definition
DpiEntryPoints.cpp:37
FIRRTLIntrinsics.h
circt::firrtl::IntrinsicLowerings
Lowering helper which collects all intrinsic converters.
Definition
FIRRTLIntrinsics.h:245
circt
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition
DebugAnalysis.h:21
circt::firrtl::IntrinsicLoweringInterfaceCollection
Definition
FIRRTLIntrinsics.h:291
Generated on Wed Dec 17 2025 00:08:55 for CIRCT by
1.9.8