[MC] Fix letter case of some MCSection member functions

This commit is contained in:
Fangrui Song 2022-03-11 20:07:00 -08:00
parent f44f60a297
commit 689c3a2552
21 changed files with 43 additions and 45 deletions

View File

@ -184,13 +184,13 @@ public:
void dump() const;
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
virtual void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const = 0;
/// Return true if a .align directive should use "optimized nops" to fill
/// instead of 0s.
virtual bool UseCodeAlign() const = 0;
virtual bool useCodeAlign() const = 0;
/// Check whether this section is "virtual", that is has no actual object
/// file contents.

View File

@ -61,7 +61,7 @@ private:
public:
/// Decides whether a '.section' directive should be printed before the
/// section name
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
unsigned getCharacteristics() const { return Characteristics; }
MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; }
@ -69,10 +69,10 @@ public:
void setSelection(int Selection) const;
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool useCodeAlign() const override;
bool isVirtualSection() const override;
StringRef getVirtualSectionKind() const override;

View File

@ -67,7 +67,7 @@ private:
public:
/// Decides whether a '.section' directive should be printed before the
/// section name
bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
@ -76,10 +76,10 @@ public:
const MCSymbolELF *getGroup() const { return Group.getPointer(); }
bool isComdat() const { return Group.getInt(); }
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool useCodeAlign() const override;
bool isVirtualSection() const override;
StringRef getVirtualSectionKind() const override;

View File

@ -29,13 +29,13 @@ private:
: MCSection(SV_GOFF, Name, K, nullptr) {}
public:
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override {
OS << "\t.section\t\"" << getName() << "\"\n";
}
bool UseCodeAlign() const override { return false; }
bool useCodeAlign() const override { return false; }
bool isVirtualSection() const override { return false; }

View File

