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), EmitSFrame(false) {

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

38 if (Context.getTargetOptions() && Context.getTargetOptions()->MCRelaxAll)

39 Assembler->setRelaxAll(true);

40}

41

43

46 return Assembler.get();

47 return nullptr;

48}

49

51

53

56

62 FragStorage.push_back(std::move(Block));

63 return F;

64}

65

69 auto End = reinterpret_cast<size_t>(getCurFragEnd());

72 FragSpace -= size_t(F) - End + sizeof(MCFragment);

73 } else {

75 }

78}

79

81 if (Headroom <= FragSpace)

82 return;

86}

87

88void MCObjectStreamer::addSpecialFragment(MCFragment *Frag) {

90 "Frag should have a variable-size tail");

91

92

93

96 auto End = reinterpret_cast<size_t>(getCurFragEnd());

99 FragSpace -= size_t(F) - End + sizeof(MCFragment);

100 } else {

102 }

103 new (F) MCFragment();

104

107}

108

111 assert(FragSpace >= Contents.size());

114 FragSpace -= Contents.size();

115}

116

121 CurFrag->FixedSize += Num;

122 FragSpace -= Num;

123}

124

128

129

130

131

135 if (Lo == Hi)

136 return 0;

137 if (Hi->isVariable() || Lo->isVariable())

138 return std::nullopt;

139 auto *LoF = Lo->getFragment();

140 if (!LoF || Hi->getFragment() != LoF || LoF->isLinkerRelaxable())

141 return std::nullopt;

142

143 auto Fixed = LoF->getFixedSize();

144 if (Lo->getOffset() > Fixed || Hi->getOffset() > Fixed)

145 return std::nullopt;

146

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

148}

149

152 unsigned Size) {

155 else

157}

158

166

168 if (Assembler) {

169 Assembler->reset();

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

172 }

173 EmitEHFrame = true;

174 EmitDebugFrame = false;

175 FragStorage.clear();

176 FragSpace = 0;

177 SpecialFragAllocator.Reset();

179}

180

183 return;

184

186 if (EmitEHFrame)

188

189 if (EmitDebugFrame)

191

192 if (EmitSFrame || (getContext().getTargetOptions() &&

193 getContext().getTargetOptions()->EmitSFrameUnwind))

195}

196

198 Assembler->registerSymbol(Sym);

199}

200

203 EmitEHFrame = EH;

204 EmitDebugFrame = Debug;

205 EmitSFrame = SFrame;

206}

207

211

213

214

215 int64_t AbsValue;

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

220 return;

221 }

223 return;

224 }

228}

229

235

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

237

240}

241

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

245}

246

249

250

251 if (Symbol->isVariable())

252 return;

253

255

256

257

258

260 Symbol->setFragment(F);

261 Symbol->setOffset(F->getFixedSize());

262

264}

265

267 auto Assignments = pendingAssignments.find(Symbol);

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

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

271

272 pendingAssignments.erase(Assignments);

273 }

274}

275

276

277

283 Symbol->setFragment(&F);

284 Symbol->setOffset(Offset);

285}

286

288 int64_t IntValue;

291 return;

292 }

294 F->makeLEB(false, Value);

296}

297

299 int64_t IntValue;

302 return;

303 }

305 F->makeLEB(true, Value);

307}

308

313

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

317

318

319

322 if (NewSec && Subsection) {

325 }

326

327

328

329

332 auto End = reinterpret_cast<size_t>(getCurFragEnd());

335 FragSpace -= size_t(F) - End + sizeof(MCFragment);

336 } else {

338 }

340 F->setParent(Section);

341

342 auto &Subsections = Section->Subsections;

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

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

345 ++I;

346

347

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

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

350 {Subsection, MCSection::FragList{F, F}});

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

353 } else {

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

355 CurFrag = Subsections[I].second.Tail;

356

357 addFragment(F);

358 }

359

360

361 if (!NewSec)

362 return;

363 if (auto *Sym = Section->getBeginSymbol()) {

364 Sym->setFragment(Subsection ? F0 : CurFrag);

365 getAssembler().registerSymbol(*Sym);

366 }

367}

368

374

378

379

380

381 if (Target->isRegistered())

383 else

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

385}

386

390

394

397

398

399

401

402

404 MCAsmBackend &Backend = Assembler.getBackend();

407 emitInstToData(Inst, STI);

408 return;

409 }

410

411

412 if (Assembler.getRelaxAll()) {

413 MCInst Relaxed = Inst;

414 while (Backend.mayNeedRelaxation(Relaxed.getOpcode(), Relaxed.getOperands(),

415 STI))

417 emitInstToData(Relaxed, STI);

418 return;

419 }

