| // 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/Quant/QuantOps.h" |
| #include "mlir/Dialect/StandardOps/IR/Ops.h" |
| #include "mlir/Dialect/Tosa/IR/TosaOps.h" |
| #include "mlir/IR/Dialect.h" |
| #include "mlir/Support/MlirOptMain.h" |
| #include "tensorflow/compiler/mlir/lite/ir/tfl_ops.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::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::StandardOpsDialect>(); |
| registry.insert<mlir::tosa::TosaDialect>(); |
| |
| 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; |
| } |