-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor Global/Constant Val/Obj #1621
Conversation
@@ -40,12 +40,18 @@ using namespace SVFUtil; | |||
* SVFVar constructor | |||
*/ | |||
SVFVar::SVFVar(const SVFValue* val, NodeID i, PNODEK k) : | |||
GenericPAGNodeTy(i,k), value(val), func(nullptr) | |||
GenericPAGNodeTy(i,k), value(val), func(nullptr) | |||
{ | |||
assert( ValNode <= k && k <= DummyObjNode && "new SVFIR node kind?"); | |||
switch (k) | |||
{ | |||
case ValNode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to follow the order and format here:
SVF/svf/include/Graphs/GenericGraph.h
Line 142 in 43e7eac
enum GNodeK |
if (chaVtbls.find(vtbl) != chaVtbls.end()) | ||
vtbls.insert(vtbl); | ||
// ptd is global obj var or ptd's base is global val/obj var | ||
if (SVFUtil::varHasGlobalValue(ptdnode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use downcasting?
@@ -439,6 +440,12 @@ class GepValVar: public ValVar | |||
return ap.getConstantStructFldIdx(); | |||
} | |||
|
|||
/// Return the base object from which this GEP node came from. | |||
inline NodeID getBaseNode(void) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this method? Can we get the basenode from its current nodeID?
svf-llvm/lib/SVFIRBuilder.cpp
Outdated
else if (auto dataValue = SVFUtil::dyn_cast<ConstantData>(llvmValue)) | ||
{ | ||
pag->addConstantDataValNode(iter->first, iter->second, icfgNode); | ||
llvmModuleSet()->setValueAttr(dataValue, pag->getGNode(iter->second)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setValueAttr => addToLLVMVal2SVFVarMap
|
||
inline NodeID addConstantFPObjNode(const SVFValue* curInst, double dval, const NodeID i) | ||
{ | ||
const MemObj* mem = getMemObj(curInst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemObj == BaseObj
svf/include/Util/SVFUtil.h
Outdated
@@ -441,6 +441,7 @@ inline const ValVar* getActualParmAtForkSite(const CallICFGNode* cs) | |||
|
|||
bool isProgExitCall(const CallICFGNode* cs); | |||
|
|||
bool varHasGlobalValue(const SVFVar* var); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
svf/include/Graphs/GenericGraph.h
Outdated
@@ -158,6 +158,12 @@ class SVFBaseNode | |||
GepValNode, // ├──Represents a GEP value variable | |||
RetNode, // ├──Represents a return value node | |||
VarargNode, // ├──Represents a variadic argument node | |||
GlobalValNode, // ├──Represents a global variable node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligin the classes
svf/lib/Util/SVFUtil.cpp
Outdated
@@ -430,4 +430,19 @@ const ObjVar* SVFUtil::getObjVarOfValVar(const SVF::ValVar* valVar) | |||
{ | |||
assert(valVar->getInEdges().size() == 1); | |||
return SVFUtil::dyn_cast<ObjVar>((*valVar->getInEdges().begin())->getSrcNode()); | |||
} | |||
|
|||
bool SVFUtil::varHasGlobalValue(const SVF::SVFVar* var) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.
1) remove unused format 2) remove confusing function like varHasGlobalVar 3) align the comment
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1621 +/- ##
==========================================
- Coverage 62.93% 62.84% -0.09%
==========================================
Files 247 247
Lines 27510 27700 +190
Branches 4535 4545 +10
==========================================
+ Hits 17313 17409 +96
- Misses 10197 10291 +94
|
--- pr.out 2025-01-06 19:08:00.126734684 +1100 General Stats****** PTACallGraph Stats (Andersen analysis)****** Memory SSA Statistics****** PTACallGraph Stats (Flow-sensitive analysis)****** Persistent Points-To Cache Statistics: flow-sensitive analysis bitvector |
--- log/redis-server.log 2025-01-06 22:33:29.475188962 +1100 PTACallGraph Stats (Andersen analysis)****** Memory SSA Statistics****** Persistent Points-To Cache Statistics: flow-sensitive analysis bitvector |
ConstantFPObjVar(NodeID i) : ConstantDataObjVar(i) {} | ||
|
||
private: | ||
float dval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float -> double
@@ -427,9 +428,9 @@ class GepValVar: public ValVar | |||
//@} | |||
|
|||
/// Constructor | |||
GepValVar(const SVFValue* val, NodeID i, const AccessPath& ap, | |||
GepValVar(NodeID baseID, const SVFValue* val, NodeID i, const AccessPath& ap, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need SVFValue as an argument?
No description provided.