Move actual section printing stuff to AsmPrinter from TAI reducing heap traffic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56573 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index a8127f6..2d9ecbd 100644
--- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -571,7 +571,7 @@
 
   // Print out labels for the function.
   const Function *F = MF.getFunction();
-  SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
+  SwitchToSection(TAI->SectionForGlobal(F));
 
   switch (F->getLinkage()) {
   default: assert(0 && "Unknown linkage type!");
@@ -662,7 +662,6 @@
     return;
 
   std::string name = Mang->getValueName(GVar);
-  std::string SectionName = TAI->SectionForGlobal(GVar);
 
   printVisibility(name, GVar->getVisibility());
 
@@ -671,7 +670,7 @@
   unsigned Size = TD->getABITypeSize(Type);
   unsigned Align = TD->getPreferredAlignmentLog(GVar);
 
-  SwitchToDataSection(SectionName.c_str());
+  SwitchToSection(TAI->SectionForGlobal(GVar));
 
   if (C->isNullValue() && /* FIXME: Verify correct */
       !GVar->hasSection() &&
@@ -759,7 +758,7 @@
 
   // Print out labels for the function.
   const Function *F = MF.getFunction();
-  SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
+  SwitchToSection(TAI->SectionForGlobal(F));
 
   switch (F->getLinkage()) {
   default: assert(0 && "Unknown linkage type!");
@@ -888,7 +887,6 @@
   }
 
   std::string name = Mang->getValueName(GVar);
-  std::string SectionName = TAI->SectionForGlobal(GVar);
 
   printVisibility(name, GVar->getVisibility());
 
@@ -897,7 +895,7 @@
   unsigned Size = TD->getABITypeSize(Type);
   unsigned Align = TD->getPreferredAlignmentLog(GVar);
 
-  SwitchToDataSection(SectionName.c_str());
+  SwitchToSection(TAI->SectionForGlobal(GVar));
 
   if (C->isNullValue() && /* FIXME: Verify correct */
       !GVar->hasSection() &&