source: icGREP/icgrep-devel/icgrep/re/re_memoizer.hpp @ 5828

Last change on this file since 5828 was 5814, checked in by cameron, 18 months ago

Parsing of byte CCs

File size: 573 bytes
RevLine 
[5630]1#ifndef RE_MEMOIZER_H
2#define RE_MEMOIZER_H
[4818]3
[4819]4#include <re/re_name.h>
5#include <set>
6
[4818]7namespace re {
8
[4819]9struct MemoizerComparator {
[5630]10    bool operator() (const RE * lh, const RE * rh) const;
[4818]11};
12
[4820]13struct Memoizer : public std::set<RE *, MemoizerComparator> {
[4819]14
[5630]15    RE * memoize(RE * const re) {
16        return *(insert(re).first);
17    }
18
19    Name * memoize(Name * const name) {
20        return llvm::cast<Name>(memoize(llvm::cast<RE>(name)));
21    }
22
[5814]23    CC * memoize(CC * const cc) {
24        return llvm::cast<CC>(memoize(llvm::cast<RE>(cc)));
[4819]25    }
26};
27
28}
29
[5630]30#endif // RE_MEMOIZER_H
Note: See TracBrowser for help on using the repository browser.