420

422}

423

424void MCObjectStreamer::emitInstToData(const MCInst &Inst,

427

428

436 CodeOffset = 0;

437 }

438 F->setHasInstructions(STI);

439

440 if (Fixups.empty())

441 return;

442 bool MarkedLinkerRelaxable = false;

443 for (auto &Fixup : Fixups) {

444 Fixup.setOffset(Fixup.getOffset() + CodeOffset);

445 if (Fixup.isLinkerRelaxable() || MarkedLinkerRelaxable)

446 continue;

447 MarkedLinkerRelaxable = true;

448

449

450 auto *Sec = F->getParent();

451 if (!Sec->isLinkerRelaxable())

452 Sec->setFirstLinkerRelaxable(F->getLayoutOrder());

453

454

455

456 F->setLinkerRelaxable();

458 }

459 F->appendFixups(Fixups);

460}

461

468

470 F->setHasInstructions(STI);

471

472 F->setVarContents(Data);

473 F->setInst(Inst);

474

475 bool MarkedLinkerRelaxable = false;

476 for (auto &Fixup : Fixups) {

477 if (Fixup.isLinkerRelaxable() || MarkedLinkerRelaxable)

478 continue;

479 MarkedLinkerRelaxable = true;

480 auto *Sec = F->getParent();

481 if (!Sec->isLinkerRelaxable())

482 Sec->setFirstLinkerRelaxable(F->getLayoutOrder());

483 F->setLinkerRelaxable();

484 }

485 F->setVarFixups(Fixups);

486

488}

489

491 unsigned Column, unsigned Flags,

492 unsigned Isa,

493 unsigned Discriminator,

496

497

499

501 Discriminator, FileName, Comment);

502}

503

509 const MCExpr *AddrDelta =

511 return AddrDelta;

512}

513

516 int64_t LineDelta, const MCSymbol *Label,

517 int PointerSize) {

518

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

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

523

524

526}

527

531 unsigned PointerSize) {

532 if (!LastLabel) {

534 Label, PointerSize);

535 return;

536 }

537

538

539

540

544 LineDelta, *OptAddrDelta, Tmp);

546 return;

547 }

548

552 F->setDwarfLineDelta(LineDelta);

554}

555

559

560

561

562

563

564

565 if (!EndLabel)

567

568

569

571 switchSection(Ctx.getObjectFileInfo()->getDwarfLineSection());

572

573 const MCAsmInfo *AsmInfo = Ctx.getAsmInfo();

576}

577

586

591 assert(FuncBase && "No function base address");

592 assert(FREBegin && "FRE doesn't describe a location");

596 F->setSFrameFDE(FDEFrag);

598}

599

601 unsigned Line, unsigned Column,

602 bool PrologueEnd, bool IsStmt,

604

606 return;

607

608

612 FileNo, Line, Column, PrologueEnd,

613 IsStmt);

614}

615

623

625 unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum,

628 *this, PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym,

629 FnEndSym);

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

632}

633

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

638

639

641}

642

649

653

658

661 unsigned MaxBytesToEmit) {

662 if (MaxBytesToEmit == 0)

663 MaxBytesToEmit = Alignment.value();

665 F->makeAlign(Alignment, Fill, FillLen, MaxBytesToEmit);

667

668

669 F->getParent()->ensureMinAlignment(Alignment);

670}

671

674 unsigned MaxBytesToEmit) {

677 F->u.align.EmitNops = true;

678 F->STI = STI;

679}

680

682 unsigned char Value,

685}

686

689 std::optional MaybeKind =

690 Assembler->getBackend().getFixupKind(Name);

691 if (!MaybeKind) {

693 return;

694 }

695

697 if (Expr)

699 else

700 Expr =

702

704 int64_t Val;

705 if (Offset.evaluateAsAbsolute(Val, nullptr)) {

709 }

711}

712

718

721 int64_t IntNumValues;

722

723 if (NumValues.evaluateAsAbsolute(IntNumValues, getAssembler())) {

724 if (IntNumValues < 0) {

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

728 return;

729 }

730

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

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

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

735 if (NonZeroSize < Size)

737 }

738 return;

739 }

740

741

744}

745

751

754 Asm.getWriter().addFileName(Filename);

755}

756

762 W.addFileName(Filename);

763 if (CompilerVersion.size())

764 W.setCompilerVersion(CompilerVersion);

765

766

767}

768

772

