source: icGREP/icgrep-devel/icgrep/pablo/pablo_type.cpp @ 5160

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

Initial work for incorporating Types into Pablo AST.

File size: 662 bytes
Line 
1#include <pablo/pablo_type.h>
2#include <llvm/Support/raw_ostream.h>
3
4namespace pablo {
5
6PabloType::Allocator PabloType::mAllocator;
7
8static std::vector<PabloType *> DEFINED_TYPES;
9
10const PabloType * getPabloType(const PabloType::TypeId typeId, const unsigned fieldWidth) {
11    for (const PabloType * t : DEFINED_TYPES) {
12        if (t->mTypeId == typeId && t->mFieldWidth == fieldWidth) {
13            return t;
14        }
15    }
16    PabloType * t = new PabloType(typeId, fieldWidth);
17    DEFINED_TYPES.emplace_back(t);
18    return t;
19}
20
21bool PabloType::operator==(const PabloType & t) const {
22    return (t.mTypeId == mTypeId && t.mFieldWidth == mFieldWidth);
23}
24
25}
Note: See TracBrowser for help on using the repository browser.