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

Last change on this file since 5299 was 5297, checked in by nmedfort, 3 years ago

Partial removal of BlockNo?

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
30    using TranslationMap = std::unordered_map<const PabloAST *, llvm::Value *>;
31
32public:
33    PabloCompiler(PabloKernel * kernel);
34    ~PabloCompiler();
35    void initializeKernelData();
36    void compile();
37
38private:
39
40    void Examine();
41
42    void Examine(const PabloBlock * const block);
43
44    void compileBlock(const PabloBlock * const block);
45
46    void compileStatement(const Statement * stmt);
47
48    void compileIf(const If * ifStmt);
49
50    void compileWhile(const While * whileStmt);
51
52    llvm::Value * compileExpression(const PabloAST * expr, const bool ensureLoaded = true) const;
53
54private:
55
56    IDISA::IDISA_Builder * const    iBuilder;
57    PabloKernel * const             mKernel;
58    CarryManager * const            mCarryManager;
59    TranslationMap                  mMarker;
60    TranslationMap                  mAccumulator;
61    IntSet                          mInputStreamOffset;
62
63};
64
65}
66
67#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.