776

779

780

781 if (getContext().getGenDwarfForAssembly())

783

784

786

787

789

791}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

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

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

#define LLVM_LIKELY(EXPR)

dxil DXContainer Global Emitter

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

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

Definition MCObjectStreamer.cpp:504

constexpr size_t FragBlockSize

Definition MCObjectStreamer.cpp:50

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

Definition MCObjectStreamer.cpp:514

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

Definition MCObjectStreamer.cpp:132

constexpr size_t NewFragHeadroom

Definition MCObjectStreamer.cpp:52

PowerPC TLS Dynamic Call Fixup

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

size_t size() const

size - Get the array size.

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 emitDefRange(MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)

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.

Generic interface to target specific assembler backends.

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(unsigned Opcode, ArrayRef< MCOperand > Operands, const MCSubtargetInfo &STI) const

Check whether the given instruction (encoded as Opcode+Operands) may need relaxation.

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.

LLVM_ABI void Finish()

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

MCObjectWriter & getWriter() const

LLVM_ABI void addRelocDirective(RelocDirective RD)

MCCodeEmitter & getEmitter() const

MCAsmBackend & getBackend() const

LLVM_ABI bool registerSection(MCSection &Section)

LLVM_ABI bool registerSymbol(const MCSymbol &Symbol)

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

static LLVM_ABI 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.

LLVM_ABI MCSymbol * createTempSymbol()

Create a temporary symbol with a unique name.

LLVM_ABI void RemapDebugPaths()

LLVM_ABI CodeViewContext & getCVContext()

const SourceMgr * getSourceManager() const

LLVM_ABI void reportError(SMLoc L, const Twine &Msg)

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

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

Utility function to emit the encoding to a streamer.

static LLVM_ABI void encode(MCContext &Context, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta, SmallVectorImpl< char > &OS)

Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.

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

static LLVM_ABI void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params)

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

static MCFixupKind getDataKindForSize(unsigned Size)

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

static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, bool PCRel=false)

Consider bit fields if we need more flags.

FragmentType getKind() const

static LLVM_ABI void Emit(MCStreamer *MCOS)

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

unsigned getOpcode() const

ArrayRef< MCOperand > getOperands() const

Streaming object file generation interface.

void reset() override

state management

Definition MCObjectStreamer.cpp:167

void emitFrames()

Definition MCObjectStreamer.cpp:181

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

Emit Size bytes worth of the value specified by FillValue.

Definition MCObjectStreamer.cpp:713

FT * newSpecialFragment(Args &&...args)

void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0) override

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

Definition MCObjectStreamer.cpp:659

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

Emit an assignment of Value to Symbol.

Definition MCObjectStreamer.cpp:369

void emitCFISections(bool EH, bool Debug, bool SFrame) override

Definition MCObjectStreamer.cpp:201

void emitULEB128Value(const MCExpr *Value) override

Definition MCObjectStreamer.cpp:287

void emitSLEB128Value(const MCExpr *Value) override

Definition MCObjectStreamer.cpp:298

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

Definition MCObjectStreamer.cpp:746

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

This implements the CodeView '.cv_inline_linetable' assembler directive.

Definition MCObjectStreamer.cpp:624

void emitCVStringTableDirective() override

This implements the CodeView '.cv_stringtable' assembler directive.

Definition MCObjectStreamer.cpp:643

MCAssembler & getAssembler()

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...

Definition MCObjectStreamer.cpp:528

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

Emit an weak reference from Alias to Symbol.

Definition MCObjectStreamer.cpp:309

void appendContents(ArrayRef< char > Contents)

Definition MCObjectStreamer.cpp:109

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.

Definition MCObjectStreamer.cpp:600

void emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc={}) override

Record a relocation described by the .reloc directive.

Definition MCObjectStreamer.cpp:687

void emitBytes(StringRef Data) override

Emit the bytes in Data into the output.

Definition MCObjectStreamer.cpp:654

void emitPendingAssignments(MCSymbol *Symbol)

Emits pending conditional assignments that depend on Symbol being emitted.

Definition MCObjectStreamer.cpp:266

void addFixup(const MCExpr *Value, MCFixupKind Kind)

Definition MCObjectStreamer.cpp:125

void emitFileDirective(StringRef Filename) override

Switch to a new logical file.

Definition MCObjectStreamer.cpp:752

void emitSFrameCalculateFuncOffset(const MCSymbol *FunCabsel, const MCSymbol *FREBegin, MCFragment *FDEFrag, SMLoc Loc)

Definition MCObjectStreamer.cpp:587

