[llvm-commits] [llvm] r56574 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp lib/Target/DarwinTargetAsmInfo.cpp lib/Target/ELFTargetAsmInfo.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp
Anton Korobeynikov
asl at math.spbu.ru
Wed Sep 24 15:15:21 PDT 2008
Author: asl
Date: Wed Sep 24 17:15:21 2008
New Revision: 56574
URL: http://llvm.org/viewvc/llvm-project?rev=56574&view=rev
Log:
Get rid of duplicate char*/Section* TextSection
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Wed Sep 24 17:15:21 2008
@@ -92,6 +92,7 @@
/// CurrentSection - The current section we are emitting to. This is
/// controlled and used by the SwitchSection method.
std::string CurrentSection;
+ const Section* CurrentSection_;
/// IsInTextSection - True if the current section we are emitting to is a
/// text section.
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Sep 24 17:15:21 2008
@@ -131,8 +131,7 @@
/// TextSection - Section directive for standard text.
///
- const char *TextSection; // Defaults to ".text".
- const Section *TextSection_;
+ const Section *TextSection; // Defaults to ".text".
/// DataSection - Section directive for standard data.
///
@@ -599,12 +598,9 @@
// Accessors.
//
- const char *getTextSection() const {
+ const Section *getTextSection() const {
return TextSection;
}
- const Section *getTextSection_() const {
- return TextSection_;
- }
const char *getDataSection() const {
return DataSection;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Sep 24 17:15:21 2008
@@ -114,6 +114,7 @@
// FIXME: Make CurrentSection a Section* in the future
CurrentSection = NewSection;
+ CurrentSection_ = NS;
if (!CurrentSection.empty()) {
// If section is named we need to switch into it via special '.section'
@@ -174,7 +175,7 @@
if (TAI->getSetDirective()) {
if (!M.alias_empty())
- SwitchToTextSection(TAI->getTextSection());
+ SwitchToSection(TAI->getTextSection());
O << '\n';
for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Wed Sep 24 17:15:21 2008
@@ -1152,7 +1152,7 @@
/// SectionMap - Provides a unique id per text section.
///
- UniqueVector<std::string> SectionMap;
+ UniqueVector<const Section*> SectionMap;
/// SectionSourceLines - Tracks line numbers per text section.
///
@@ -2062,7 +2062,7 @@
Asm->SwitchToDataSection(TAI->getDwarfRangesSection());
EmitLabel("section_ranges", 0);
- Asm->SwitchToTextSection(TAI->getTextSection());
+ Asm->SwitchToSection(TAI->getTextSection());
EmitLabel("text_begin", 0);
Asm->SwitchToDataSection(TAI->getDataSection());
EmitLabel("data_begin", 0);
@@ -2353,9 +2353,10 @@
// Isolate current sections line info.
const std::vector<SourceLineInfo> &LineInfos = SectionSourceLines[j];
- if (VerboseAsm)
- Asm->EOL(std::string("Section ") + SectionMap[j + 1]);
- else
+ if (VerboseAsm) {
+ const Section* S = SectionMap[j + 1];
+ Asm->EOL(std::string("Section ") + S->getName());
+ } else
Asm->EOL();
// Dwarf assumes we start with first line of first source file.
@@ -2747,14 +2748,14 @@
if (!ShouldEmitDwarf()) return;
// Standard sections final addresses.
- Asm->SwitchToTextSection(TAI->getTextSection());
+ Asm->SwitchToSection(TAI->getTextSection());
EmitLabel("text_end", 0);
Asm->SwitchToDataSection(TAI->getDataSection());
EmitLabel("data_end", 0);
// End text sections.
for (unsigned i = 1, N = SectionMap.size(); i <= N; ++i) {
- Asm->SwitchToTextSection(SectionMap[i].c_str());
+ Asm->SwitchToSection(SectionMap[i]);
EmitLabel("section_end", i);
}
@@ -2832,7 +2833,7 @@
if (!LineInfos.empty()) {
// Get section line info.
- unsigned ID = SectionMap.insert(Asm->CurrentSection);
+ unsigned ID = SectionMap.insert(Asm->CurrentSection_);
if (SectionSourceLines.size() < ID) SectionSourceLines.resize(ID);
std::vector<SourceLineInfo> &SectionLineInfos = SectionSourceLines[ID-1];
// Append the function info to section info.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp Wed Sep 24 17:15:21 2008
@@ -62,7 +62,7 @@
void OcamlGCMetadataPrinter::beginAssembly(raw_ostream &OS, AsmPrinter &AP,
const TargetAsmInfo &TAI) {
- AP.SwitchToTextSection(TAI.getTextSection());
+ AP.SwitchToSection(TAI.getTextSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin");
AP.SwitchToDataSection(TAI.getDataSection());
@@ -97,7 +97,7 @@
AddressAlignLog = 3;
}
- AP.SwitchToTextSection(TAI.getTextSection());
+ AP.SwitchToSection(TAI.getTextSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "code_end");
AP.SwitchToDataSection(TAI.getDataSection());
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Wed Sep 24 17:15:21 2008
@@ -82,7 +82,7 @@
if (isWeak)
return TextCoalSection;
else
- return getTextSection_();
+ return getTextSection();
case SectionKind::Data:
case SectionKind::ThreadData:
case SectionKind::BSS:
Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Wed Sep 24 17:15:21 2008
@@ -27,7 +27,6 @@
ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) {
ETM = &TM;
- TextSection_ = getUnnamedSection("\t.text", SectionFlags::Code);
DataSection_ = getUnnamedSection("\t.data", SectionFlags::Writeable);
BSSSection_ = getUnnamedSection("\t.bss",
SectionFlags::Writeable | SectionFlags::BSS);
@@ -49,7 +48,7 @@
case Function::InternalLinkage:
case Function::DLLExportLinkage:
case Function::ExternalLinkage:
- return getTextSection_();
+ return getTextSection();
case Function::WeakLinkage:
case Function::LinkOnceLinkage:
std::string Name = UniqueSectionForGlobal(GV, Kind);
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Sep 24 17:15:21 2008
@@ -637,7 +637,7 @@
// GNU as handles section names wrapped in quotes
Mang->setUseQuotes(true);
- SwitchToTextSection(TAI->getTextSection());
+ SwitchToSection(TAI->getTextSection());
return Result;
}
@@ -864,7 +864,7 @@
SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
"pure_instructions,16");
}
- SwitchToTextSection(TAI->getTextSection());
+ SwitchToSection(TAI->getTextSection());
return Result;
}
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Wed Sep 24 17:15:21 2008
@@ -26,8 +26,7 @@
using namespace llvm;
TargetAsmInfo::TargetAsmInfo() :
- TextSection("\t.text"),
- TextSection_(0),
+ TextSection(0),
DataSection("\t.data"),
DataSection_(0),
BSSSection("\t.bss"),
@@ -126,7 +125,7 @@
DwarfEHFrameSection(".eh_frame"),
DwarfExceptionSection(".gcc_except_table"),
AsmTransCBE(0) {
- TextSection_ = getUnnamedSection(TextSection);
+ TextSection = getUnnamedSection("\t.text", SectionFlags::Code);
DataSection_ = getUnnamedSection(DataSection);
}
@@ -300,7 +299,7 @@
return getNamedSection(Name.c_str(), Flags);
} else {
if (Kind == SectionKind::Text)
- return getTextSection_();
+ return getTextSection();
else if (isBSS(Kind) && getBSSSection_())
return getBSSSection_();
else if (getReadOnlySection_() && SectionKind::isReadOnly(Kind))
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=56574&r1=56573&r2=56574&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Wed Sep 24 17:15:21 2008
@@ -433,7 +433,7 @@
Data64bitsDirective = "\tdq\t";
HasDotTypeDotSizeDirective = false;
- TextSection = "_text";
+ TextSection = getUnnamedSection("_text", SectionFlags::Code);
DataSection = "_data";
JumpTableDataSection = NULL;
SwitchToSectionDirective = "";
More information about the llvm-commits
mailing list