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

Last change on this file since 5141 was 5141, checked in by cameron, 3 years ago

pablo.Lookahead support updated for stream set access/kernel system

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