aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-09-24 22:12:10 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-09-24 22:12:10 +0000
commitb5a32e2e8ce2f3de3a340c5a2dfcd3a159968466 (patch)
treebabe952c23545f7ce13d6dfa1e6b808fedb26c83 /lib/CodeGen/AsmPrinter
parent90a7b88c5ba958a9647ed7dfa3b2a1ebd35b0473 (diff)
downloadexternal_llvm-b5a32e2e8ce2f3de3a340c5a2dfcd3a159968466.zip
external_llvm-b5a32e2e8ce2f3de3a340c5a2dfcd3a159968466.tar.gz
external_llvm-b5a32e2e8ce2f3de3a340c5a2dfcd3a159968466.tar.bz2
Provide direct function to switch to Section
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index de856c1..6e9d935 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -105,6 +105,26 @@ void AsmPrinter::SwitchToDataSection(const char *NewSection,
IsInTextSection = false;
}
+/// SwitchToSection - Switch to the specified section of the executable if we
+/// are not already in it!
+void AsmPrinter::SwitchToSection(const Section* NS) {
+ const std::string& NewSection = NS->getName();
+
+ // If we're already in this section, we're done.
+ if (CurrentSection == NewSection) return;
+
+ // Close the current section, if applicable.
+ if (TAI->getSectionEndDirectiveSuffix() && !CurrentSection.empty())
+ O << CurrentSection << TAI->getSectionEndDirectiveSuffix() << '\n';
+
+ // FIXME: Make CurrentSection a Section* in the future
+ CurrentSection = NewSection;
+
+ if (!CurrentSection.empty())
+ O << CurrentSection << TAI->getDataSectionStartSuffix() << '\n';
+
+ IsInTextSection = (NS->getFlags() & SectionFlags::Code);
+}
void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
MachineFunctionPass::getAnalysisUsage(AU);