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

Last change on this file since 5350 was 5347, checked in by nmedfort, 3 years ago

Added enable asserts (-ea) command line flag + restructured BlockOrientedKernels? to allow for inlined code.

File size: 1.5 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 compile();
41
42private:
43
44    void examineBlock(const PabloBlock * const block);
45
46    void compileBlock(const PabloBlock * const block);
47
48    void compileStatement(const Statement * stmt);
49
50    void compileIf(const If * ifStmt);
51
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 * const    iBuilder;
59    PabloKernel * const             mKernel;
60    CarryManager * const            mCarryManager;
61    TranslationMap                  mMarker;
62    TranslationMap                  mAccumulator;
63
64};
65
66}
67
68#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.