LLVM: lib/MC/MCObjectStreamer.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

25using namespace llvm;

26

28 std::unique_ptr TAB,

29 std::unique_ptr OW,

30 std::unique_ptr Emitter)

34 EmitEHFrame(true), EmitDebugFrame(false) {

35 assert(Assembler->getBackendPtr() && Assembler->getEmitterPtr());

38 Assembler->setRelaxAll(true);

39}

40

42

45 return Assembler.get();

46 return nullptr;

47}

48

49

50

51

52

53

54

55

56void MCObjectStreamer::resolvePendingFixups() {

57 for (PendingMCFixup &PendingFixup : PendingFixups) {

58 if (!PendingFixup.Sym || PendingFixup.Sym->isUndefined ()) {

60 "unresolved relocation offset");

61 continue;

62 }

63 PendingFixup.Fixup.setOffset(PendingFixup.Sym->getOffset() +

64 PendingFixup.Fixup.getOffset());

65

66

67

68

69 MCFragment *SymFragment = PendingFixup.Sym->getFragment();

70 switch (SymFragment->getKind()) {

74 cast<MCEncodedFragmentWithFixups<8, 1>>(SymFragment)

75 ->getFixups()

76 .push_back(PendingFixup.Fixup);

77 break;

80 cast<MCEncodedFragmentWithFixups<32, 4>>(SymFragment)

81 ->getFixups()

82 .push_back(PendingFixup.Fixup);

83 break;

84 default:

85 PendingFixup.DF->getFixups().push_back(PendingFixup.Fixup);

86 break;

87 }

88 }

89 PendingFixups.clear();

90}

91

92

93

97 if (Hi->getFragment() || Hi->getFragment() != Lo->getFragment() ||

98 Hi->isVariable() || Lo->isVariable())

99 return std::nullopt;

100

101 return Hi->getOffset() - Lo->getOffset();

102}

103

106 unsigned Size) {

111}

112

118 return;

119 }

121}

122

124 if (Assembler) {

125 Assembler->reset();

127 Assembler->setRelaxAll(getContext().getTargetOptions()->MCRelaxAll);

128 }

129 EmitEHFrame = true;

130 EmitDebugFrame = false;

132}

133

136 return;

137

138 if (EmitEHFrame)

140

141 if (EmitDebugFrame)

143}

144

148 if (F.hasInstructions())

149 return true;

150

151

152

153 if (F.isLinkerRelaxable())

154 return false;

155

156

158 return false;

159

160

161 return !STI || F.getSubtargetInfo() == STI;

162}

163

170 }

171 return F;

172}

173

175 Assembler->registerSymbol(Sym);

176}

177

180 EmitEHFrame = EH;

181 EmitDebugFrame = Debug;

182}

183

188

190

191

192 int64_t AbsValue;

196 Loc, "value evaluated as " + Twine(AbsValue) + " is out of range.");

197 return;

198 }

200 return;

201 }

202 DF->getFixups().push_back(

205 DF->appendContents(Size, 0);

206}

207

208MCSymbol *MCObjectStreamer::emitCFILabel() {

211 return Label;

212}

213

214void MCObjectStreamer::emitCFIStartProcImpl(MCDwarfFrameInfo &Frame) {

215

218}

219

220void MCObjectStreamer::emitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {

223}

224

227

229

230

231

232

234 Symbol->setFragment(F);

235 Symbol->setOffset(F->getContents().size());

236

238}

239

241 auto Assignments = pendingAssignments.find(Symbol);

242 if (Assignments != pendingAssignments.end()) {

243 for (const PendingAssignment &A : Assignments->second)

245

246 pendingAssignments.erase(Assignments);

247 }

248}

249

250

251

257 Symbol->setFragment(&F);

258 Symbol->setOffset(Offset);

259}

260

262 int64_t IntValue;

265 return;

266 }

268}

269

271 int64_t IntValue;

274 return;

275 }

277}

278

