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