CIRCT  19.0.0git
ModuleImplementation.h
Go to the documentation of this file.
1 //===- ModuleImplementation.h - Module-like Op utilities --------*- 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 provides utility functions for implementing module-like
10 // operations, in particular, parsing, and printing common to module-like
11 // operations.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef CIRCT_DIALECT_HW_MODULEIMPLEMENTATION_H
16 #define CIRCT_DIALECT_HW_MODULEIMPLEMENTATION_H
17 
19 #include "circt/Support/LLVM.h"
20 #include "mlir/IR/DialectImplementation.h"
21 
22 namespace circt {
23 namespace hw {
24 
25 class HWModuleLike;
26 
27 namespace module_like_impl {
28 
29 struct PortParse : OpAsmParser::Argument {
31  std::string rawName;
32 };
33 
34 /// This is a variant of mlir::parseFunctionSignature that allows names on
35 /// result arguments.
37  OpAsmParser &parser, bool &isVariadic,
38  SmallVectorImpl<OpAsmParser::Argument> &args,
39  SmallVectorImpl<Attribute> &argNames, SmallVectorImpl<Attribute> &argLocs,
40  SmallVectorImpl<Attribute> &resultNames,
41  SmallVectorImpl<DictionaryAttr> &resultAttrs,
42  SmallVectorImpl<Attribute> &resultLocs, TypeAttr &type);
43 
44 /// Print a module signature with named results.
45 void printModuleSignature(OpAsmPrinter &p, Operation *op,
46  ArrayRef<Type> argTypes, bool isVariadic,
47  ArrayRef<Type> resultTypes, bool &needArgNamesAttr);
48 
49 /// New Style parsing
50 ParseResult parseModuleSignature(OpAsmParser &parser,
51  SmallVectorImpl<PortParse> &args,
52  TypeAttr &modType);
53 void printModuleSignatureNew(OpAsmPrinter &p, HWModuleLike op);
54 
55 } // namespace module_like_impl
56 } // namespace hw
57 } // namespace circt
58 
59 #endif // CIRCT_DIALECT_HW_MODULEIMPLEMENTATION_H
void printModuleSignature(OpAsmPrinter &p, Operation *op, ArrayRef< Type > argTypes, bool isVariadic, ArrayRef< Type > resultTypes, bool &needArgNamesAttr)
Print a module signature with named results.
ParseResult parseModuleSignature(OpAsmParser &parser, SmallVectorImpl< PortParse > &args, TypeAttr &modType)
New Style parsing.
ParseResult parseModuleFunctionSignature(OpAsmParser &parser, bool &isVariadic, SmallVectorImpl< OpAsmParser::Argument > &args, SmallVectorImpl< Attribute > &argNames, SmallVectorImpl< Attribute > &argLocs, SmallVectorImpl< Attribute > &resultNames, SmallVectorImpl< DictionaryAttr > &resultAttrs, SmallVectorImpl< Attribute > &resultLocs, TypeAttr &type)
This is a variant of mlir::parseFunctionSignature that allows names on result arguments.
void printModuleSignatureNew(OpAsmPrinter &p, HWModuleLike op)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: hw.py:1