[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon May 8 22:34:01 PDT 2006
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.74 -> 1.75
---
Log message:
Implement MASM sections correctly, without a "has masm sections flag" and a bunch of special case code.
---
Diffs of the changes: (+17 -27)
AsmPrinter.cpp | 44 +++++++++++++++++---------------------------
1 files changed, 17 insertions(+), 27 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.74 llvm/lib/CodeGen/AsmPrinter.cpp:1.75
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.74 Tue May 9 00:24:50 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Tue May 9 00:33:48 2006
@@ -47,7 +47,9 @@
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\", at progbits"),
@@ -73,20 +75,14 @@
// 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 @@
// 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';
}
More information about the llvm-commits
mailing list