LLVM  10.0.0svn
MCStreamer.h
Go to the documentation of this file.
1 //===- MCStreamer.h - High-level Streaming Machine Code Output --*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the MCStreamer class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_MC_MCSTREAMER_H
14 #define LLVM_MC_MCSTREAMER_H
15 
16 #include "llvm/ADT/ArrayRef.h"
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/MC/MCDirectives.h"
23 #include "llvm/MC/MCSymbol.h"
24 #include "llvm/MC/MCWinEH.h"
25 #include "llvm/Support/Error.h"
26 #include "llvm/Support/MD5.h"
27 #include "llvm/Support/SMLoc.h"
30 #include <cassert>
31 #include <cstdint>
32 #include <memory>
33 #include <string>
34 #include <utility>
35 #include <vector>
36 
37 namespace llvm {
38 
39 class AssemblerConstantPools;
40 class formatted_raw_ostream;
41 class MCAsmBackend;
42 class MCCodeEmitter;
43 struct MCCodePaddingContext;
44 class MCContext;
45 struct MCDwarfFrameInfo;
46 class MCExpr;
47 class MCInst;
48 class MCInstPrinter;
49 class MCRegister;
50 class MCSection;
51 class MCStreamer;
52 class MCSymbolRefExpr;
53 class MCSubtargetInfo;
54 class raw_ostream;
55 class Twine;
56 
57 namespace codeview {
58 struct DefRangeRegisterRelHeader;
59 struct DefRangeSubfieldRegisterHeader;
60 struct DefRangeRegisterHeader;
61 struct DefRangeFramePointerRelHeader;
62 }
63 
64 using MCSectionSubPair = std::pair<MCSection *, const MCExpr *>;
65 
66 /// Target specific streamer interface. This is used so that targets can
67 /// implement support for target specific assembly directives.
68 ///
69 /// If target foo wants to use this, it should implement 3 classes:
70 /// * FooTargetStreamer : public MCTargetStreamer
71 /// * FooTargetAsmStreamer : public FooTargetStreamer
72 /// * FooTargetELFStreamer : public FooTargetStreamer
73 ///
74 /// FooTargetStreamer should have a pure virtual method for each directive. For
75 /// example, for a ".bar symbol_name" directive, it should have
76 /// virtual emitBar(const MCSymbol &Symbol) = 0;
77 ///
78 /// The FooTargetAsmStreamer and FooTargetELFStreamer classes implement the
79 /// method. The assembly streamer just prints ".bar symbol_name". The object
80 /// streamer does whatever is needed to implement .bar in the object file.
81 ///
82 /// In the assembly printer and parser the target streamer can be used by
83 /// calling getTargetStreamer and casting it to FooTargetStreamer:
84 ///
85 /// MCTargetStreamer &TS = OutStreamer.getTargetStreamer();
86 /// FooTargetStreamer &ATS = static_cast<FooTargetStreamer &>(TS);
87 ///
88 /// The base classes FooTargetAsmStreamer and FooTargetELFStreamer should
89 /// *never* be treated differently. Callers should always talk to a
90 /// FooTargetStreamer.
92 protected:
94 
95 public:
97  virtual ~MCTargetStreamer();
98 
99  MCStreamer &getStreamer() { return Streamer; }
100 
101  // Allow a target to add behavior to the EmitLabel of MCStreamer.
102  virtual void emitLabel(MCSymbol *Symbol);
103  // Allow a target to add behavior to the emitAssignment of MCStreamer.
104  virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value);
105 
106  virtual void prettyPrintAsm(MCInstPrinter &InstPrinter, raw_ostream &OS,
107  const MCInst &Inst, const MCSubtargetInfo &STI);
108 
109  virtual void emitDwarfFileDirective(StringRef Directive);
110 
111  /// Update streamer for a new active section.
112  ///
113  /// This is called by PopSection and SwitchSection, if the current
114  /// section changes.
115  virtual void changeSection(const MCSection *CurSection, MCSection *Section,
116  const MCExpr *SubSection, raw_ostream &OS);
117 
118  virtual void emitValue(const MCExpr *Value);
119 
120  /// Emit the bytes in \p Data into the output.
121  ///
122  /// This is used to emit bytes in \p Data as sequence of .byte directives.
123  virtual void emitRawBytes(StringRef Data);
124 
125  virtual void finish();
126 };
127 
128 // FIXME: declared here because it is used from
129 // lib/CodeGen/AsmPrinter/ARMException.cpp.
131 public:
133  ~ARMTargetStreamer() override;
134 
135  virtual void emitFnStart();
136  virtual void emitFnEnd();
137  virtual void emitCantUnwind();
138  virtual void emitPersonality(const MCSymbol *Personality);
139  virtual void emitPersonalityIndex(unsigned Index);
140  virtual void emitHandlerData();
141  virtual void emitSetFP(unsigned FpReg, unsigned SpReg,
142  int64_t Offset = 0);
143  virtual void emitMovSP(unsigned Reg, int64_t Offset = 0);
144  virtual void emitPad(int64_t Offset);
145  virtual void emitRegSave(const SmallVectorImpl<unsigned> &RegList,
146  bool isVector);
147  virtual void emitUnwindRaw(int64_t StackOffset,
148  const SmallVectorImpl<uint8_t> &Opcodes);
149 
150  virtual void switchVendor(StringRef Vendor);
151  virtual void emitAttribute(unsigned Attribute, unsigned Value);
152  virtual void emitTextAttribute(unsigned Attribute, StringRef String);
153  virtual void emitIntTextAttribute(unsigned Attribute, unsigned IntValue,
154  StringRef StringValue = "");
155  virtual void emitFPU(unsigned FPU);
156  virtual void emitArch(ARM::ArchKind Arch);
157  virtual void emitArchExtension(unsigned ArchExt);
158  virtual void emitObjectArch(ARM::ArchKind Arch);
159  void emitTargetAttributes(const MCSubtargetInfo &STI);
160  virtual void finishAttributeSection();
161  virtual void emitInst(uint32_t Inst, char Suffix = '\0');
162 
163  virtual void AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE);
164 
165  virtual void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value);
166 
167  void finish() override;
168 
169  /// Reset any state between object emissions, i.e. the equivalent of
170  /// MCStreamer's reset method.
171  virtual void reset();
172 
173  /// Callback used to implement the ldr= pseudo.
174  /// Add a new entry to the constant pool for the current section and return an
175  /// MCExpr that can be used to refer to the constant pool location.
176  const MCExpr *addConstantPoolEntry(const MCExpr *, SMLoc Loc);
177 
178  /// Callback used to implemnt the .ltorg directive.
179  /// Emit contents of constant pool for the current section.
180  void emitCurrentConstantPool();
181 
182 private:
183  std::unique_ptr<AssemblerConstantPools> ConstantPools;
184 };
185 
186 /// Streaming machine code generation interface.
187 ///
188 /// This interface is intended to provide a programatic interface that is very
189 /// similar to the level that an assembler .s file provides. It has callbacks
190 /// to emit bytes, handle directives, etc. The implementation of this interface
191 /// retains state to know what the current section is etc.
192 ///
193 /// There are multiple implementations of this interface: one for writing out
194 /// a .s file, and implementations that write out .o files of various formats.
195 ///
196 class MCStreamer {
198  std::unique_ptr<MCTargetStreamer> TargetStreamer;
199 
200  std::vector<MCDwarfFrameInfo> DwarfFrameInfos;
201  MCDwarfFrameInfo *getCurrentDwarfFrameInfo();
202 
203  /// Similar to DwarfFrameInfos, but for SEH unwind info. Chained frames may
204  /// refer to each other, so use std::unique_ptr to provide pointer stability.
205  std::vector<std::unique_ptr<WinEH::FrameInfo>> WinFrameInfos;
206 
207  WinEH::FrameInfo *CurrentWinFrameInfo;
208 
209  /// Tracks an index to represent the order a symbol was emitted in.
210  /// Zero means we did not emit that symbol.
212 
213  /// This is stack of current and previous section values saved by
214  /// PushSection.
216 
217  /// The next unique ID to use when creating a WinCFI-related section (.pdata
218  /// or .xdata). This ID ensures that we have a one-to-one mapping from
219  /// code section to unwind info section, which MSVC's incremental linker
220  /// requires.
221  unsigned NextWinCFIID = 0;
222 
223  bool UseAssemblerInfoForParsing;
224 
225 protected:
226  MCStreamer(MCContext &Ctx);
227 
228  virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
229  virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
230 
232  return CurrentWinFrameInfo;
233  }
234 
235  virtual void EmitWindowsUnwindTables();
236 
237  virtual void EmitRawTextImpl(StringRef String);
238 
239  /// Returns true if the the .cv_loc directive is in the right section.
240  bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc);
241 
242 public:
243  MCStreamer(const MCStreamer &) = delete;
244  MCStreamer &operator=(const MCStreamer &) = delete;
245  virtual ~MCStreamer();
246 
247  void visitUsedExpr(const MCExpr &Expr);
248  virtual void visitUsedSymbol(const MCSymbol &Sym);
249 
251  TargetStreamer.reset(TS);
252  }
253 
254  /// State management
255  ///
256  virtual void reset();
257 
258  MCContext &getContext() const { return Context; }
259 
260  virtual MCAssembler *getAssemblerPtr() { return nullptr; }
261 
262  void setUseAssemblerInfoForParsing(bool v) { UseAssemblerInfoForParsing = v; }
263  bool getUseAssemblerInfoForParsing() { return UseAssemblerInfoForParsing; }
264 
266  return TargetStreamer.get();
267  }
268 
269  /// When emitting an object file, create and emit a real label. When emitting
270  /// textual assembly, this should do nothing to avoid polluting our output.
271  virtual MCSymbol *EmitCFILabel();
272 
273  /// Retreive the current frame info if one is available and it is not yet
274  /// closed. Otherwise, issue an error and return null.
275  WinEH::FrameInfo *EnsureValidWinFrameInfo(SMLoc Loc);
276 
277  unsigned getNumFrameInfos();
278  ArrayRef<MCDwarfFrameInfo> getDwarfFrameInfos() const;
279 
280  bool hasUnfinishedDwarfFrameInfo();
281 
282  unsigned getNumWinFrameInfos() { return WinFrameInfos.size(); }
284  return WinFrameInfos;
285  }
286 
287  void generateCompactUnwindEncodings(MCAsmBackend *MAB);
288 
289  /// \name Assembly File Formatting.
290  /// @{
291 
292  /// Return true if this streamer supports verbose assembly and if it is
293  /// enabled.
294  virtual bool isVerboseAsm() const { return false; }
295 
296  /// Return true if this asm streamer supports emitting unformatted text
297  /// to the .s file with EmitRawText.
298  virtual bool hasRawTextSupport() const { return false; }
299 
300  /// Is the integrated assembler required for this streamer to function
301  /// correctly?
302  virtual bool isIntegratedAssemblerRequired() const { return false; }
303 
304  /// Add a textual comment.
305  ///
306  /// Typically for comments that can be emitted to the generated .s
307  /// file if applicable as a QoI issue to make the output of the compiler
308  /// more readable. This only affects the MCAsmStreamer, and only when
309  /// verbose assembly output is enabled.
310  ///
311  /// If the comment includes embedded \n's, they will each get the comment
312  /// prefix as appropriate. The added comment should not end with a \n.
313  /// By default, each comment is terminated with an end of line, i.e. the
314  /// EOL param is set to true by default. If one prefers not to end the
315  /// comment with a new line then the EOL param should be passed
316  /// with a false value.
317  virtual void AddComment(const Twine &T, bool EOL = true) {}
318 
319  /// Return a raw_ostream that comments can be written to. Unlike
320  /// AddComment, you are required to terminate comments with \n if you use this
321  /// method.
322  virtual raw_ostream &GetCommentOS();
323 
324  /// Print T and prefix it with the comment string (normally #) and
325  /// optionally a tab. This prints the comment immediately, not at the end of
326  /// the current line. It is basically a safe version of EmitRawText: since it
327  /// only prints comments, the object streamer ignores it instead of asserting.
328  virtual void emitRawComment(const Twine &T, bool TabPrefix = true);
329 
330  /// Add explicit comment T. T is required to be a valid
331  /// comment in the output and does not need to be escaped.
332  virtual void addExplicitComment(const Twine &T);
333 
334  /// Emit added explicit comments.
335  virtual void emitExplicitComments();
336 
337  /// AddBlankLine - Emit a blank line to a .s file to pretty it up.
338  virtual void AddBlankLine() {}
339 
340  /// @}
341 
342  /// \name Symbol & Section Management
343  /// @{
344 
345  /// Return the current section that the streamer is emitting code to.
347  if (!SectionStack.empty())
348  return SectionStack.back().first;
349  return MCSectionSubPair();
350  }
351  MCSection *getCurrentSectionOnly() const { return getCurrentSection().first; }
352 
353  /// Return the previous section that the streamer is emitting code to.
355  if (!SectionStack.empty())
356  return SectionStack.back().second;
357  return MCSectionSubPair();
358  }
359 
360  /// Returns an index to represent the order a symbol was emitted in.
361  /// (zero if we did not emit that symbol)
362  unsigned GetSymbolOrder(const MCSymbol *Sym) const {
363  return SymbolOrdering.lookup(Sym);
364  }
365 
366  /// Update streamer for a new active section.
367  ///
368  /// This is called by PopSection and SwitchSection, if the current
369  /// section changes.
370  virtual void ChangeSection(MCSection *, const MCExpr *);
371 
372  /// Save the current and previous section on the section stack.
373  void PushSection() {
374  SectionStack.push_back(
375  std::make_pair(getCurrentSection(), getPreviousSection()));
376  }
377 
378  /// Restore the current and previous section from the section stack.
379  /// Calls ChangeSection as needed.
380  ///
381  /// Returns false if the stack was empty.
382  bool PopSection() {
383  if (SectionStack.size() <= 1)
384  return false;
385  auto I = SectionStack.end();
386  --I;
387  MCSectionSubPair OldSection = I->first;
388  --I;
389  MCSectionSubPair NewSection = I->first;
390 
391  if (OldSection != NewSection)
392  ChangeSection(NewSection.first, NewSection.second);
393  SectionStack.pop_back();
394  return true;
395  }
396 
397  bool SubSection(const MCExpr *Subsection) {
398  if (SectionStack.empty())
399  return false;
400 
401  SwitchSection(SectionStack.back().first.first, Subsection);
402  return true;
403  }
404 
405  /// Set the current section where code is being emitted to \p Section. This
406  /// is required to update CurSection.
407  ///
408  /// This corresponds to assembler directives like .section, .text, etc.
409  virtual void SwitchSection(MCSection *Section,
410  const MCExpr *Subsection = nullptr);
411 
412  /// Set the current section where code is being emitted to \p Section.
413  /// This is required to update CurSection. This version does not call
414  /// ChangeSection.
416  const MCExpr *Subsection = nullptr) {
417  assert(Section && "Cannot switch to a null section!");
418  MCSectionSubPair curSection = SectionStack.back().first;
419  SectionStack.back().second = curSection;
420  if (MCSectionSubPair(Section, Subsection) != curSection)
421  SectionStack.back().first = MCSectionSubPair(Section, Subsection);
422  }
423 
424  /// Create the default sections and set the initial one.
425  virtual void InitSections(bool NoExecStack);
426 
427  MCSymbol *endSection(MCSection *Section);
428 
429  /// Sets the symbol's section.
430  ///
431  /// Each emitted symbol will be tracked in the ordering table,
432  /// so we can sort on them later.
433  void AssignFragment(MCSymbol *Symbol, MCFragment *Fragment);
434 
435  /// Emit a label for \p Symbol into the current section.
436  ///
437  /// This corresponds to an assembler statement such as:
438  /// foo:
439  ///
440  /// \param Symbol - The symbol to emit. A given symbol should only be
441  /// emitted as a label once, and symbols emitted as a label should never be
442  /// used in an assignment.
443  // FIXME: These emission are non-const because we mutate the symbol to
444  // add the section we're emitting it to later.
445  virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc());
446 
447  virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol);
448 
449  /// Note in the output the specified \p Flag.
450  virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
451 
452  /// Emit the given list \p Options of strings as linker
453  /// options into the output.
455 
456  /// Note in the output the specified region \p Kind.
458 
459  /// Specify the Mach-O minimum deployment target version.
460  virtual void EmitVersionMin(MCVersionMinType Type, unsigned Major,
461  unsigned Minor, unsigned Update,
462  VersionTuple SDKVersion) {}
463 
464  /// Emit/Specify Mach-O build version command.
465  /// \p Platform should be one of MachO::PlatformType.
466  virtual void EmitBuildVersion(unsigned Platform, unsigned Major,
467  unsigned Minor, unsigned Update,
468  VersionTuple SDKVersion) {}
469 
470  void EmitVersionForTarget(const Triple &Target,
471  const VersionTuple &SDKVersion);
472 
473  /// Note in the output that the specified \p Func is a Thumb mode
474  /// function (ARM target only).
475  virtual void EmitThumbFunc(MCSymbol *Func);
476 
477  /// Emit an assignment of \p Value to \p Symbol.
478  ///
479  /// This corresponds to an assembler statement such as:
480  /// symbol = value
481  ///
482  /// The assignment generates no code, but has the side effect of binding the
483  /// value in the current context. For the assembly streamer, this prints the
484  /// binding into the .s file.
485  ///
486  /// \param Symbol - The symbol being assigned to.
487  /// \param Value - The value for the symbol.
488  virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
489 
490  /// Emit an weak reference from \p Alias to \p Symbol.
491  ///
492  /// This corresponds to an assembler statement such as:
493  /// .weakref alias, symbol
494  ///
495  /// \param Alias - The alias that is being created.
496  /// \param Symbol - The symbol being aliased.
497  virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
498 
499  /// Add the given \p Attribute to \p Symbol.
500  virtual bool EmitSymbolAttribute(MCSymbol *Symbol,
501  MCSymbolAttr Attribute) = 0;
502 
503  /// Set the \p DescValue for the \p Symbol.
504  ///
505  /// \param Symbol - The symbol to have its n_desc field set.
506  /// \param DescValue - The value to set into the n_desc field.
507  virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
508 
509  /// Start emitting COFF symbol definition
510  ///
511  /// \param Symbol - The symbol to have its External & Type fields set.
512  virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol);
513 
514  /// Emit the storage class of the symbol.
515  ///
516  /// \param StorageClass - The storage class the symbol should have.
517  virtual void EmitCOFFSymbolStorageClass(int StorageClass);
518 
519  /// Emit the type of the symbol.
520  ///
521  /// \param Type - A COFF type identifier (see COFF::SymbolType in X86COFF.h)
522  virtual void EmitCOFFSymbolType(int Type);
523 
524  /// Marks the end of the symbol definition.
525  virtual void EndCOFFSymbolDef();
526 
527  virtual void EmitCOFFSafeSEH(MCSymbol const *Symbol);
528 
529  /// Emits the symbol table index of a Symbol into the current section.
530  virtual void EmitCOFFSymbolIndex(MCSymbol const *Symbol);
531 
532  /// Emits a COFF section index.
533  ///
534  /// \param Symbol - Symbol the section number relocation should point to.
535  virtual void EmitCOFFSectionIndex(MCSymbol const *Symbol);
536 
537  /// Emits a COFF section relative relocation.
538  ///
539  /// \param Symbol - Symbol the section relative relocation should point to.
540  virtual void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset);
541 
542  /// Emits a COFF image relative relocation.
543  ///
544  /// \param Symbol - Symbol the image relative relocation should point to.
545  virtual void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset);
546 
547  /// Emits an lcomm directive with XCOFF csect information.
548  ///
549  /// \param Symbol - The symbol we are emiting.
550  /// \param Size - The size of the block of storage.
551  /// \param ByteAlignment - The alignment of the symbol in bytes. Must be a power
552  /// of 2.
553  virtual void EmitXCOFFLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
554  unsigned ByteAlignment);
555 
556  /// Emit an ELF .size directive.
557  ///
558  /// This corresponds to an assembler statement such as:
559  /// .size symbol, expression
560  virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value);
561 
562  /// Emit an ELF .symver directive.
563  ///
564  /// This corresponds to an assembler statement such as:
565  /// .symver _start, foo@@SOME_VERSION
566  /// \param AliasName - The versioned alias (i.e. "foo@@SOME_VERSION")
567  /// \param Aliasee - The aliased symbol (i.e. "_start")
568  virtual void emitELFSymverDirective(StringRef AliasName,
569  const MCSymbol *Aliasee);
570 
571  /// Emit a Linker Optimization Hint (LOH) directive.
572  /// \param Args - Arguments of the LOH.
573  virtual void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {}
574 
575  /// Emit a common symbol.
576  ///
577  /// \param Symbol - The common symbol to emit.
578  /// \param Size - The size of the common symbol.
579  /// \param ByteAlignment - The alignment of the symbol if
580  /// non-zero. This must be a power of 2.
581  virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
582  unsigned ByteAlignment) = 0;
583 
584  /// Emit a local common (.lcomm) symbol.
585  ///
586  /// \param Symbol - The common symbol to emit.
587  /// \param Size - The size of the common symbol.
588  /// \param ByteAlignment - The alignment of the common symbol in bytes.
589  virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
590  unsigned ByteAlignment);
591 
592  /// Emit the zerofill section and an optional symbol.
593  ///
594  /// \param Section - The zerofill section to create and or to put the symbol
595  /// \param Symbol - The zerofill symbol to emit, if non-NULL.
596  /// \param Size - The size of the zerofill symbol.
597  /// \param ByteAlignment - The alignment of the zerofill symbol if
598  /// non-zero. This must be a power of 2 on some targets.
599  virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
600  uint64_t Size = 0, unsigned ByteAlignment = 0,
601  SMLoc Loc = SMLoc()) = 0;
602 
603  /// Emit a thread local bss (.tbss) symbol.
604  ///
605  /// \param Section - The thread local common section.
606  /// \param Symbol - The thread local common symbol to emit.
607  /// \param Size - The size of the symbol.
608  /// \param ByteAlignment - The alignment of the thread local common symbol
609  /// if non-zero. This must be a power of 2 on some targets.
610  virtual void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
611  uint64_t Size, unsigned ByteAlignment = 0);
612 
613  /// @}
614  /// \name Generating Data
615  /// @{
616 
617  /// Emit the bytes in \p Data into the output.
618  ///
619  /// This is used to implement assembler directives such as .byte, .ascii,
620  /// etc.
621  virtual void EmitBytes(StringRef Data);
622 
623  /// Functionally identical to EmitBytes. When emitting textual assembly, this
624  /// method uses .byte directives instead of .ascii or .asciz for readability.
625  virtual void EmitBinaryData(StringRef Data);
626 
627  /// Emit the expression \p Value into the output as a native
628  /// integer of the given \p Size bytes.
629  ///
630  /// This is used to implement assembler directives such as .word, .quad,
631  /// etc.
632  ///
633  /// \param Value - The value to emit.
634  /// \param Size - The size of the integer (in bytes) to emit. This must
635  /// match a native machine width.
636  /// \param Loc - The location of the expression for error reporting.
637  virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
638  SMLoc Loc = SMLoc());
639 
640  void EmitValue(const MCExpr *Value, unsigned Size, SMLoc Loc = SMLoc());
641 
642  /// Special case of EmitValue that avoids the client having
643  /// to pass in a MCExpr for constant integers.
644  virtual void EmitIntValue(uint64_t Value, unsigned Size);
645 
646  /// Special case of EmitValue that avoids the client having to pass
647  /// in a MCExpr for constant integers & prints in Hex format for certain
648  /// modes.
649  virtual void EmitIntValueInHex(uint64_t Value, unsigned Size) {
650  EmitIntValue(Value, Size);
651  }
652 
653  virtual void EmitULEB128Value(const MCExpr *Value);
654 
655  virtual void EmitSLEB128Value(const MCExpr *Value);
656 
657  /// Special case of EmitULEB128Value that avoids the client having to
658  /// pass in a MCExpr for constant integers.
659  void EmitULEB128IntValue(uint64_t Value, unsigned PadTo = 0);
660 
661  /// Special case of EmitSLEB128Value that avoids the client having to
662  /// pass in a MCExpr for constant integers.
663  void EmitSLEB128IntValue(int64_t Value);
664 
665  /// Special case of EmitValue that avoids the client having to pass in
666  /// a MCExpr for MCSymbols.
667  void EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
668  bool IsSectionRelative = false);
669 
670  /// Emit the expression \p Value into the output as a dtprel
671  /// (64-bit DTP relative) value.
672  ///
673  /// This is used to implement assembler directives such as .dtpreldword on
674  /// targets that support them.
675  virtual void EmitDTPRel64Value(const MCExpr *Value);
676 
677  /// Emit the expression \p Value into the output as a dtprel
678  /// (32-bit DTP relative) value.
679  ///
680  /// This is used to implement assembler directives such as .dtprelword on
681  /// targets that support them.
682  virtual void EmitDTPRel32Value(const MCExpr *Value);
683 
684  /// Emit the expression \p Value into the output as a tprel
685  /// (64-bit TP relative) value.
686  ///
687  /// This is used to implement assembler directives such as .tpreldword on
688  /// targets that support them.
689  virtual void EmitTPRel64Value(const MCExpr *Value);
690 
691  /// Emit the expression \p Value into the output as a tprel
692  /// (32-bit TP relative) value.
693  ///
694  /// This is used to implement assembler directives such as .tprelword on
695  /// targets that support them.
696  virtual void EmitTPRel32Value(const MCExpr *Value);
697 
698  /// Emit the expression \p Value into the output as a gprel64 (64-bit
699  /// GP relative) value.
700  ///
701  /// This is used to implement assembler directives such as .gpdword on
702  /// targets that support them.
703  virtual void EmitGPRel64Value(const MCExpr *Value);
704 
705  /// Emit the expression \p Value into the output as a gprel32 (32-bit
706  /// GP relative) value.
707  ///
708  /// This is used to implement assembler directives such as .gprel32 on
709  /// targets that support them.
710  virtual void EmitGPRel32Value(const MCExpr *Value);
711 
712  /// Emit NumBytes bytes worth of the value specified by FillValue.
713  /// This implements directives such as '.space'.
714  void emitFill(uint64_t NumBytes, uint8_t FillValue);
715 
716  /// Emit \p Size bytes worth of the value specified by \p FillValue.
717  ///
718  /// This is used to implement assembler directives such as .space or .skip.
719  ///
720  /// \param NumBytes - The number of bytes to emit.
721  /// \param FillValue - The value to use when filling bytes.
722  /// \param Loc - The location of the expression for error reporting.
723  virtual void emitFill(const MCExpr &NumBytes, uint64_t FillValue,
724  SMLoc Loc = SMLoc());
725 
726  /// Emit \p NumValues copies of \p Size bytes. Each \p Size bytes is
727  /// taken from the lowest order 4 bytes of \p Expr expression.
728  ///
729  /// This is used to implement assembler directives such as .fill.
730  ///
731  /// \param NumValues - The number of copies of \p Size bytes to emit.
732  /// \param Size - The size (in bytes) of each repeated value.
733  /// \param Expr - The expression from which \p Size bytes are used.
734  virtual void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
735  SMLoc Loc = SMLoc());
736 
737  /// Emit NumBytes worth of zeros.
738  /// This function properly handles data in virtual sections.
739  void EmitZeros(uint64_t NumBytes);
740 
741  /// Emit some number of copies of \p Value until the byte alignment \p
742  /// ByteAlignment is reached.
743  ///
744  /// If the number of bytes need to emit for the alignment is not a multiple
745  /// of \p ValueSize, then the contents of the emitted fill bytes is
746  /// undefined.
747  ///
748  /// This used to implement the .align assembler directive.
749  ///
750  /// \param ByteAlignment - The alignment to reach. This must be a power of
751  /// two on some targets.
752  /// \param Value - The value to use when filling bytes.
753  /// \param ValueSize - The size of the integer (in bytes) to emit for
754  /// \p Value. This must match a native machine width.
755  /// \param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
756  /// the alignment cannot be reached in this many bytes, no bytes are
757  /// emitted.
758  virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
759  unsigned ValueSize = 1,
760  unsigned MaxBytesToEmit = 0);
761 
762  /// Emit nops until the byte alignment \p ByteAlignment is reached.
763  ///
764  /// This used to align code where the alignment bytes may be executed. This
765  /// can emit different bytes for different sizes to optimize execution.
766  ///
767  /// \param ByteAlignment - The alignment to reach. This must be a power of
768  /// two on some targets.
769  /// \param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
770  /// the alignment cannot be reached in this many bytes, no bytes are
771  /// emitted.
772  virtual void EmitCodeAlignment(unsigned ByteAlignment,
773  unsigned MaxBytesToEmit = 0);
774 
775  /// Emit some number of copies of \p Value until the byte offset \p
776  /// Offset is reached.
777  ///
778  /// This is used to implement assembler directives such as .org.
779  ///
780  /// \param Offset - The offset to reach. This may be an expression, but the
781  /// expression must be associated with the current section.
782  /// \param Value - The value to use when filling bytes.
783  virtual void emitValueToOffset(const MCExpr *Offset, unsigned char Value,
784  SMLoc Loc);
785 
786  virtual void
788 
789  virtual void
791 
792  /// @}
793 
794  /// Switch to a new logical file. This is used to implement the '.file
795  /// "foo.c"' assembler directive.
796  virtual void EmitFileDirective(StringRef Filename);
797 
798  /// Emit the "identifiers" directive. This implements the
799  /// '.ident "version foo"' assembler directive.
800  virtual void EmitIdent(StringRef IdentString) {}
801 
802  /// Associate a filename with a specified logical file number. This
803  /// implements the DWARF2 '.file 4 "foo.c"' assembler directive.
804  unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
805  StringRef Filename,
806  Optional<MD5::MD5Result> Checksum = None,
808  unsigned CUID = 0) {
809  return cantFail(
810  tryEmitDwarfFileDirective(FileNo, Directory, Filename, Checksum,
811  Source, CUID));
812  }
813 
814  /// Associate a filename with a specified logical file number.
815  /// Also associate a directory, optional checksum, and optional source
816  /// text with the logical file. This implements the DWARF2
817  /// '.file 4 "dir/foo.c"' assembler directive, and the DWARF5
818  /// '.file 4 "dir/foo.c" md5 "..." source "..."' assembler directive.
819  virtual Expected<unsigned> tryEmitDwarfFileDirective(
820  unsigned FileNo, StringRef Directory, StringRef Filename,
822  unsigned CUID = 0);
823 
824  /// Specify the "root" file of the compilation, using the ".file 0" extension.
825  virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
826  Optional<MD5::MD5Result> Checksum,
828  unsigned CUID = 0);
829 
830  virtual void EmitCFIBKeyFrame();
831 
832  /// This implements the DWARF2 '.loc fileno lineno ...' assembler
833  /// directive.
834  virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
835  unsigned Column, unsigned Flags,
836  unsigned Isa, unsigned Discriminator,
837  StringRef FileName);
838 
839  /// Associate a filename with a specified logical file number, and also
840  /// specify that file's checksum information. This implements the '.cv_file 4
841  /// "foo.c"' assembler directive. Returns true on success.
842  virtual bool EmitCVFileDirective(unsigned FileNo, StringRef Filename,
843  ArrayRef<uint8_t> Checksum,
844  unsigned ChecksumKind);
845 
846  /// Introduces a function id for use with .cv_loc.
847  virtual bool EmitCVFuncIdDirective(unsigned FunctionId);
848 
849  /// Introduces an inline call site id for use with .cv_loc. Includes
850  /// extra information for inline line table generation.
851  virtual bool EmitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc,
852  unsigned IAFile, unsigned IALine,
853  unsigned IACol, SMLoc Loc);
854 
855  /// This implements the CodeView '.cv_loc' assembler directive.
856  virtual void EmitCVLocDirective(unsigned FunctionId, unsigned FileNo,
857  unsigned Line, unsigned Column,
858  bool PrologueEnd, bool IsStmt,
859  StringRef FileName, SMLoc Loc);
860 
861  /// This implements the CodeView '.cv_linetable' assembler directive.
862  virtual void EmitCVLinetableDirective(unsigned FunctionId,
863  const MCSymbol *FnStart,
864  const MCSymbol *FnEnd);
865 
866  /// This implements the CodeView '.cv_inline_linetable' assembler
867  /// directive.
868  virtual void EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId,
869  unsigned SourceFileId,
870  unsigned SourceLineNum,
871  const MCSymbol *FnStartSym,
872  const MCSymbol *FnEndSym);
873 
874  /// This implements the CodeView '.cv_def_range' assembler
875  /// directive.
876  virtual void EmitCVDefRangeDirective(
877  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
878  StringRef FixedSizePortion);
879 
880  virtual void EmitCVDefRangeDirective(
881  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
883 
884  virtual void EmitCVDefRangeDirective(
885  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
887 
888  virtual void EmitCVDefRangeDirective(
889  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
891 
892  virtual void EmitCVDefRangeDirective(
893  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
895 
896  /// This implements the CodeView '.cv_stringtable' assembler directive.
897  virtual void EmitCVStringTableDirective() {}
898 
899  /// This implements the CodeView '.cv_filechecksums' assembler directive.
901 
902  /// This implements the CodeView '.cv_filechecksumoffset' assembler
903  /// directive.
904  virtual void EmitCVFileChecksumOffsetDirective(unsigned FileNo) {}
905 
906  /// This implements the CodeView '.cv_fpo_data' assembler directive.
907  virtual void EmitCVFPOData(const MCSymbol *ProcSym, SMLoc Loc = {}) {}
908 
909  /// Emit the absolute difference between two symbols.
910  ///
911  /// \pre Offset of \c Hi is greater than the offset \c Lo.
912  virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
913  unsigned Size);
914 
915  /// Emit the absolute difference between two symbols encoded with ULEB128.
916  virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi,
917  const MCSymbol *Lo);
918 
919  virtual MCSymbol *getDwarfLineTableSymbol(unsigned CUID);
920  virtual void EmitCFISections(bool EH, bool Debug);
921  void EmitCFIStartProc(bool IsSimple, SMLoc Loc = SMLoc());
922  void EmitCFIEndProc();
923  virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset);
924  virtual void EmitCFIDefCfaOffset(int64_t Offset);
925  virtual void EmitCFIDefCfaRegister(int64_t Register);
926  virtual void EmitCFIOffset(int64_t Register, int64_t Offset);
927  virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding);
928  virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding);
929  virtual void EmitCFIRememberState();
930  virtual void EmitCFIRestoreState();
931  virtual void EmitCFISameValue(int64_t Register);
932  virtual void EmitCFIRestore(int64_t Register);
933  virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset);
934  virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment);
935  virtual void EmitCFIEscape(StringRef Values);
936  virtual void EmitCFIReturnColumn(int64_t Register);
937  virtual void EmitCFIGnuArgsSize(int64_t Size);
938  virtual void EmitCFISignalFrame();
939  virtual void EmitCFIUndefined(int64_t Register);
940  virtual void EmitCFIRegister(int64_t Register1, int64_t Register2);
941  virtual void EmitCFIWindowSave();
942  virtual void EmitCFINegateRAState();
943 
944  virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc = SMLoc());
945  virtual void EmitWinCFIEndProc(SMLoc Loc = SMLoc());
946  /// This is used on platforms, such as Windows on ARM64, that require function
947  /// or funclet sizes to be emitted in .xdata before the End marker is emitted
948  /// for the frame. We cannot use the End marker, as it is not set at the
949  /// point of emitting .xdata, in order to indicate that the frame is active.
950  virtual void EmitWinCFIFuncletOrFuncEnd(SMLoc Loc = SMLoc());
951  virtual void EmitWinCFIStartChained(SMLoc Loc = SMLoc());
952  virtual void EmitWinCFIEndChained(SMLoc Loc = SMLoc());
953  virtual void EmitWinCFIPushReg(MCRegister Register, SMLoc Loc = SMLoc());
954  virtual void EmitWinCFISetFrame(MCRegister Register, unsigned Offset,
955  SMLoc Loc = SMLoc());
956  virtual void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc = SMLoc());
957  virtual void EmitWinCFISaveReg(MCRegister Register, unsigned Offset,
958  SMLoc Loc = SMLoc());
959  virtual void EmitWinCFISaveXMM(MCRegister Register, unsigned Offset,
960  SMLoc Loc = SMLoc());
961  virtual void EmitWinCFIPushFrame(bool Code, SMLoc Loc = SMLoc());
962  virtual void EmitWinCFIEndProlog(SMLoc Loc = SMLoc());
963  virtual void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except,
964  SMLoc Loc = SMLoc());
965  virtual void EmitWinEHHandlerData(SMLoc Loc = SMLoc());
966 
967  virtual void emitCGProfileEntry(const MCSymbolRefExpr *From,
968  const MCSymbolRefExpr *To, uint64_t Count);
969 
970  /// Get the .pdata section used for the given section. Typically the given
971  /// section is either the main .text section or some other COMDAT .text
972  /// section, but it may be any section containing code.
973  MCSection *getAssociatedPDataSection(const MCSection *TextSec);
974 
975  /// Get the .xdata section used for the given section.
976  MCSection *getAssociatedXDataSection(const MCSection *TextSec);
977 
978  virtual void EmitSyntaxDirective();
979 
980  /// Emit a .reloc directive.
981  /// Returns true if the relocation could not be emitted because Name is not
982  /// known.
983  virtual bool EmitRelocDirective(const MCExpr &Offset, StringRef Name,
984  const MCExpr *Expr, SMLoc Loc,
985  const MCSubtargetInfo &STI) {
986  return true;
987  }
988 
989  virtual void EmitAddrsig() {}
990  virtual void EmitAddrsigSym(const MCSymbol *Sym) {}
991 
992  /// Emit the given \p Instruction into the current section.
993  virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI);
994 
995  /// Set the bundle alignment mode from now on in the section.
996  /// The argument is the power of 2 to which the alignment is set. The
997  /// value 0 means turn the bundle alignment off.
998  virtual void EmitBundleAlignMode(unsigned AlignPow2);
999 
1000  /// The following instructions are a bundle-locked group.
1001  ///
1002  /// \param AlignToEnd - If true, the bundle-locked group will be aligned to
1003  /// the end of a bundle.
1004  virtual void EmitBundleLock(bool AlignToEnd);
1005 
1006  /// Ends a bundle-locked group.
1007  virtual void EmitBundleUnlock();
1008 
1009  /// If this file is backed by a assembly streamer, this dumps the
1010  /// specified string in the output .s file. This capability is indicated by
1011  /// the hasRawTextSupport() predicate. By default this aborts.
1012  void EmitRawText(const Twine &String);
1013 
1014  /// Streamer specific finalization.
1015  virtual void FinishImpl();
1016  /// Finish emission of machine code.
1017  void Finish();
1018 
1019  virtual bool mayHaveInstructions(MCSection &Sec) const { return true; }
1020 };
1021 
1022 /// Create a dummy machine code streamer, which does nothing. This is useful for
1023 /// timing the assembler front end.
1025 
1026 /// Create a machine code streamer which will print out assembly for the native
1027 /// target, suitable for compiling with a native assembler.
1028 ///
1029 /// \param InstPrint - If given, the instruction printer to use. If not given
1030 /// the MCInst representation will be printed. This method takes ownership of
1031 /// InstPrint.
1032 ///
1033 /// \param CE - If given, a code emitter to use to show the instruction
1034 /// encoding inline with the assembly. This method takes ownership of \p CE.
1035 ///
1036 /// \param TAB - If given, a target asm backend to use to show the fixup
1037 /// information in conjunction with encoding information. This method takes
1038 /// ownership of \p TAB.
1039 ///
1040 /// \param ShowInst - Whether to show the MCInst representation inline with
1041 /// the assembly.
1043  std::unique_ptr<formatted_raw_ostream> OS,
1044  bool isVerboseAsm, bool useDwarfDirectory,
1045  MCInstPrinter *InstPrint, MCCodeEmitter *CE,
1046  MCAsmBackend *TAB, bool ShowInst);
1047 
1048 } // end namespace llvm
1049 
1050 #endif // LLVM_MC_MCSTREAMER_H
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition: Error.h:703
Profile::FuncID FuncId
Definition: Profile.cpp:321
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
unsigned GetSymbolOrder(const MCSymbol *Sym) const
Returns an index to represent the order a symbol was emitted in.
Definition: MCStreamer.h:362
virtual void EmitCVStringTableDirective()
This implements the CodeView &#39;.cv_stringtable&#39; assembler directive.
Definition: MCStreamer.h:897
StackOffset is a wrapper around scalable and non-scalable offsets and is used in several functions su...
LLVMContext & Context
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:22
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
virtual void AddBlankLine()
AddBlankLine - Emit a blank line to a .s file to pretty it up.
Definition: MCStreamer.h:338
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
virtual void EmitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Emit/Specify Mach-O build version command.
Definition: MCStreamer.h:466
virtual void EmitAddrsigSym(const MCSymbol *Sym)
Definition: MCStreamer.h:990
void SwitchSectionNoChange(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
Definition: MCStreamer.h:415
Target specific streamer interface.
Definition: MCStreamer.h:91
unsigned Reg
MCStreamer * createNullStreamer(MCContext &Ctx)
Create a dummy machine code streamer, which does nothing.
void PushSection()
Save the current and previous section on the section stack.
Definition: MCStreamer.h:373
virtual void EmitCVFPOData(const MCSymbol *ProcSym, SMLoc Loc={})
This implements the CodeView &#39;.cv_fpo_data&#39; assembler directive.
Definition: MCStreamer.h:907
MCDataRegionType
Definition: MCDirectives.h:57
COFF::SymbolStorageClass StorageClass
Definition: COFFYAML.cpp:356
LegalityPredicate isVector(unsigned TypeIdx)
True iff the specified type index is a vector.
MCContext & getContext() const
Definition: MCStreamer.h:258
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:169
Tagged union holding either a T or a Error.
Definition: yaml2obj.h:21
unsigned getNumWinFrameInfos()
Definition: MCStreamer.h:282
ArrayRef< std::unique_ptr< WinEH::FrameInfo > > getWinFrameInfos() const
Definition: MCStreamer.h:283
Context object for machine code objects.
Definition: MCContext.h:65
MCSectionSubPair getPreviousSection() const
Return the previous section that the streamer is emitting code to.
Definition: MCStreamer.h:354
virtual void AddComment(const Twine &T, bool EOL=true)
Add a textual comment.
Definition: MCStreamer.h:317
virtual void EmitCVFileChecksumsDirective()
This implements the CodeView &#39;.cv_filechecksums&#39; assembler directive.
Definition: MCStreamer.h:900
MCStreamer * createAsmStreamer(MCContext &Ctx, std::unique_ptr< formatted_raw_ostream > OS, bool isVerboseAsm, bool useDwarfDirectory, MCInstPrinter *InstPrint, MCCodeEmitter *CE, MCAsmBackend *TAB, bool ShowInst)
Create a machine code streamer which will print out assembly for the native target, suitable for compiling with a native assembler.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
bool getUseAssemblerInfoForParsing()
Definition: MCStreamer.h:263
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
virtual MCAssembler * getAssemblerPtr()
Definition: MCStreamer.h:260
virtual bool hasRawTextSupport() const
Return true if this asm streamer supports emitting unformatted text to the .s file with EmitRawText...
Definition: MCStreamer.h:298
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:131
Streaming machine code generation interface.
Definition: MCStreamer.h:196
WinEH::FrameInfo * getCurrentWinFrameInfo()
Definition: MCStreamer.h:231
MCTargetStreamer * getTargetStreamer()
Definition: MCStreamer.h:265
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:21
virtual void EmitCodePaddingBasicBlockStart(const MCCodePaddingContext &Context)
Definition: MCStreamer.h:787
MCLOHType
Linker Optimization Hint Type.
virtual bool mayHaveInstructions(MCSection &Sec) const
Definition: MCStreamer.h:1019
void setUseAssemblerInfoForParsing(bool v)
Definition: MCStreamer.h:262
virtual void EmitAddrsig()
Definition: MCStreamer.h:989
virtual void EmitIdent(StringRef IdentString)
Emit the "identifiers" directive.
Definition: MCStreamer.h:800
size_t size() const
Definition: SmallVector.h:52
bool SubSection(const MCExpr *Subsection)
Definition: MCStreamer.h:397
virtual void EmitDataRegion(MCDataRegionType Kind)
Note in the output the specified region Kind.
Definition: MCStreamer.h:457
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
MCSectionSubPair getCurrentSection() const
Return the current section that the streamer is emitting code to.
Definition: MCStreamer.h:346
MCStreamer & getStreamer()
Definition: MCStreamer.h:99
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
Definition: MCStreamer.h:64
BlockVerifier::State From
virtual void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args)
Emit a Linker Optimization Hint (LOH) directive.
Definition: MCStreamer.h:573
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:837
virtual bool EmitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI)
Emit a .reloc directive.
Definition: MCStreamer.h:983
virtual void EmitVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Specify the Mach-O minimum deployment target version.
Definition: MCStreamer.h:460
MCStreamer & Streamer
Definition: MCStreamer.h:93
MCSymbolAttr
Definition: MCDirectives.h:18
virtual void EmitIntValueInHex(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers & p...
Definition: MCStreamer.h:649
Target - Wrapper for Target specific information.
MCSection * getCurrentSectionOnly() const
Definition: MCStreamer.h:351
virtual void EmitCVFileChecksumOffsetDirective(unsigned FileNo)
This implements the CodeView &#39;.cv_filechecksumoffset&#39; assembler directive.
Definition: MCStreamer.h:904
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:39
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
virtual void EmitLinkerOptions(ArrayRef< std::string > Kind)
Emit the given list Options of strings as linker options into the output.
Definition: MCStreamer.h:454
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:55
MCAssemblerFlag
Definition: MCDirectives.h:49
#define I(x, y, z)
Definition: MD5.cpp:58
virtual void EmitCodePaddingBasicBlockEnd(const MCCodePaddingContext &Context)
Definition: MCStreamer.h:790
Generic base class for all target subtargets.
uint32_t Size
Definition: Profile.cpp:46
unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory, StringRef Filename, Optional< MD5::MD5Result > Checksum=None, Optional< StringRef > Source=None, unsigned CUID=0)
Associate a filename with a specified logical file number.
Definition: MCStreamer.h:804
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: DenseMap.h:185
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool PopSection()
Restore the current and previous section from the section stack.
Definition: MCStreamer.h:382
MCVersionMinType
Definition: MCDirectives.h:65
LLVM Value Representation.
Definition: Value.h:74
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:41
static cl::opt< bool, true > Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag))
Defines the llvm::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
Represents a location in source code.
Definition: SMLoc.h:23
virtual bool isVerboseAsm() const
Return true if this streamer supports verbose assembly and if it is enabled.
Definition: MCStreamer.h:294
void setTargetStreamer(MCTargetStreamer *TS)
Definition: MCStreamer.h:250
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
virtual bool isIntegratedAssemblerRequired() const
Is the integrated assembler required for this streamer to function correctly?
Definition: MCStreamer.h:302