Skip to content

Commit cd0750b

Browse files
authored
Remove BasicBlock Values (#1841)
* Remove BasicBlockVal. * Update node count. * Don't put basic block in symbol table. * Remove AsmPCVal. * Remove TODO * More thoroughly ignore ASM et al. * Remove isBasicBlockSym. * Make a dummy node for unhandled values. * Go back to just removing basic block vals.
1 parent 2f1cb3b commit cd0750b

6 files changed

Lines changed: 8 additions & 61 deletions

File tree

svf-llvm/lib/SVFIRBuilder.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,6 @@ void SVFIRBuilder::initialiseValVars()
510510
{
511511
pag->addConstantAggValNode(iter->second, icfgNode, llvmModuleSet()->getSVFType(llvmValue->getType()));
512512
}
513-
else if (SVFUtil::isa<BasicBlock>(llvmValue))
514-
{
515-
pag->addBasicBlockValNode(iter->second, llvmModuleSet()->getSVFType(llvmValue->getType()));
516-
}
517513
else if (SVFUtil::isa<InlineAsm>(llvmValue) ||
518514
SVFUtil::isa<DSOLocalEquivalent>(llvmValue) ||
519515
SVFUtil::isa<NoCFIValue>(llvmValue))

svf-llvm/lib/SymbolTableBuilder.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,15 @@ void SymbolTableBuilder::collectSym(const Value* val)
298298
void SymbolTableBuilder::collectVal(const Value* val)
299299
{
300300
// collect and record special sym here
301-
if (LLVMUtil::isNullPtrSym(val) || LLVMUtil::isBlackholeSym(val))
301+
if (
302+
LLVMUtil::isNullPtrSym(val) ||
303+
LLVMUtil::isBlackholeSym(val) ||
304+
SVFUtil::isa<BasicBlock>(val)
305+
)
302306
{
303307
return;
304308
}
309+
305310
LLVMModuleSet::ValueToIDMapTy::iterator iter = llvmModuleSet()->valSymMap.find(val);
306311
if (iter == llvmModuleSet()->valSymMap.end())
307312
{

svf/include/SVFIR/SVFIR.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,6 @@ class SVFIR : public IRGraph
849849
{
850850
return addValNode(new IntrinsicValVar(i, type));
851851
}
852-
inline NodeID addBasicBlockValNode(NodeID i, const SVFType* type)
853-
{
854-
return addValNode(new BasicBlockValVar(i, type));
855-
}
856852
inline NodeID addAsmPCValNode(NodeID i, const SVFType* type)
857853
{
858854
return addValNode(new AsmPCValVar(i, type));

svf/include/SVFIR/SVFValue.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class SVFValue
8181
// │ └─ Subclass: DummyValVar
8282
DummyValNode, // │ └── Dummy node for uninitialized values
8383
IntrinsicValNode, // │ └── LLVM intrinsic call instruction (e.g. llvm.dbg.declare)
84-
BasicBlockValNode, // │ └── LLVM BasicBlock (label operand of br/switch)
8584
AsmPCValNode, // │ └── InlineAsm, DSOLocalEquivalent, NoCFIValue
8685

8786
// └─ Subclass: ObjVar (Object variable nodes)
@@ -232,7 +231,7 @@ class SVFValue
232231

233232
static inline bool isSVFVarKind(GNodeK n)
234233
{
235-
static_assert(DummyObjNode - ValNode == 29,
234+
static_assert(DummyObjNode - ValNode == 28,
236235
"The number of SVFVarKinds has changed, make sure the "
237236
"range is correct");
238237

@@ -241,7 +240,7 @@ class SVFValue
241240

242241
static inline bool isValVarKinds(GNodeK n)
243242
{
244-
static_assert(AsmPCValNode - ValNode == 16,
243+
static_assert(AsmPCValNode - ValNode == 15,
245244
"The number of ValVarKinds has changed, make sure the "
246245
"range is correct");
247246
return n <= AsmPCValNode && n >= ValNode;

svf/include/SVFIR/SVFVariables.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,46 +2220,6 @@ class IntrinsicValVar: public ValVar
22202220
virtual const std::string toString() const;
22212221
};
22222222

2223-
/*
2224-
* Represents an LLVM BasicBlock (label operand of br/switch).
2225-
* Collected into valSyms as a branch operand but has no ICFGNode.
2226-
*/
2227-
class BasicBlockValVar: public ValVar
2228-
{
2229-
friend class GraphDBClient;
2230-
2231-
public:
2232-
static inline bool classof(const BasicBlockValVar*)
2233-
{
2234-
return true;
2235-
}
2236-
static inline bool classof(const SVFVar* node)
2237-
{
2238-
return node->getNodeKind() == SVFVar::BasicBlockValNode;
2239-
}
2240-
static inline bool classof(const ValVar* node)
2241-
{
2242-
return node->getNodeKind() == SVFVar::BasicBlockValNode;
2243-
}
2244-
static inline bool classof(const GenericPAGNodeTy* node)
2245-
{
2246-
return node->getNodeKind() == SVFVar::BasicBlockValNode;
2247-
}
2248-
static inline bool classof(const SVFValue* node)
2249-
{
2250-
return node->getNodeKind() == SVFVar::BasicBlockValNode;
2251-
}
2252-
2253-
BasicBlockValVar(NodeID i, const SVFType* svfType)
2254-
: ValVar(i, svfType, nullptr, BasicBlockValNode) {}
2255-
2256-
inline const std::string getValueName() const
2257-
{
2258-
return "basicBlockVal";
2259-
}
2260-
virtual const std::string toString() const;
2261-
};
2262-
22632223
/*
22642224
* Represents InlineAsm, DSOLocalEquivalent, and NoCFIValue.
22652225
* These are non-instruction values related to inline assembly,

svf/lib/SVFIR/SVFVariables.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ ValVar::ValVar(NodeID i, const SVFType* svfType, const ICFGNode* node, PNODEK ty
104104
SVFUtil::isa<FunValVar>(this) ||
105105
SVFUtil::isa<DummyValVar>(this) ||
106106
SVFUtil::isa<IntrinsicValVar>(this) ||
107-
SVFUtil::isa<BasicBlockValVar>(this) ||
108107
SVFUtil::isa<AsmPCValVar>(this))
109108
{
110109
// These ValVar subclasses don't require an ICFGNode.
@@ -568,14 +567,6 @@ const std::string IntrinsicValVar::toString() const
568567
return rawstr.str();
569568
}
570569

571-
const std::string BasicBlockValVar::toString() const
572-
{
573-
std::string str;
574-
std::stringstream rawstr(str);
575-
rawstr << "BasicBlockValVar ID: " << getId();
576-
return rawstr.str();
577-
}
578-
579570
const std::string AsmPCValVar::toString() const
580571
{
581572
std::string str;

0 commit comments

Comments
 (0)