diff --git a/svf-llvm/lib/LLVMModule.cpp b/svf-llvm/lib/LLVMModule.cpp index a9d0cdf1c..c4bbd9a53 100644 --- a/svf-llvm/lib/LLVMModule.cpp +++ b/svf-llvm/lib/LLVMModule.cpp @@ -290,13 +290,7 @@ void LLVMModuleSet::createSVFFunction(const Function* func) SVFInstruction* svfInst = nullptr; if (const CallBase* call = SVFUtil::dyn_cast(&inst)) { - if (cppUtil::isVirtualCallSite(call)) - svfInst = new SVFVirtualCallInst( - getSVFType(call->getType()), svfBB, - call->getFunctionType()->isVarArg(), - inst.isTerminator()); - else - svfInst = new SVFCallInst( + svfInst = new SVFCallInst( getSVFType(call->getType()), svfBB, call->getFunctionType()->isVarArg(), inst.isTerminator()); @@ -379,12 +373,6 @@ void LLVMModuleSet::initSVFBasicBlock(const Function* func) { svfcall->setCalledOperand(getSVFValue(called_llvmval)); } - if(SVFVirtualCallInst* virtualCall = SVFUtil::dyn_cast(svfcall)) - { - virtualCall->setVtablePtr(getSVFValue(cppUtil::getVCallVtblPtr(call))); - virtualCall->setFunIdxInVtable(cppUtil::getVCallIdx(call)); - virtualCall->setFunNameOfVirtualCall(cppUtil::getFunNameOfVCallSite(call)); - } for(u32_t i = 0; i < call->arg_size(); i++) { SVFValue* svfval = getSVFValue(call->getArgOperand(i)); diff --git a/svf/include/SVFIR/SVFFileSystem.h b/svf/include/SVFIR/SVFFileSystem.h index b3ab13b39..0fc17af3e 100644 --- a/svf/include/SVFIR/SVFFileSystem.h +++ b/svf/include/SVFIR/SVFFileSystem.h @@ -116,7 +116,6 @@ class SVFFunction; class SVFBasicBlock; class SVFInstruction; class SVFCallInst; -class SVFVirtualCallInst; class SVFConstant; class SVFGlobalValue; class SVFArgument; @@ -516,7 +515,6 @@ class SVFIRWriter cJSON* contentToJson(const SVFBasicBlock* value); cJSON* contentToJson(const SVFInstruction* value); cJSON* contentToJson(const SVFCallInst* value); - cJSON* contentToJson(const SVFVirtualCallInst* value); cJSON* contentToJson(const SVFConstant* value); cJSON* contentToJson(const SVFGlobalValue* value); cJSON* contentToJson(const SVFArgument* value); @@ -1290,7 +1288,6 @@ class SVFIRReader void fill(const cJSON*& fieldJson, SVFBasicBlock* value); void fill(const cJSON*& fieldJson, SVFInstruction* value); void fill(const cJSON*& fieldJson, SVFCallInst* value); - void fill(const cJSON*& fieldJson, SVFVirtualCallInst* value); void fill(const cJSON*& fieldJson, SVFConstant* value); void fill(const cJSON*& fieldJson, SVFGlobalValue* value); void fill(const cJSON*& fieldJson, SVFArgument* value); diff --git a/svf/include/SVFIR/SVFValue.h b/svf/include/SVFIR/SVFValue.h index 751d66361..1d7794af7 100644 --- a/svf/include/SVFIR/SVFValue.h +++ b/svf/include/SVFIR/SVFValue.h @@ -735,66 +735,6 @@ class SVFCallInst : public SVFInstruction } }; -class SVFVirtualCallInst : public SVFCallInst -{ - friend class SVFIRWriter; - friend class SVFIRReader; - friend class LLVMModuleSet; - -private: - const SVFValue* vCallVtblPtr; /// virtual table pointer - s32_t virtualFunIdx; /// virtual function index of the virtual table(s) at a virtual call - std::string funNameOfVcall; /// the function name of this virtual call - -protected: - inline void setFunIdxInVtable(s32_t idx) - { - virtualFunIdx = idx; - } - inline void setFunNameOfVirtualCall(const std::string& name) - { - funNameOfVcall = name; - } - inline void setVtablePtr(const SVFValue* vptr) - { - vCallVtblPtr = vptr; - } - -public: - SVFVirtualCallInst(const SVFType* ty, const SVFBasicBlock* b, bool vararg, - bool tm) - : SVFCallInst(ty, b, vararg, tm, SVFVCall), vCallVtblPtr(nullptr), - virtualFunIdx(-1), funNameOfVcall() - { - } - inline const SVFValue* getVtablePtr() const - { - assert(vCallVtblPtr && "virtual call does not have a vtblptr? set it first"); - return vCallVtblPtr; - } - inline s32_t getFunIdxInVtable() const - { - assert(virtualFunIdx >=0 && "virtual function idx is less than 0? not set yet?"); - return virtualFunIdx; - } - inline const std::string& getFunNameOfVirtualCall() const - { - return funNameOfVcall; - } - static inline bool classof(const SVFValue *node) - { - return node->getKind() == SVFVCall; - } - static inline bool classof(const SVFInstruction *node) - { - return node->getKind() == SVFVCall; - } - static inline bool classof(const SVFCallInst *node) - { - return node->getKind() == SVFVCall; - } -}; - class SVFConstant : public SVFValue { friend class SVFIRWriter; diff --git a/svf/lib/SVFIR/SVFFileSystem.cpp b/svf/lib/SVFIR/SVFFileSystem.cpp index 0dfe58ac9..a930fe52a 100644 --- a/svf/lib/SVFIR/SVFFileSystem.cpp +++ b/svf/lib/SVFIR/SVFFileSystem.cpp @@ -61,8 +61,6 @@ static SVFValue* createSVFValue(SVFValue::GNodeK kind, const SVFType* type, return new SVFInstruction(type, {}, {}, {}); case SVFValue::SVFCall: return new SVFCallInst(type, {}, {}, {}); - case SVFValue::SVFVCall: - return new SVFVirtualCallInst(type, {}, {}, {}); case SVFValue::SVFGlob: return new SVFGlobalValue(type); case SVFValue::SVFArg: @@ -189,7 +187,6 @@ cJSON* SVFIRWriter::virtToJson(const SVFValue* value) CASE(SVFBB, SVFBasicBlock); CASE(SVFInst, SVFInstruction); CASE(SVFCall, SVFCallInst); - CASE(SVFVCall, SVFVirtualCallInst); CASE(SVFGlob, SVFGlobalValue); CASE(SVFArg, SVFArgument); CASE(SVFConst, SVFConstant); @@ -578,15 +575,6 @@ cJSON* SVFIRWriter::contentToJson(const SVFCallInst* value) return root; } -cJSON* SVFIRWriter::contentToJson(const SVFVirtualCallInst* value) -{ - cJSON* root = contentToJson(static_cast(value)); - JSON_WRITE_FIELD(root, value, vCallVtblPtr); - JSON_WRITE_FIELD(root, value, virtualFunIdx); - JSON_WRITE_FIELD(root, value, funNameOfVcall); - return root; -} - cJSON* SVFIRWriter::contentToJson(const SVFConstant* value) { return contentToJson(static_cast(value)); @@ -2308,7 +2296,6 @@ void SVFIRReader::virtFill(const cJSON*& fieldJson, SVFValue* value) CASE(SVFBB, SVFBasicBlock); CASE(SVFInst, SVFInstruction); CASE(SVFCall, SVFCallInst); - CASE(SVFVCall, SVFVirtualCallInst); CASE(SVFGlob, SVFGlobalValue); CASE(SVFArg, SVFArgument); CASE(SVFConst, SVFConstant); @@ -2373,14 +2360,6 @@ void SVFIRReader::fill(const cJSON*& fieldJson, SVFCallInst* value) JSON_READ_FIELD_FWD(fieldJson, value, calledVal); } -void SVFIRReader::fill(const cJSON*& fieldJson, SVFVirtualCallInst* value) -{ - fill(fieldJson, static_cast(value)); - JSON_READ_FIELD_FWD(fieldJson, value, vCallVtblPtr); - JSON_READ_FIELD_FWD(fieldJson, value, virtualFunIdx); - JSON_READ_FIELD_FWD(fieldJson, value, funNameOfVcall); -} - void SVFIRReader::fill(const cJSON*& fieldJson, SVFConstant* value) { fill(fieldJson, static_cast(value));