@ -68,10 +68,10 @@ public:
bool &TAAParsed, // Out.
unsigned &StubSize); // Out.
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool useCodeAlign() const override;
bool isVirtualSection() const override;
static bool classof(const MCSection *S) {

View File

@ -58,10 +58,10 @@ public:
const MCSymbolWasm *getGroup() const { return Group; }
unsigned getSegmentFlags() const { return SegmentFlags; }
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool useCodeAlign() const override;
bool isVirtualSection() const override;
bool isWasmData() const {

View File

@ -101,10 +101,10 @@ public:
}
MCSymbolXCOFF *getQualNameSymbol() const { return QualName; }
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool useCodeAlign() const override;
bool isVirtualSection() const override;
StringRef getSymbolTableName() const { return SymbolTableName; }
bool isMultiSymbolsAllowed() const { return MultiSymbolsAllowed; }

View File

@ -503,7 +503,7 @@ void MCAsmStreamer::changeSection(MCSection *Section,
if (MCTargetStreamer *TS = getTargetStreamer()) {
TS->changeSection(getCurrentSectionOnly(), Section, Subsection, OS);
} else {
Section->PrintSwitchToSection(*MAI, getContext().getTargetTriple(), OS,
Section->printSwitchToSection(*MAI, getContext().getTargetTriple(), OS,
Subsection);
}
}

View File

@ -335,7 +335,7 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
// Insert extra Nops for code alignment if the target define
// shouldInsertExtraNopBytesForCodeAlign target hook.
if (AF.getParent()->UseCodeAlign() && AF.hasEmitNops() &&
if (AF.getParent()->useCodeAlign() && AF.hasEmitNops() &&
getBackend().shouldInsertExtraNopBytesForCodeAlign(AF, Size))
return Size;
@ -874,7 +874,7 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
MCAlignFragment &AF = cast<MCAlignFragment>(Frag);
// Insert fixup type for code alignment if the target define
// shouldInsertFixupForCodeAlign target hook.
if (Sec.UseCodeAlign() && AF.hasEmitNops())
if (Sec.useCodeAlign() && AF.hasEmitNops())
getBackend().shouldInsertFixupForCodeAlign(*this, Layout, AF);
continue;
}

View File

@ -3470,9 +3470,9 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
// directive.
const MCSection *Section = getStreamer().getCurrentSectionOnly();
assert(Section && "must have section to emit alignment");
bool UseCodeAlign = Section->UseCodeAlign();
bool useCodeAlign = Section->useCodeAlign();
if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) &&
ValueSize == 1 && UseCodeAlign) {
ValueSize == 1 && useCodeAlign) {
getStreamer().emitCodeAlignment(Alignment, &getTargetParser().getSTI(),
MaxBytesToFill);
} else {

View File

@ -4759,7 +4759,7 @@ bool MasmParser::emitAlignTo(int64_t Alignment) {
// directive.
const MCSection *Section = getStreamer().getCurrentSectionOnly();
assert(Section && "must have section to emit alignment");
if (Section->UseCodeAlign()) {
if (Section->useCodeAlign()) {
getStreamer().emitCodeAlignment(Alignment, &getTargetParser().getSTI(),
/*MaxBytesToEmit=*/0);
} else {

View File

@ -14,9 +14,9 @@
using namespace llvm;
// ShouldOmitSectionDirective - Decides whether a '.section' directive
// shouldOmitSectionDirective - Decides whether a '.section' directive
// should be printed before the section name
bool MCSectionCOFF::ShouldOmitSectionDirective(StringRef Name,
bool MCSectionCOFF::shouldOmitSectionDirective(StringRef Name,
const MCAsmInfo &MAI) const {
if (COMDATSymbol)
return false;
@ -34,11 +34,11 @@ void MCSectionCOFF::setSelection(int Selection) const {
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
}
void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void MCSectionCOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
// standard sections don't require the '.section'
if (ShouldOmitSectionDirective(getName(), MAI)) {
if (shouldOmitSectionDirective(getName(), MAI)) {
OS << '\t' << getName() << '\n';
return;
}
@ -104,9 +104,7 @@ void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
OS << '\n';
}
bool MCSectionCOFF::UseCodeAlign() const {
return getKind().isText();
}
bool MCSectionCOFF::useCodeAlign() const { return getKind().isText(); }
bool MCSectionCOFF::isVirtualSection() const {
return getCharacteristics() & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;

View File

@ -19,7 +19,7 @@ using namespace llvm;
// Decides whether a '.section' directive
// should be printed before the section name.
bool MCSectionELF::ShouldOmitSectionDirective(StringRef Name,
bool MCSectionELF::shouldOmitSectionDirective(StringRef Name,
const MCAsmInfo &MAI) const {
if (isUnique())
return false;
@ -50,10 +50,10 @@ static void printName(raw_ostream &OS, StringRef Name) {
OS << '"';
}
void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void MCSectionELF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
if (ShouldOmitSectionDirective(getName(), MAI)) {
if (shouldOmitSectionDirective(getName(), MAI)) {
OS << '\t' << getName();
if (Subsection) {
OS << '\t';
@ -201,7 +201,7 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
}
}
bool MCSectionELF::UseCodeAlign() const {
bool MCSectionELF::useCodeAlign() const {
return getFlags() & ELF::SHF_EXECINSTR;
}

View File

@ -102,7 +102,7 @@ MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
}
}
void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void MCSectionMachO::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
OS << "\t.section\t" << getSegmentName() << ',' << getName();
@ -166,7 +166,7 @@ void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
OS << '\n';
}
bool MCSectionMachO::UseCodeAlign() const {
bool MCSectionMachO::useCodeAlign() const {
return hasAttribute(MachO::S_ATTR_PURE_INSTRUCTIONS);
}

View File

@ -44,7 +44,7 @@ static void printName(raw_ostream &OS, StringRef Name) {
OS << '"';
}
void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void MCSectionWasm::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
@ -101,6 +101,6 @@ void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
}
}
bool MCSectionWasm::UseCodeAlign() const { return false; }
bool MCSectionWasm::useCodeAlign() const { return false; }
bool MCSectionWasm::isVirtualSection() const { return false; }

View File

@ -25,7 +25,7 @@ void MCSectionXCOFF::printCsectDirective(raw_ostream &OS) const {
<< '\n';
}
void MCSectionXCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
void MCSectionXCOFF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
if (getKind().isText()) {
@ -120,7 +120,7 @@ void MCSectionXCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
report_fatal_error("Printing for this SectionKind is unimplemented.");
}
bool MCSectionXCOFF::UseCodeAlign() const { return getKind().isText(); }
bool MCSectionXCOFF::useCodeAlign() const { return getKind().isText(); }
bool MCSectionXCOFF::isVirtualSection() const {
// DWARF sections are always not virtual.

View File

@ -60,7 +60,7 @@ void MCTargetStreamer::changeSection(const MCSection *CurSection,
MCSection *Section,
const MCExpr *Subsection,
raw_ostream &OS) {
Section->PrintSwitchToSection(*Streamer.getContext().getAsmInfo(),
Section->printSwitchToSection(*Streamer.getContext().getAsmInfo(),
Streamer.getContext().getTargetTriple(), OS,
Subsection);
}

View File

@ -11786,7 +11786,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
}
assert(Section && "must have section to emit alignment");
if (Section->UseCodeAlign())
if (Section->useCodeAlign())
getStreamer().emitCodeAlignment(2, &getSTI());
else
getStreamer().emitValueToAlignment(2);
@ -11988,7 +11988,7 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) {
// '.align' is target specifically handled to mean 2**2 byte alignment.
const MCSection *Section = getStreamer().getCurrentSectionOnly();
assert(Section && "must have section to emit alignment");
if (Section->UseCodeAlign())
if (Section->useCodeAlign())
getStreamer().emitCodeAlignment(4, &getSTI(), 0);
else
getStreamer().emitValueToAlignment(4, 0, 1, 0);

View File

@ -903,7 +903,7 @@ void MipsTargetELFStreamer::finish() {
unsigned Alignment = Section.getAlignment();
if (Alignment) {
OS.SwitchSection(&Section);
if (Section.UseCodeAlign())
if (Section.useCodeAlign())
OS.emitCodeAlignment(Alignment, &STI, Alignment);
else
OS.emitValueToAlignment(Alignment, 0, 1, Alignment);

View File

@ -93,7 +93,7 @@ void NVPTXTargetStreamer::changeSection(const MCSection *CurSection,
// Emit DWARF .file directives in the outermost scope.
outputDwarfFileDirectives();
OS << "\t.section";
Section->PrintSwitchToSection(*getStreamer().getContext().getAsmInfo(),
Section->printSwitchToSection(*getStreamer().getContext().getAsmInfo(),
getStreamer().getContext().getTargetTriple(),
OS, SubSection);
// DWARF sections are enclosed into braces - emit the open one.

View File

@ -4871,7 +4871,7 @@ bool X86AsmParser::parseDirectiveEven(SMLoc L) {
getStreamer().initSections(false, getSTI());
Section = getStreamer().getCurrentSectionOnly();
}
if (Section->UseCodeAlign())
if (Section->useCodeAlign())
getStreamer().emitCodeAlignment(2, &getSTI(), 0);
else
getStreamer().emitValueToAlignment(2, 0, 1, 0);