CIRCT  20.0.0git
SimOps.h
Go to the documentation of this file.
1 //===- SimOps.h - Declare Sim dialect operations ----------------*- 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 declares the operation classes for the Sim dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_DIALECT_SIM_SIMOPS_H
14 #define CIRCT_DIALECT_SIM_SIMOPS_H
15 
22 #include "mlir/Bytecode/BytecodeOpInterface.h"
23 #include "mlir/IR/OpImplementation.h"
24 #include "mlir/IR/SymbolTable.h"
25 #include "mlir/Interfaces/CallInterfaces.h"
26 #include "mlir/Interfaces/FunctionInterfaces.h"
27 #include "mlir/Interfaces/InferTypeOpInterface.h"
28 
29 #define GET_OP_CLASSES
30 #include "circt/Dialect/Sim/Sim.h.inc"
31 
32 namespace circt {
33 namespace sim {
34 
35 /// Returns the value operand of a value formatting operation.
36 /// Returns a null value for all other operations.
37 static inline mlir::Value getFormattedValue(mlir::Operation *fmtOp) {
38  if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatBinOp>(fmtOp))
39  return fmt.getValue();
40  if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatDecOp>(fmtOp))
41  return fmt.getValue();
42  if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatHexOp>(fmtOp))
43  return fmt.getValue();
44  if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatCharOp>(fmtOp))
45  return fmt.getValue();
46  return {};
47 }
48 
49 } // namespace sim
50 } // namespace circt
51 
52 #endif // CIRCT_DIALECT_SIM_SIMOPS_H
static mlir::Value getFormattedValue(mlir::Operation *fmtOp)
Returns the value operand of a value formatting operation.
Definition: SimOps.h:37
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21