source: icGREP/icgrep-devel/icgrep/pablo/pe_pabloe.h @ 4200

Last change on this file since 4200 was 4200, checked in by nmedfort, 5 years ago

Replaced dynamic_cast with llvm::dyn_cast in pablo code; implemented make functions for pablo constructors. Disabled RTTI.

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_PABLOE_H
8#define PE_PABLOE_H
9
10#include <llvm/Support/Casting.h>
11
12using namespace llvm;
13
14namespace pablo {
15
16class PabloE
17{
18public:
19    enum class ClassTypeId : unsigned {
20        Advance
21        , All
22        , And
23        , Call
24        , CharClass
25        , MatchStar
26        , Not
27        , Or
28        , ScanThru
29        , Sel
30        , Var
31        , Xor
32        , Assign
33        , If
34        , While
35    };
36    inline ClassTypeId getClassTypeId() const {
37        return mClassTypeId;
38    }
39    virtual ~PabloE() = 0;
40protected:
41    inline PabloE(const ClassTypeId id)
42    : mClassTypeId(id) {
43
44    }
45private:
46    const ClassTypeId mClassTypeId;
47};
48
49bool equals(const PabloE * expr1, const PabloE *expr2);
50
51//template <typename To, typename From>
52//inline static bool isa(const From * object) {
53//    return To::classof(object);
54//}
55
56//template <typename To, typename From>
57//inline static To * cast(From * object) {
58//    return reinterpret_cast<To *>(object);
59//}
60
61//template <typename To, typename From>
62//inline static To * dyn_cast(From * object) {
63//    if (isa<To, From>(object)) {
64//        return cast<To, From>(object);
65//    }
66//    return nullptr;
67//}
68
69}
70
71#endif // PE_PABLOE_H
72
73
74
Note: See TracBrowser for help on using the repository browser.