source: icGREP/icgrep-devel/icgrep/pablo/pe_not.h @ 4280

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

More Pablo IR manipulation functionality; finished use analysis optimizer (requires boost). Removed remaining LLVM optimization passes.

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 PE_NOT_H
8#define PE_NOT_H
9
10#include <pablo/pabloAST.h>
11
12namespace pablo {
13
14class PabloBlock;
15
16class Not : public PabloAST {
17    friend struct OptimizeNot;
18    friend class PabloBlock;
19public:
20    static inline bool classof(const PabloAST * e) {
21        return e->getClassTypeId() == ClassTypeId::Not;
22    }
23    static inline bool classof(const void *) {
24        return false;
25    }
26    virtual PabloAST * getOperand(const unsigned index) const {
27        assert (index == 0);
28        return mExpr;
29    }
30    virtual unsigned getNumOperands() const {
31        return 1;
32    }
33    virtual void setOperand(const unsigned index, PabloAST * value) {
34        assert (index == 0);
35        mExpr = value;
36    }
37    virtual ~Not() {
38    }
39    PabloAST * getExpr() const {
40        return mExpr;
41    }
42protected:
43    void* operator new (std::size_t size) noexcept {
44        return mAllocator.allocate(size);
45    }
46    Not(PabloAST * expr)
47    : PabloAST(ClassTypeId::Not)
48    , mExpr(expr) {
49
50    }
51private:
52    PabloAST * mExpr;
53};
54
55struct OptimizeNot {
56    inline OptimizeNot(PabloBlock & cg) : cg(cg) {}
57    PabloAST * operator()(PabloAST * expr);
58private:
59    PabloBlock & cg;
60
61};
62
63}
64
65#endif // PE_NOT_H
66
67
Note: See TracBrowser for help on using the repository browser.