source: icGREP/icgrep-devel/icgrep/pablo/ps_if.h @ 4765

Last change on this file since 4765 was 4764, checked in by nmedfort, 4 years ago

More work on reassociation pass

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_IF_H
8#define PS_IF_H
9
10#include <pablo/pabloAST.h>
11#include <vector>
12
13namespace pablo {
14
15class Assign;
16
17class If : public Statement {
18    friend class PabloBlock;
19    friend class Statement;
20    friend class Simplifier;
21public:
22    using DefinedAllocator = VectorAllocator::rebind<Assign *>::other;
23    using DefinedVars = std::vector<Assign *, DefinedAllocator>;
24
25    static inline bool classof(const PabloAST * e) {
26        return e->getClassTypeId() == ClassTypeId::If;
27    }
28    static inline bool classof(const void *) {
29        return false;
30    }
31    virtual ~If() {
32        mDefined.clear();
33    }
34    inline PabloAST * getCondition() const {
35        return getOperand(0);
36    }
37    inline PabloBlock & getBody() {
38        return mBody;
39    }
40    inline  PabloBlock & getBody() const {
41        return mBody;
42    }
43    inline const DefinedVars & getDefined() const {
44        return mDefined;
45    }
46    void addDefined(Assign * def);
47protected:
48    inline DefinedVars & getDefined() {
49        return mDefined;
50    }
51    If(PabloAST * expr, const std::initializer_list<Assign *> definedVars, PabloBlock & body);
52
53    If(PabloAST * expr, const std::vector<Assign *> & definedVars, PabloBlock & body);
54private:
55    PabloBlock &    mBody;
56    DefinedVars     mDefined;
57};
58
59}
60
61#endif // PS_IF_H
62
63
Note: See TracBrowser for help on using the repository browser.