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 MantaIntraFalcon;
44 friend class SEGSerializer;
46 void setPtrOperand(
SEGNodeBase *Node) { PtrOp = Node; }
48 void setValOperand(
SEGNodeBase *Node) { ValOp = Node; }
52 if (Value *Val = Node->getLLVMValue()) {
53 kvec<Value *> DerefPtrs;
54 getDerefPtrFromInst(*getInstruction(), DerefPtrs);
55 if (DerefPtrs.find(Val) != DerefPtrs.end()) {
62 bool isLoad() {
return isa<LoadInst>(getInstruction()); }
64 bool isStore() {
return isa<StoreInst>(getInstruction()); }
66 SEGNodeBase *getPtrOperand()
const {
return PtrOp; }
68 SEGNodeBase *getValOperand()
const {
return ValOp; }
71 return N->getKind() == SEGOBJK_DereferenceSite;
86 return N->getKind() == SEGOBJK_CmpSite;
99 return N->getKind() == SEGOBJK_DivSite;
106 std::vector<SEGNodeBase *> OffsetOps;
113 friend class SEGSerializer;
117 void addOffsetOperand(
SEGNodeBase *N) { OffsetOps.emplace_back(N); }
120 static bool classof(
const SEGObject *N) {
121 return N->getKind() == SEGOBJK_GEPSite;
124 Instruction *GEPUsedInstruction()
const {
125 auto *SiteNode = getParentGraph()->findNode(getInstruction());
126 for (
auto It = SiteNode->use_site_begin(); It != SiteNode->use_site_end();
128 auto I = (*It)->getInstruction();
129 auto OpCode = I->getOpcode();
130 if (OpCode == Instruction::Load || OpCode == Instruction::Store) {
137 SEGNodeBase *getPtrOperand()
const {
return PtrOp; }
138 std::vector<SEGNodeBase *> &getOffsetOperands() {
return OffsetOps; }
149 static bool classof(
const SEGObject *N) {
150 return N->getKind() == SEGOBJK_AllocSite;