picceler
A compiled DSL for image processing, built on MLIR
Loading...
Searching...
No Matches
compiler.h
Go to the documentation of this file.
1#pragma once
2
3#include "CLI/CLI.hpp"
4#include "mlir/Pass/PassManager.h"
5#include "llvm/IR/Module.h"
6
7#include "dialect.h"
8#include "mlir_gen.h"
9#include "parser.h"
10#include "pass_manager.h"
11
12namespace picceler {
13
18public:
19 std::string _inputFile;
20 std::string _outputFile;
21 bool _profile = false;
22 unsigned _optLevel = 2;
23 bool _nativeArch = false;
24};
25
29class Compiler {
30public:
31 Compiler();
32
36 bool run();
37
38 CLI::App &getCliApp() { return _cliApp; }
39 const CLIOptions &getCliOptions() const { return _cliOptions; }
40
41private:
42 mlir::MLIRContext &getContext() { return _context; }
43
47 static mlir::DialectRegistry initRegistry();
48
55 bool emitObjectFile(llvm::Module *llvmModule, const std::string &objFilename);
56
64 bool linkWithClang(const std::string &objFile, const std::string &runtimeLib, const std::string &outputExe);
65
66private:
67 CLI::App _cliApp;
68 CLIOptions _cliOptions;
69 Lexer _lexer;
70 Parser _parser;
71
72 mlir::MLIRContext _context;
73 MLIRGen _mlirGen;
74 IRPassManager _passManager;
75};
76
77} // namespace picceler
Struct to hold command-line options for the compiler.
Definition compiler.h:17
std::string _outputFile
Definition compiler.h:20
unsigned _optLevel
Definition compiler.h:22
bool _nativeArch
Definition compiler.h:23
std::string _inputFile
Definition compiler.h:19
bool _profile
Definition compiler.h:21
const CLIOptions & getCliOptions() const
Definition compiler.h:39
bool run()
Runs the compilation process.
Definition compiler.cpp:217
Compiler()
Definition compiler.cpp:172
CLI::App & getCliApp()
Definition compiler.h:38
Picceler MLIR dialect declarations.
Definition ast.h:11