brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 03c84bd Raw
44 lines · cpp
1//===-- transform-opt.cpp - Transform dialect tutorial entry point --------===//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-exception6//7//===----------------------------------------------------------------------===//8//9// This is the top-level file for the Transform dialect tutorial chapter 4.10//11//===----------------------------------------------------------------------===//12 13#include "MyExtension.h"14 15#include "mlir/Dialect/Transform/Transforms/Passes.h"16#include "mlir/IR/DialectRegistry.h"17#include "mlir/IR/MLIRContext.h"18#include "mlir/InitAllDialects.h"19#include "mlir/InitAllExtensions.h"20#include "mlir/Tools/mlir-opt/MlirOptMain.h"21#include "mlir/Transforms/Passes.h"22#include <cstdlib>23 24int main(int argc, char **argv) {25  // Register all "core" dialects and our transform dialect extension.26  mlir::DialectRegistry registry;27  mlir::registerAllDialects(registry);28  mlir::registerAllExtensions(registry);29  registerMyExtension(registry);30 31  // Register a handful of cleanup passes that we can run to make the output IR32  // look nicer.33  mlir::registerCanonicalizerPass();34  mlir::registerCSEPass();35  mlir::registerSymbolDCEPass();36  mlir::transform::registerInterpreterPass();37 38  // Delegate to the MLIR utility for parsing and pass management.39  return mlir::MlirOptMain(argc, argv, "transform-opt-ch4", registry)40                 .succeeded()41             ? EXIT_SUCCESS42             : EXIT_FAILURE;43}44