source: icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h @ 5260

Last change on this file since 5260 was 5260, checked in by nmedfort, 2 years ago

Changes working towards simplifying accessing stream elements + some modifications to simplify include / forward declarations within the CodeGen? library.

File size: 1.6 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef PABLO_COMPILER_H
8#define PABLO_COMPILER_H
9
10#include <unordered_map>
11#include <llvm/IR/IRBuilder.h>
12#include <IR_Gen/idisa_builder.h>
13#include <kernels/kernel.h>
14#include <boost/container/flat_set.hpp>
15
16namespace llvm {
17class Value;
18class Function;
19}
20
21namespace pablo {
22
23class PabloAST;
24class PabloBlock;
25class PabloKernel;
26class String;
27class Statement;
28class If;
29class While;
30class CarryManager;
31
32class PabloCompiler {
33    friend class CarryManager;
34
35    using IntSet = boost::container::flat_set<unsigned>;
36    using MarkerMap = std::unordered_map<const PabloAST *, llvm::Value *>;
37
38public:
39    PabloCompiler(PabloKernel * kernel);
40    ~PabloCompiler();
41    void initializeKernelData();
42    void compile(llvm::Value * const self, llvm::Function * doBlockFunction);
43
44private:
45
46    void Examine();
47    void Examine(const PabloBlock * const block);
48
49    void compileBlock(const PabloBlock * const block);
50    void compileStatement(const Statement * stmt);
51    void compileIf(const If * ifStmt);
52    void compileWhile(const While * whileStmt);
53
54    llvm::Value * compileExpression(const PabloAST * expr, const bool ensureLoaded = true) const;
55
56private:
57
58    IDISA::IDISA_Builder *  iBuilder;
59    CarryManager *          mCarryManager;
60    PabloKernel *           mKernel;
61    llvm::Value *           mSelf;
62    llvm::Function *        mFunction;
63    MarkerMap               mMarkerMap;
64    IntSet                  mInputStreamOffset;
65
66};
67
68}
69
70#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.