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

Last change on this file since 4744 was 4650, checked in by nmedfort, 4 years ago

Partial roll back of Trie structure. Seemed to introduce the potential of generating a cycle in the AST. More analysis is needed here before mixing together multiple Advance DAG traversals.

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_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    }
46protected:
47    inline DefinedVars & getDefined() {
48        return mDefined;
49    }
50    If(PabloAST * expr, const std::initializer_list<Assign *> definedVars, PabloBlock & body);
51
52    If(PabloAST * expr, const std::vector<Assign *> & definedVars, PabloBlock & body);
53private:
54    PabloBlock &    mBody;
55    DefinedVars     mDefined;
56};
57
58}
59
60#endif // PS_IF_H
61
62
Note: See TracBrowser for help on using the repository browser.