mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 08:29:43 +00:00
Tidy the calls to getCurrentSection().first -> getCurrentSectionOnly to help
readability a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284202 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c675e3184b
commit
ea40df32e3
@ -157,7 +157,7 @@ void AsmPrinter::EmitToStreamer(MCStreamer &S, const MCInst &Inst) {
|
||||
|
||||
/// getCurrentSection() - Return the current section we are emitting to.
|
||||
const MCSection *AsmPrinter::getCurrentSection() const {
|
||||
return OutStreamer->getCurrentSection().first;
|
||||
return OutStreamer->getCurrentSectionOnly();
|
||||
}
|
||||
|
||||
void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
|
@ -79,7 +79,7 @@ void AssemblerConstantPools::emitAll(MCStreamer &Streamer) {
|
||||
}
|
||||
|
||||
void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
|
||||
MCSection *Section = Streamer.getCurrentSection().first;
|
||||
MCSection *Section = Streamer.getCurrentSectionOnly();
|
||||
if (ConstantPool *CP = getConstantPool(Section)) {
|
||||
emitConstantPool(Streamer, Section, *CP);
|
||||
}
|
||||
@ -88,7 +88,7 @@ void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
|
||||
const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
|
||||
const MCExpr *Expr,
|
||||
unsigned Size, SMLoc Loc) {
|
||||
MCSection *Section = Streamer.getCurrentSection().first;
|
||||
MCSection *Section = Streamer.getCurrentSectionOnly();
|
||||
return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(),
|
||||
Size, Loc);
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ static void PrintQuotedString(StringRef Data, raw_ostream &OS) {
|
||||
}
|
||||
|
||||
void MCAsmStreamer::EmitBytes(StringRef Data) {
|
||||
assert(getCurrentSection().first &&
|
||||
assert(getCurrentSectionOnly() &&
|
||||
"Cannot emit contents before setting section!");
|
||||
if (Data.empty()) return;
|
||||
|
||||
@ -794,7 +794,7 @@ void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
|
||||
void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
SMLoc Loc) {
|
||||
assert(Size <= 8 && "Invalid size");
|
||||
assert(getCurrentSection().first &&
|
||||
assert(getCurrentSectionOnly() &&
|
||||
"Cannot emit contents before setting section!");
|
||||
const char *Directive = nullptr;
|
||||
switch (Size) {
|
||||
@ -1580,8 +1580,9 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst,
|
||||
}
|
||||
}
|
||||
|
||||
void MCAsmStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) {
|
||||
assert(getCurrentSection().first &&
|
||||
void MCAsmStreamer::EmitInstruction(const MCInst &Inst,
|
||||
const MCSubtargetInfo &STI) {
|
||||
assert(getCurrentSectionOnly() &&
|
||||
"Cannot emit contents before setting section!");
|
||||
|
||||
// Show the encoding in a comment if we have a code emitter.
|
||||
|
@ -917,7 +917,7 @@ void MCGenDwarfLabelEntry::Make(MCSymbol *Symbol, MCStreamer *MCOS,
|
||||
MCContext &context = MCOS->getContext();
|
||||
// We won't create dwarf labels for symbols in sections that we are not
|
||||
// generating debug info for.
|
||||
if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSection().first))
|
||||
if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSectionOnly()))
|
||||
return;
|
||||
|
||||
// The dwarf label's name does not have the symbol name's leading
|
||||
|
@ -128,7 +128,7 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
flushPendingLabels(DF, DF->getContents().size());
|
||||
|
||||
MCCVLineEntry::Make(this);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSection().first);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
|
||||
|
||||
// Avoid fixups when possible.
|
||||
int64_t AbsValue;
|
||||
@ -236,7 +236,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst,
|
||||
// Now that a machine instruction has been assembled into this section, make
|
||||
// a line entry for any .loc directive that has been seen.
|
||||
MCCVLineEntry::Make(this);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSection().first);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
|
||||
|
||||
// If this instruction doesn't need relaxation, just emit it as data.
|
||||
MCAssembler &Assembler = getAssembler();
|
||||
@ -305,7 +305,7 @@ void MCObjectStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
|
||||
StringRef FileName) {
|
||||
// In case we see two .loc directives in a row, make sure the
|
||||
// first one gets a line entry.
|
||||
MCDwarfLineEntry::Make(this, getCurrentSection().first);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
|
||||
|
||||
this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
|
||||
Isa, Discriminator, FileName);
|
||||
@ -413,7 +413,7 @@ void MCObjectStreamer::EmitCVFileChecksumsDirective() {
|
||||
|
||||
void MCObjectStreamer::EmitBytes(StringRef Data) {
|
||||
MCCVLineEntry::Make(this);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSection().first);
|
||||
MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
|
||||
MCDataFragment *DF = getOrCreateDataFragment();
|
||||
flushPendingLabels(DF, DF->getContents().size());
|
||||
DF->getContents().append(Data.begin(), Data.end());
|
||||
@ -428,7 +428,7 @@ void MCObjectStreamer::EmitValueToAlignment(unsigned ByteAlignment,
|
||||
insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit));
|
||||
|
||||
// Update the maximum alignment on the current section if necessary.
|
||||
MCSection *CurSec = getCurrentSection().first;
|
||||
MCSection *CurSec = getCurrentSectionOnly();
|
||||
if (ByteAlignment > CurSec->getAlignment())
|
||||
CurSec->setAlignment(ByteAlignment);
|
||||
}
|
||||
@ -530,9 +530,7 @@ bool MCObjectStreamer::EmitRelocDirective(const MCExpr &Offset, StringRef Name,
|
||||
}
|
||||
|
||||
void MCObjectStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) {
|
||||
const MCSection *Sec = getCurrentSection().first;
|
||||
(void)Sec;
|
||||
assert(Sec && "need a section");
|
||||
assert(getCurrentSectionOnly() && "need a section");
|
||||
insert(new MCFillFragment(FillValue, NumBytes));
|
||||
}
|
||||
|
||||
|
@ -733,7 +733,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
||||
// If we are generating dwarf for assembly source files save the initial text
|
||||
// section and generate a .file directive.
|
||||
if (getContext().getGenDwarfForAssembly()) {
|
||||
MCSection *Sec = getStreamer().getCurrentSection().first;
|
||||
MCSection *Sec = getStreamer().getCurrentSectionOnly();
|
||||
if (!Sec->getBeginSymbol()) {
|
||||
MCSymbol *SectionStartSym = getContext().createTempSymbol();
|
||||
getStreamer().EmitLabel(SectionStartSym);
|
||||
@ -829,7 +829,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
||||
}
|
||||
|
||||
bool AsmParser::checkForValidSection() {
|
||||
if (!ParsingInlineAsm && !getStreamer().getCurrentSection().first) {
|
||||
if (!ParsingInlineAsm && !getStreamer().getCurrentSectionOnly()) {
|
||||
Out.InitSections(false);
|
||||
return Error(getTok().getLoc(),
|
||||
"expected section directive before assembly directive");
|
||||
@ -2014,7 +2014,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
||||
// directive for the instruction.
|
||||
if (!ParseHadError && getContext().getGenDwarfForAssembly() &&
|
||||
getContext().getGenDwarfSectionSyms().count(
|
||||
getStreamer().getCurrentSection().first)) {
|
||||
getStreamer().getCurrentSectionOnly())) {
|
||||
unsigned Line;
|
||||
if (ActiveMacros.empty())
|
||||
Line = SrcMgr.FindLineNumber(IDLoc, CurBuffer);
|
||||
@ -3109,7 +3109,7 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
|
||||
|
||||
// Check whether we should use optimal code alignment for this .align
|
||||
// directive.
|
||||
const MCSection *Section = getStreamer().getCurrentSection().first;
|
||||
const MCSection *Section = getStreamer().getCurrentSectionOnly();
|
||||
assert(Section && "must have section to emit alignment");
|
||||
bool UseCodeAlign = Section->UseCodeAlign();
|
||||
if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) &&
|
||||
|
@ -525,8 +525,8 @@ bool COFFAsmParser::ParseDirectiveLinkOnce(StringRef, SMLoc Loc) {
|
||||
if (parseCOMDATType(Type))
|
||||
return true;
|
||||
|
||||
const MCSectionCOFF *Current = static_cast<const MCSectionCOFF*>(
|
||||
getStreamer().getCurrentSection().first);
|
||||
const MCSectionCOFF *Current =
|
||||
static_cast<const MCSectionCOFF *>(getStreamer().getCurrentSectionOnly());
|
||||
|
||||
if (Type == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE)
|
||||
return Error(Loc, "cannot make section associative with .linkonce");
|
||||
|
@ -468,8 +468,8 @@ bool DarwinAsmParser::parseDirectiveDesc(StringRef, SMLoc) {
|
||||
/// parseDirectiveIndirectSymbol
|
||||
/// ::= .indirect_symbol identifier
|
||||
bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
|
||||
const MCSectionMachO *Current = static_cast<const MCSectionMachO*>(
|
||||
getStreamer().getCurrentSection().first);
|
||||
const MCSectionMachO *Current = static_cast<const MCSectionMachO *>(
|
||||
getStreamer().getCurrentSectionOnly());
|
||||
MachO::SectionType SectionType = Current->getType();
|
||||
if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
|
||||
SectionType != MachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
|
@ -292,7 +292,7 @@ void MCStreamer::AssignFragment(MCSymbol *Symbol, MCFragment *Fragment) {
|
||||
|
||||
void MCStreamer::EmitLabel(MCSymbol *Symbol) {
|
||||
assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
|
||||
assert(getCurrentSection().first && "Cannot emit before setting section!");
|
||||
assert(getCurrentSectionOnly() && "Cannot emit before setting section!");
|
||||
assert(!Symbol->getFragment() && "Unexpected fragment on symbol data!");
|
||||
Symbol->setFragment(&getCurrentSectionOnly()->getDummyFragment());
|
||||
|
||||
|
@ -10106,7 +10106,7 @@ bool ARMAsmParser::parseDirectiveLtorg(SMLoc L) {
|
||||
}
|
||||
|
||||
bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
|
||||
const MCSection *Section = getStreamer().getCurrentSection().first;
|
||||
const MCSection *Section = getStreamer().getCurrentSectionOnly();
|
||||
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
TokError("unexpected token in directive");
|
||||
@ -10115,7 +10115,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
|
||||
|
||||
if (!Section) {
|
||||
getStreamer().InitSections(false);
|
||||
Section = getStreamer().getCurrentSection().first;
|
||||
Section = getStreamer().getCurrentSectionOnly();
|
||||
}
|
||||
|
||||
assert(Section && "must have section to emit alignment");
|
||||
@ -10369,7 +10369,7 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) {
|
||||
return true;
|
||||
|
||||
// '.align' is target specifically handled to mean 2**2 byte alignment.
|
||||
const MCSection *Section = getStreamer().getCurrentSection().first;
|
||||
const MCSection *Section = getStreamer().getCurrentSectionOnly();
|
||||
assert(Section && "must have section to emit alignment");
|
||||
if (Section->UseCodeAlign())
|
||||
getStreamer().EmitCodeAlignment(4, 0);
|
||||
|
@ -2972,14 +2972,14 @@ bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
|
||||
/// parseDirectiveEven
|
||||
/// ::= .even
|
||||
bool X86AsmParser::parseDirectiveEven(SMLoc L) {
|
||||
const MCSection *Section = getStreamer().getCurrentSection().first;
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
TokError("unexpected token in directive");
|
||||
return false;
|
||||
}
|
||||
const MCSection *Section = getStreamer().getCurrentSectionOnly();
|
||||
if (!Section) {
|
||||
getStreamer().InitSections(false);
|
||||
Section = getStreamer().getCurrentSection().first;
|
||||
Section = getStreamer().getCurrentSectionOnly();
|
||||
}
|
||||
if (Section->UseCodeAlign())
|
||||
getStreamer().EmitCodeAlignment(2, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user