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

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

Added the kernel instance class; removed original mmap file access in favour of the boost mmap system. corrected PrintRegister? routine.

File size: 2.2 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 <llvm/ADT/Twine.h>
16#include <llvm/IR/IRBuilder.h>
17#include <IDISA/idisa_builder.h>
18#include <kernels/kernel.h>
19
20namespace llvm {
21    class Value;
22    class Module;
23    class ExecutionEngine;
24    class VectorType;
25    class PointerType;
26    class ConstantAggregateZero;
27    class Constant;
28    class FunctionType;
29    class Function;
30    class BasicBlock;
31}
32
33namespace pablo {
34
35class PabloAST;
36class PabloBlock;
37class PabloFunction;
38class String;
39class Var;
40class Statement;
41class StatementList;
42class If;
43class While;
44
45class PabloCompiler {
46
47    using MarkerMap = std::unordered_map<const PabloAST *, Value *>;
48
49public:
50    PabloCompiler(Module * m, IDISA::IDISA_Builder * b);
51
52    llvm::Function * compile(PabloFunction * function);
53    void setKernel(kernel::KernelBuilder * kBuilder);
54
55private:
56
57    void Examine(PabloFunction & function);
58    void Examine(PabloBlock * block);
59
60    void compileBlock(const PabloBlock * const block);
61    void compileStatement(const Statement * stmt);
62    void compileIf(const If * ifStmt);
63    void compileWhile(const While * whileStmt);
64    Value * compileExpression(const PabloAST * expr);
65    void GenerateKernel(PabloFunction * const function);
66
67    MarkerMap                           mMarkerMap;
68
69    Module *                            mMod;
70    IDISA::IDISA_Builder *              iBuilder;
71    Type* const                         mBitBlockType;
72
73    CarryManager *                      mCarryManager;
74
75    const PabloFunction *               mPabloFunction;
76    const PabloBlock *                  mPabloBlock;
77
78    kernel::KernelBuilder *             mKernelBuilder;
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.