| // Copyright 2021 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 iree-tflite-opt and derived binaries. | |
| // | |
| // This is a bare-bones, minimal *-opt just for testing the handful of local | |
| // passes here. If you need something, add it, but add only what you need as | |
| // each addition will likely end up on the build critical path. | |
| #include "iree_tf_compiler/TFL/Passes.h" | |
| #include "llvm/Support/InitLLVM.h" | |
| #include "mlir/Dialect/Func/IR/FuncOps.h" | |
| #include "mlir/Dialect/Quant/QuantOps.h" | |
| #include "mlir/Dialect/Tosa/IR/TosaOps.h" | |
| #include "mlir/IR/Dialect.h" | |
| #include "mlir/Tools/mlir-opt/MlirOptMain.h" | |
| #include "tensorflow/compiler/mlir/lite/ir/tfl_ops.h" | |
| #include "tensorflow/compiler/mlir/tensorflow/dialect_registration.h" | |
| #include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" | |
| #include "tensorflow/compiler/mlir/tosa/transforms/passes.h" | |
| int main(int argc, char **argv) { | |
| llvm::setBugReportMsg( | |
| "Please report issues to https://github.com/iree-org/iree/issues and " | |
| "include the crash backtrace.\n"); | |
| llvm::InitLLVM y(argc, argv); | |
| mlir::DialectRegistry registry; | |
| registry.insert<mlir::quant::QuantizationDialect>(); | |
| registry.insert<mlir::TF::TensorFlowDialect>(); | |
| registry.insert<mlir::TFL::TensorFlowLiteDialect>(); | |
| registry.insert<mlir::func::FuncDialect>(); | |
| registry.insert<mlir::tosa::TosaDialect>(); | |
| RegisterAllTensorFlowDialects(registry); | |
| mlir::iree_integrations::TFL::registerAllPasses(); | |
| mlir::tosa::registerLegalizeTosaPasses(); | |
| if (failed(MlirOptMain(argc, argv, "IREE-TFL modular optimizer driver\n", | |
| registry, | |
| /*preloadDialectsInContext=*/false))) { | |
| return 1; | |
| } | |
| return 0; | |
| } |