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

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

Code clean-up. Removed Pablo Call, SetIthBit? and Prototype.

File size: 1.7 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 <boost/container/flat_set.hpp>
12namespace IDISA { class IDISA_Builder; }
13namespace llvm { class Function; }
14namespace llvm { class Value; }
15namespace pablo { class CarryManager; }
16namespace pablo { class If; }
17namespace pablo { class PabloAST; }
18namespace pablo { class PabloBlock; }
19namespace pablo { class PabloKernel; }
20namespace pablo { class Statement; }
21namespace pablo { class While; }
22
23namespace pablo {
24
25class PabloCompiler {
26    friend class CarryManager;
27
28    using IntSet = boost::container::flat_set<unsigned>;
29    using MarkerMap = std::unordered_map<const PabloAST *, llvm::Value *>;
30
31public:
32    PabloCompiler(PabloKernel * kernel);
33    ~PabloCompiler();
34    void initializeKernelData();
35    void compile(llvm::Value * const self, llvm::Function * doBlockFunction);
36
37private:
38
39    void Examine();
40
41    void Examine(const PabloBlock * const block);
42
43    void compileBlock(const PabloBlock * const block);
44
45    void compileStatement(const Statement * stmt);
46
47    void compileIf(const If * ifStmt);
48
49    void compileWhile(const While * whileStmt);
50
51    llvm::Value * compileExpression(const PabloAST * expr, const bool ensureLoaded = true) const;
52
53private:
54
55    IDISA::IDISA_Builder *  iBuilder;
56    CarryManager *          mCarryManager;
57    PabloKernel *           mKernel;
58    llvm::Value *           mSelf;
59    llvm::Function *        mFunction;
60    MarkerMap               mMarkerMap;
61    IntSet                  mInputStreamOffset;
62
63};
64
65}
66
67#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.