llvm-project/mlir/examples/minimal-opt/mlir-minimal-opt-canonicalize.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

22 lines
816 B
C++

//===- mlir-minimal-opt-canonicalize.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"
#include "mlir/Transforms/Passes.h"
int main(int argc, char **argv) {
// Register only the canonicalize pass
// This pulls in the pattern rewrite engine as well as the whole PDL
// compiler/intepreter.
mlir::registerCanonicalizerPass();
mlir::DialectRegistry registry;
return mlir::asMainReturnCode(mlir::MlirOptMain(
argc, argv, "Minimal Standalone optimizer driver\n", registry));
}