Clean up Type class by removing mutable ConstRules member and use annotations insead
authorChris Lattner <sabre@nondot.org>
Sun, 9 Sep 2001 21:02:38 +0000 (21:02 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 9 Sep 2001 21:02:38 +0000 (21:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@516 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Annotation.cpp
lib/VMCore/Type.cpp
support/lib/Support/Annotation.cpp

index fabf34b2db78da319788a3e1a56e9e096f55d752..65a049d42dcc19a18988e7e4abca291e918bbdca 100644 (file)
@@ -28,6 +28,16 @@ AnnotationID AnnotationManager::getID(const string &Name) {  // Name -> ID
   return I->second;
 }
 
+// getID - Name -> ID + registration of a factory function for demand driven
+// annotation support.
+AnnotationID AnnotationManager::getID(const string &Name, Factory Fact,
+                                     void *Data=0) {
+  AnnotationID Result(getID(Name));
+  registerAnnotationFactory(Result, Fact, Data);
+  return Result;                     
+}
+
+
 // getName - This function is especially slow, but that's okay because it should
 // only be used for debugging.
 //
index 033ca952c4c86b468f23e1b22f00e05e3232e72c..87fa581a573ea5c25670a8d86aae04dde7c0bd41 100644 (file)
@@ -29,7 +29,6 @@ Type::Type(const string &name, PrimitiveID id)
   setDescription(name);
   ID = id;
   Abstract = false;
-  ConstRulesImpl = 0;
   UID = CurUID++;       // Assign types UID's as they are created
   UIDMappings.push_back(this);
 }
index fabf34b2db78da319788a3e1a56e9e096f55d752..65a049d42dcc19a18988e7e4abca291e918bbdca 100644 (file)
@@ -28,6 +28,16 @@ AnnotationID AnnotationManager::getID(const string &Name) {  // Name -> ID
   return I->second;
 }
 
+// getID - Name -> ID + registration of a factory function for demand driven
+// annotation support.
+AnnotationID AnnotationManager::getID(const string &Name, Factory Fact,
+                                     void *Data=0) {
+  AnnotationID Result(getID(Name));
+  registerAnnotationFactory(Result, Fact, Data);
+  return Result;                     
+}
+
+
 // getName - This function is especially slow, but that's okay because it should
 // only be used for debugging.
 //