source: icGREP/icgrep-devel/icgrep/pablo/pe_matchstar.h @ 4410

Last change on this file since 4410 was 4410, checked in by nmedfort, 5 years ago

Changes to support 3-operand form for all instructions. CSE disabled but partially redundant now.

File size: 1.4 KB
Line 
1/*
2 *  Copyright (c) 2014 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 PE_MATCHSTAR_H
8#define PE_MATCHSTAR_H
9
10#include "pabloAST.h"
11#include <pablo/symbol_generator.h>
12#include <array>
13
14namespace pablo {
15
16class MatchStar : public Statement {
17    friend class PabloBlock;
18public:
19    static inline bool classof(const PabloAST * e) {
20        return e->getClassTypeId() == ClassTypeId::MatchStar;
21    }
22    static inline bool classof(const void *) {
23        return false;
24    }
25    virtual ~MatchStar() {
26    }
27    virtual PabloAST * getOperand(const unsigned index) const {
28        assert (index < 2);
29        return mExprs[index];
30    }
31    virtual unsigned getNumOperands() const {
32        return 2;
33    }
34    virtual void setOperand(const unsigned index, PabloAST * value) {
35        assert (index < 2);
36        mExprs[index] = value;
37    }
38    inline PabloAST * getMarker() const {
39        return mExprs[0];
40    }
41    inline PabloAST * getCharClass() const  {
42        return mExprs[1];
43    }
44protected:
45    MatchStar(PabloAST * marker, PabloAST * cc, SymbolGenerator * sg, PabloBlock * parent)
46    : Statement(ClassTypeId::MatchStar, sg->make("matchstar"), parent)
47    , mExprs({{marker, cc}})
48    {
49        marker->addUser(this);
50        cc->addUser(this);
51    }
52private:
53    std::array<PabloAST*, 2> mExprs;
54};
55
56}
57
58#endif // PE_MATCHSTAR_H
59
60
61
Note: See TracBrowser for help on using the repository browser.