llvm.org GIT mirror llvm / ea40df3
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 Eric Christopher 3 years ago
11 changed file(s) with 29 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
156156
157157 /// getCurrentSection() - Return the current section we are emitting to.
158158 const MCSection *AsmPrinter::getCurrentSection() const {
159 return OutStreamer->getCurrentSection().first;
159 return OutStreamer->getCurrentSectionOnly();
160160 }
161161
162162 void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
7878 }
7979
8080 void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
81 MCSection *Section = Streamer.getCurrentSection().first;
81 MCSection *Section = Streamer.getCurrentSectionOnly();
8282 if (ConstantPool *CP = getConstantPool(Section)) {
8383 emitConstantPool(Streamer, Section, *CP);
8484 }
8787 const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
8888 const MCExpr *Expr,
8989 unsigned Size, SMLoc Loc) {
90 MCSection *Section = Streamer.getCurrentSection().first;
90 MCSection *Section = Streamer.getCurrentSectionOnly();
9191 return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(),
9292 Size, Loc);
9393 }
748748 }
749749
750750 void MCAsmStreamer::EmitBytes(StringRef Data) {
751 assert(getCurrentSection().first &&
751 assert(getCurrentSectionOnly() &&
752752 "Cannot emit contents before setting section!");
753753 if (Data.empty()) return;
754754
793793 void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
794794 SMLoc Loc) {
795795 assert(Size <= 8 && "Invalid size");
796 assert(getCurrentSection().first &&
796 assert(getCurrentSectionOnly() &&
797797 "Cannot emit contents before setting section!");
798798 const char *Directive = nullptr;
799799 switch (Size) {
15791579 }
15801580 }
15811581
1582 void MCAsmStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) {
1583 assert(getCurrentSection().first &&
1582 void MCAsmStreamer::EmitInstruction(const MCInst &Inst,
1583 const MCSubtargetInfo &STI) {
1584 assert(getCurrentSectionOnly() &&
15841585 "Cannot emit contents before setting section!");
15851586
15861587 // Show the encoding in a comment if we have a code emitter.
916916 MCContext &context = MCOS->getContext();
917917 // We won't create dwarf labels for symbols in sections that we are not
918918 // generating debug info for.
919 if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSection().first))
919 if (!context.getGenDwarfSectionSyms().count(MCOS->getCurrentSectionOnly()))
920920 return;
921921
922922 // The dwarf label's name does not have the symbol name's leading
127127 flushPendingLabels(DF, DF->getContents().size());
128128
129129 MCCVLineEntry::Make(this);
130 MCDwarfLineEntry::Make(this, getCurrentSection().first);
130 MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
131131
132132 // Avoid fixups when possible.
133133 int64_t AbsValue;
235235 // Now that a machine instruction has been assembled into this section, make
236236 // a line entry for any .loc directive that has been seen.
237237 MCCVLineEntry::Make(this);
238 MCDwarfLineEntry::Make(this, getCurrentSection().first);
238 MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
239239
240240 // If this instruction doesn't need relaxation, just emit it as data.
241241 MCAssembler &Assembler = getAssembler();
304304 StringRef FileName) {
305305 // In case we see two .loc directives in a row, make sure the
306306 // first one gets a line entry.
307 MCDwarfLineEntry::Make(this, getCurrentSection().first);
307 MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
308308
309309 this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
310310 Isa, Discriminator, FileName);
412412
413413 void MCObjectStreamer::EmitBytes(StringRef Data) {
414414 MCCVLineEntry::Make(this);
415 MCDwarfLineEntry::Make(this, getCurrentSection().first);
415 MCDwarfLineEntry::Make(this, getCurrentSectionOnly());
416416 MCDataFragment *DF = getOrCreateDataFragment();
417417 flushPendingLabels(DF, DF->getContents().size());
418418 DF->getContents().append(Data.begin(), Data.end());
427427 insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit));
428428
429429 // Update the maximum alignment on the current section if necessary.
430 MCSection *CurSec = getCurrentSection().first;
430 MCSection *CurSec = getCurrentSectionOnly();
431431 if (ByteAlignment > CurSec->getAlignment())
432432 CurSec->setAlignment(ByteAlignment);
433433 }
529529 }
530530
531531 void MCObjectStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) {
532 const MCSection *Sec = getCurrentSection().first;
533 (void)Sec;
534 assert(Sec && "need a section");
532 assert(getCurrentSectionOnly() && "need a section");
535533 insert(new MCFillFragment(FillValue, NumBytes));
536534 }
537535
732732 // If we are generating dwarf for assembly source files save the initial text
733733 // section and generate a .file directive.
734734 if (getContext().getGenDwarfForAssembly()) {
735 MCSection *Sec = getStreamer().getCurrentSection().first;
735 MCSection *Sec = getStreamer().getCurrentSectionOnly();
736736 if (!Sec->getBeginSymbol()) {
737737 MCSymbol *SectionStartSym = getContext().createTempSymbol();
738738 getStreamer().EmitLabel(SectionStartSym);
828828 }
829829
830830 bool AsmParser::checkForValidSection() {
831 if (!ParsingInlineAsm && !getStreamer().getCurrentSection().first) {
831 if (!ParsingInlineAsm && !getStreamer().getCurrentSectionOnly()) {
832832 Out.InitSections(false);
833833 return Error(getTok().getLoc(),
834834 "expected section directive before assembly directive");
20132013 // directive for the instruction.
20142014 if (!ParseHadError && getContext().getGenDwarfForAssembly() &&
20152015 getContext().getGenDwarfSectionSyms().count(
2016 getStreamer().getCurrentSection().first)) {
2016 getStreamer().getCurrentSectionOnly())) {
20172017 unsigned Line;
20182018 if (ActiveMacros.empty())
20192019 Line = SrcMgr.FindLineNumber(IDLoc, CurBuffer);
31083108
31093109 // Check whether we should use optimal code alignment for this .align
31103110 // directive.
3111 const MCSection *Section = getStreamer().getCurrentSection().first;
3111 const MCSection *Section = getStreamer().getCurrentSectionOnly();
31123112 assert(Section && "must have section to emit alignment");
31133113 bool UseCodeAlign = Section->UseCodeAlign();
31143114 if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) &&
524524 if (parseCOMDATType(Type))
525525 return true;
526526
527 const MCSectionCOFF *Current = static_cast(
528 getStreamer().getCurrentSection().first);
527 const MCSectionCOFF *Current =
528 static_cast(getStreamer().getCurrentSectionOnly());
529529
530530 if (Type == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE)
531531 return Error(Loc, "cannot make section associative with .linkonce");
467467 /// parseDirectiveIndirectSymbol
468468 /// ::= .indirect_symbol identifier
469469 bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
470 const MCSectionMachO *Current = static_cast(
471 getStreamer().getCurrentSection().first);
470 const MCSectionMachO *Current = static_cast(
471 getStreamer().getCurrentSectionOnly());
472472 MachO::SectionType SectionType = Current->getType();
473473 if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
474474 SectionType != MachO::S_LAZY_SYMBOL_POINTERS &&
291291
292292 void MCStreamer::EmitLabel(MCSymbol *Symbol) {
293293 assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
294 assert(getCurrentSection().first && "Cannot emit before setting section!");
294 assert(getCurrentSectionOnly() && "Cannot emit before setting section!");
295295 assert(!Symbol->getFragment() && "Unexpected fragment on symbol data!");
296296 Symbol->setFragment(&getCurrentSectionOnly()->getDummyFragment());
297297
1010510105 }
1010610106
1010710107 bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
10108 const MCSection *Section = getStreamer().getCurrentSection().first;
10108 const MCSection *Section = getStreamer().getCurrentSectionOnly();
1010910109
1011010110 if (getLexer().isNot(AsmToken::EndOfStatement)) {
1011110111 TokError("unexpected token in directive");
1011410114
1011510115 if (!Section) {
1011610116 getStreamer().InitSections(false);
10117 Section = getStreamer().getCurrentSection().first;
10117 Section = getStreamer().getCurrentSectionOnly();
1011810118 }
1011910119
1012010120 assert(Section && "must have section to emit alignment");
1036810368 return true;
1036910369
1037010370 // '.align' is target specifically handled to mean 2**2 byte alignment.
10371 const MCSection *Section = getStreamer().getCurrentSection().first;
10371 const MCSection *Section = getStreamer().getCurrentSectionOnly();
1037210372 assert(Section && "must have section to emit alignment");
1037310373 if (Section->UseCodeAlign())
1037410374 getStreamer().EmitCodeAlignment(4, 0);
29712971 /// parseDirectiveEven
29722972 /// ::= .even
29732973 bool X86AsmParser::parseDirectiveEven(SMLoc L) {
2974 const MCSection *Section = getStreamer().getCurrentSection().first;
29752974 if (getLexer().isNot(AsmToken::EndOfStatement)) {
29762975 TokError("unexpected token in directive");
29772976 return false;
29782977 }
2978 const MCSection *Section = getStreamer().getCurrentSectionOnly();
29792979 if (!Section) {
29802980 getStreamer().InitSections(false);
2981 Section = getStreamer().getCurrentSection().first;
2981 Section = getStreamer().getCurrentSectionOnly();
29822982 }
29832983 if (Section->UseCodeAlign())
29842984 getStreamer().EmitCodeAlignment(2, 0);