source: icGREP/icgrep-devel/icgrep/pablo/pe_var.h @ 5217

Last change on this file since 5217 was 5217, checked in by nmedfort, 2 years ago

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

File size: 1.6 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_VAR_H
8#define PE_VAR_H
9
10#include <pablo/pabloAST.h>
11#include <pablo/pe_string.h>
12#include <pablo/pe_integer.h>
13
14namespace pablo {
15
16class Assign;
17
18// A Var is unique in that it is not a statement but a "lives" within a
19// scope and cannot be accessed outside of it. A Var is mutable (via an
20// Assign instruction.
21
22class Var : public PabloAST {
23    friend class PabloBlock;
24    friend class PabloAST;
25    friend class PabloKernel;
26    friend class Statement;
27public:
28    static inline bool classof(const PabloAST * e) {
29        return e->getClassTypeId() == ClassTypeId::Var;
30    }
31    static inline bool classof(const void *) {
32        return false;
33    }
34protected:
35    Var(const PabloAST * name, Type * const type)
36    : PabloAST(ClassTypeId::Var, type, cast<String>(name)) {
37
38    }
39};
40
41class Extract : public Statement {
42    friend class PabloBlock;
43public:
44    static inline bool classof(const PabloAST * e) {
45        return e->getClassTypeId() == ClassTypeId::Extract;
46    }
47    static inline bool classof(const void *) {
48        return false;
49    }
50    virtual ~Extract(){
51    }
52    inline PabloAST * getArray() const {
53        return getOperand(0);
54    }
55    inline PabloAST * getIndex() const {
56        return getOperand(1);
57    }
58protected:
59    Extract(PabloAST * array, PabloAST * const index, const String * const name, Type * type)
60    : Statement(ClassTypeId::Extract, type, {array, index}, name) {
61
62    }
63};
64
65}
66
67#endif // PE_VAR_H
68
69
Note: See TracBrowser for help on using the repository browser.