ClearBlue
SEGLoadMemNode.h
1 /*
2  * SEGLoadMemNode.h
3  *
4  * Qingkai
5  *
6  * This node is to model value loaded from a memory.
7  */
8 
9 #ifndef IR_SEG_SEGLOADMEMNODE_H
10 #define IR_SEG_SEGLOADMEMNODE_H
11 
12 #include <llvm/IR/BasicBlock.h>
13 
14 #include <sstream>
15 #include <unordered_map>
16 
17 #include "IR/SEG/SymbolicExprGraph.h"
18 
19 using namespace llvm;
20 
22  friend class SEGSerializer;
23  friend class SEGHash;
24 
25 private:
26  // Used when pointer analysis is applied
27  // Loaded Value -> Conditions
28  std::unordered_map<const SEGNodeBase *, SEGRegionNode *> MatchingConditions;
29  friend class SymbolicExprGraph;
30 
31  SEGLoadMemNode(Type *Ty, SymbolicExprGraph *SEG, BasicBlock *BB,
32  bool fromDisk);
33 
34 public:
35  ~SEGLoadMemNode() {}
36 
40  void addMatchingCondition(const SEGNodeBase *Node, SEGRegionNode *Cond) {
41  MatchingConditions[Node] = Cond;
42  }
43 
46  auto It = MatchingConditions.find(Node);
47  if (It != MatchingConditions.end()) {
48  return It->second;
49  }
50  // assert(false && "No matching condition for a mem node.");
51  // It may return null when falcon is disabled.
52  return nullptr;
53  }
54 
55  void dot(raw_fd_ostream &O) const;
56 
57 public:
58  static bool classof(const SEGObject *N) {
59  return N->getKind() == SEGOBJK_LoadMem;
60  }
61 };
62 
63 #endif
SymbolicExprGraph::dot
void dot(const char *FileName) const
Dot this graph to a file with filename.
Definition: SymbolicExprGraph.cpp:881
SEGOperandNode
Definition: SymbolicExprGraph.h:456
SymbolicExprGraph
Definition: SymbolicExprGraph.h:708
SEGLoadMemNode::addMatchingCondition
void addMatchingCondition(const SEGNodeBase *Node, SEGRegionNode *Cond)
Definition: SEGLoadMemNode.h:40
SEGLoadMemNode::getMatchingCondition
SEGRegionNode * getMatchingCondition(const SEGNodeBase *Node) const
Get the condition of loaded value.
Definition: SEGLoadMemNode.h:45
SEGObject
Definition: SymbolicExprGraph.h:76
SEGRegionNode
Definition: SEGRegionNode.h:34
SEGLoadMemNode
Definition: SEGLoadMemNode.h:21
SEGNodeBase
The node base of symbolic expression graph.
Definition: SymbolicExprGraph.h:244