summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-15 18:47:15 +0000
committerChris Lattner <sabre@nondot.org>2004-01-15 18:47:15 +0000
commit21699e8f5540ef9df9cfdd92f079c6b0cb1bd422 (patch)
tree5261c6bf9811ad4ebb0bf803d9a421c369c2e7ba
parentf4572852dc7fc58370925a695f3cae9ec224561a (diff)
downloadbcm5719-llvm-21699e8f5540ef9df9cfdd92f079c6b0cb1bd422.tar.gz
bcm5719-llvm-21699e8f5540ef9df9cfdd92f079c6b0cb1bd422.zip
The bcwriter does not want ConstantPointerRef's to be indexed, and the asmwriter never did!
llvm-svn: 10885
-rw-r--r--llvm/lib/VMCore/SlotCalculator.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/SlotCalculator.cpp b/llvm/lib/VMCore/SlotCalculator.cpp
index 283ca96bd26..6ce2f35ffb1 100644
--- a/llvm/lib/VMCore/SlotCalculator.cpp
+++ b/llvm/lib/VMCore/SlotCalculator.cpp
@@ -321,11 +321,16 @@ void SlotCalculator::purgeFunction() {
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;
}
@@ -333,6 +338,10 @@ 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)) {
// If we are emitting a bytecode file, do not index the characters that
OpenPOWER on IntegriCloud