blob: b66e12ef3cf0cdcb72bb4a15d546fca0957b5e07 [file] [log] [blame]
// Copyright 2020 The IREE Authors
//
// 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
// Main entry function for custom-opt.
// Based on the iree-opt main entry function (iree-opt-main.cc).
//
// We need this entry function because we want to register the custom
// dialect, which is missing in IREE's opt main entry function.
#include "iree/compiler/Tools/init_dialects.h"
#include "iree/compiler/Tools/init_passes.h"
#include "iree/compiler/Tools/init_targets.h"
#include "iree_custom_modules/dialect/init_dialect.h"
#include "llvm/Support/InitLLVM.h"
#include "mlir/IR/Dialect.h"
#include "mlir/Tools/mlir-opt/MlirOptMain.h"
int main(int argc, char **argv) {
llvm::InitLLVM y(argc, argv);
mlir::DialectRegistry registry;
mlir::iree_compiler::registerAllDialects(registry);
mlir::iree_compiler::registerCustomDialect(registry);
mlir::iree_compiler::registerAllPasses();
mlir::iree_compiler::registerHALTargetBackends();
if (failed(MlirOptMain(argc, argv, "IREE-TF modular optimizer driver\n",
registry,
/*preloadDialectsInContext=*/false))) {
return 1;
}
return 0;
}