MCPcopy Create free account
hub / github.com/MegEngine/MegCC / main

Function main

compiler/tools/dump-kernel/dump-kernel.cpp:46–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46int main(int argc, char** argv) {
47 cl::ParseCommandLineOptions(argc, argv);
48 llvm::InitializeNativeTarget();
49 llvm::InitializeNativeTargetAsmPrinter();
50 mlir::DialectRegistry registry;
51 registerLLVMDialectTranslation(registry);
52 MLIRContext context(registry);
53 auto module = parseMLIRInput(InputFile.getValue(), &context);
54
55 auto opt_pipeline = mlir::makeOptimizingTransformer(3, 3, 0);
56 std::vector<std::string> libs;
57 auto&& mb_engine = mlir::ExecutionEngine::create(
58 *module, nullptr, opt_pipeline, llvm::None,
59 std::vector<llvm::StringRef>(libs.begin(), libs.end()), true, false);
60
61 assert(mb_engine && "Error can't create engine\n");
62 std::unique_ptr<mlir::ExecutionEngine> my_engine = std::move(*mb_engine);
63
64 if (FindSym.getValue().size() > 0) {
65 auto lkup_rst = my_engine->lookup(FindSym.getValue());
66 assert(lkup_rst && "lkup_rst ");
67 }
68
69 std::string dump_obj_file =
70 OutputFile.getValue().size() > 0 ? OutputFile.getValue() : "./dump_mlir.o";
71 my_engine->dumpToObjectFile(dump_obj_file);
72 return 0;
73}

Callers

nothing calls this directly

Calls 1

parseMLIRInputFunction · 0.85

Tested by

no test coverage detected