281 report_fatal_error("This file format doesn't support weak aliases.");

282}

283

286}

287

290 assert(Section && "Cannot switch to a null section!");

292

293 auto &Subsections = Section->Subsections;

294 size_t I = 0, E = Subsections.size();

295 while (I != E && Subsections[I].first < Subsection)

296 ++I;

297

298

299 if (I == E || Subsections[I].first != Subsection) {

301 F->setParent(Section);

302 Subsections.insert(Subsections.begin() + I,

304 }

305 Section->CurFragList = &Subsections[I].second;

306 CurFrag = Section->CurFragList->Tail;

307

309}

310

314}

315

320}

321

324 const MCSymbol *Target = &cast(*Value).getSymbol();

325

326

327

328 if (Target->isRegistered())

330 else

331 pendingAssignments[Target].push_back({Symbol, Value});

332}

333

336}

337

343 " section '" + Sec.getName() +

344 "' cannot have instructions");

345 return;

346 }

347 emitInstructionImpl(Inst, STI);

348}

349

350void MCObjectStreamer::emitInstructionImpl(const MCInst &Inst,

353

356

357

358

360

361

366 emitInstToData(Inst, STI);

367 return;

368 }

369

370

371

372

373

374

377 MCInst Relaxed = Inst;

380 emitInstToData(Relaxed, STI);

381 return;

382 }

383

384

386}

387

390

391

395

397 IF->getFixups(), STI);

398}

399

400#ifndef NDEBUG

402 "Aligned bundling is not implemented for this object format";

403#endif

404

407}

408

411}

412

415}

416

418 unsigned Column, unsigned Flags,

419 unsigned Isa,

420 unsigned Discriminator,

422

423

425

427 Discriminator, FileName);

428}

429

436 const MCExpr *AddrDelta =

438 return AddrDelta;

439}

440

443 int64_t LineDelta, const MCSymbol *Label,

444 int PointerSize) {

445

446 OS.emitIntValue(dwarf::DW_LNS_extended_op, 1);

447 OS.emitULEB128IntValue(PointerSize + 1);

448 OS.emitIntValue(dwarf::DW_LNE_set_address, 1);

449 OS.emitSymbolValue(Label, PointerSize);

450

451

453}

454

458 unsigned PointerSize) {

459 if (!LastLabel) {

461 Label, PointerSize);

462 return;

463 }

465 insert(getContext().allocFragment(LineDelta,

466 *AddrDelta));

467}

468

472

473

474

475

476

477

478 if (!EndLabel)

480

481

482

485

489}

490

495 insert(getContext().allocFragment(*AddrDelta));

496}

497

499 unsigned Line, unsigned Column,

500 bool PrologueEnd, bool IsStmt,

502

504 return;

505

506

510 FileNo, Line, Column, PrologueEnd,

511 IsStmt);

512}

513

520}

521

523 unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum,

526 *this, PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym,

527 FnEndSym);

529 PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym, FnEndSym);

530}

531

533 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,

536

537

539}

540

543}

546}

547

550}

551

556}

557

559 unsigned ValueSize,

560 unsigned MaxBytesToEmit) {

561 if (MaxBytesToEmit == 0)

562 MaxBytesToEmit = Alignment.value();

564 Alignment, Value, ValueSize, MaxBytesToEmit));

565

566

569}

570

573 unsigned MaxBytesToEmit) {

576}

577

579 unsigned char Value,

582}

583

584

589 DF->appendContents(4, 0);

590}

591

592

597 DF->appendContents(8, 0);

598}

599

600

605 DF->appendContents(4, 0);

606}

607

608

613 DF->appendContents(8, 0);

614}

615

616

619 DF->getFixups().push_back(

621 DF->appendContents(4, 0);

622}

623

624

627 DF->getFixups().push_back(

629 DF->appendContents(8, 0);

630}

631

632static std::optional<std::pair<bool, std::string>>

