llvm-project/mlir/examples/minimal-opt/mlir-minimal-opt.cpp
Mehdi Amini e7f8b45953 Add an MLIR example of some mimimal example of MLIR setup
These may serve as example and showcase of the MLIR binary footprint.

Right now a release build of these tools on a linux machine shows:

- mlir-cat: 2MB
  This includes the Core IR, the textual parser/printer, the support for
  bytecode.
- mlir-minimal-opt: 3MB
  This adds all the tooling for an mlir-opt tool: the pass infrastructure
  and all the instrumentation associated with it.
- mlir-miminal-opt-canonicalize: 4.8MB
  This add the canonicalizer pass, which pulls in all the pattern/rewrite
  machinery, including the PDL compiler and intepreter.

Differential Revision: https://reviews.llvm.org/D156218
2023-07-25 11:38:19 -07:00

19 lines
813 B
C++

//===- mlir-minimal-opt.cpp -------------------------------------*- C++ -*-===//
//
// This file is licensed 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
//
//===----------------------------------------------------------------------===//
#include "mlir/Tools/mlir-opt/MlirOptMain.h"
/// This test includes the minimal amount of components for mlir-opt, that is
/// the CoreIR, the printer/parser, the bytecode reader/writer, the
/// passmanagement infrastructure and all the instrumentation.
int main(int argc, char **argv) {
mlir::DialectRegistry registry;
return mlir::asMainReturnCode(mlir::MlirOptMain(
argc, argv, "Minimal Standalone optimizer driver\n", registry));
}