[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureStats.cpp Local.cpp Printer.cpp
LLVM
llvm at cs.uiuc.edu
Sat Jul 17 17:18:40 PDT 2004
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructureStats.cpp updated: 1.11 -> 1.12
Local.cpp updated: 1.107 -> 1.108
Printer.cpp updated: 1.70 -> 1.71
---
Log message:
bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
---
Diffs of the changes: (+10 -15)
Index: llvm/lib/Analysis/DataStructure/DataStructureStats.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.11 llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.12
--- llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.11 Wed Jul 7 01:32:21 2004
+++ llvm/lib/Analysis/DataStructure/DataStructureStats.cpp Sat Jul 17 19:18:30 2004
@@ -102,7 +102,7 @@
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();
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.107 llvm/lib/Analysis/DataStructure/Local.cpp:1.108
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.107 Wed Jul 7 01:32:21 2004
+++ llvm/lib/Analysis/DataStructure/Local.cpp Sat Jul 17 19:18:30 2004
@@ -220,10 +220,13 @@
// 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 @@
} 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::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))
Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.70 llvm/lib/Analysis/DataStructure/Printer.cpp:1.71
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.70 Wed Jul 7 01:32:21 2004
+++ llvm/lib/Analysis/DataStructure/Printer.cpp Sat Jul 17 19:18:30 2004
@@ -138,7 +138,7 @@
// 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());
More information about the llvm-commits
mailing list