635 if (Symbol.isVariable()) {

636 const MCExpr *SymbolExpr = Symbol.getVariableValue();

639 return std::make_pair(false,

640 std::string("symbol in .reloc offset is not "

641 "relocatable"));

644 MCFragment *Fragment = Symbol.getFragment();

645

646

648 return std::make_pair(false,

649 std::string("symbol in offset has no data "

650 "fragment"));

651 DF = cast(Fragment);

652 return std::nullopt;

653 }

654

656 return std::make_pair(false,

657 std::string(".reloc symbol offset is not "

658 "representable"));

659

662 return std::make_pair(false,

663 std::string("symbol used in the .reloc offset is "

664 "not defined"));

665

667 return std::make_pair(false,

668 std::string("symbol used in the .reloc offset is "

669 "variable"));

670

672

673

675 return std::make_pair(false,

676 std::string("symbol in offset has no data "

677 "fragment"));

679 DF = cast(Fragment);

680 } else {

681 RelocOffset = Symbol.getOffset();

682 MCFragment *Fragment = Symbol.getFragment();

683

684

686 return std::make_pair(false,

687 std::string("symbol in offset has no data "

688 "fragment"));

689 DF = cast(Fragment);

690 }

691 return std::nullopt;

692}

693

694std::optional<std::pair<bool, std::string>>

698 std::optional MaybeKind =

700 if (!MaybeKind)

701 return std::make_pair(true, std::string("unknown relocation name"));

702

704 if (Expr)

706 else

707 Expr =

709

712 if (Offset.evaluateAsRelocatable(OffsetVal, nullptr, nullptr))

713 return std::make_pair(false,

714 std::string(".reloc offset is not relocatable"));

717 return std::make_pair(false, std::string(".reloc offset is negative"));

718 DF->getFixups().push_back(

720 return std::nullopt;

721 }

723 return std::make_pair(false,

724 std::string(".reloc offset is not representable"));

725

728 if (Symbol.isDefined()) {

730 std::optional<std::pair<bool, std::string>> Error =

732

733 if (Error != std::nullopt)

735

736 DF->getFixups().push_back(

738 Expr, Kind, Loc));

739 return std::nullopt;

740 }

741

742 PendingFixups.emplace_back(

745 return std::nullopt;

746}

747

752 getContext().allocFragment(FillValue, 1, NumBytes, Loc));

753}

754

756 int64_t Expr, SMLoc Loc) {

757 int64_t IntNumValues;

758

759 if (NumValues.evaluateAsAbsolute(IntNumValues, getAssemblerPtr())) {

760 if (IntNumValues < 0) {

763 "'.fill' directive with negative repeat count has no effect");

764 return;

765 }

766

767 int64_t NonZeroSize = Size > 4 ? 4 : Size;

768 Expr &= ~0ULL >> (64 - NonZeroSize * 8);

769 for (uint64_t i = 0, e = IntNumValues; i != e; ++i) {

771 if (NonZeroSize < Size)

773 }

774 return;

775 }

776

777

780 getContext().allocFragment(Expr, Size, NumValues, Loc));

781}

782

787 NumBytes, ControlledNopLength, Loc, STI));

788}

789

792 Asm.getWriter().addFileName(Asm, Filename);

793}

794

801 if (CompilerVersion.size())

802 W.setCompilerVersion(CompilerVersion);

803

804

805}

806

809}

810

813}

814

817

818

819 if (getContext().getGenDwarfForAssembly())

821

822

824

825

827

828 resolvePendingFixups();

830}

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

dxil DXContainer Global Emitter

static ManagedStatic< cl::opt< bool, true >, CreateDebug > Debug

static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")

static const MCExpr * buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A, const MCSymbol *B, SMLoc Loc)

static const char *const BundlingNotImplementedMsg

static std::optional< std::pair< bool, std::string > > getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset, MCDataFragment *&DF)

static void emitDwarfSetLineAddr(MCObjectStreamer &OS, MCDwarfLineTableParams Params, int64_t LineDelta, const MCSymbol *Label, int PointerSize)

