diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-09 05:23:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-09 05:23:12 +0000 |
commit | b81cb6133e224e37b1783fa2343a4789536fb0a4 (patch) | |
tree | 4769f065580ad5cd18bd5d220a5a51ebce2b6e33 /lib/CodeGen/AsmPrinter.cpp | |
parent | c9260a15565bbc67150c36c42cd0d3238bb52976 (diff) |
Setting SwitchToSectionDirective properly in the MASM backend permits a bunch
of code to be unified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 846d41d25f..dda8fd0d05 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -102,34 +102,27 @@ void AsmPrinter::SwitchToTextSection(const char *NewSection, 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'; } } |