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

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