|
| 1 | +//===- MlirLinkMain.cpp - MLIR Link main ----------------------------------===// |
| 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-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +#include "mlir/Tools/mlir-link/MlirLinkMain.h" |
| 10 | +#include "mlir/IR/Dialect.h" |
| 11 | +#include "llvm/Support/CommandLine.h" |
| 12 | +#include "llvm/Support/Error.h" |
| 13 | +#include "llvm/Support/InitLLVM.h" |
| 14 | +#include "llvm/Support/WithColor.h" |
| 15 | + |
| 16 | +using namespace mlir; |
| 17 | +using namespace llvm; |
| 18 | + |
| 19 | +LogicalResult mlir::MlirLinkMain(int argc, char **argv, |
| 20 | + DialectRegistry ®istry) { |
| 21 | + static cl::OptionCategory linkCategory("Link options"); |
| 22 | + |
| 23 | + static cl::list<std::string> inputFilenames(cl::Positional, cl::OneOrMore, |
| 24 | + cl::desc("<input mlir files>"), |
| 25 | + cl::cat(linkCategory)); |
| 26 | + |
| 27 | + static cl::opt<std::string> outputFilename( |
| 28 | + "o", cl::desc("Override output filename"), cl::init("-"), |
| 29 | + cl::value_desc("filename"), cl::cat(linkCategory)); |
| 30 | + |
| 31 | + static ExitOnError ExitOnErr; |
| 32 | + |
| 33 | + InitLLVM y(argc, argv); |
| 34 | + ExitOnErr.setBanner(std::string(argv[0]) + ": "); |
| 35 | + |
| 36 | + cl::HideUnrelatedOptions({&linkCategory, &getColorCategory()}); |
| 37 | + cl::ParseCommandLineOptions(argc, argv, "mlir linker\n"); |
| 38 | + |
| 39 | + return success(); |
| 40 | +} |
0 commit comments