source: icGREP/icgrep-devel/icgrep/pablo/pe_scanthru.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 PS_SCANTHRU_H
8#define PS_SCANTHRU_H
9
10#include <pablo/pabloAST.h>
11#include <pablo/symbol_generator.h>
12#include <array>
13
14namespace pablo {
15
16class ScanThru : public Statement {
17    friend class PabloBlock;
18public:
19    static inline bool classof(const PabloAST * e) {
20        return e->getClassTypeId() == ClassTypeId::ScanThru;
21    }
22    static inline bool classof(const void *) {
23        return false;
24    }
25    virtual ~ScanThru() {
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    PabloAST * getScanFrom() const {
39        return mExprs[0];
40    }
41    PabloAST * getScanThru() const {
42        return mExprs[1];
43    }
44    ScanThru(PabloAST * from, PabloAST * thru, SymbolGenerator * sg, PabloBlock * parent)
45    : Statement(ClassTypeId::ScanThru, sg->make("scanthru"), parent)
46    , mExprs({{from, thru}})
47    {
48        from->addUser(this);
49        thru->addUser(this);
50    }
51private:
52    std::array<PabloAST*, 2> mExprs;
53};
54
55}
56
57#endif // PS_SCANTHRU_H
58
59
60
Note: See TracBrowser for help on using the repository browser.