11 #ifndef IR_SEG_SEGCALLSITEPSEUDOINPUTNODE_H
12 #define IR_SEG_SEGCALLSITEPSEUDOINPUTNODE_H
14 #include <llvm/IR/BasicBlock.h>
15 #include <llvm/IR/CallSite.h>
16 #include <llvm/IR/Constants.h>
17 #include <llvm/IR/Function.h>
18 #include <llvm/IR/Instructions.h>
19 #include <llvm/IR/Value.h>
20 #include <llvm/Support/FileSystem.h>
21 #include <llvm/Support/Format.h>
22 #include <llvm/Support/raw_ostream.h>
24 #include "CBAccessPath.h"
25 #include "IR/SEG/SymbolicExprGraph.h"
26 #include "Persistence/PersistenceBasis.h"
37 this->index = Node->getIndex();
38 auto *WrappedMod = SEG->getWrappedMod();
39 this->WrappedCallee = dyn_cast<WrappedFunction>(
40 WrappedMod->findWrappedValue(Node->getCalleeFunctionID()));
41 this->WrappedCallSiteInst = dyn_cast<WrappedInstruction>(
42 WrappedMod->findWrappedValue(Node->getCallSiteInstructionID()));
43 if (this->WrappedCallee) {
44 if (Function *callee = this->WrappedCallee->getRealFunc())
45 this->Callee = callee;
47 if (this->WrappedCallSiteInst) {
48 if (Instruction *CSI = this->WrappedCallSiteInst->getRealInstruction())
49 this->LLVMCS = CallSite(CSI);
59 WrappedInstruction *WrappedCallSiteInst =
nullptr;
61 Function *Callee =
nullptr;
62 WrappedFunction *WrappedCallee =
nullptr;
67 LLVMCS(CS), Callee(Callee), index(-1) {
68 access_path.reset(Val);
69 WrappedCallee = WrappedValue::findWrappedFunction(Callee);
71 WrappedValue::findWrappedInstruction(CS.getInstruction());
84 virtual PersistedSEGObject *createPersistedObject()
const {
85 PersistedSEGObject *
PersistedObj =
new PersistedSEGCallSitePseudoInputNode;
89 CallSite getCallSite()
const {
return LLVMCS; }
91 WrappedCallSite getWrappedCallSite()
const {
92 return WrappedCallSite(WrappedCallSiteInst);
95 WrappedInstruction *getWrappedCallSiteInst()
const {
96 return WrappedCallSiteInst;
99 Function *getCallee()
const {
return Callee; }
101 WrappedFunction *getWrappedCallee()
const {
return WrappedCallee; }
103 virtual size_t getIndex()
const {
return index; }
105 const CBAccessPath &getAccessPath()
const {
return access_path; }
109 virtual std::string getSrcFile()
const {
110 if (WrappedCallSiteInst) {
111 return WrappedCallSiteInst->getSrcFileName();
113 return SEGNodeBase::getSrcFile();
116 virtual std::int32_t getSrcLine()
const {
117 if (WrappedCallSiteInst) {
118 return WrappedCallSiteInst->getSrcLine();
120 return SEGNodeBase::getSrcLine();
124 static bool classof(
const SEGObject *N) {
125 return N->getKind() == SEGOBJK_CallSitePseudoInput;