summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit7d002fa77b3d6eab83a59710b58bb2d30e4fec6b (patch)
treed012c8b746c20e9e70bb965ebeebabf670985d57 /llvm/lib/CodeGen
parent8ac1127ed6cda9f0df13eef03dcb97eafc2fb8d5 (diff)
downloadbcm5719-llvm-7d002fa77b3d6eab83a59710b58bb2d30e4fec6b.tar.gz
bcm5719-llvm-7d002fa77b3d6eab83a59710b58bb2d30e4fec6b.zip
Provide direct function to switch to Section
llvm-svn: 56571
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index de856c165af..6e9d935e0c0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud