diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-09-24 22:14:23 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-09-24 22:14:23 +0000 |
commit | 1a9edae76b2e7cf15c5f7c36928b3701ac2ef47b (patch) | |
tree | d82adcff4e4317e4abcb578ae1fdf33e10864174 /lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | cf87a3dd015c7e2acfc0b4feff48fc7fc2a16f01 (diff) | |
download | external_llvm-1a9edae76b2e7cf15c5f7c36928b3701ac2ef47b.zip external_llvm-1a9edae76b2e7cf15c5f7c36928b3701ac2ef47b.tar.gz external_llvm-1a9edae76b2e7cf15c5f7c36928b3701ac2ef47b.tar.bz2 |
Move actual section printing stuff to AsmPrinter from TAI reducing heap traffic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56573 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 93ebf21..9fc57a9 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -115,8 +115,18 @@ void AsmPrinter::SwitchToSection(const Section* NS) { // FIXME: Make CurrentSection a Section* in the future CurrentSection = NewSection; - if (!CurrentSection.empty()) - O << CurrentSection << TAI->getDataSectionStartSuffix() << '\n'; + if (!CurrentSection.empty()) { + // If section is named we need to switch into it via special '.section' + // directive and also append funky flags. Otherwise - section name is just + // some magic assembler directive. + if (NS->isNamed()) + O << TAI->getSwitchToSectionDirective() + << CurrentSection + << TAI->getSectionFlags(NS->getFlags()); + else + O << CurrentSection; + O << TAI->getDataSectionStartSuffix() << '\n'; + } IsInTextSection = (NS->getFlags() & SectionFlags::Code); } @@ -326,7 +336,7 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, // function body itself, otherwise the label differences won't make sense. // We should also do if the section name is NULL or function is declared in // discardable section. - SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F); + SwitchToSection(TAI->SectionForGlobal(F)); } else { SwitchToDataSection(JumpTableDataSection); } |