Move actual section printing stuff to AsmPrinter from TAI reducing heap traffic.
[oota-llvm.git] / lib / Target / Alpha / AlphaAsmPrinter.cpp
index b1265afe1abe49319618f5579189f8c6c4afc6d6..9a4102c1a46932d34674bd9b160130102d42ef3c 100644 (file)
@@ -149,7 +149,7 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   // Print out labels for the function.
   const Function *F = MF.getFunction();
-  SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
+  SwitchToSection(TAI->SectionForGlobal(F));
 
   EmitAlignment(4, F);
   switch (F->getLinkage()) {
@@ -214,14 +214,13 @@ void AlphaAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
   if (EmitSpecialLLVMGlobal(GVar))
     return;
 
-  std::string SectionName = TAI->SectionForGlobal(GVar);
   std::string name = Mang->getValueName(GVar);
   Constant *C = GVar->getInitializer();
   unsigned Size = TD->getABITypeSize(C->getType());
   unsigned Align = TD->getPreferredAlignmentLog(GVar);
 
   // 0: Switch to section
-  SwitchToDataSection(SectionName.c_str());
+  SwitchToSection(TAI->SectionForGlobal(GVar));
 
   // 1: Check visibility
   printVisibility(name, GVar->getVisibility());