source: icGREP/icgrep-devel/icgrep/pablo/pe_xor.h @ 4272

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

Implemented slab allocator based on the original Parabix StringPool?; intergrated it with RE and Pablo AST nodes.

File size: 1.2 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 XOR_H
8#define XOR_H
9
10#include <pablo/pabloAST.h>
11
12namespace pablo {
13
14class PabloBlock;
15
16class Xor : public PabloAST {
17    friend struct OptimizeXor;
18    friend class PabloBlock;
19public:
20    static inline bool classof(const PabloAST * e) {
21        return e->getClassTypeId() == ClassTypeId::Xor;
22    }
23    static inline bool classof(const void *) {
24        return false;
25    }
26    virtual ~Xor() {
27    }
28    inline PabloAST * getExpr1() const {
29        return mExpr1;
30    }
31    inline PabloAST * getExpr2() const {
32        return mExpr2;
33    }
34protected:
35    void* operator new (std::size_t size) noexcept {
36        return mAllocator.allocate(size);
37    }
38    Xor(PabloAST * expr1, PabloAST * expr2)
39    : PabloAST(ClassTypeId::Xor)
40    , mExpr1(expr1)
41    , mExpr2(expr2)
42    {
43
44    }
45private:
46    PabloAST * const mExpr1;
47    PabloAST * const mExpr2;
48};
49
50struct OptimizeXor {
51    inline OptimizeXor(PabloBlock & cg) : cg(cg) {}
52    PabloAST * operator()(PabloAST * expr1, PabloAST * expr2);
53private:
54    PabloBlock & cg;
55};
56
57}
58
59#endif // XOR_H
60
61
62
Note: See TracBrowser for help on using the repository browser.