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

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

Rewrite of the CarryManager? to support non-carry-collapsing loops.

File size: 1.9 KB
RevLine 
[3850]1/*
[4951]2 *  Copyright (c) 2016 International Characters.
[3850]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
[4237]7#ifndef PABLO_COMPILER_H
8#define PABLO_COMPILER_H
9
[4959]10//Pablo Expressions
[4237]11#include <string>
[4417]12#include <vector>
[4510]13#include <unordered_map>
[5063]14#include <pablo/pablo_kernel.h>
[4274]15#include <llvm/ADT/Twine.h>
[4628]16#include <llvm/IR/IRBuilder.h>
[4663]17#include <IDISA/idisa_builder.h>
[4939]18#include <kernels/kernel.h>
[5000]19#include <boost/container/flat_set.hpp>
[4237]20
[4274]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;
[4416]30    class BasicBlock;
[4274]31}
[4237]32
[4416]33namespace pablo {
34
35class PabloAST;
36class PabloBlock;
37class String;
38class Var;
39class Statement;
40class StatementList;
[4535]41class If;
42class While;
[5227]43class CarryManager;
44class Extract;
[4237]45
46class PabloCompiler {
[5227]47    friend class CarryManager;
48
[5000]49    using IntSet = boost::container::flat_set<unsigned>;
[4959]50    using MarkerMap = std::unordered_map<const PabloAST *, Value *>;
[5227]51
[4237]52public:
[5217]53    PabloCompiler(PabloKernel * kernel);
[5227]54    ~PabloCompiler();
55    void initializeKernelData();
[5217]56    void compile(Value * const self, Function * doBlockFunction);
[4959]57
[4237]58private:
[4959]59
[5217]60    void Examine();
[5141]61    void Examine(const PabloBlock * const block);
[4684]62
[4970]63    void compileBlock(const PabloBlock * const block);
[4410]64    void compileStatement(const Statement * stmt);
[4535]65    void compileIf(const If * ifStmt);
66    void compileWhile(const While * whileStmt);
[5227]67
[5202]68    Value * compileExpression(const PabloAST * expr, const bool ensureLoaded = true) const;
[4237]69
[5227]70private:
[4663]71
[5227]72    IDISA::IDISA_Builder *  iBuilder;
73    CarryManager *          mCarryManager;
74    PabloKernel *           mKernel;
75    Value *                 mSelf;
76    Function *              mFunction;
77    MarkerMap               mMarkerMap;
78    IntSet                  mInputStreamOffset;
[4237]79
80};
81
82}
83
[4951]84#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.