summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-09 05:24:50 +0000
committerChris Lattner <sabre@nondot.org>2006-05-09 05:24:50 +0000
commita7090ae7a3209783ba2a2f7b8ab5744ec3d292b3 (patch)
tree2407d10d7edac268dd29701655a26257b37e1343 /lib/CodeGen
parentb81cb6133e224e37b1783fa2343a4789536fb0a4 (diff)
downloadllvm-a7090ae7a3209783ba2a2f7b8ab5744ec3d292b3.tar.gz
llvm-a7090ae7a3209783ba2a2f7b8ab5744ec3d292b3.tar.bz2
llvm-a7090ae7a3209783ba2a2f7b8ab5744ec3d292b3.tar.xz
Oh yeah, there are two of these now, unify both.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter.cpp37
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index dda8fd0d05..dafad915bb 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -65,34 +65,27 @@ AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm)
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';
}
}