source: icGREP/icgrep-devel/icgrep/pablo/ps_assign.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 PS_SETMARKER_H
8#define PS_SETMARKER_H
9
10#include <pablo/pe_string.h>
11#include <pablo/symbol_generator.h>
12#include <array>
13
14namespace pablo {
15
16class Assign : public Statement {
17    friend class PabloBlock;
18    friend class Next;
19    friend class Var;
20public:
21    static inline bool classof(const PabloAST * e) {
22        return e->getClassTypeId() == ClassTypeId::Assign;
23    }
24    static inline bool classof(const void *) {
25        return false;
26    }
27    virtual ~Assign() {
28    }
29    virtual PabloAST * getOperand(const unsigned index) const {
30        assert (index == 0);
31        return mExpr;
32    }
33    virtual unsigned getNumOperands() const {
34        return 1;
35    }
36    virtual void setOperand(const unsigned index, PabloAST * value) {
37        assert (index == 0);
38        mExpr = value;
39    }
40    inline PabloAST * getExpr() const {
41        return mExpr;
42    }
43    inline bool isOutputAssignment() const {
44        return mOutputIndex >= 0;
45    }
46    inline int getOutputIndex() const {
47        return mOutputIndex;
48    }
49protected:
50    explicit Assign(PabloAST * expr, int outputIndex, String * name, PabloBlock * parent)
51    : Statement(ClassTypeId::Assign, name, parent)
52    , mExpr(expr)
53    , mOutputIndex(outputIndex)
54    {
55        expr->addUser(this);
56    }
57private:
58    PabloAST *          mExpr;
59    const int           mOutputIndex;
60};
61
62}
63
64#endif // PS_SETMARKER_H
65
Note: See TracBrowser for help on using the repository browser.