static std::optional< uint64_t > absoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo)

static bool canReuseDataFragment(const MCDataFragment &F, const MCAssembler &Assembler, const MCSubtargetInfo *STI)

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)

Emits a line table substream.

void emitFileChecksums(MCObjectStreamer &OS)

Emits the file checksum substream.

void recordCVLoc(MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt)

Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen.

void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo)

Emits the offset into the checksum table of the given file number.

void emitInlineLineTableForFunction(MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)

void emitStringTable(MCObjectStreamer &OS)

Emits the string table substream.

MCFragment * emitDefRange(MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)

Lightweight error class with error context and mandatory checking.

Generic interface to target specific assembler backends.

virtual bool allowEnhancedRelaxation() const

Return true if this target allows an unrelaxable instruction to be emitted into RelaxableFragment and...

virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const

Relax the instruction in the given fragment to the next wider instruction.

virtual bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const

Check whether the given instruction may need relaxation.

virtual std::optional< MCFixupKind > getFixupKind(StringRef Name) const

Map a relocation name used in .reloc to a fixup kind.

This class is intended to be used as a base class for asm properties and features specific to the tar...

unsigned getCodePointerSize() const

Get the code pointer size in bytes.

void Finish()

Finish - Do final processing and write the object to the output stream.

bool isBundlingEnabled() const

MCObjectWriter & getWriter() const

MCCodeEmitter & getEmitter() const

MCAsmBackend & getBackend() const

bool registerSection(MCSection &Section)

bool registerSymbol(const MCSymbol &Symbol)

MCDwarfLineTableParams getDWARFLinetableParams() const

static const MCBinaryExpr * create(Opcode Op, const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())

virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0

Encode the given Inst to bytes and append to CB.

Context object for machine code objects.

const MCObjectFileInfo * getObjectFileInfo() const

MCSymbol * createTempSymbol()

Create a temporary symbol with a unique name.

CodeViewContext & getCVContext()

const SourceMgr * getSourceManager() const

const MCAsmInfo * getAsmInfo() const

void reportError(SMLoc L, const Twine &Msg)

const MCTargetOptions * getTargetOptions() const

F * allocFragment(Args &&...args)

Fragment for data and encoded instructions.

static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH)

static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta)

Utility function to emit the encoding to a streamer.

static void make(MCStreamer *MCOS, MCSection *Section)

static void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params)

Base class for the full range of assembler expressions which are needed for parsing.

bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const

Try to evaluate the expression to a relocatable value, i.e.

static MCFixupKind getKindForSize(unsigned Size, bool IsPCRel)

Return the generic fixup kind for a value with the given size.

static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())

FragmentType getKind() const

static void Emit(MCStreamer *MCOS)

Instances of this class represent a single low-level machine instruction.

MCSection * getDwarfLineSection() const

Streaming object file generation interface.

void reset() override

state management

void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override

Emit Size bytes worth of the value specified by FillValue.

void emitValueToAlignment(Align Alignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0) override

Emit some number of copies of Value until the byte alignment ByteAlignment is reached.

void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override

Emit an assignment of Value to Symbol.

void emitULEB128Value(const MCExpr *Value) override

void emitSLEB128Value(const MCExpr *Value) override

void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI) override

MCDataFragment * getOrCreateDataFragment(const MCSubtargetInfo *STI=nullptr)

Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.

void emitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) override

This implements the CodeView '.cv_inline_linetable' assembler directive.

void emitCVStringTableDirective() override

This implements the CodeView '.cv_stringtable' assembler directive.

void emitBundleAlignMode(Align Alignment) override

Set the bundle alignment mode from now on in the section.

MCAssembler & getAssembler()

void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override

Emit an weak reference from Alias to Symbol.

void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel, const MCSymbol *Label, unsigned PointerSize) override

If targets does not support representing debug line section by .loc/.file directives in assembly outp...

void emitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc) override

