summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit8c2bfc0659c5a844659e89310c9eb9fe49ba8723 (patch)
tree4c769b338295b31d84aae9478f591017b26890a6 /llvm/lib/CodeGen
parent6341df80693916ba95fe7ff8e98966748393576d (diff)
downloadbcm5719-llvm-8c2bfc0659c5a844659e89310c9eb9fe49ba8723.tar.gz
bcm5719-llvm-8c2bfc0659c5a844659e89310c9eb9fe49ba8723.zip
Oh yeah, there are two of these now, unify both.
llvm-svn: 28192
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter.cpp37
1 files changed, 15 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index dda8fd0d054..dafad915bb6 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/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';
}
}
OpenPOWER on IntegriCloud