-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataFlowNode.hxx
63 lines (53 loc) · 1.87 KB
/
DataFlowNode.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef DataFlowNode_hxx
#define DataFlowNode_hxx
class DataSourceNode;
#include "state.hxx"
#include "asserts.hxx"
class DataSourceNode {
//clang inheritance seems buggy
/*protected:
llvm::Value* value;
public:
DataSourceNode(llvm::Value* val) : value(val) { assertdefined(this->value)}*/
public:
static void createPushNode(std::shared_ptr<codegenState> state, llvm::Value* value);
static void createMemStore(std::shared_ptr<codegenState> state, llvm::Value* address, llvm::Value* value);
virtual llvm::Value* getValue(std::shared_ptr<codegenState> state) = 0;
};
class DataConsumerNode {
public:
static llvm::Value* createPopNode(std::shared_ptr<codegenState> state);
static llvm::Value* createMemRetrive(std::shared_ptr<codegenState> state, llvm::Value* address);
static void SaveStack(std::shared_ptr<codegenState> state, bool cleargeninfo = true);
};
class RegisterPushNode : public DataSourceNode {
private:
llvm::Value* value;
public:
RegisterPushNode(llvm::Value* val) : value(val) {VALGRIND_CHECK_VALUE_IS_DEFINED(this->value);}
virtual llvm::Value* getValue(std::shared_ptr<codegenState> state);
};
class StackPopNode : public DataConsumerNode {
public:
static llvm::Value* createPopNode(std::shared_ptr<codegenState> state);
};
class StackPushNode : public DataSourceNode {
private:
bool Codegened;
llvm::Value* value;
public:
StackPushNode(llvm::Value* val) : value(val), Codegened(false) { assertdefined(this->value)}
void CodeGen(std::shared_ptr<codegenState> state);
virtual llvm::Value* getValue(std::shared_ptr<codegenState> state){
this->CodeGen(state);
return StackPopNode::createPopNode(state);
}
};
class MemoryStoreNode : public DataSourceNode {
private:
llvm::Value* value;
public:
MemoryStoreNode(llvm::Value* val) : value(val) { assertdefined(this->value)}
virtual llvm::Value* getValue(std::shared_ptr<codegenState> state) {return(this->value);}
};
#endif