summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-03 15:39:36 +0000
committerChris Lattner <sabre@nondot.org>2001-10-03 15:39:36 +0000
commit883ad0b3529c6c9bf39f91810e10ab167619f244 (patch)
treeb685b9f9c88cafd9c34facd31ef45c1e5b7ead06 /llvm/lib
parentad95d1d12f4ec676ff4fbedb3ca0dca2ff5b6951 (diff)
downloadbcm5719-llvm-883ad0b3529c6c9bf39f91810e10ab167619f244.tar.gz
bcm5719-llvm-883ad0b3529c6c9bf39f91810e10ab167619f244.zip
Rename getNullPointer to getNull
Allow sharing of null pointer constants llvm-svn: 709
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/ConstPoolVals.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ConstPoolVals.cpp b/llvm/lib/VMCore/ConstPoolVals.cpp
index 6c054e1ee07..eeb7a43069f 100644
--- a/llvm/lib/VMCore/ConstPoolVals.cpp
+++ b/llvm/lib/VMCore/ConstPoolVals.cpp
@@ -46,7 +46,7 @@ ConstPoolVal *ConstPoolVal::getNullConstant(const Type *Ty) {
case Type::DoubleTyID: return ConstPoolFP::get(Ty, 0);
case Type::PointerTyID:
- return ConstPoolPointer::getNullPointer(cast<PointerType>(Ty));
+ return ConstPoolPointer::getNull(cast<PointerType>(Ty));
default:
return 0;
}
@@ -331,3 +331,15 @@ ConstPoolStruct *ConstPoolStruct::get(const StructType *Ty,
StructConstants.add(Ty, V, Result = new ConstPoolStruct(Ty, V));
return Result;
}
+
+//---- ConstPoolPointer::get() implementation...
+//
+static ValueMap<char, ConstPoolPointer> NullPtrConstants;
+
+ConstPoolPointer *ConstPoolPointer::getNull(const PointerType *Ty) {
+ ConstPoolPointer *Result = NullPtrConstants.get(Ty, 0);
+ if (!Result) // If no preexisting value, create one now...
+ NullPtrConstants.add(Ty, 0, Result = new ConstPoolPointer(Ty));
+ return Result;
+}
+
OpenPOWER on IntegriCloud