source: icGREP/icgrep-devel/icgrep/pablo/symbol_generator.h @ 6184

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

Large refactoring step. Removed IR generation code from Kernel (formally KernelBuilder?) and moved it into the new KernelBuilder? class.

File size: 1.3 KB
Line 
1/*
2 *  Copyright (c) 2014 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 SYMBOL_GENERATOR_H
8#define SYMBOL_GENERATOR_H
9
10#include <pablo/pabloAST.h>
11#include <llvm/ADT/StringMap.h>
12#include <boost/container/flat_map.hpp>
13#include <memory>
14
15namespace IDISA { class IDISA_Builder; }
16namespace pablo { class String; }
17namespace pablo { class Integer; }
18namespace llvm { class LLVMContext; }
19
20namespace pablo {
21
22class SymbolGenerator {
23    friend class PabloKernel;
24    using Allocator = PabloAST::Allocator;
25public:
26    using IntTy = int64_t;
27    String * makeString(const llvm::StringRef prefix) noexcept;
28    Integer * getInteger(const IntTy value) noexcept;
29    ~SymbolGenerator() { }
30protected:
31    SymbolGenerator(llvm::LLVMContext & C, Allocator & allocator)
32    : mContext(C)
33    , mAllocator(allocator) {
34
35    }
36private:
37    llvm::LLVMContext &                          mContext;
38    Allocator &                                  mAllocator;
39    llvm::StringMap<IntTy>                       mPrefixMap;
40    llvm::StringMap<String *>                    mStringMap;
41    boost::container::flat_map<IntTy, Integer *> mIntegerMap;
42};
43
44
45}
46
47#endif // SYMBOL_GENERATOR_H
Note: See TracBrowser for help on using the repository browser.