This implements the CodeView '.cv_loc' assembler directive.

void emitDTPRel32Value(const MCExpr *Value) override

Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.

void emitBytes(StringRef Data) override

Emit the bytes in Data into the output.

void emitBundleLock(bool AlignToEnd) override

The following instructions are a bundle-locked group.

void emitPendingAssignments(MCSymbol *Symbol)

Emits pending conditional assignments that depend on Symbol being emitted.

bool changeSectionImpl(MCSection *Section, uint32_t Subsection)

void emitFileDirective(StringRef Filename) override

Switch to a new logical file.

void emitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion) override

This implements the CodeView '.cv_def_range' assembler directive.

void emitGPRel64Value(const MCExpr *Value) override

Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.

MCAssembler * getAssemblerPtr() override

std::optional< std::pair< bool, std::string > > emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI) override

Record a relocation described by the .reloc directive.

void emitAddrsigSym(const MCSymbol *Sym) override

void emitDwarfLineEndEntry(MCSection *Section, MCSymbol *LastLabel, MCSymbol *EndLabel=nullptr) override

Emit the debug line end entry.

void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override

Emit the given Instruction into the current section.

void visitUsedSymbol(const MCSymbol &Sym) override

void emitGPRel32Value(const MCExpr *Value) override

Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.

void insert(MCFragment *F)

virtual void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &)

Emit an instruction to a special fragment, because this instruction can change its size during relaxa...

void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override

Emit a label for Symbol into the current section.

MCObjectStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)

void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override

Emit the expression Value into the output as a native integer of the given Size bytes.

void finishImpl() override

Streamer specific finalization.

void changeSection(MCSection *Section, uint32_t Subsection=0) override

This is called by popSection and switchSection, if the current section changes.

void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) override

Emit the absolute difference between two symbols encoded with ULEB128.

void emitBundleUnlock() override

Ends a bundle-locked group.

void emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel, const MCSymbol *Label, SMLoc Loc)

void switchSectionNoPrint(MCSection *Section) override

Similar to switchSection, but does not print the section directive.

void emitCFISections(bool EH, bool Debug) override

void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName) override

This implements the DWARF2 '.loc fileno lineno ...' assembler directive.

bool mayHaveInstructions(MCSection &Sec) const override

void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0) override

Emit nops until the byte alignment ByteAlignment is reached.

void emitFrames(MCAsmBackend *MAB)

void emitTPRel64Value(const MCExpr *Value) override

Emit the expression Value into the output as a tprel (64-bit TP relative) value.

void emitCVFileChecksumOffsetDirective(unsigned FileNo) override

This implements the CodeView '.cv_filechecksumoffset' assembler directive.

void emitTPRel32Value(const MCExpr *Value) override

Emit the expression Value into the output as a tprel (32-bit TP relative) value.

void emitAddrsig() override

void emitConditionalAssignment(MCSymbol *Symbol, const MCExpr *Value) override

Emit an assignment of Value to Symbol, but only if Value is also emitted.

void emitCVFileChecksumsDirective() override

This implements the CodeView '.cv_filechecksums' assembler directive.

void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *Begin, const MCSymbol *End) override

This implements the CodeView '.cv_linetable' assembler directive.

void emitDTPRel64Value(const MCExpr *Value) override

Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.

virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F, uint64_t Offset)

void emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc) override

Emit some number of copies of Value until the byte offset Offset is reached.

void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) override

Emit the absolute difference between two symbols if possible.

Defines the object file and target independent interfaces used by the assembler backend to write nati...

void emitAddrsigSection()

Tell the object writer to emit an address-significance table during writeObject().

void addAddrsigSymbol(const MCSymbol *Sym)

Record the given symbol in the address-significance table to be written diring writeObject().

static void emit(MCObjectStreamer *MCOS)

A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...

Instances of this class represent a uniqued identifier for a section in the current translation unit.

virtual StringRef getVirtualSectionKind() const

void ensureMinAlignment(Align MinAlignment)

