[llvm-commits] [llvm] r78017 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Chris Lattner
sabre at nondot.org
Mon Aug 3 16:20:29 PDT 2009
Author: lattner
Date: Mon Aug 3 18:20:21 2009
New Revision: 78017
URL: http://llvm.org/viewvc/llvm-project?rev=78017&view=rev
Log:
eliminate CurrentSection, rename CurrentSection_ -> CurrentSection, make it private,
eliminate IsInTextSection.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=78017&r1=78016&r2=78017&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Aug 3 18:20:21 2009
@@ -60,6 +60,10 @@
typedef gcp_map_type::iterator gcp_iterator;
gcp_map_type GCMetadataPrinters;
+ /// CurrentSection - The current section we are emitting to. This is
+ /// controlled and used by the SwitchToSection method.
+ const MCSection *CurrentSection;
+
protected:
/// MMI - If available, this is a pointer to the current MachineModuleInfo.
MachineModuleInfo *MMI;
@@ -110,14 +114,9 @@
///
std::string CurrentFnName;
- /// CurrentSection - The current section we are emitting to. This is
- /// controlled and used by the SwitchSection method.
- std::string CurrentSection;
- const MCSection *CurrentSection_;
-
- /// IsInTextSection - True if the current section we are emitting to is a
- /// text section.
- bool IsInTextSection;
+ /// getCurrentSection() - Return the current section we are emitting to.
+ const MCSection *getCurrentSection() const { return CurrentSection; }
+
/// VerboseAsm - Emit comments in assembly output if this is true.
///
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=78017&r1=78016&r2=78017&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug 3 18:20:21 2009
@@ -55,8 +55,9 @@
OutContext(*new MCContext()),
OutStreamer(*createAsmStreamer(OutContext, O)),
- IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U),
+ LastMI(0), LastFn(0), Counter(~0U),
PrevDLT(0, ~0U, ~0U) {
+ CurrentSection = 0;
DW = 0; MMI = 0;
switch (AsmVerbose) {
case cl::BOU_UNSET: VerboseAsm = VDef; break;
@@ -86,20 +87,16 @@
/// FIXME: Remove support for null sections.
///
void AsmPrinter::SwitchToSection(const MCSection *NS) {
- const std::string &NewSection = NS ? NS->getName() : "";
-
// If we're already in this section, we're done.
- if (CurrentSection == NewSection) return;
+ if (CurrentSection == NS) return;
// Close the current section, if applicable.
- if (TAI->getSectionEndDirectiveSuffix() && !CurrentSection.empty())
- O << CurrentSection << TAI->getSectionEndDirectiveSuffix() << '\n';
+ if (NS != 0 && TAI->getSectionEndDirectiveSuffix())
+ O << NS->getName() << TAI->getSectionEndDirectiveSuffix() << '\n';
- // FIXME: Make CurrentSection a Section* in the future
- CurrentSection = NewSection;
- CurrentSection_ = NS;
+ CurrentSection = NS;
- if (!CurrentSection.empty()) {
+ if (NS != 0) {
// 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.
@@ -109,15 +106,12 @@
getObjFileLowering().getSectionFlagsAsString(NS->getKind(), FlagsStr);
O << TAI->getSwitchToSectionDirective()
- << CurrentSection
- << FlagsStr.c_str();
+ << CurrentSection->getName() << FlagsStr.c_str();
} else {
- O << CurrentSection;
+ O << CurrentSection->getName();
}
O << TAI->getDataSectionStartSuffix() << '\n';
}
-
- IsInTextSection = NS ? NS->getKind().isText() : false;
}
void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
@@ -787,12 +781,11 @@
if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits;
O << TAI->getAlignDirective() << NumBits;
- unsigned FillValue = TAI->getTextAlignFillValue();
- UseFillExpr &= IsInTextSection && FillValue;
- if (UseFillExpr) {
- O << ',';
- PrintHex(FillValue);
- }
+ if (CurrentSection && CurrentSection->getKind().isText())
+ if (unsigned FillValue = TAI->getTextAlignFillValue()) {
+ O << ',';
+ PrintHex(FillValue);
+ }
O << '\n';
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=78017&r1=78016&r2=78017&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 3 18:20:21 2009
@@ -1463,7 +1463,7 @@
// Get function line info.
if (!Lines.empty()) {
// Get section line info.
- unsigned ID = SectionMap.insert(Asm->CurrentSection_);
+ unsigned ID = SectionMap.insert(Asm->getCurrentSection());
if (SectionSourceLines.size() < ID) SectionSourceLines.resize(ID);
std::vector<SrcLineInfo> &SectionLineInfos = SectionSourceLines[ID-1];
// Append the function info to section info.
More information about the llvm-commits
mailing list