9 #ifndef IR_SEG_SEGSIMPLESITE_H
10 #define IR_SEG_SEGSIMPLESITE_H
12 #include <llvm/IR/Instructions.h>
14 #include "Analysis/Bitcode/BitcodeUtils.h"
15 #include "IR/SEG/SymbolicExprGraph.h"
27 return N->getKind() >= SEGOBJK_SimpleSiteBegin &&
28 N->getKind() <= SEGOBJK_SimpleSiteEnd;
42 friend class IntraFalcon;
43 friend class SEGSerializer;
45 void setPtrOperand(
SEGNodeBase *Node) { PtrOp = Node; }
47 void setValOperand(
SEGNodeBase *Node) { ValOp = Node; }
51 if (Value *Val = Node->getLLVMValue()) {
52 kvec<Value *> DerefPtrs;
53 getDerefPtrFromInst(*getInstruction(), DerefPtrs);
54 if (DerefPtrs.find(Val) != DerefPtrs.end()) {
61 bool isLoad() {
return isa<LoadInst>(getInstruction()); }
63 bool isStore() {
return isa<StoreInst>(getInstruction()); }
65 SEGNodeBase *getPtrOperand()
const {
return PtrOp; }
67 SEGNodeBase *getValOperand()
const {
return ValOp; }
70 return N->getKind() == SEGOBJK_DereferenceSite;
85 return N->getKind() == SEGOBJK_CmpSite;
98 return N->getKind() == SEGOBJK_DivSite;
105 std::vector<SEGNodeBase *> OffsetOps;
112 friend class SEGSerializer;
116 void addOffsetOperand(
SEGNodeBase *N) { OffsetOps.emplace_back(N); }
119 static bool classof(
const SEGObject *N) {
120 return N->getKind() == SEGOBJK_GEPSite;
123 Instruction *GEPUsedInstruction()
const {
124 auto *SiteNode = getParentGraph()->findNode(getInstruction());
125 for (
auto It = SiteNode->use_site_begin(); It != SiteNode->use_site_end();
127 auto I = (*It)->getInstruction();
128 auto OpCode = I->getOpcode();
129 if (OpCode == Instruction::Load || OpCode == Instruction::Store) {
136 SEGNodeBase *getPtrOperand()
const {
return PtrOp; }
137 std::vector<SEGNodeBase *> &getOffsetOperands() {
return OffsetOps; }
148 static bool classof(
const SEGObject *N) {
149 return N->getKind() == SEGOBJK_AllocSite;