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

Last change on this file since 5238 was 5238, checked in by cameron, 2 years ago

IR_Gen subdirectory for all IR generation utility functions

File size: 1.9 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//Pablo Expressions
11#include <string>
12#include <vector>
13#include <unordered_map>
14#include <pablo/pablo_kernel.h>
15#include <llvm/ADT/Twine.h>
16#include <llvm/IR/IRBuilder.h>
17#include <IR_Gen/idisa_builder.h>
18#include <kernels/kernel.h>
19#include <boost/container/flat_set.hpp>
20
21namespace llvm {
22    class Value;
23    class Module;
24    class ExecutionEngine;
25    class VectorType;
26    class PointerType;
27    class Constant;
28    class FunctionType;
29    class Function;
30    class BasicBlock;
31}
32
33namespace pablo {
34
35class PabloAST;
36class PabloBlock;
37class String;
38class Var;
39class Statement;
40class StatementList;
41class If;
42class While;
43class CarryManager;
44class Extract;
45
46class PabloCompiler {
47    friend class CarryManager;
48
49    using IntSet = boost::container::flat_set<unsigned>;
50    using MarkerMap = std::unordered_map<const PabloAST *, Value *>;
51
52public:
53    PabloCompiler(PabloKernel * kernel);
54    ~PabloCompiler();
55    void initializeKernelData();
56    void compile(Value * const self, Function * doBlockFunction);
57
58private:
59
60    void Examine();
61    void Examine(const PabloBlock * const block);
62
63    void compileBlock(const PabloBlock * const block);
64    void compileStatement(const Statement * stmt);
65    void compileIf(const If * ifStmt);
66    void compileWhile(const While * whileStmt);
67
68    Value * compileExpression(const PabloAST * expr, const bool ensureLoaded = true) const;
69
70private:
71
72    IDISA::IDISA_Builder *  iBuilder;
73    CarryManager *          mCarryManager;
74    PabloKernel *           mKernel;
75    Value *                 mSelf;
76    Function *              mFunction;
77    MarkerMap               mMarkerMap;
78    IntSet                  mInputStreamOffset;
79
80};
81
82}
83
84#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.