picceler
Loading...
Searching...
No Matches
compiler.h
Go to the documentation of this file.
1#pragma once
2
3#include <format>
4#include <iostream>
5
6#include "CLI/CLI.hpp"
7#include "spdlog/spdlog.h"
8#include "mlir/Dialect/Arith/IR/Arith.h"
9#include "mlir/Dialect/Func/IR/FuncOps.h"
10#include "mlir/IR/Builders.h"
11#include "mlir/IR/BuiltinOps.h"
12#include "mlir/IR/Dialect.h"
13#include "mlir/Pass/PassManager.h"
14#include "mlir/Pass/Pass.h"
15#include "llvm/IR/Module.h"
16
17#include "dialect.h"
18#include "mlir_gen.h"
19#include "parser.h"
20#include "pass_manager.h"
21
22namespace picceler {
23
25public:
26 std::string inputFile;
27 std::string outputFile;
28};
29
33class Compiler {
34public:
35 Compiler();
36
40 bool run();
41
42 CLI::App &getCliApp() { return _cliApp; }
43 const CLIOptions &getCliOptions() const { return _cliOptions; }
44
45private:
46 mlir::MLIRContext &getContext() { return _context; }
47 static mlir::DialectRegistry initRegistry();
48
49 bool emitObjectFile(llvm::Module *llvmModule, const std::string &objFilename);
50 bool linkWithLLD(const std::string &objFile, const std::string &runtimeLib, const std::string &outputExe);
51
52private:
53 CLI::App _cliApp;
54 CLIOptions _cliOptions;
55 Parser _parser;
56
57 mlir::MLIRContext _context;
58 MLIRGen _mlirGen;
59 IRPassManager _passManager;
60};
61
62} // namespace picceler
Definition compiler.h:24
std::string outputFile
Definition compiler.h:27
std::string inputFile
Definition compiler.h:26
const CLIOptions & getCliOptions() const
Definition compiler.h:43
bool run()
Runs the compilation process.
Definition compiler.cpp:57
Compiler()
Definition compiler.cpp:29
CLI::App & getCliApp()
Definition compiler.h:42
Definition ast.h:11