[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp MachineDebugInfo.cpp

Jim Laskey jlaskey at apple.com
Tue Mar 7 14:00:49 PST 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.57 -> 1.58
MachineDebugInfo.cpp updated: 1.24 -> 1.25
---
Log message:

Use "llvm.metadata" section for debug globals.  Filter out these globals in the
asm printer.


---
Diffs of the changes:  (+9 -2)

 AsmPrinter.cpp       |    8 ++++++--
 MachineDebugInfo.cpp |    3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.57 llvm/lib/CodeGen/AsmPrinter.cpp:1.58
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.57	Thu Mar  2 20:04:29 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Tue Mar  7 16:00:35 2006
@@ -131,8 +131,12 @@
 /// special global used by LLVM.  If so, emit it and return true, otherwise
 /// do nothing and return false.
 bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
-  assert(GV->hasInitializer() && GV->hasAppendingLinkage() &&
-         "Not a special LLVM global!");
+  // Ignore debug and non-emitted data.
+  if (GV->getSection() == "llvm.metadata") return true;
+  
+  if (!GV->hasAppendingLinkage()) return false;
+
+  assert(GV->hasInitializer() && "Not a special LLVM global!");
   
   if (GV->getName() == "llvm.used")
     return true;  // No need to emit this at all.


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.24 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.25
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.24	Tue Mar  7 14:53:47 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp	Tue Mar  7 16:00:35 2006
@@ -350,6 +350,7 @@
                                               GlobalValue::InternalLinkage,
                                               CA, "llvm.dbg.array",
                                               SR.getModule());
+    CAGV->setSection("llvm.metadata");
     Constant *CAE = ConstantExpr::getCast(CAGV, EmptyTy);
     Elements.push_back(CAE);
   }
@@ -1193,6 +1194,7 @@
   GlobalVariable *StrGV = new GlobalVariable(ConstStr->getType(), true,
                                              GlobalVariable::InternalLinkage,
                                              ConstStr, "str", M);
+  StrGV->setSection("llvm.metadata");
   // Convert to generic string pointer.
   Slot = ConstantExpr::getCast(StrGV, getStrPtrType());
   return Slot;
@@ -1214,6 +1216,7 @@
   // Create the GlobalVariable early to prevent infinite recursion.
   GlobalVariable *GV = new GlobalVariable(Ty, true, DD->getLinkage(),
                                           NULL, DD->getDescString(), M);
+  GV->setSection("llvm.metadata");
 
   // Insert new GlobalVariable in DescGlobals map.
   Slot = GV;






More information about the llvm-commits mailing list