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 
17 using namespace llvm;
18 
20 public:
21  friend class SEGSerializer;
22 
23 protected:
24  SEGCallSite *SEGCS;
25 
26  SEGCallSiteOutputNode(SEGObjectKind, SEGCallSite *CS, Type *Ty,
27  SymbolicExprGraph *SEG, BasicBlock *BB, bool fromDisk);
28 
29  SEGCallSiteOutputNode(SEGObjectKind, SEGCallSite *CS, Value *Val, Type *Ty,
30  SymbolicExprGraph *SEG, BasicBlock *BB, bool fromDisk);
31 
32  friend class SymbolicExprGraph;
33 
34 public:
36 
37  virtual Instruction *getLLVMDbgInstruction() const override;
38 
39  const SEGCallSite *getCallSite() const { return SEGCS; }
40 
41  virtual int64_t getIndex() const = 0;
42 
43 public:
44  static bool classof(const SEGObject *N) {
45  return N->getKind() >= SEGOBJK_CallSiteOutputBegin &&
46  N->getKind() <= SEGOBJK_CallSiteOutputEnd;
47  }
48 };
49 
51 private:
53  BasicBlock *BB, bool fromDisk);
54 
55  SEGCallSiteCommonOutputNode(SEGCallSite *CS, Value *Val, Type *Ty,
56  SymbolicExprGraph *SEG, BasicBlock *BB,
57  bool fromDisk);
58 
59  friend class SymbolicExprGraph;
60  friend class SEGSerializer;
61 
62 public:
64 
65  virtual int64_t getIndex() const {
66  assert(false);
67  return 0;
68  }
69 
70 public:
71  static bool classof(const SEGObject *N) {
72  return N->getKind() == SEGOBJK_CallSiteCommonOutput;
73  }
74 };
75 
77 private:
78  SEGCallSitePseudoOutputNode(SEGCallSite *CS, Function *Callee, Value *Val,
79  Type *Ty, SymbolicExprGraph *SEG, BasicBlock *BB,
80  bool fromDisk);
81 
82  // If it is a pseudo call site return node, it has an index
83  // It is set by the SEGCallSite
84  int64_t Index = -1;
85 
86  CBAccessPath AP;
87 
88  Function *Callee = nullptr;
89 
90  friend class SymbolicExprGraph;
91  friend class SEGCallSite;
92  friend class SEGSerializer;
93 
94 public:
96 
97  virtual int64_t getIndex() const { return Index; }
98 
99  const CBAccessPath &getAccessPath() const { return AP; }
100 
101  CBAccessPath &getAccessPath() { return AP; }
102 
103  Function *getCallee() const { return Callee; }
104 
105 public:
106  static bool classof(const SEGObject *N) {
107  return N->getKind() == SEGOBJK_CallSitePseudoOutput;
108  }
109 };
110 
111 #endif
SEGOperandNode
Definition: SymbolicExprGraph.h:456
SEGCallSiteOutputNode
Definition: SEGCallSiteOutputNode.h:19
SEGCallSite
Definition: SEGCallSite.h:51
SymbolicExprGraph
Definition: SymbolicExprGraph.h:708
SEGCallSiteCommonOutputNode
Definition: SEGCallSiteOutputNode.h:50
SEGObject
Definition: SymbolicExprGraph.h:76
SEGCallSitePseudoOutputNode
Definition: SEGCallSiteOutputNode.h:76
CBAccessPath
Definition: CBAccessPath.h:22