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

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