LLVM 24.0.0git
SystemZHLASMAsmStreamer.cpp
Go to the documentation of this file.
1//===- SystemZHLASMAsmStreamer.cpp - HLASM Assembly Text Output -----------===//
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
12#include "llvm/MC/MCExpr.h"
17#include <sstream>
18
19using namespace llvm;
20
22 Assembler->registerSymbol(Sym);
23}
24
26 // Comments are emitted on a new line before the instruction.
27 if (IsVerboseAsm)
29
30 std::istringstream Stream(Str);
32 std::string Line;
33 while (std::getline(Stream, Line, '\n'))
34 Lines.push_back(Line);
35
36 for (auto S : Lines) {
37 if (LLVM_LIKELY(S.length() < ContIndicatorColumn)) {
38 FOS << S;
39 // Each line in HLASM must fill the full 80 characters.
40 FOS.PadToColumn(InstLimit);
41 FOS << "\n";
42 } else {
43 // If last character before end of the line is not a space
44 // we must insert an additional non-space character that
45 // is not part of the statement coding. We just reuse
46 // the existing character by making the new substring start
47 // 1 character sooner, thus "duplicating" that character
48 // If The last character is a space. We insert an X instead.
49 std::string TmpSubStr = S.substr(0, ContIndicatorColumn);
50 if (!TmpSubStr.compare(ContIndicatorColumn - 1, 1, " "))
51 TmpSubStr.replace(ContIndicatorColumn - 1, 1, "X");
52
53 FOS << TmpSubStr;
54 FOS.PadToColumn(InstLimit);
55 FOS << "\n";
56
57 size_t Emitted = ContIndicatorColumn - 1;
58
59 while (Emitted < S.length()) {
60 if ((S.length() - Emitted) < ContLen)
61 TmpSubStr = S.substr(Emitted, S.length());
62 else {
63 TmpSubStr = S.substr(Emitted, ContLen);
64 if (!TmpSubStr.compare(ContLen - 1, 1, " "))
65 TmpSubStr.replace(ContLen - 1, 1, "X");
66 }
67 FOS.PadToColumn(ContStartColumn);
68 FOS << TmpSubStr;
69 FOS.PadToColumn(InstLimit);
70 FOS << "\n";
71 Emitted += ContLen - 1;
72 }
73 }
74 }
75 Str.clear();
76}
77
78static void emitXATTR(raw_ostream &OS, StringRef Name, MCSectionGOFF *ADA,
79 bool IsIndirectReference, GOFF::ESDLinkageType Linkage,
80 GOFF::ESDExecutable Executable,
81 GOFF::ESDBindingScope BindingScope) {
82 llvm::ListSeparator Sep(",");
83 OS << Name << " XATTR ";
84 OS << Sep << "LINKAGE(" << (Linkage == GOFF::ESD_LT_OS ? "OS" : "XPLINK")
85 << ")";
86
87 const bool NotUnspecified = (Executable != GOFF::ESD_EXE_Unspecified);
88 if (NotUnspecified || IsIndirectReference) {
89 OS << Sep << "REFERENCE(";
90 llvm::ListSeparator SepRef(",");
91
92 if (NotUnspecified)
93 OS << SepRef << (Executable == GOFF::ESD_EXE_CODE ? "CODE" : "DATA");
94
95 if (IsIndirectReference)
96 OS << SepRef << "INDIRECT";
97
98 OS << ")";
99 }
100 // Emit PSECT only for code symbols.
101 if (ADA && Executable != GOFF::ESD_EXE_DATA)
102 OS << Sep << "PSECT(" << ADA->getName() << ")";
103 if (BindingScope != GOFF::ESD_BSC_Unspecified) {
104 OS << Sep << "SCOPE(";
105 switch (BindingScope) {
107 OS << "SECTION";
108 break;
110 OS << "MODULE";
111 break;
113 OS << "LIBRARY";
114 break;
116 OS << "EXPORT";
117 break;
118 default:
119 break;
120 }
121 OS << ')';
122 }
123}
124
125static void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode,
126 GOFF::ESDAlignment Alignment,
127 GOFF::ESDLoadingBehavior LoadBehavior,
128 GOFF::ESDExecutable Executable, bool IsReadOnly,
129 uint32_t SortKey, uint8_t FillByteValue,
130 StringRef PartName) {
131 OS << Name << " CATTR ";
132 OS << "ALIGN(" << static_cast<unsigned>(Alignment) << "),"
133 << "FILL(" << static_cast<unsigned>(FillByteValue) << ")";
134 switch (LoadBehavior) {
136 OS << ",DEFLOAD";
137 break;
139 OS << ",NOLOAD";
140 break;
141 default:
142 break;
143 }
144 switch (Executable) {
146 OS << ",EXECUTABLE";
147 break;
149 OS << ",NOTEXECUTABLE";
150 break;
151 default:
152 break;
153 }
154 if (IsReadOnly)
155 OS << ",READONLY";
156 if (Rmode != GOFF::ESD_RMODE_None) {
157 OS << ',';
158 OS << "RMODE(";
159 switch (Rmode) {
163 OS << "24";
164 break;
166 OS << "31";
167 break;
169 OS << "64";
170 break;
171 }
172 OS << ')';
173 }
174 if (SortKey)
175 OS << ",PRIORITY(" << SortKey << ")";
176 if (!PartName.empty())
177 OS << ",PART(" << PartName << ")";
178 OS << '\n';
179}
180
182 uint32_t Subsection) {
183 auto &Sec = *static_cast<MCSectionGOFF *>(Section);
184 auto EmitExternalName = [&Sec, this]() {
185 if (Sec.hasExternalName())
186 OS << Sec.getName() << " ALIAS C'" << Sec.getExternalName() << "'\n";
187 };
188 switch (Sec.getSymbolType()) {
190 OS << Sec.getName() << " CSECT\n";
191 Sec.setEmitted();
192 EmitExternalName();
193 break;
194 }
196 changeSection(Sec.getParent(), Subsection);
197 if (!Sec.isEmitted()) {
198 GOFF::EDAttr ED = Sec.getEDAttributes();
199 emitCATTR(OS, Sec.getName(), ED.Rmode, Sec.getEDAlignment(),
202 if (auto *BeginSym = static_cast<MCSymbolGOFF *>(Sec.getBeginSymbol())) {
203 if (BeginSym->getADA()) {
204 emitXATTR(OS, BeginSym->getName(), BeginSym->getADA(),
205 /*IsIndirectReference=*/false, GOFF::ESD_LT_XPLink,
207 OS << '\n';
208 }
209 }
210 Sec.setEmitted();
211 EmitExternalName();
212 } else
213 OS << Sec.getName() << " CATTR\n";
214 break;
215 }
217 MCSectionGOFF *ED = Sec.getParent();
218 changeSection(ED->getParent(), Subsection);
219 if (!Sec.isEmitted()) {
220 GOFF::EDAttr EDAttr = ED->getEDAttributes();
221 GOFF::PRAttr PRAttr = Sec.getPRAttributes();
222 emitCATTR(OS, ED->getName(), EDAttr.Rmode, ED->getEDAlignment(),
223 EDAttr.LoadBehavior, PRAttr.Executable, EDAttr.IsReadOnly,
224 PRAttr.SortKey, EDAttr.FillByteValue, Sec.getName());
225 MCSectionGOFF *ADA =
226 Sec.getBeginSymbol() != nullptr
227 ? static_cast<MCSymbolGOFF *>(Sec.getBeginSymbol())->getADA()
228 : nullptr;
229 emitXATTR(OS, Sec.getName(), ADA, /*IsIndirectReference=*/false,
230 PRAttr.Linkage, PRAttr.Executable, PRAttr.BindingScope);
231 OS << '\n';
232 ED->setEmitted();
233 Sec.setEmitted();
234 EmitExternalName();
235 } else
236 OS << ED->getName() << " CATTR PART(" << Sec.getName() << ")\n";
237 break;
238 }
239 default:
240 llvm_unreachable("Wrong section type");
241 }
242 MCStreamer::changeSection(Section, Subsection);
243 EmitEOL();
244}
245
247 std::optional<int64_t> Value,
248 unsigned ValueSize,
249 unsigned MaxBytesToEmit) {
250 if (!isPowerOf2_64(ByteAlignment))
251 report_fatal_error("Only power-of-two alignments are supported ");
252
253 OS << " DS 0";
254 switch (ValueSize) {
255 default:
256 llvm_unreachable("Invalid size for machine code value!");
257 case 1:
258 OS << "B";
259 break;
260 case 2:
261 OS << "H";
262 break;
263 case 4:
264 OS << "F";
265 break;
266 case 8:
267 OS << "D";
268 break;
269 case 16:
270 OS << "Q";
271 break;
272 }
273
274 EmitEOL();
275}
276
277void SystemZHLASMAsmStreamer::emitRawComment(const Twine &T, bool TabPrefix) {
278 OS << MAI->getCommentString() << T;
279 EmitEOL();
280}
281
283 if (!IsVerboseAsm)
284 return;
285
286 T.toVector(CommentToEmit);
287
288 if (EOL)
289 CommentToEmit.push_back('\n'); // Place comment in a new line.
290}
291
293 if (CommentToEmit.empty() && CommentStream.GetNumBytesInBuffer() == 0)
294 return;
295
296 StringRef Comments = CommentToEmit;
297
298 assert(Comments.back() == '\n' && "Comment array not newline terminated");
299 do {
300 // Emit a line of comments, but not exceeding 80 characters.
301 size_t Position = std::min(InstLimit - 2, Comments.find('\n'));
302 FOS << MAI->getCommentString() << ' ' << Comments.substr(0, Position)
303 << '\n';
304
305 if (Comments[Position] == '\n')
306 Position++;
307 Comments = Comments.substr(Position);
308 } while (!Comments.empty());
309
310 CommentToEmit.clear();
311}
312
314 int64_t Fill,
315 uint8_t FillLen,
316 unsigned MaxBytesToEmit) {
317 emitAlignmentDS(Alignment.value(), Fill, FillLen, MaxBytesToEmit);
318}
319
321 const MCSubtargetInfo &STI,
322 unsigned MaxBytesToEmit) {
323 // Emit with a text fill value.
324 if (MAI->getTextAlignFillValue())
325 emitAlignmentDS(Alignment.value(), MAI->getTextAlignFillValue(), 1,
326 MaxBytesToEmit);
327 else
328 emitAlignmentDS(Alignment.value(), std::nullopt, 1, MaxBytesToEmit);
329}
330
333 "Cannot emit contents before setting section!");
334 if (Data.empty())
335 return;
336
337 OS << " DC ";
338 size_t Len = Data.size();
340 Chars.resize(Len);
341 OS << "XL" << Len;
342 uint32_t Index = 0;
343 for (uint8_t C : Data) {
344 Chars[Index] = C;
345 Index++;
346 }
347
348 OS << '\'' << toHex(Chars) << '\'';
349
350 EmitEOL();
351}
352
354 const MCSubtargetInfo &STI) {
356 SmallString<256> Code;
358
359 // If we have no code emitter, don't emit code.
360 if (!getAssembler().getEmitterPtr())
361 return;
362
363 getAssembler().getEmitter().encodeInstruction(Inst, Code, Fixups, STI);
364
365 // If we are showing fixups, create symbolic markers in the encoded
366 // representation. We do this by making a per-bit map to the fixup item index,
367 // then trying to display it as nicely as possible.
369 FixupMap.resize(Code.size() * 8);
370 for (unsigned I = 0, E = Code.size() * 8; I != E; ++I)
371 FixupMap[I] = 0;
372
373 for (unsigned I = 0, E = Fixups.size(); I != E; ++I) {
374 MCFixup &F = Fixups[I];
375 MCFixupKindInfo Info =
377 for (unsigned J = 0; J != Info.TargetSize; ++J) {
378 unsigned Index = F.getOffset() * 8 + Info.TargetOffset + J;
379 assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
380 FixupMap[Index] = 1 + I;
381 }
382 }
383
384 OS << "encoding: [";
385 for (unsigned I = 0, E = Code.size(); I != E; ++I) {
386 if (I)
387 OS << ',';
388
389 // See if all bits are the same map entry.
390 uint8_t MapEntry = FixupMap[I * 8 + 0];
391 for (unsigned J = 1; J != 8; ++J) {
392 if (FixupMap[I * 8 + J] == MapEntry)
393 continue;
394
395 MapEntry = uint8_t(~0U);
396 break;
397 }
398
399 if (MapEntry != uint8_t(~0U)) {
400 if (MapEntry == 0) {
401 OS << format("0x%02x", uint8_t(Code[I]));
402 } else {
403 if (Code[I]) {
404 // FIXME: Some of the 8 bits require fix up.
405 OS << format("0x%02x", uint8_t(Code[I])) << '\''
406 << char('A' + MapEntry - 1) << '\'';
407 } else
408 OS << char('A' + MapEntry - 1);
409 }
410 } else {
411 // Otherwise, write out in binary.
412 OS << "0b";
413 for (unsigned J = 8; J--;) {
414 unsigned Bit = (Code[I] >> J) & 1;
415 unsigned FixupBit = I * 8 + (7 - J);
416 if (uint8_t MapEntry = FixupMap[FixupBit]) {
417 assert(Bit == 0 && "Encoder wrote into fixed up bit!");
418 OS << char('A' + MapEntry - 1);
419 } else
420 OS << Bit;
421 }
422 }
423 }
424 OS << "]\n";
425
426 for (unsigned I = 0, E = Fixups.size(); I != E; ++I) {
427 MCFixup &F = Fixups[I];
428 OS << " fixup " << char('A' + I) << " - "
429 << "offset: " << F.getOffset() << ", value: ";
430 MAI->printExpr(OS, *F.getValue());
431 auto Kind = F.getKind();
432 if (mc::isRelocation(Kind))
433 OS << ", relocation type: " << Kind;
434 else {
435 OS << ", kind: ";
436 auto Info = getAssembler().getBackend().getFixupKindInfo(Kind);
437 if (F.isPCRel() && StringRef(Info.Name).starts_with("FK_Data_"))
438 OS << "FK_PCRel_" << (Info.TargetSize / 8);
439 else
440 OS << Info.Name;
441 }
442 OS << "\n";
443 }
444}
445
447 const MCSubtargetInfo &STI) {
448 // Show the encoding in a comment if we have a code emitter.
449 addEncodingComment(Inst, STI);
450 EmitEOL();
451
452 InstPrinter->printInst(&Inst, 0, "", STI, OS);
453 EmitEOL();
454}
455
457 MCSymbolGOFF *Sym = static_cast<MCSymbolGOFF *>(Symbol);
458
460
461 // Emit label and ENTRY statement only if not implied by CSECT. Do not emit a
462 // label if the symbol is on a PR section.
463 bool EmitLabelAndEntry =
464 !static_cast<MCSectionGOFF *>(getCurrentSectionOnly())->isPR();
465 if (!Sym->isTemporary() && Sym->isInEDSection()) {
466 EmitLabelAndEntry =
467 Sym->getName() !=
468 static_cast<MCSectionGOFF &>(Sym->getSection()).getParent()->getName();
469 if (EmitLabelAndEntry) {
470 OS << " ENTRY " << Sym->getName();
471 EmitEOL();
472 }
473
474 emitXATTR(OS, Sym->getName(), Sym->getADA(), Sym->isIndirect(),
475 Sym->getLinkage(), Sym->getCodeData(), Sym->getBindingScope());
476 EmitEOL();
477 if (Sym->hasExternalName())
478 OS << Sym->getName() << " ALIAS C'" << Sym->getExternalName() << "'\n";
479 }
480
481 if (EmitLabelAndEntry) {
482 OS << Sym->getName() << " DS 0H";
483 EmitEOL();
484 }
485}
486
489 return static_cast<MCSymbolGOFF *>(Sym)->setSymbolAttribute(Attribute);
490}
491
493 Align ByteAlignment) {
494 auto *Symbol = static_cast<MCSymbolGOFF *>(S);
495 MCSectionGOFF *Section =
496 Symbol->getSectionForCommonSymbol(getContext(), ByteAlignment);
497 pushSection();
498 switchSection(Section);
499 emitLabel(Symbol, SMLoc());
501 popSection();
502}
503
505 String.consume_back("\n");
506 OS << String;
507 EmitEOL();
508}
509
510// Slight duplicate of MCExpr::print due to HLASM only recognizing limited
511// arithmetic operators (+-*/).
513 unsigned Size, bool Parens) {
514 switch (Value->getKind()) {
515 case MCExpr::Constant: {
516 OS << "XL" << Size << '\'';
517 MAI->printExpr(OS, *Value);
518 OS << '\'';
519 return;
520 }
521 case MCExpr::Binary: {
523 int64_t Const;
524 // Or is handled differently.
525 if (BE.getOpcode() == MCBinaryExpr::Or) {
526 emitHLASMValueImpl(BE.getLHS(), Size, true);
527 OS << ',';
528 emitHLASMValueImpl(BE.getRHS(), Size, true);
529 return;
530 }
531
532 if (Parens)
533 OS << "AD(";
535
536 switch (BE.getOpcode()) {
537 case MCBinaryExpr::LShr: {
538 Const = cast<MCConstantExpr>(BE.getRHS())->getValue();
539 OS << '/' << (1 << Const);
540 if (Parens)
541 OS << ')';
542 return;
543 }
545 OS << '+';
546 break;
548 OS << '/';
549 break;
551 OS << '*';
552 break;
554 OS << '-';
555 break;
556 default:
558 "Unrecognized HLASM arithmetic expression!");
559 }
561 if (Parens)
562 OS << ')';
563 return;
564 }
565 case MCExpr::Target:
566 MAI->printExpr(OS, *Value);
567 return;
568 default:
569 Parens &= isa<MCSymbolRefExpr>(Value);
570 if (Parens)
571 OS << "AD(";
572 MAI->printExpr(OS, *Value);
573 if (Parens)
574 OS << ')';
575 return;
576 }
577}
578
580 SMLoc Loc) {
581 assert(Size <= 8 && "Invalid size");
583 "Cannot emit contents before setting section!");
584
586 OS << " DC ";
588 EmitEOL();
589}
590
592 for (auto &Symbol : getAssembler().symbols()) {
593 if (Symbol.isTemporary() || !Symbol.isRegistered() || Symbol.isDefined())
594 continue;
595 auto &Sym = static_cast<MCSymbolGOFF &>(const_cast<MCSymbol &>(Symbol));
596 if (Sym.getCodeData() == GOFF::ESD_EXE_DATA) {
597 OS << Sym.getADA()->getParent()->getExternalName() << " CATTR PART("
598 << Sym.getName() << ")";
599 EmitEOL();
600 } else {
601 OS << " " << (Sym.isWeak() ? "WXTRN" : "EXTRN") << " " << Sym.getName();
602 EmitEOL();
603 }
604 emitXATTR(OS, Sym.getName(), Sym.getADA(), Sym.isIndirect(),
605 Sym.getLinkage(), Sym.getCodeData(), Sym.getBindingScope());
606 EmitEOL();
607 if (Sym.hasExternalName())
608 OS << Sym.getName() << " ALIAS C'" << Sym.getExternalName() << "'\n";
609 }
610
611 // Finish the assembly output.
612 OS << " END";
613 EmitEOL();
614}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_LIKELY(EXPR)
Definition Compiler.h:343
DXIL Finalize Linkage
This file declares the MCSectionGOFF class, which contains all of the necessary machine code sections...
This file contains the MCSymbolGOFF class.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define T
This file contains some functions that are useful when dealing with strings.
static void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode, GOFF::ESDAlignment Alignment, GOFF::ESDLoadingBehavior LoadBehavior, GOFF::ESDExecutable Executable, bool IsReadOnly, uint32_t SortKey, uint8_t FillByteValue, StringRef PartName)
static void emitXATTR(raw_ostream &OS, StringRef Name, MCSectionGOFF *ADA, bool IsIndirectReference, GOFF::ESDLinkageType Linkage, GOFF::ESDExecutable Executable, GOFF::ESDBindingScope BindingScope)
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:105
A helper class to return the specified delimiter string after the first invocation of operator String...
virtual MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
std::unique_ptr< MCAssembler > Assembler
SmallString< 128 > CommentToEmit
MCAssembler & getAssembler()
raw_ostream & getCommentOS() override
Return a raw_ostream that comments can be written to.
raw_svector_ostream CommentStream
MCCodeEmitter & getEmitter() const
MCAsmBackend & getBackend() const
Binary assembler expressions.
Definition MCExpr.h:298
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Definition MCExpr.h:445
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Definition MCExpr.h:448
Opcode getOpcode() const
Get the kind of this binary expression.
Definition MCExpr.h:442
@ Div
Signed division.
Definition MCExpr.h:303
@ LShr
Logical shift right.
Definition MCExpr.h:322
@ Sub
Subtraction.
Definition MCExpr.h:323
@ Mul
Multiplication.
Definition MCExpr.h:316
@ Or
Bitwise or.
Definition MCExpr.h:318
@ Add
Addition.
Definition MCExpr.h:301
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.
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
@ Constant
Constant expressions.
Definition MCExpr.h:42
@ Target
Target specific expression.
Definition MCExpr.h:46
@ Binary
Binary expressions.
Definition MCExpr.h:41
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition MCFixup.h:61
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
GOFF::EDAttr getEDAttributes() const
void setEmitted() const
GOFF::ESDAlignment getEDAlignment() const
MCSectionGOFF * getParent() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:580
StringRef getName() const
Definition MCSection.h:650
MCSymbol * getBeginSymbol()
Definition MCSection.h:653
virtual bool popSection()
Restore the current and previous section from the section stack.
MCContext & getContext() const
Definition MCStreamer.h:326
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
void pushSection()
Save the current and previous section on the section stack.
Definition MCStreamer.h:460
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
MCSection * getCurrentSectionOnly() const
Definition MCStreamer.h:438
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 emitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
virtual void changeSection(MCSection *, uint32_t)
This is called by popSection and switchSection, if the current section changes.
Generic base class for all target subtargets.
StringRef getExternalName() const
GOFF::ESDExecutable getCodeData() const
bool hasExternalName() const
bool isInEDSection() const
GOFF::ESDBindingScope getBindingScope() const
bool isIndirect() const
GOFF::ESDLinkageType getLinkage() const
MCSectionGOFF * getADA() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
Definition MCSymbol.h:251
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition MCSymbol.h:205
Represents a location in source code.
Definition SMLoc.h:22
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
void resize(size_type N)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition StringRef.h:597
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition StringRef.h:258
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
char back() const
Get the last character in the string.
Definition StringRef.h:153
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Definition StringRef.h:290
void emitHLASMValueImpl(const MCExpr *Value, unsigned Size, bool Parens=false)
void emitRawTextImpl(StringRef String) override
EmitRawText - If this file is backed by an assembly streamer, this dumps the specified string in the ...
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override
Emit the expression Value into the output as a native integer of the given Size bytes.
void addEncodingComment(const MCInst &Inst, const MCSubtargetInfo &STI)
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
void emitAlignmentDS(uint64_t ByteAlignment, std::optional< int64_t > Value, unsigned ValueSize, unsigned MaxBytesToEmit)
void finishImpl() override
Streamer specific finalization.
void visitUsedSymbol(const MCSymbol &Sym) override
void AddComment(const Twine &T, bool EOL=true) override
Add a comment that can be emitted to the generated .s file to make the output of the compiler more re...
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a common symbol.
void emitValueToAlignment(Align Alignment, int64_t Fill, uint8_t FillLen, unsigned MaxBytesToEmit) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void emitRawComment(const Twine &T, bool TabPrefix=false) override
Print T and prefix it with the comment string (normally #) and optionally a tab.
void emitCodeAlignment(Align Alignment, const MCSubtargetInfo &STI, unsigned MaxBytesToEmit=0) override
Emit nops until the byte alignment ByteAlignment is reached.
void changeSection(MCSection *Section, uint32_t Subsection) override
This is called by popSection and switchSection, if the current section changes.
void emitLabel(MCSymbol *Symbol, SMLoc Loc) override
Emit a label for Symbol into the current section.
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ESDLoadingBehavior
Definition GOFF.h:127
@ ESD_LB_Deferred
Definition GOFF.h:129
@ ESD_LB_NoLoad
Definition GOFF.h:130
ESDExecutable
Definition GOFF.h:109
@ ESD_EXE_Unspecified
Definition GOFF.h:110
@ ESD_EXE_CODE
Definition GOFF.h:112
@ ESD_EXE_DATA
Definition GOFF.h:111
ESDAlignment
Definition GOFF.h:144
ESDBindingScope
Definition GOFF.h:134
@ ESD_BSC_Library
Definition GOFF.h:138
@ ESD_BSC_Module
Definition GOFF.h:137
@ ESD_BSC_Unspecified
Definition GOFF.h:135
@ ESD_BSC_ImportExport
Definition GOFF.h:139
@ ESD_BSC_Section
Definition GOFF.h:136
ESDLinkageType
Definition GOFF.h:142
@ ESD_LT_OS
Definition GOFF.h:142
@ ESD_LT_XPLink
Definition GOFF.h:142
@ ESD_ST_PartReference
Definition GOFF.h:57
@ ESD_ST_ElementDefinition
Definition GOFF.h:55
@ ESD_ST_SectionDefinition
Definition GOFF.h:54
@ ESD_RMODE_31
Definition GOFF.h:87
@ ESD_RMODE_None
Definition GOFF.h:85
@ ESD_RMODE_64
Definition GOFF.h:88
@ ESD_RMODE_24
Definition GOFF.h:86
bool isRelocation(MCFixupKind FixupKind)
Definition MCFixup.h:130
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
Definition MathExtras.h:285
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition Format.h:102
void toHex(ArrayRef< uint8_t > Input, bool LowerCase, SmallVectorImpl< char > &Output)
Convert buffer Input to its hexadecimal representation. The returned string is double the size of Inp...
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
GOFF::ESDRmode Rmode
GOFF::ESDLoadingBehavior LoadBehavior
GOFF::ESDLinkageType Linkage
GOFF::ESDBindingScope BindingScope
GOFF::ESDExecutable Executable
Target independent information on a fixup kind.
const char * Name
A target specific name for the fixup kind.