readability a bit.
llvm-svn: 284202
/// 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 {
}
void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
- MCSection *Section = Streamer.getCurrentSection().first;
+ MCSection *Section = Streamer.getCurrentSectionOnly();
if (ConstantPool *CP = getConstantPool(Section)) {
emitConstantPool(Streamer, Section, *CP);
}
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);
}
}
void MCAsmStreamer::EmitBytes(StringRef Data) {
- assert(getCurrentSection().first &&
+ assert(getCurrentSectionOnly() &&
"Cannot emit contents before setting section!");
if (Data.empty()) return;
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) {
}
}
-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.
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
flushPendingLabels(DF, DF->getContents().size());
MCCVLineEntry::Make(this);
- MCDwarfLineEntry::Make(this, getCurrentSection().first);
+ MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
// Avoid fixups when possible.
int64_t AbsValue;
// 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();
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);
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());
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);
}
}
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));
}
// 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);
}
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");
// 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);
// 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) &&
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");
/// 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 &&
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());
}
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");
if (!Section) {
getStreamer().InitSections(false);
- Section = getStreamer().getCurrentSection().first;
+ Section = getStreamer().getCurrentSectionOnly();
}
assert(Section && "must have section to emit alignment");
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);
/// 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);