source: icGREP/icgrep-devel/icgrep/pablo/pe_metadata.h @ 4388

Last change on this file since 4388 was 4287, checked in by nmedfort, 5 years ago

More work on multiplexing.

File size: 992 bytes
Line 
1#ifndef PABLO_METADATA_H
2#define PABLO_METADATA_H
3
4#include <pablo/pabloAST.h>
5#include <llvm/ADT/DenseSet.h>
6
7namespace pablo {
8
9class PMDNode {
10public:
11    enum class ClassTypeId : unsigned {
12        Set
13    };
14    inline ClassTypeId getClassTypeId() const {
15        return mClassTypeId;
16    }
17protected:
18    void* operator new (std::size_t size) noexcept {
19        return PabloAST::mAllocator.allocate(size);
20    }
21    inline PMDNode(const ClassTypeId id)
22    : mClassTypeId(id)
23    {
24
25    }
26private:
27    const ClassTypeId   mClassTypeId;
28};
29
30class PMDSet : public PMDNode, public llvm::DenseSet<PabloAST*> {
31public:
32    template<typename iterator>
33    inline static PMDSet * get(iterator begin, iterator end) {
34        return new PMDSet(begin, end);
35    }
36protected:
37    template<typename iterator>
38    PMDSet(iterator begin, iterator end)
39    : PMDNode(PMDNode::ClassTypeId::Set)
40    , llvm::DenseSet<PabloAST*>()
41    {
42        insert(begin, end);
43    }
44};
45
46
47
48}
49
50#endif // PE_METADATA_H
Note: See TracBrowser for help on using the repository browser.