source: icGREP/icgrep-devel/icgrep/pablo/pe_and.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.3 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_AND_H
8#define PE_AND_H
9
10#include <pablo/pabloAST.h>
11#include <array>
12
13namespace pablo {
14
15class PabloBlock;
16
17class And : public Statement {
18    friend struct OptimizeAnd;
19    friend class PabloBlock;
20public:
21    static inline bool classof(const PabloAST * e) {
22        return e->getClassTypeId() == ClassTypeId::And;
23    }
24    static inline bool classof(const void *) {
25        return false;
26    }
27    virtual ~And() {
28    }
29    virtual PabloAST * getOperand(const unsigned index) const {
30        assert (index < 2);
31        return mExprs[index];
32    }
33    virtual unsigned getNumOperands() const {
34        return 2;
35    }
36    virtual void setOperand(const unsigned index, PabloAST * value) {
37        assert (index < 2);
38        mExprs[index] = value;
39    }
40    PabloAST * getExpr1() const {
41        return mExprs[0];
42    }
43    PabloAST * getExpr2() const {
44        return mExprs[1];
45    }
46protected:
47    And(PabloAST * expr1, PabloAST * expr2, PabloBlock * parent);
48private:
49    std::array<PabloAST*, 2> mExprs;
50};
51
52struct OptimizeAnd {
53    PabloAST * operator()(PabloAST * expr1, PabloAST * expr2, PabloBlock * pb);
54};
55
56}
57
58#endif // PE_AND_H
59
60
Note: See TracBrowser for help on using the repository browser.