brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · eebfcb7 Raw
36 lines · cpp
1//===- standalone-opt.cpp ---------------------------------------*- C++ -*-===//2//3// This file is licensed 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#include "mlir/Dialect/Arith/IR/Arith.h"10#include "mlir/Dialect/Func/IR/FuncOps.h"11#include "mlir/IR/MLIRContext.h"12#include "mlir/InitAllDialects.h"13#include "mlir/InitAllPasses.h"14#include "mlir/Support/FileUtilities.h"15#include "mlir/Tools/mlir-opt/MlirOptMain.h"16 17#include "Standalone/StandaloneDialect.h"18#include "Standalone/StandalonePasses.h"19 20int main(int argc, char **argv) {21  mlir::registerAllPasses();22  mlir::standalone::registerPasses();23  // TODO: Register standalone passes here.24 25  mlir::DialectRegistry registry;26  registry.insert<mlir::standalone::StandaloneDialect,27                  mlir::arith::ArithDialect, mlir::func::FuncDialect>();28  // Add the following to include *all* MLIR Core dialects, or selectively29  // include what you need like above. You only need to register dialects that30  // will be *parsed* by the tool, not the one generated31  // registerAllDialects(registry);32 33  return mlir::asMainReturnCode(34      mlir::MlirOptMain(argc, argv, "Standalone optimizer driver\n", registry));35}36