ClearBlue
SEGCallSiteOutputNode.h
1 /*
2  * SEGCallSiteOutputNode.h
3  *
4  * Qingkai
5  *
6  * This node is to model the output of a call site.
7  */
8 
9 #ifndef IR_SEG_SEGCALLSITEOUTPUTNODE_H
10 #define IR_SEG_SEGCALLSITEOUTPUTNODE_H
11 
12 #include <llvm/IR/BasicBlock.h>
13 
14 #include "CBAccessPath.h"
15 #include "IR/SEG/SymbolicExprGraph.h"
16 #include "Persistence/PersistenceBasis.h"
17 
18 using namespace llvm;
19 
21 public:
24  SEGCallSiteOutputNode(PersistedSEGCallSiteOutputNode *Node,
25  SymbolicExprGraph *SEG);
26 
27  virtual void assembleSEGObject(std::map<int, SEGObject *> &FuncSEGObjMap);
28 
29 protected:
30  SEGCallSite *SEGCS;
31 
32  SEGCallSiteOutputNode(SEGObjectKind, SEGCallSite *CS, Type *Ty,
33  SymbolicExprGraph *SEG, BasicBlock *BB);
34 
35  SEGCallSiteOutputNode(SEGObjectKind, SEGCallSite *CS, Value *Val, Type *Ty,
36  SymbolicExprGraph *SEG, BasicBlock *BB);
37 
38  friend class SymbolicExprGraph;
39 
40 public:
42 
43  virtual Instruction *getLLVMDbgInstruction() const override;
44 
45  const SEGCallSite *getCallSite() const { return SEGCS; }
46 
47  virtual size_t getIndex() const = 0;
48 
49  virtual std::string getSrcFile() const;
50 
51  virtual std::int32_t getSrcLine() const;
52 
53 public:
54  static bool classof(const SEGObject *N) {
55  return N->getKind() >= SEGOBJK_CallSiteOutputBegin &&
56  N->getKind() <= SEGOBJK_CallSiteOutputEnd;
57  }
58 };
59 
61 public:
64  SEGCallSiteCommonOutputNode(PersistedSEGCallSiteCommonOutputNode *Node,
65  SymbolicExprGraph *SEG);
66 
67  virtual void assembleSEGObject(std::map<int, SEGObject *> &FuncSEGObjMap) {
69  }
70 
71 private:
73  BasicBlock *BB);
74 
75  SEGCallSiteCommonOutputNode(SEGCallSite *CS, Value *Val, Type *Ty,
76  SymbolicExprGraph *SEG, BasicBlock *BB);
77 
78  friend class SymbolicExprGraph;
79 
80 public:
82 
83  virtual PersistedSEGObject *createPersistedObject() const;
84 
85  virtual size_t getIndex() const {
86  assert(false);
87  return 0;
88  }
89 
90 public:
91  static bool classof(const SEGObject *N) {
92  return N->getKind() == SEGOBJK_CallSiteCommonOutput;
93  }
94 };
95 
97 public:
100  SEGCallSitePseudoOutputNode(PersistedSEGCallSitePseudoOutputNode *Node,
101  SymbolicExprGraph *SEG);
102 
103  virtual void assembleSEGObject(std::map<int, SEGObject *> &FuncSEGObjMap) {
105  }
106 
107 private:
108  SEGCallSitePseudoOutputNode(SEGCallSite *CS, Function *Callee, Type *Ty,
109  SymbolicExprGraph *SEG, BasicBlock *BB);
110 
111  SEGCallSitePseudoOutputNode(SEGCallSite *CS, Function *Callee, Value *Val,
112  Type *Ty, SymbolicExprGraph *SEG, BasicBlock *BB);
113 
114  // If it is a pseudo call site return node, it has an index
115  // It is set by the SEGCallSite
116  size_t Index = -1;
117 
118  CBAccessPath AP;
119 
120  Function *Callee = nullptr;
121 
122  WrappedFunction *WrappedCallee = nullptr;
123 
124  friend class SymbolicExprGraph;
125  friend class SEGCallSite;
126 
127 public:
129 
130  virtual PersistedSEGObject *createPersistedObject() const;
131 
132  virtual size_t getIndex() const { return Index; }
133 
134  const CBAccessPath &getAccessPath() const { return AP; }
135 
136  CBAccessPath &getAccessPath() { return AP; }
137 
138  Function *getCallee() const { return Callee; }
139 
140  WrappedFunction *getWrappedCallee() const { return WrappedCallee; }
141 
142 public:
143  static bool classof(const SEGObject *N) {
144  return N->getKind() == SEGOBJK_CallSitePseudoOutput;
145  }
146 };
147 
148 #endif
SEGOperandNode
Definition: SymbolicExprGraph.h:539
SEGCallSiteOutputNode
Definition: SEGCallSiteOutputNode.h:20
SEGCallSite
Definition: SEGCallSite.h:53
SymbolicExprGraph
Definition: SymbolicExprGraph.h:855
SEGCallSiteCommonOutputNode
Definition: SEGCallSiteOutputNode.h:60
SEGCallSitePseudoOutputNode::assembleSEGObject
virtual void assembleSEGObject(std::map< int, SEGObject * > &FuncSEGObjMap)
Assemble the SEG object's related objects.
Definition: SEGCallSiteOutputNode.h:103
SEGObject
Definition: SymbolicExprGraph.h:87
SEGCallSiteCommonOutputNode::assembleSEGObject
virtual void assembleSEGObject(std::map< int, SEGObject * > &FuncSEGObjMap)
Assemble the SEG object's related objects.
Definition: SEGCallSiteOutputNode.h:67
SEGCallSiteOutputNode::assembleSEGObject
virtual void assembleSEGObject(std::map< int, SEGObject * > &FuncSEGObjMap)
Assemble the SEG object's related objects.
Definition: SEGCallSiteOutputNode.cpp:31
SEGCallSitePseudoOutputNode
Definition: SEGCallSiteOutputNode.h:96
CBAccessPath
Definition: CBAccessPath.h:22