[FIRRTL] Generate docs for each ODS file

Change the way FIRRTL ODS documentation is generated to manually run
each file through mlir-tblgen.  This is primarily done to enable more
cleanly adding documentation about OpInterfaces and to remove
information about type constraints (which are ephemeral and do not
appear in the generated C++).

Note that this currently produces buggy Markdown for OpInterfaces with a
defined function body.  This will be fixed by:

  - https://reviews.llvm.org/D140590

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
This commit is contained in:
Schuyler Eldridge 2022-12-22 15:07:56 -05:00
parent 3d83279c81
commit 44b3e4b1bb
No known key found for this signature in database
GPG Key ID: 50C5E9936AAD536D
3 changed files with 48 additions and 6 deletions

View File

@ -1,3 +1,34 @@
# 'firrtl' Dialect
[include "Dialects/FIRRTL.md"]
This dialect defines the `firrtl` dialect, which is used to lower from Chisel
code to Verilog. For more information, see the [FIRRTL GitHub
page](https://github.com/freechipsproject/firrtl).
[TOC]
## Operation Definitions -- Structure
[include "Dialects/FIRRTLStructureOps.md"]
## Operation Definitions -- Declarations
[include "Dialects/FIRRTLDeclarationOps.md"]
## Statement Operation -- Statements
[include "Dialects/FIRRTLStatementOps.md"]
## Operation Definitions -- Expressions
[include "Dialects/FIRRTLExpressionOps.md"]
## Type Definitions
[include "Dialects/FIRRTLTypes.md"]
[include "Dialects/FIRRTLTypesImpl.md"]
## Attribute Definitions
[include "Dialects/FIRRTLAttributes.md"]
[include "Dialects/FIRRTLOpInterfaces.md"]

View File

@ -1,6 +1,5 @@
# FIRRTL
add_circt_dialect(FIRRTL firrtl FIRRTL)
add_circt_dialect_doc(FIRRTL firrtl)
set(LLVM_TARGET_DEFINITIONS FIRRTL.td)
mlir_tablegen(FIRRTLEnums.h.inc -gen-enum-decls)
@ -12,7 +11,6 @@ add_public_tablegen_target(CIRCTFIRRTLEnumsIncGen)
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls)
add_public_tablegen_target(CIRCTFIRRTLTransformsIncGen)
add_circt_doc(Passes FIRRTLPasses -gen-pass-doc)
set(LLVM_TARGET_DEFINITIONS FIRRTLCanonicalization.td)
mlir_tablegen(FIRRTLCanonicalization.h.inc -gen-rewriters)
@ -24,6 +22,19 @@ mlir_tablegen(FIRRTLOpInterfaces.cpp.inc -gen-op-interface-defs)
add_public_tablegen_target(CIRCTFIRRTLOpInterfacesIncGen)
add_dependencies(circt-headers CIRCTFIRRTLOpInterfacesIncGen)
# Generate Dialect documentation.
add_circt_doc(FIRRTLAttributes Dialects/FIRRTLAttributes -gen-attrdef-doc)
add_circt_doc(FIRRTLStructure Dialects/FIRRTLStructureOps -gen-op-doc)
add_circt_doc(FIRRTLDeclarations Dialects/FIRRTLDeclarationOps -gen-op-doc)
add_circt_doc(FIRRTLStatements Dialects/FIRRTLStatementOps -gen-op-doc)
add_circt_doc(FIRRTLExpressions Dialects/FIRRTLExpressionOps -gen-op-doc)
add_circt_doc(FIRRTLTypes Dialects/FIRRTLTypes -gen-typedef-doc)
add_circt_doc(FIRRTLTypesImpl Dialects/FIRRTLTypesImpl -gen-typedef-doc)
add_circt_doc(FIRRTLOpInterfaces Dialects/FIRRTLOpInterfaces -gen-op-interface-docs)
# Generate Pass documentation.
add_circt_doc(Passes FIRRTLPasses -gen-pass-doc)
# CHIRRTL
add_circt_dialect(CHIRRTL chirrtl CHIRRTL)
add_circt_dialect_doc(CHIRRTL chirrtl)

View File

@ -25,9 +25,9 @@ def FIRRTLDialect : Dialect {
let summary = "Types and operations for firrtl dialect";
let description = [{
This dialect defines the `firrtl` dialect, which is used to lower from
Chisel code to Verilog. For more information, see the
[FIRRTL GitHub page](https://github.com/freechipsproject/firrtl).
This dialect defines the `firrtl` dialect, which is used to lower from Chisel
code to Verilog. For more information, see the [FIRRTL GitHub
page](https://github.com/freechipsproject/firrtl).
}];
let hasConstantMaterializer = 1;