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

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

Optimized Symbol Generation (and fixed potential bug that could allow duplicate names being constructed); made PabloKernel? extend PabloAST (temporarily removed PabloAST::getName() to avoid diamond problem); added an internal scalar to PabloKernel? struct for each Count to avoid InOut? output scalar variable problem; allowed CodeMotionPass? to move code within the same scope but across a branch statement. Began work on separating Kernels into either Block-Oriented or Segment-Oriented kernels.

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
14namespace IDISA { class IDISA_Builder; }
15namespace pablo { class String; }
16namespace pablo { class Integer; }
17
18namespace pablo {
19
20class SymbolGenerator {
21    friend class PabloKernel;
22    using Allocator = PabloAST::Allocator;
23public:
24    using IntTy = int64_t;
25    String * getString(const llvm::StringRef name, IDISA::IDISA_Builder * builder) noexcept;
26    String * makeString(const llvm::StringRef prefix, IDISA::IDISA_Builder * builder) noexcept;
27    Integer * getInteger(const IntTy value, IDISA::IDISA_Builder * builder) noexcept;
28    ~SymbolGenerator() { }
29protected:
30    SymbolGenerator(Allocator & allocator) : mAllocator(allocator) { }
31private:
32    Allocator &                                  mAllocator;
33    llvm::StringMap<IntTy>                       mPrefixMap;
34    llvm::StringMap<String *>                    mStringMap;
35    boost::container::flat_map<IntTy, Integer *> mIntegerMap;
36};
37
38
39}
40
41#endif // SYMBOL_GENERATOR_H
Note: See TracBrowser for help on using the repository browser.