source: icGREP/icgrep-devel/icgrep/pablo/carry_data.h @ 5652

Last change on this file since 5652 was 5630, checked in by nmedfort, 2 years ago

Partial check-in for avoidance of compiling Pablo/LLVM code to determine the Kernel struct type when using a cached object. Inactive RE alternation minimization check in.

File size: 1.7 KB
Line 
1/*
2 *  Copyright (c) 2015 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 CARRY_DATA_H
8#define CARRY_DATA_H
9
10namespace pablo {
11
12class CarryData {
13public:
14
15    enum SummaryType : unsigned {
16        NoSummary = 0
17        , ImplicitSummary = 1
18        , BorrowedSummary = 2
19        , ExplicitSummary = 3
20        , NonCarryCollapsingMode = 4
21    };
22
23    CarryData()
24    : mSummaryType(NoSummary) {
25
26    }
27             
28    bool hasSummary() const {
29        return (mSummaryType & (ImplicitSummary | BorrowedSummary | ExplicitSummary)) != NoSummary;
30    }
31   
32    bool hasImplicitSummary() const {
33        return (mSummaryType & (ImplicitSummary | BorrowedSummary | ExplicitSummary)) == ImplicitSummary;
34    }
35
36    bool hasBorrowedSummary() const {
37        return (mSummaryType & (ImplicitSummary | BorrowedSummary | ExplicitSummary)) == BorrowedSummary;
38    }
39
40    bool hasExplicitSummary() const {
41        return (mSummaryType & (ImplicitSummary | BorrowedSummary | ExplicitSummary)) == ExplicitSummary;
42    }
43
44    bool nonCarryCollapsingMode() const {
45        return (mSummaryType & (NonCarryCollapsingMode)) != 0;
46    }
47
48    void setSummaryType(const SummaryType value) {
49        mSummaryType = value;
50    }
51
52    void setNonCollapsingCarryMode(const bool value = true) {
53        if (value) {
54            mSummaryType = (SummaryType)(mSummaryType | NonCarryCollapsingMode);
55        } else {
56            mSummaryType = (SummaryType)(mSummaryType & ~NonCarryCollapsingMode);
57        }
58    }
59   
60private:
61
62    SummaryType     mSummaryType;
63
64};
65
66
67}
68
69
70#endif // CARRY_DATA_H
Note: See TracBrowser for help on using the repository browser.