[llvm-commits] CVS: llvm/lib/VMCore/SlotCalculator.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jan 15 12:48:21 PST 2004
Changes in directory llvm/lib/VMCore:
SlotCalculator.cpp updated: 1.44 -> 1.45
---
Log message:
The bcwriter does not want ConstantPointerRef's to be indexed, and the asmwriter never did!
---
Diffs of the changes: (+14 -5)
Index: llvm/lib/VMCore/SlotCalculator.cpp
diff -u llvm/lib/VMCore/SlotCalculator.cpp:1.44 llvm/lib/VMCore/SlotCalculator.cpp:1.45
--- llvm/lib/VMCore/SlotCalculator.cpp:1.44 Wed Jan 14 17:34:39 2004
+++ llvm/lib/VMCore/SlotCalculator.cpp Thu Jan 15 12:47:15 2004
@@ -321,17 +321,26 @@
SC_DEBUG("end purgeFunction!\n");
}
-int SlotCalculator::getSlot(const Value *D) const {
- std::map<const Value*, unsigned>::const_iterator I = NodeMap.find(D);
- if (I == NodeMap.end()) return -1;
-
- return (int)I->second;
+int SlotCalculator::getSlot(const Value *V) const {
+ std::map<const Value*, unsigned>::const_iterator I = NodeMap.find(V);
+ if (I != NodeMap.end())
+ return (int)I->second;
+
+ // Do not number ConstantPointerRef's at all. They are an abomination.
+ if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V))
+ return getSlot(CPR->getValue());
+
+ return -1;
}
int SlotCalculator::getOrCreateSlot(const Value *V) {
int SlotNo = getSlot(V); // Check to see if it's already in!
if (SlotNo != -1) return SlotNo;
+
+ // Do not number ConstantPointerRef's at all. They are an abomination.
+ if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V))
+ return getOrCreateSlot(CPR->getValue());
if (!isa<GlobalValue>(V))
if (const Constant *C = dyn_cast<Constant>(V)) {
More information about the llvm-commits
mailing list