summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-09 05:33:48 +0000
committerChris Lattner <sabre@nondot.org>2006-05-09 05:33:48 +0000
commit4ebc6a2311c9101e6234847290f8506c32ddc987 (patch)
treec4c55bfd71ed0092758867d1a7ccdb8d2db201c3 /llvm/lib/CodeGen/AsmPrinter.cpp
parentaf35b1476e430c70b3527f500c1f08b5289ca6bb (diff)
downloadbcm5719-llvm-4ebc6a2311c9101e6234847290f8506c32ddc987.tar.gz
bcm5719-llvm-4ebc6a2311c9101e6234847290f8506c32ddc987.zip
Implement MASM sections correctly, without a "has masm sections flag" and a bunch of special case code.
llvm-svn: 28194
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter.cpp44
1 files changed, 17 insertions, 27 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index dafad915bb6..d95b6911927 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter.cpp
@@ -47,7 +47,9 @@ AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm)
AlignDirective("\t.align\t"),
AlignmentIsInBytes(true),
SwitchToSectionDirective("\t.section\t"),
- MLSections(false),
+ TextSectionStartSuffix(""),
+ DataSectionStartSuffix(""),
+ SectionEndDirectiveSuffix(0),
ConstantPoolSection("\t.section .rodata\n"),
JumpTableSection("\t.section .rodata\n"),
StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"),
@@ -73,20 +75,14 @@ void AsmPrinter::SwitchToTextSection(const char *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.
+ // Close the current section, if applicable.
+ if (SectionEndDirectiveSuffix && !CurrentSection.empty())
+ O << CurrentSection << SectionEndDirectiveSuffix << "\n";
- if (MLSections) {
- if (!CurrentSection.empty())
- O << CurrentSection << "\tends\n\n";
- CurrentSection = NS;
- if (!CurrentSection.empty())
- O << CurrentSection << "\tsegment 'CODE'\n";
- } else {
- CurrentSection = NS;
- if (!CurrentSection.empty())
- O << CurrentSection << '\n';
- }
+ CurrentSection = NS;
+
+ if (!CurrentSection.empty())
+ O << CurrentSection << TextSectionStartSuffix << '\n';
}
/// SwitchToTextSection - Switch to the specified text section of the executable
@@ -103,20 +99,14 @@ void AsmPrinter::SwitchToDataSection(const char *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.
+ // Close the current section, if applicable.
+ if (SectionEndDirectiveSuffix && !CurrentSection.empty())
+ O << CurrentSection << SectionEndDirectiveSuffix << "\n";
+
+ CurrentSection = NS;
- if (MLSections) {
- if (!CurrentSection.empty())
- O << CurrentSection << "\tends\n\n";
- CurrentSection = NS;
- if (!CurrentSection.empty())
- O << CurrentSection << "\tsegment 'DATA'\n";
- } else {
- CurrentSection = NS;
- if (!CurrentSection.empty())
- O << CurrentSection << '\n';
- }
+ if (!CurrentSection.empty())
+ O << CurrentSection << DataSectionStartSuffix << '\n';
}
OpenPOWER on IntegriCloud