source: icGREP/icgrep-devel/icgrep/kernels/attributes.cpp @ 5941

Last change on this file since 5941 was 5782, checked in by nmedfort, 20 months ago

Initial check-in of LookAhead? support; modified LineBreakKernel? to compute CR+LF using LookAhead?(1) + misc. fixes.

File size: 711 bytes
Line 
1#include "attributes.h"
2
3#include <llvm/Support/raw_ostream.h>
4
5namespace kernel {
6
7Attribute & AttributeSet::addAttribute(Attribute attribute) {
8    for (auto i = begin(), i_end = end(); i != i_end; ++i) {
9        Attribute & attr = const_cast<Attribute &>(*i);
10        if (attr.getKind() == attribute.getKind()) {
11            attr.mAmount = attribute.mAmount;
12            return attr;
13        }
14    }
15    emplace_back(attribute);
16    return back();
17}
18
19Attribute * AttributeSet::__findAttribute(const AttributeId id) const {
20    for (auto i = begin(), i_end = end(); i != i_end; ++i) {
21        if (i->getKind() == id) {
22            return const_cast<Attribute *>(&*i);
23        }
24    }
25    return nullptr;
26}
27
28}
Note: See TracBrowser for help on using the repository browser.