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;
43 friend class IntraFalcon;
44 friend class MantaIntraFalcon;
45 friend class SEGSerializer;
47 void setPtrOperand(
SEGNodeBase *Node) { PtrOp = Node; }
49 void setValOperand(
SEGNodeBase *Node) { ValOp = Node; }
53 if (Value *Val = Node->getLLVMValue()) {
54 kvec<Value *> DerefPtrs;
55 getDerefPtrFromInst(*getInstruction(), DerefPtrs);
56 if (DerefPtrs.find(Val) != DerefPtrs.end()) {
63 bool isLoad() {
return isa<LoadInst>(getInstruction()); }
65 bool isStore() {
return isa<StoreInst>(getInstruction()); }
67 SEGNodeBase *getPtrOperand()
const {
return PtrOp; }
69 SEGNodeBase *getValOperand()
const {
return ValOp; }
72 return N->getKind() == SEGOBJK_DereferenceSite;
87 return N->getKind() == SEGOBJK_CmpSite;
100 return N->getKind() == SEGOBJK_DivSite;
107 std::vector<SEGNodeBase *> OffsetOps;
115 friend class SEGSerializer;
119 void addOffsetOperand(
SEGNodeBase *N) { OffsetOps.emplace_back(N); }
122 static bool classof(
const SEGObject *N) {
123 return N->getKind() == SEGOBJK_GEPSite;
126 Instruction *GEPUsedInstruction()
const {
127 auto *SiteNode = getParentGraph()->findNode(getInstruction());
128 for (
auto It = SiteNode->use_site_begin(); It != SiteNode->use_site_end();
130 auto I = (*It)->getInstruction();
131 auto OpCode = I->getOpcode();
132 if (OpCode == Instruction::Load || OpCode == Instruction::Store) {
139 SEGNodeBase *getPtrOperand()
const {
return PtrOp; }
140 std::vector<SEGNodeBase *> &getOffsetOperands() {
return OffsetOps; }
151 static bool classof(
const SEGObject *N) {
152 return N->getKind() == SEGOBJK_AllocSite;