s/class Metadata/class MetadataContext/g
authorDevang Patel <dpatel@apple.com>
Mon, 28 Sep 2009 21:41:20 +0000 (21:41 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 28 Sep 2009 21:41:20 +0000 (21:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83019 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/llvm/LLVMContext.h
include/llvm/Metadata.h
include/llvm/Value.h
lib/AsmParser/LLParser.cpp
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/Bitcode/Writer/ValueEnumerator.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/LLVMContext.cpp
lib/VMCore/LLVMContextImpl.h
lib/VMCore/Metadata.cpp

index 5e8cd1a88e026c3bc2e03a9f70b86e442d1bdc9e..42b4ea69b93416380f01d0258f3a159a96a50245 100644 (file)
@@ -18,7 +18,7 @@
 namespace llvm {
 
 class LLVMContextImpl;
-class Metadata;
+class MetadataContext;
 /// This is an important class for using LLVM in a threaded context.  It
 /// (opaquely) owns and manages the core "global" data of LLVM's core 
 /// infrastructure, including the type and constant uniquing tables.
@@ -30,7 +30,7 @@ class LLVMContext {
   void operator=(LLVMContext&);
 public:
   LLVMContextImpl* pImpl;
-  Metadata &getMetadata();
+  MetadataContext &getMetadata();
   bool RemoveDeadMetadata();
   LLVMContext();
   ~LLVMContext();
index d799ea4981bf16feb818847af14d1d37f9bf2c27..883de23cf1aa31af1a35d48cfe35aef6a704b509 100644 (file)
@@ -304,10 +304,10 @@ public:
 };
 
 //===----------------------------------------------------------------------===//
-/// Metadata -
-/// Metadata manages metadata used in a context.
+/// MetadataContext -
+/// MetadataContext manages metadata used in a context.
 
-class Metadata {
+class MetadataContext {
 public:
   typedef std::pair<unsigned, WeakVH> MDPairTy;
   typedef SmallVector<MDPairTy, 2> MDMapTy;
index ab6247e801df7948d2bc7918eb4cf64d502518c2..6b393f603a61b93bfc2b06f9651fbeb1dc44849c 100644 (file)
@@ -42,7 +42,7 @@ class raw_ostream;
 class AssemblyAnnotationWriter;
 class ValueHandleBase;
 class LLVMContext;
-class Metadata;
+class MetadataContext;
 
 //===----------------------------------------------------------------------===//
 //                                 Value Class
@@ -83,7 +83,7 @@ private:
   friend class ValueSymbolTable; // Allow ValueSymbolTable to directly mod Name.
   friend class SymbolTable;      // Allow SymbolTable to directly poke Name.
   friend class ValueHandleBase;
-  friend class Metadata;
+  friend class MetadataContext;
   friend class AbstractTypeUser;
   ValueName *Name;
 
index 1543e4b0a8478ac5e715c27650df4d459c7c353c..b2b6b751ee0a0a47379b2dfe401f83c3fe2f9529 100644 (file)
@@ -1038,7 +1038,7 @@ bool LLParser::ParseOptionalDbgInfo() {
   MetadataBase *Node;
   if (ParseMDNode(Node)) return true;
 
-  Metadata &TheMetadata = M->getContext().getMetadata();
+  MetadataContext &TheMetadata = M->getContext().getMetadata();
   unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
   if (!MDDbgKind)
     MDDbgKind = TheMetadata.RegisterMDKind("dbg");
@@ -2656,7 +2656,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
       ParseOptionalDbgInfo();
 
     // Set metadata attached with this instruction.
-    Metadata &TheMetadata = M->getContext().getMetadata();
+    MetadataContext &TheMetadata = M->getContext().getMetadata();
     for (SmallVector<std::pair<unsigned, MDNode *>, 2>::iterator
            MDI = MDsOnInst.begin(), MDE = MDsOnInst.end(); MDI != MDE; ++MDI)
       TheMetadata.setMD(MDI->first, MDI->second, Inst);
index 0150f000484530d4bbc28a52d06d054a4815b125..f5ddd3ff3ba98fc0c1e62351fa4c32c220169cf6 100644 (file)
@@ -839,7 +839,7 @@ bool BitcodeReader::ParseMetadata() {
       unsigned Kind = Record[0];
       for (unsigned i = 1; i != RecordLength; ++i)
         Name[i-1] = Record[i];
-      Metadata &TheMetadata = Context.getMetadata();
+      MetadataContext &TheMetadata = Context.getMetadata();
       assert(TheMetadata.MDHandlerNames.find(Name.str())
              == TheMetadata.MDHandlerNames.end() &&
              "Already registered MDKind!");
@@ -1556,7 +1556,7 @@ bool BitcodeReader::ParseMetadataAttachment() {
   if (Stream.EnterSubBlock(bitc::METADATA_ATTACHMENT_ID))
     return Error("Malformed block record");
 
-  Metadata &TheMetadata = Context.getMetadata();
+  MetadataContext &TheMetadata = Context.getMetadata();
   SmallVector<uint64_t, 64> Record;
   while(1) {
     unsigned Code = Stream.ReadCode();
index 3511dbc96cae377795b8a7e3b7becdea59ed4a3d..5857c5914bbaa43d25daa3438df0281cd094aa12 100644 (file)
@@ -562,15 +562,15 @@ static void WriteMetadataAttachment(const Function &F,
 
   // Write metadata attachments
   // METADATA_ATTACHMENT - [m x [value, [n x [id, mdnode]]]
-  Metadata &TheMetadata = F.getContext().getMetadata();
+  MetadataContext &TheMetadata = F.getContext().getMetadata();
   for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
     for (BasicBlock::const_iterator I = BB->begin(), E = BB->end();
          I != E; ++I) {
-      const Metadata::MDMapTy *P = TheMetadata.getMDs(I);
+      const MetadataContext::MDMapTy *P = TheMetadata.getMDs(I);
       if (!P) continue;
       bool RecordedInstruction = false;
-      for (Metadata::MDMapTy::const_iterator PI = P->begin(), PE = P->end();
-           PI != PE; ++PI) {
+      for (MetadataContext::MDMapTy::const_iterator PI = P->begin(), 
+             PE = P->end(); PI != PE; ++PI) {
         if (MDNode *ND = dyn_cast_or_null<MDNode>(PI->second)) {
           if (RecordedInstruction == false) {
             Record.push_back(VE.getInstructionID(I));
@@ -601,7 +601,7 @@ static void WriteModuleMetadataStore(const Module *M,
 
   // Write metadata kinds
   // METADATA_KIND - [n x [id, name]]
-  Metadata &TheMetadata = M->getContext().getMetadata();
+  MetadataContext &TheMetadata = M->getContext().getMetadata();
   const StringMap<unsigned> *Kinds = TheMetadata.getHandlerNames();
   for (StringMap<unsigned>::const_iterator
          I = Kinds->begin(), E = Kinds->end(); I != E; ++I) {
index 97219afa46ecd8c8682fa63e04c68452d4b9e97a..60253ad91e6ec2913a7dd9f1abc32e37087ff737 100644 (file)
@@ -86,7 +86,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
          I != E; ++I)
       EnumerateType(I->getType());
 
-    Metadata &TheMetadata = F->getContext().getMetadata();
+    MetadataContext &TheMetadata = F->getContext().getMetadata();
     for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
       for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
         for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
@@ -99,9 +99,9 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
           EnumerateAttributes(II->getAttributes());
 
         // Enumerate metadata attached with this instruction.
-        const Metadata::MDMapTy *MDs = TheMetadata.getMDs(I);
+        const MetadataContext::MDMapTy *MDs = TheMetadata.getMDs(I);
         if (MDs)
-          for (Metadata::MDMapTy::const_iterator MI = MDs->begin(),
+          for (MetadataContext::MDMapTy::const_iterator MI = MDs->begin(),
                  ME = MDs->end(); MI != ME; ++MI)
             if (MDNode *MDN = dyn_cast_or_null<MDNode>(MI->second))
               EnumerateMetadata(MDN);
index 53a2e6427dbb6cd9aa1c6d0fd7f069e20ed991bb..1b28bbd1976e256bc6009885dc80ad9b138af664 100644 (file)
@@ -372,7 +372,7 @@ void SelectionDAGISel::SelectBasicBlock(BasicBlock *LLVMBB,
                                         BasicBlock::iterator Begin,
                                         BasicBlock::iterator End) {
   SDL->setCurrentBasicBlock(BB);
-  Metadata &TheMetadata = LLVMBB->getParent()->getContext().getMetadata();
+  MetadataContext &TheMetadata = LLVMBB->getParent()->getContext().getMetadata();
   unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
 
   // Lower all of the non-terminator instructions. If a call is emitted
@@ -655,7 +655,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
 #endif
                                 );
 
-  Metadata &TheMetadata = Fn.getContext().getMetadata();
+  MetadataContext &TheMetadata = Fn.getContext().getMetadata();
   unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
 
   // Iterate over all basic blocks in the function.
index b8e5ec026574bfc1ece43a63c4050eb1530cf862..a8b3d05a032f4c258e0666426f30e74e715ba41c 100644 (file)
@@ -678,7 +678,7 @@ void SlotTracker::processFunction() {
 
   ST_DEBUG("Inserting Instructions:\n");
 
-  Metadata &TheMetadata = TheFunction->getContext().getMetadata();
+  MetadataContext &TheMetadata = TheFunction->getContext().getMetadata();
 
   // Add all of the basic blocks and instructions with no names.
   for (Function::const_iterator BB = TheFunction->begin(),
@@ -695,9 +695,9 @@ void SlotTracker::processFunction() {
           CreateMetadataSlot(N);
 
       // Process metadata attached with this instruction.
-      const Metadata::MDMapTy *MDs = TheMetadata.getMDs(I);
+      const MetadataContext::MDMapTy *MDs = TheMetadata.getMDs(I);
       if (MDs)
-        for (Metadata::MDMapTy::const_iterator MI = MDs->begin(),
+        for (MetadataContext::MDMapTy::const_iterator MI = MDs->begin(),
                ME = MDs->end(); MI != ME; ++MI)
           if (MDNode *MDN = dyn_cast_or_null<MDNode>(MI->second))
             CreateMetadataSlot(MDN);
@@ -1275,7 +1275,7 @@ public:
     : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) {
     AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M);
     // FIXME: Provide MDPrinter
-    Metadata &TheMetadata = M->getContext().getMetadata();
+    MetadataContext &TheMetadata = M->getContext().getMetadata();
     const StringMap<unsigned> *Names = TheMetadata.getHandlerNames();
     for (StringMapConstIterator<unsigned> I = Names->begin(),
            E = Names->end(); I != E; ++I) {
@@ -2001,10 +2001,10 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
   }
 
   // Print Metadata info
-  Metadata &TheMetadata = I.getContext().getMetadata();
-  const Metadata::MDMapTy *MDMap = TheMetadata.getMDs(&I);
+  MetadataContext &TheMetadata = I.getContext().getMetadata();
+  const MetadataContext::MDMapTy *MDMap = TheMetadata.getMDs(&I);
   if (MDMap)
-    for (Metadata::MDMapTy::const_iterator MI = MDMap->begin(),
+    for (MetadataContext::MDMapTy::const_iterator MI = MDMap->begin(),
            ME = MDMap->end(); MI != ME; ++MI)
       if (const MDNode *MD = dyn_cast_or_null<MDNode>(MI->second))
         Out << ", " << MDNames[MI->first]
index 03f04366a44b8014544f8701a00ee106d374445f..39ed7ed688282b844bdfdf3a27429a2df5f92b73 100644 (file)
@@ -71,6 +71,6 @@ bool LLVMContext::RemoveDeadMetadata() {
   return Changed;
 }
 
-Metadata &LLVMContext::getMetadata() {
+MetadataContext &LLVMContext::getMetadata() {
   return pImpl->TheMetadata;
 }
index e4660c277debb5d9796c1966558c1cd412dffa87..83888c3907bf99f9b9f2f226e7614a74d6657078 100644 (file)
@@ -179,7 +179,7 @@ public:
   typedef DenseMap<Value*, ValueHandleBase*> ValueHandlesTy;
   ValueHandlesTy ValueHandles;
   
-  Metadata TheMetadata;
+  MetadataContext TheMetadata;
   LLVMContextImpl(LLVMContext &C) : TheTrueVal(0), TheFalseVal(0),
     VoidTy(C, Type::VoidTyID),
     LabelTy(C, Type::LabelTyID),
index 3daae13dd18c8e7220bbab8bf615b87b79ffd7b7..ddd510347b96028c7eea9ed28ef1881c066b43b2 100644 (file)
@@ -259,7 +259,7 @@ NamedMDNode::~NamedMDNode() {
 
 /// RegisterMDKind - Register a new metadata kind and return its ID.
 /// A metadata kind can be registered only once. 
-unsigned Metadata::RegisterMDKind(const char *Name) {
+unsigned MetadataContext::RegisterMDKind(const char *Name) {
   unsigned Count = MDHandlerNames.size();
   StringMap<unsigned>::iterator I = MDHandlerNames.find(Name);
   assert(I == MDHandlerNames.end() && "Already registered MDKind!");
@@ -269,7 +269,7 @@ unsigned Metadata::RegisterMDKind(const char *Name) {
 
 /// getMDKind - Return metadata kind. If the requested metadata kind
 /// is not registered then return 0.
-unsigned Metadata::getMDKind(const char *Name) {
+unsigned MetadataContext::getMDKind(const char *Name) {
   StringMap<unsigned>::iterator I = MDHandlerNames.find(Name);
   if (I == MDHandlerNames.end())
     return 0;
@@ -278,7 +278,7 @@ unsigned Metadata::getMDKind(const char *Name) {
 }
 
 /// setMD - Attach the metadata of given kind with an Instruction.
-void Metadata::setMD(unsigned MDKind, MDNode *Node, Instruction *Inst) {
+void MetadataContext::setMD(unsigned MDKind, MDNode *Node, Instruction *Inst) {
   MDStoreTy::iterator I = MetadataStore.find(Inst);
   Inst->HasMetadata = true;
   if (I == MetadataStore.end()) {
@@ -295,7 +295,7 @@ void Metadata::setMD(unsigned MDKind, MDNode *Node, Instruction *Inst) {
 
 /// getMD - Get the metadata of given kind attached with an Instruction.
 /// If the metadata is not found then return 0.
-MDNode *Metadata::getMD(unsigned MDKind, const Instruction *Inst) {
+MDNode *MetadataContext::getMD(unsigned MDKind, const Instruction *Inst) {
   MDNode *Node = NULL;
   MDStoreTy::iterator I = MetadataStore.find(Inst);
   if (I == MetadataStore.end())
@@ -309,7 +309,7 @@ MDNode *Metadata::getMD(unsigned MDKind, const Instruction *Inst) {
 }
 
 /// getMDs - Get the metadata attached with an Instruction.
-const Metadata::MDMapTy *Metadata::getMDs(const Instruction *Inst) {
+const MetadataContext::MDMapTy *MetadataContext::getMDs(const Instruction *Inst) {
   MDStoreTy::iterator I = MetadataStore.find(Inst);
   if (I == MetadataStore.end())
     return NULL;
@@ -319,13 +319,13 @@ const Metadata::MDMapTy *Metadata::getMDs(const Instruction *Inst) {
 
 /// getHandlerNames - Get handler names. This is used by bitcode
 /// writer.
-const StringMap<unsigned> *Metadata::getHandlerNames() {
+const StringMap<unsigned> *MetadataContext::getHandlerNames() {
   return &MDHandlerNames;
 }
 
 /// ValueIsDeleted - This handler is used to update metadata store
 /// when a value is deleted.
-void Metadata::ValueIsDeleted(const Instruction *Inst) {
+void MetadataContext::ValueIsDeleted(const Instruction *Inst) {
   // Find Metadata handles for this instruction.
   MDStoreTy::iterator I = MetadataStore.find(Inst);
   if (I == MetadataStore.end())
@@ -341,7 +341,7 @@ void Metadata::ValueIsDeleted(const Instruction *Inst) {
 
 /// ValueIsCloned - This handler is used to update metadata store
 /// when In1 is cloned to create In2.
-void Metadata::ValueIsCloned(const Instruction *In1, Instruction *In2) {
+void MetadataContext::ValueIsCloned(const Instruction *In1, Instruction *In2) {
   // Find Metadata handles for In1.
   MDStoreTy::iterator I = MetadataStore.find(In1);
   if (I == MetadataStore.end())