summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-07-18 00:18:30 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-07-18 00:18:30 +0000
commit30d69a5af91f3a558f0fd6edaf569970bb95f135 (patch)
tree658977b1e94894d6f7bc8d53c68b8d9f4686108a /llvm/lib/Analysis/DataStructure
parent51fe3361b6731f96ffdb924cb6f4769f03a99a8e (diff)
downloadbcm5719-llvm-30d69a5af91f3a558f0fd6edaf569970bb95f135.tar.gz
bcm5719-llvm-30d69a5af91f3a558f0fd6edaf569970bb95f135.zip
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage - Minimize redundant isa<GlobalValue> usage - Correct isa<Constant> for GlobalValue subclass llvm-svn: 14942
Diffstat (limited to 'llvm/lib/Analysis/DataStructure')
-rw-r--r--llvm/lib/Analysis/DataStructure/DataStructureStats.cpp2
-rw-r--r--llvm/lib/Analysis/DataStructure/Local.cpp21
-rw-r--r--llvm/lib/Analysis/DataStructure/Printer.cpp2
3 files changed, 10 insertions, 15 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp b/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp
index 4a3e3851d27..18e97cb018a 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp
+++ b/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp
@@ -102,7 +102,7 @@ void DSGraphStats::countCallees(const Function& F) {
DSNode *DSGraphStats::getNodeForValue(Value *V) {
const DSGraph *G = TDGraph;
- if (isa<GlobalValue>(V) || isa<Constant>(V))
+ if (isa<Constant>(V))
G = TDGraph->getGlobalsGraph();
const DSGraph::ScalarMapTy &ScalarMap = G->getScalarMap();
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp
index 865c14480af..7836555c293 100644
--- a/llvm/lib/Analysis/DataStructure/Local.cpp
+++ b/llvm/lib/Analysis/DataStructure/Local.cpp
@@ -220,10 +220,13 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
// Otherwise we need to create a new node to point to.
// Check first for constant expressions that must be traversed to
// extract the actual value.
- if (Constant *C = dyn_cast<Constant>(V))
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
- return NH = getValueDest(*CPR->getValue());
- } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
+ DSNode* N;
+ if (GlobalValue* GV = dyn_cast<GlobalValue>(V)) {
+ // Create a new global node for this global variable...
+ N = createNode(GV->getType()->getElementType());
+ N->addGlobal(GV);
+ } else if (Constant *C = dyn_cast<Constant>(V)) {
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
if (CE->getOpcode() == Instruction::Cast)
NH = getValueDest(*CE->getOperand(0));
else if (CE->getOpcode() == Instruction::GetElementPtr) {
@@ -247,13 +250,7 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
} else {
assert(0 && "Unknown constant type!");
}
-
- // Otherwise we need to create a new node to point to...
- DSNode *N;
- if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
- // Create a new global node for this global variable...
- N = createNode(GV->getType()->getElementType());
- N->addGlobal(GV);
+ N = createNode(); // just create a shadow node
} else {
// Otherwise just create a shadow node
N = createNode();
@@ -491,8 +488,6 @@ void GraphBuilder::visitInvokeInst(InvokeInst &II) {
void GraphBuilder::visitCallSite(CallSite CS) {
Value *Callee = CS.getCalledValue();
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Callee))
- Callee = CPR->getValue();
// Special case handling of certain libc allocation functions here.
if (Function *F = dyn_cast<Function>(Callee))
diff --git a/llvm/lib/Analysis/DataStructure/Printer.cpp b/llvm/lib/Analysis/DataStructure/Printer.cpp
index 87d6bbc3f40..24bf7683798 100644
--- a/llvm/lib/Analysis/DataStructure/Printer.cpp
+++ b/llvm/lib/Analysis/DataStructure/Printer.cpp
@@ -138,7 +138,7 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
// Add scalar nodes to the graph...
const DSGraph::ScalarMapTy &VM = G->getScalarMap();
for (DSGraph::ScalarMapTy::const_iterator I = VM.begin(); I != VM.end();++I)
- if (!isa<GlobalValue>(I->first) && !isa<ConstantPointerRef>(I->first)) {
+ if (!isa<GlobalValue>(I->first)) {
std::stringstream OS;
WriteAsOperand(OS, I->first, false, true, CurMod);
GW.emitSimpleNode(I->first, "", OS.str());
OpenPOWER on IntegriCloud