Makes sure that Alignment is at least MinAlignment.

bool hasInstructions() const

void setHasInstructions(bool Value)

bool isVirtualSection() const

Check whether this section is "virtual", that is has no actual object file contents.

bool isBundleLocked() const

StringRef getName() const

Streaming machine code generation interface.

virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)

Emit an assignment of Value to Symbol.

virtual void switchSectionNoPrint(MCSection *Section)

Similar to switchSection, but does not print the section directive.

virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)

Emit the given Instruction into the current section.

MCFragment * getCurrentFragment() const

virtual void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName)

This implements the DWARF2 '.loc fileno lineno ...' assembler directive.

virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo)

Emit the absolute difference between two symbols encoded with ULEB128.

bool getUseAssemblerInfoForParsing()

MCContext & getContext() const

bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc)

Returns true if the .cv_loc directive is in the right section.

virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size)

Emit the absolute difference between two symbols.

virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())

Emit a label for Symbol into the current section.

void setAllowAutoPadding(bool v)

virtual void reset()

State management.

virtual void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)

This implements the CodeView '.cv_linetable' assembler directive.

virtual void emitCFISections(bool EH, bool Debug)

virtual void emitIntValue(uint64_t Value, unsigned Size)

Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.

unsigned getNumFrameInfos()

unsigned emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)

Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...

MCSymbol * endSection(MCSection *Section)

virtual void switchSection(MCSection *Section, uint32_t Subsec=0)

Set the current section where code is being emitted to Section.

virtual void emitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)

This implements the CodeView '.cv_def_range' assembler directive.

MCSection * getCurrentSectionOnly() const

virtual void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())

Emit the expression Value into the output as a native integer of the given Size bytes.

unsigned emitSLEB128IntValue(int64_t Value)

Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integ...

virtual void emitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)

This implements the CodeView '.cv_inline_linetable' assembler directive.

void visitUsedExpr(const MCExpr &Expr)

Generic base class for all target subtargets.

Represent a reference to a symbol from inside an expression.

const MCSymbol & getSymbol() const

static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

bool isDefined() const

isDefined - Check if this symbol is defined (i.e., it has an address).

bool isVariable() const

isVariable - Check if this is a variable symbol.

uint64_t getOffset() const

MCFragment * getFragment(bool SetUsed=true) const

This represents an "assembler immediate".

int64_t getConstant() const

const MCSymbolRefExpr * getSymB() const

const MCSymbolRefExpr * getSymA() const

bool isAbsolute() const

Is this an absolute (as opposed to relocatable) value.

Represents a location in source code.

void PrintMessage(raw_ostream &OS, SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges={}, ArrayRef< SMFixIt > FixIts={}, bool ShowColors=true) const

Emit a message about the specified location with the specified string.

StringRef - Represent a constant reference to a string, i.e.

constexpr size_t size() const

size - Get the string size.

Target - Wrapper for Target specific information.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

LLVM Value Representation.

This class represents a function that is read from a sample profile.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

This is an optimization pass for GlobalISel generic memory operations.

bool isUIntN(unsigned N, uint64_t x)

Checks if an unsigned integer fits into the given (dynamic) bit width.

void report_fatal_error(Error Err, bool gen_crash_diag=true)

Report a serious error, calling any installed error handler.

MCFixupKind

Extensible enumeration to represent the type of a fixup.

@ FK_DTPRel_4

A four-byte dtp relative fixup.

@ FK_DTPRel_8

A eight-byte dtp relative fixup.

@ FK_TPRel_4

A four-byte tp relative fixup.

@ FK_GPRel_4

A four-byte gp relative fixup.

@ FK_TPRel_8

A eight-byte tp relative fixup.

bool isIntN(unsigned N, int64_t x)

Checks if an signed integer fits into the given (dynamic) bit width.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.

This struct is a compact representation of a valid (non-zero power of two) alignment.

uint64_t value() const

This is a hole in the type system and should not be abused.