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

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

Added a simple CreateAssert? function in CBuilder and ReadOnly? flag for getStreamSetBufferPtr method to prevent expanding input stream sets. Begun work on CarryManager? to preallocate variable-length carry data slots.

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