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

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

Multi-threading support for PabloAST / PabloCompiler?. Requires unique LLVM Context / Module for each thread.

File size: 1.2 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 <unordered_map>
12#include <string>
13
14namespace IDISA {
15    class IDISA_Builder;
16}
17
18namespace pablo {
19
20class String;
21class Integer;
22
23class SymbolGenerator {
24    friend class PabloBlock;
25    using Twine = llvm::Twine;
26    using Allocator = PabloAST::Allocator;
27public:
28    typedef int64_t integer_t;
29    String * get(const std::string name, IDISA::IDISA_Builder * builder);
30    String * make(const std::string prefix, IDISA::IDISA_Builder *builder);
31    Integer * getInteger(const integer_t value, IDISA::IDISA_Builder * builder);
32    SymbolGenerator(Allocator & allocator) : mAllocator(allocator) {}
33    ~SymbolGenerator() = default;
34private:
35    Allocator &                                 mAllocator;
36    std::unordered_map<std::string, integer_t>  mPrefixMap;
37    std::unordered_map<std::string, String *>   mStringMap;
38    std::unordered_map<integer_t, Integer *>    mIntegerMap;
39};
40
41}
42
43#endif // SYMBOL_GENERATOR_H
Note: See TracBrowser for help on using the repository browser.