#include #include #include #include #include "zamalang/Dialect/HLFHE/IR/HLFHEDialect.h" #include "zamalang/Dialect/HLFHE/IR/HLFHETypes.h" struct CommandLineArgs { std::vector inputs; std::string output; }; void parseCommandLine(int argc, char** argv, CommandLineArgs* args) { try { TCLAP::CmdLine cmd("zamacompiler", ' ', "0.0.1"); // Input file names TCLAP::UnlabeledMultiArg fileNames("file", "The input files", false, "file"); cmd.add(fileNames); // Output TCLAP::ValueArg output("o","out","Place the output into the ",false, "","string"); cmd.add(output); cmd.parse( argc, argv ); args->output = output.getValue(); args->inputs = fileNames.getValue(); } catch (TCLAP::ArgException &e) // catch exceptions { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; std::exit(1); } } int main(int argc, char **argv) { // Parse command line arguments CommandLineArgs cmdLineArgs; parseCommandLine(argc, argv, &cmdLineArgs); // Initialize the MLIR context mlir::MLIRContext context; // Load our Dialect in this MLIR Context. context.getOrLoadDialect(); context.getOrLoadDialect(); // For all input file, parse and dump for (const auto& fileName: cmdLineArgs.inputs) { auto module = mlir::parseSourceFile(fileName, &context); module->dump(); } return 0; }