void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName, StringRef Comment={}) override

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

Definition MCObjectStreamer.cpp:490

MCSymbol * emitCFILabel() override

When emitting an object file, create and emit a real label.

Definition MCObjectStreamer.cpp:230

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

This implements the CodeView '.cv_def_range' assembler directive.

Definition MCObjectStreamer.cpp:634

MCAssembler * getAssemblerPtr() override

Definition MCObjectStreamer.cpp:44

void newFragment()

Definition MCObjectStreamer.cpp:66

void emitAddrsigSym(const MCSymbol *Sym) override

Definition MCObjectStreamer.cpp:773

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

Emit the debug line end entry.

Definition MCObjectStreamer.cpp:556

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

Emit the given Instruction into the current section.

Definition MCObjectStreamer.cpp:391

void visitUsedSymbol(const MCSymbol &Sym) override

Definition MCObjectStreamer.cpp:197

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

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

Definition MCObjectStreamer.cpp:462

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

Definition MCObjectStreamer.cpp:278

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

Emit a label for Symbol into the current section.

Definition MCObjectStreamer.cpp:247

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

Definition MCObjectStreamer.cpp:27

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.

Definition MCObjectStreamer.cpp:208

void finishImpl() override

Streamer specific finalization.

Definition MCObjectStreamer.cpp:777

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

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

Definition MCObjectStreamer.cpp:314

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

Emit the absolute difference between two symbols encoded with ULEB128.

Definition MCObjectStreamer.cpp:159

MCFragment * allocFragSpace(size_t Headroom)

Definition MCObjectStreamer.cpp:57

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

Definition MCObjectStreamer.cpp:578

bool mayHaveInstructions(MCSection &Sec) const override

Definition MCObjectStreamer.cpp:387

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

Emit nops until the byte alignment ByteAlignment is reached.

Definition MCObjectStreamer.cpp:672

~MCObjectStreamer() override

void ensureHeadroom(size_t Headroom)

Definition MCObjectStreamer.cpp:80

void emitCVFileChecksumOffsetDirective(unsigned FileNo) override

This implements the CodeView '.cv_filechecksumoffset' assembler directive.

Definition MCObjectStreamer.cpp:650

void emitAddrsig() override

Definition MCObjectStreamer.cpp:769

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

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

Definition MCObjectStreamer.cpp:375

void emitCVFileChecksumsDirective() override

This implements the CodeView '.cv_filechecksums' assembler directive.

Definition MCObjectStreamer.cpp:646

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

This implements the CodeView '.cv_linetable' assembler directive.

Definition MCObjectStreamer.cpp:616

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.

Definition MCObjectStreamer.cpp:681

uint8_t * getCurFragEnd() const

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

Emit the absolute difference between two symbols if possible.

Definition MCObjectStreamer.cpp:150

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 LLVM_ABI void emit(MCObjectStreamer *MCOS)

static void emit(MCObjectStreamer &Streamer)

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

bool hasInstructions() const

void setHasInstructions(bool Value)

MCSymbol * getBeginSymbol()

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

Emit an assignment of Value to Symbol.

virtual void emitCFISections(bool EH, bool Debug, bool SFrame)

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

Emit the given Instruction into the current section.

MCFragment * getCurrentFragment() const

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

Emit the absolute difference between two symbols encoded with ULEB128.

bool getUseAssemblerInfoForParsing()

MCContext & getContext() const

void emitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)

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

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 emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName, StringRef Comment={})

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

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

This implements the CodeView '.cv_linetable' assembler directive.

MCStreamer(MCContext &Ctx)

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()

size_t getCurFragSize() const

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.

void addFragment(MCFragment *F)

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.

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

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

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

Represents a location in source code.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

LLVM_ABI 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.

This is an optimization pass for GlobalISel generic memory operations.

void fill(R &&Range, T &&Value)

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

constexpr bool isUIntN(unsigned N, uint64_t x)

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

uint16_t MCFixupKind

Extensible enumeration to represent the type of a fixup.

constexpr T alignToPowerOf2(U Value, V Align)

Will overflow only if result is not representable in T.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

ArrayRef(const T &OneElt) -> ArrayRef< T >

OutputIt copy(R &&Range, OutputIt Out)

OutputIt move(R &&Range, OutputIt Out)

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

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

constexpr bool isIntN(unsigned N, int64_t x)

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

LLVM_ABI void reportFatalUsageError(Error Err)

Report a fatal error that does not indicate a bug in LLVM.

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.

constexpr uint64_t value() const

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