mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-17 00:57:54 +00:00
* Implement DSNode::removeAllIncomingEdges
* Implement Critical Shadow node handling * Implement routines to determine whether an allocation node is a malloc or alloca llvm-svn: 2003
This commit is contained in:
parent
a16c85b43d
commit
4c6e9cda3f
@ -65,6 +65,13 @@ void DSNode::removeReferrer(PointerValSet *PVS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// removeAllIncomingEdges - Erase all edges in the graph that point to this node
|
||||||
|
void DSNode::removeAllIncomingEdges() {
|
||||||
|
while (!Referrers.empty())
|
||||||
|
Referrers.back()->removePointerTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void replaceIn(std::string &S, char From, const std::string &To) {
|
static void replaceIn(std::string &S, char From, const std::string &To) {
|
||||||
for (unsigned i = 0; i < S.size(); )
|
for (unsigned i = 0; i < S.size(); )
|
||||||
if (S[i] == From) {
|
if (S[i] == From) {
|
||||||
@ -145,12 +152,14 @@ NewDSNode::NewDSNode(AllocationInst *V)
|
|||||||
: DSNode(NewNode, V->getType()->getElementType()), Allocation(V) {
|
: DSNode(NewNode, V->getType()->getElementType()), Allocation(V) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NewDSNode::isAllocaNode() const {
|
||||||
|
return isa<AllocaInst>(Allocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string NewDSNode::getCaption() const {
|
string NewDSNode::getCaption() const {
|
||||||
stringstream OS;
|
stringstream OS;
|
||||||
if (isa<MallocInst>(Allocation))
|
OS << (isMallocNode() ? "new " : "alloca ");
|
||||||
OS << "new ";
|
|
||||||
else
|
|
||||||
OS << "alloca ";
|
|
||||||
|
|
||||||
WriteTypeSymbolic(OS, getType(),
|
WriteTypeSymbolic(OS, getType(),
|
||||||
Allocation->getParent()->getParent()->getParent());
|
Allocation->getParent()->getParent()->getParent());
|
||||||
@ -170,11 +179,12 @@ string GlobalDSNode::getCaption() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ShadowDSNode::ShadowDSNode(DSNode *P, Module *M)
|
ShadowDSNode::ShadowDSNode(DSNode *P, Module *M, bool C = false)
|
||||||
: DSNode(ShadowNode, cast<PointerType>(P->getType())->getElementType()) {
|
: DSNode(ShadowNode, cast<PointerType>(P->getType())->getElementType()) {
|
||||||
Parent = P;
|
Parent = P;
|
||||||
Mod = M;
|
Mod = M;
|
||||||
ShadowParent = 0;
|
ShadowParent = 0;
|
||||||
|
CriticalNode = C;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowDSNode::ShadowDSNode(const Type *Ty, Module *M, ShadowDSNode *ShadParent)
|
ShadowDSNode::ShadowDSNode(const Type *Ty, Module *M, ShadowDSNode *ShadParent)
|
||||||
@ -182,12 +192,16 @@ ShadowDSNode::ShadowDSNode(const Type *Ty, Module *M, ShadowDSNode *ShadParent)
|
|||||||
Parent = 0;
|
Parent = 0;
|
||||||
Mod = M;
|
Mod = M;
|
||||||
ShadowParent = ShadParent;
|
ShadowParent = ShadParent;
|
||||||
|
CriticalNode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ShadowDSNode::getCaption() const {
|
std::string ShadowDSNode::getCaption() const {
|
||||||
stringstream OS;
|
stringstream OS;
|
||||||
|
if (CriticalNode) OS << "# ";
|
||||||
|
OS << "shadow ";
|
||||||
WriteTypeSymbolic(OS, getType(), Mod);
|
WriteTypeSymbolic(OS, getType(), Mod);
|
||||||
return "shadow " + OS.str();
|
if (CriticalNode) OS << " #";
|
||||||
|
return OS.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowDSNode::mapNode(map<const DSNode*, DSNode*> &NodeMap,
|
void ShadowDSNode::mapNode(map<const DSNode*, DSNode*> &NodeMap,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user