Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.72 -> 1.73 --- Log message: Setting SwitchToSectionDirective properly in the MASM backend permits a bunch of code to be unified. --- 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.72 llvm/lib/CodeGen/AsmPrinter.cpp:1.73 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.72 Tue May 9 00:19:59 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Tue May 9 00:23:12 2006 @@ -102,34 +102,27 @@ void AsmPrinter::SwitchToDataSection(const char *NewSection, const GlobalValue *GV) { std::string NS; + if (GV && GV->hasSection()) + NS = SwitchToSectionDirective + 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 'DATA'\n"; - } + if (!CurrentSection.empty()) + O << CurrentSection << "\tends\n\n"; + CurrentSection = NS; + if (!CurrentSection.empty()) + O << CurrentSection << "\tsegment 'DATA'\n"; } else { - if (GV && GV->hasSection()) - NS = SwitchToSectionDirective + GV->getSection(); - else - NS = NewSection; - - if (CurrentSection != NS) { - CurrentSection = NS; - if (!CurrentSection.empty()) - O << CurrentSection << '\n'; - } + CurrentSection = NS; + if (!CurrentSection.empty()) + O << CurrentSection << '\n'; } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits