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

Chris Lattner lattner at cs.uiuc.edu
Mon May 8 22:25:03 PDT 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.73 -> 1.74
---
Log message:

Oh yeah, there are two of these now, unify both.


---
Diffs of the changes:  (+15 -22)

 AsmPrinter.cpp |   37 +++++++++++++++----------------------
 1 files changed, 15 insertions(+), 22 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.73 llvm/lib/CodeGen/AsmPrinter.cpp:1.74
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.73	Tue May  9 00:23:12 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Tue May  9 00:24:50 2006
@@ -65,34 +65,27 @@
 void AsmPrinter::SwitchToTextSection(const char *NewSection,
                                      const GlobalValue *GV) {
   std::string NS;
+  if (GV && GV->hasSection())
+    NS = GV->getSection();
+  else
+    NS = NewSection;
+  
+  // If we're already in this section, we're done.
+  if (CurrentSection == NS) return;
 
   // Microsoft ML/MASM has a fundamentally different approach to handling
   // sections.
 
   if (MLSections) {
-    if (GV && GV->hasSection())
-      NS = GV->getSection();
-    else
-      NS = NewSection;
-
-    if (CurrentSection != NS) {
-      if (!CurrentSection.empty())
-        O << CurrentSection << "\tends\n\n";
-      CurrentSection = NS;
-      if (!CurrentSection.empty())
-        O << CurrentSection << "\tsegment 'CODE'\n";
-    }
+    if (!CurrentSection.empty())
+      O << CurrentSection << "\tends\n\n";
+    CurrentSection = NS;
+    if (!CurrentSection.empty())
+      O << CurrentSection << "\tsegment 'CODE'\n";
   } else {
-    if (GV && GV->hasSection())
-      NS = SwitchToSectionDirective + GV->getSection();
-    else
-      NS = std::string("\t")+NewSection;
-    
-    if (CurrentSection != NS) {
-      CurrentSection = NS;
-      if (!CurrentSection.empty())
-        O << CurrentSection << '\n';
-    }
+    CurrentSection = NS;
+    if (!CurrentSection.empty())
+      O << CurrentSection << '\n';
   }
 }
 






More information about the llvm-commits mailing list