From dcf0657604692cafafdd6ff729087344271c2ace Mon Sep 17 00:00:00 2001
From: Chris Lattner <sabre@nondot.org>
Date: Mon, 28 Dec 2009 23:41:32 +0000
Subject: This is a major cleanup of the instruction metadata interfaces that I
 asked Devang to do back on Sep 27.  Instead of going through the
 MetadataContext class with methods like getMD() and getMDs(), just ask the
 instruction directly for its metadata with getMetadata() and
 getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92235 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Analysis/DebugInfo.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'lib/Analysis')

diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 3732818..256a7d1 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -1117,9 +1117,7 @@ Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, Value *Offset,
 
 /// processModule - Process entire module and collect debug info.
 void DebugInfoFinder::processModule(Module &M) {
-
-  MetadataContext &TheMetadata = M.getContext().getMetadata();
-  unsigned MDDbgKind = TheMetadata.getMDKindID("dbg");
+  unsigned MDDbgKind = M.getContext().getMetadata().getMDKindID("dbg");
 
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
@@ -1127,7 +1125,7 @@ void DebugInfoFinder::processModule(Module &M) {
            ++BI) {
         if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
           processDeclare(DDI);
-        else if (MDNode *L = TheMetadata.getMD(MDDbgKind, BI)) 
+        else if (MDNode *L = BI->getMetadata(MDDbgKind)) 
           processLocation(DILocation(L));
       }
 
-- 
cgit v1.1