
This has previously been done for `mlir-opt` and `mlir-reduce` and roughly the same approach has been done here. The use case for having a separate library is that it is easier for downstream to make custom TableGen backends/executable that work on top of the utilities that are defined in `mlir/TableGen`. The customization point here is the same one as for any upstream TableGen backends: One can add a new generator by simply creating a global instance of `mlir::GenRegistration`. Differential Revision: https://reviews.llvm.org/D131112
28 lines
1.0 KiB
C++
28 lines
1.0 KiB
C++
//===- mlir-tblgen.cpp - Top-Level TableGen implementation for MLIR -------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains the main function for MLIR's TableGen.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/TableGen/GenInfo.h"
|
|
#include "mlir/Tools/mlir-tblgen/MlirTblgenMain.h"
|
|
#include "llvm/TableGen/Record.h"
|
|
|
|
using namespace llvm;
|
|
using namespace mlir;
|
|
|
|
// Generator that prints records.
|
|
GenRegistration printRecords("print-records", "Print all records to stdout",
|
|
[](const RecordKeeper &records, raw_ostream &os) {
|
|
os << records;
|
|
return false;
|
|
});
|
|
|
|
int main(int argc, char **argv) { return MlirTblgenMain(argc, argv); }
|