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

Last change on this file since 5260 was 5260, checked in by nmedfort, 2 years ago

Changes working towards simplifying accessing stream elements + some modifications to simplify include / forward declarations within the CodeGen? library.

File size: 1.6 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
[4510]10#include <unordered_map>
[4628]11#include <llvm/IR/IRBuilder.h>
[5238]12#include <IR_Gen/idisa_builder.h>
[4939]13#include <kernels/kernel.h>
[5000]14#include <boost/container/flat_set.hpp>
[4237]15
[4274]16namespace llvm {
[5260]17class Value;
18class Function;
[4274]19}
[4237]20
[4416]21namespace pablo {
22
23class PabloAST;
24class PabloBlock;
[5260]25class PabloKernel;
[4416]26class String;
27class Statement;
[4535]28class If;
29class While;
[5227]30class CarryManager;
[4237]31
32class PabloCompiler {
[5227]33    friend class CarryManager;
34
[5000]35    using IntSet = boost::container::flat_set<unsigned>;
[5260]36    using MarkerMap = std::unordered_map<const PabloAST *, llvm::Value *>;
[5227]37
[4237]38public:
[5217]39    PabloCompiler(PabloKernel * kernel);
[5227]40    ~PabloCompiler();
41    void initializeKernelData();
[5260]42    void compile(llvm::Value * const self, llvm::Function * doBlockFunction);
[4959]43
[4237]44private:
[4959]45
[5217]46    void Examine();
[5141]47    void Examine(const PabloBlock * const block);
[4684]48
[4970]49    void compileBlock(const PabloBlock * const block);
[4410]50    void compileStatement(const Statement * stmt);
[4535]51    void compileIf(const If * ifStmt);
52    void compileWhile(const While * whileStmt);
[5227]53
[5260]54    llvm::Value * compileExpression(const PabloAST * expr, const bool ensureLoaded = true) const;
[4237]55
[5227]56private:
[4663]57
[5227]58    IDISA::IDISA_Builder *  iBuilder;
59    CarryManager *          mCarryManager;
60    PabloKernel *           mKernel;
[5260]61    llvm::Value *           mSelf;
62    llvm::Function *        mFunction;
[5227]63    MarkerMap               mMarkerMap;
64    IntSet                  mInputStreamOffset;
[4237]65
66};
67
68}
69
[4951]70#endif // PABLO_COMPILER_H
Note: See TracBrowser for help on using the repository browser.