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"
19#include <sstream>
20
21using namespace llvm;
22
24 Assembler->registerSymbol(Sym);
25}
26
28 // Comments are emitted on a new line before the instruction.
29 if (IsVerboseAsm)
31
32 std::istringstream Stream(Str);
34 std::string Line;
35 while (std::getline(Stream, Line, '\n'))
36 Lines.push_back(Line);
37
38 for (auto S : Lines) {
39 if (LLVM_LIKELY(S.length() < ContIndicatorColumn)) {
40 FOS << S;
41 // Each line in HLASM must fill the full 80 characters.
42 FOS.PadToColumn(InstLimit);
43 FOS << "\n";
44 } else {
45 // If last character before end of the line is not a space
46 // we must insert an additional non-space character that
47 // is not part of the statement coding. We just reuse
48 // the existing character by making the new substring start
49 // 1 character sooner, thus "duplicating" that character
50 // If The last character is a space. We insert an X instead.
51 std::string TmpSubStr = S.substr(0, ContIndicatorColumn);
52 if (!TmpSubStr.compare(ContIndicatorColumn - 1, 1, " "))
53 TmpSubStr.replace(ContIndicatorColumn - 1, 1, "X");
54
55 FOS << TmpSubStr;
56 FOS.PadToColumn(InstLimit);
57 FOS << "\n";
58
59 size_t Emitted = ContIndicatorColumn - 1;
60
61 while (Emitted < S.length()) {
62 if ((S.length() - Emitted) < ContLen)
63 TmpSubStr = S.substr(Emitted, S.length());
64 else {
65 TmpSubStr = S.substr(Emitted, ContLen);
66 if (!TmpSubStr.compare(ContLen - 1, 1, " "))
67 TmpSubStr.replace(ContLen - 1, 1, "X");
68 }
69 FOS.PadToColumn(ContStartColumn);
70 FOS << TmpSubStr;
71 FOS.PadToColumn(InstLimit);
72 FOS << "\n";
73 Emitted += ContLen - 1;
74 }
75 }
76 }
77 Str.clear();
78}
79
80static void emitXATTR(raw_ostream &OS, StringRef Name, MCSectionGOFF *ADA,
81 bool IsIndirectReference, GOFF::ESDLinkageType Linkage,
82 GOFF::ESDExecutable Executable,
83 GOFF::ESDBindingScope BindingScope) {
84 llvm::ListSeparator Sep(",");
85 OS << Name << " XATTR ";
86 OS << Sep << "LINKAGE(" << (Linkage == GOFF::ESD_LT_OS ? "OS" : "XPLINK")
87 << ")";
88
89 const bool NotUnspecified = (Executable != GOFF::ESD_EXE_Unspecified);
90 if (NotUnspecified || IsIndirectReference) {
91 OS << Sep << "REFERENCE(";
92 llvm::ListSeparator SepRef(",");
93
94 if (NotUnspecified)
95 OS << SepRef << (Executable == GOFF::ESD_EXE_CODE ? "CODE" : "DATA");
96
97 if (IsIndirectReference)
98 OS << SepRef << "INDIRECT";
99
100 OS << ")";
101 }
102 // Emit PSECT only for code symbols.
103 if (ADA && Executable != GOFF::ESD_EXE_DATA)
104 OS << Sep << "PSECT(" << ADA->getName() << ")";
105 if (BindingScope != GOFF::ESD_BSC_Unspecified) {
106 OS << Sep << "SCOPE(";
107 switch (BindingScope) {
109 OS << "SECTION";
110 break;
112 OS << "MODULE";
113 break;
115 OS << "LIBRARY";
116 break;
118 OS << "EXPORT";
119 break;
120 default:
121 break;
122 }
123 OS << ')';
124 }
125}
126
127static void emitCATTR(raw_ostream &OS, StringRef Name, GOFF::ESDRmode Rmode,
128 GOFF::ESDAlignment Alignment,
129 GOFF::ESDLoadingBehavior LoadBehavior,
130 GOFF::ESDExecutable Executable, bool IsReadOnly,
131 uint32_t SortKey, uint8_t FillByteValue,
132 StringRef PartName) {
133 OS << Name << " CATTR ";
134 OS << "ALIGN(" << static_cast<unsigned>(Alignment) << "),"
135 << "FILL(" << static_cast<unsigned>(FillByteValue) << ")";
136 switch (LoadBehavior) {
138 OS << ",DEFLOAD";
139 break;
141 OS << ",NOLOAD";
142 break;
143 default:
144 break;
145 }
146 switch (Executable) {
148 OS << ",EXECUTABLE";
149 break;
151 OS << ",NOTEXECUTABLE";
152 break;
153 default:
154 break;
155 }
156 if (IsReadOnly)
157 OS << ",READONLY";
158 if (Rmode != GOFF::ESD_RMODE_None) {
159 OS << ',';
160 OS << "RMODE(";
161 switch (Rmode) {
165 OS << "24";
166 break;
168 OS << "31";
169 break;
171 OS << "64";
172 break;
173 }
174 OS << ')';
175 }
176 if (SortKey)
177 OS << ",PRIORITY(" << SortKey << ")";
178 if (!PartName.empty())
179 OS << ",PART(" << PartName << ")";
180 OS << '\n';
181}
182
184 uint32_t Subsection) {
185 auto &Sec = *static_cast<MCSectionGOFF *>(Section);
186 auto EmitExternalName = [&Sec, this]() {
187 if (Sec.hasExternalName())
188 OS << Sec.getName() << " ALIAS C'" << Sec.getExternalName() << "'\n";
189 };
190 switch (Sec.getSymbolType()) {
192 OS << Sec.getName() << " CSECT\n";
193 Sec.setEmitted();
194 EmitExternalName();
195 break;
196 }
198 changeSection(Sec.getParent(), Subsection);
199 if (!Sec.isEmitted()) {
200 GOFF::EDAttr ED = Sec.getEDAttributes();
201 emitCATTR(OS, Sec.getName(), ED.Rmode, Sec.getEDAlignment(),
204 if (auto *BeginSym = static_cast<MCSymbolGOFF *>(Sec.getBeginSymbol())) {
205 if (BeginSym->getADA()) {
206 emitXATTR(OS, BeginSym->getName(), BeginSym->getADA(),
207 /*IsIndirectReference=*/false, GOFF::ESD_LT_XPLink,
209 OS << '\n';
210 }
211 }
212 Sec.setEmitted();
213 EmitExternalName();
214 } else
215 OS << Sec.getName() << " CATTR\n";
216 break;
217 }
219 MCSectionGOFF *ED = Sec.getParent();
220 changeSection(ED->getParent(), Subsection);
221 if (!Sec.isEmitted()) {
222 GOFF::EDAttr EDAttr = ED->getEDAttributes();
223 GOFF::PRAttr PRAttr = Sec.getPRAttributes();
224 emitCATTR(OS, ED->getName(), EDAttr.Rmode, ED->getEDAlignment(),
225 EDAttr.LoadBehavior, PRAttr.Executable, EDAttr.IsReadOnly,
226 PRAttr.SortKey, EDAttr.FillByteValue, Sec.getName());
227 MCSectionGOFF *ADA =
228 Sec.getBeginSymbol() != nullptr
229 ? static_cast<MCSymbolGOFF *>(Sec.getBeginSymbol())->getADA()
230 : nullptr;
231 emitXATTR(OS, Sec.getName(), ADA, /*IsIndirectReference=*/false,
232 PRAttr.Linkage, PRAttr.Executable, PRAttr.BindingScope);
233 OS << '\n';
234 ED->setEmitted();
235 Sec.setEmitted();
236 EmitExternalName();
237 } else
238 OS << ED->getName() << " CATTR PART(" << Sec.getName() << ")\n";
239 break;
240 }
241 default:
242 llvm_unreachable("Wrong section type");
243 }
244 MCStreamer::changeSection(Section, Subsection);
245 EmitEOL();
246}
247
249 std::optional<int64_t> Value,
250 unsigned ValueSize,
251 unsigned MaxBytesToEmit) {
252 if (!isPowerOf2_64(ByteAlignment))
253 report_fatal_error("Only power-of-two alignments are supported ");
254
255 OS << " DS 0";
256 switch (ValueSize) {
257 default:
258 llvm_unreachable("Invalid size for machine code value!");
259 case 1:
260 OS << "B";
261 break;
262 case 2:
263 OS << "H";
264 break;
265 case 4:
266 OS << "F";
267 break;
268 case 8:
269 OS << "D";
270 break;
271 case 16:
272 OS << "Q";
273 break;
274 }
275
276 EmitEOL();
277}
278
279void SystemZHLASMAsmStreamer::emitRawComment(const Twine &T, bool TabPrefix) {
280 OS << MAI->getCommentString() << T;
281 EmitEOL();
282}
283
285 if (!IsVerboseAsm)
286 return;
287
288 T.toVector(CommentToEmit);
289
290 if (EOL)
291 CommentToEmit.push_back('\n'); // Place comment in a new line.
292}
293
295 if (CommentToEmit.empty() && CommentStream.GetNumBytesInBuffer() == 0)
296 return;
297
298 StringRef Comments = CommentToEmit;
299
300 assert(Comments.back() == '\n' && "Comment array not newline terminated");
301 do {
302 // Emit a line of comments, but not exceeding 80 characters.
303 size_t Position = std::min(InstLimit - 2, Comments.find('\n'));
304 FOS << MAI->getCommentString() << ' ' << Comments.substr(0, Position)
305 << '\n';
306
307 if (Comments[Position] == '\n')
308 Position++;
309 Comments = Comments.substr(Position);
310 } while (!Comments.empty());
311
312 CommentToEmit.clear();
313}
314
316 int64_t Fill,
317 uint8_t FillLen,
318 unsigned MaxBytesToEmit) {
319 emitAlignmentDS(Alignment.value(), Fill, FillLen, MaxBytesToEmit);
320}
321
323 const MCSubtargetInfo &STI,
324 unsigned MaxBytesToEmit) {
325 // Emit with a text fill value.
326 if (MAI->getTextAlignFillValue())
327 emitAlignmentDS(Alignment.value(), MAI->getTextAlignFillValue(), 1,
328 MaxBytesToEmit);
329 else
330 emitAlignmentDS(Alignment.value(), std::nullopt, 1, MaxBytesToEmit);
331}
332
335 "Cannot emit contents before setting section!");
336 if (Data.empty())
337 return;
338
339 OS << " DC ";
340 size_t Len = Data.size();
342 Chars.resize(Len);
343 OS << "XL" << Len;
344 uint32_t Index = 0;
345 for (uint8_t C : Data) {
346 Chars[Index] = C;
347 Index++;
348 }
349
350 OS << '\'' << toHex(Chars) << '\'';
351
352 EmitEOL();
353}
354
356 const MCSubtargetInfo &STI) {
358 SmallString<256> Code;
360
361 // If we have no code emitter, don't emit code.
362 if (!getAssembler().getEmitterPtr())
363 return;
364
365 getAssembler().getEmitter().encodeInstruction(Inst, Code, Fixups, STI);
366
367 // If we are showing fixups, create symbolic markers in the encoded
368 // representation. We do this by making a per-bit map to the fixup item index,
369 // then trying to display it as nicely as possible.
371 FixupMap.resize(Code.size() * 8);
372 for (unsigned I = 0, E = Code.size() * 8; I != E; ++I)
373 FixupMap[I] = 0;
374
375 for (unsigned I = 0, E = Fixups.size(); I != E; ++I) {
376 MCFixup &F = Fixups[I];
377 MCFixupKindInfo Info =
379 for (unsigned J = 0; J != Info.TargetSize; ++J) {
380 unsigned Index = F.getOffset() * 8 + Info.TargetOffset + J;
381 assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
382 FixupMap[Index] = 1 + I;
383 }
384 }
385
386 OS << "encoding: [";
387 for (unsigned I = 0, E = Code.size(); I != E; ++I) {
388 if (I)
389 OS << ',';
390
391 // See if all bits are the same map entry.
392 uint8_t MapEntry = FixupMap[I * 8 + 0];
393 for (unsigned J = 1; J != 8; ++J) {
394 if (FixupMap[I * 8 + J] == MapEntry)
395 continue;
396
397 MapEntry = uint8_t(~0U);
398 break;
399 }
400
401 if (MapEntry != uint8_t(~0U)) {
402 if (MapEntry == 0) {
403 OS << format("0x%02x", uint8_t(Code[I]));
404 } else {
405 if (Code[I]) {
406 // FIXME: Some of the 8 bits require fix up.
407 OS << format("0x%02x", uint8_t(Code[I])) << '\''
408 << char('A' + MapEntry - 1) << '\'';
409 } else
410 OS << char('A' + MapEntry - 1);
411 }
412 } else {
413 // Otherwise, write out in binary.
414 OS << "0b";
415 for (unsigned J = 8; J--;) {
416 unsigned Bit = (Code[I] >> J) & 1;
417 unsigned FixupBit = I * 8 + (7 - J);
418 if (uint8_t MapEntry = FixupMap[FixupBit]) {
419 assert(Bit == 0 && "Encoder wrote into fixed up bit!");
420 OS << char('A' + MapEntry - 1);
421 } else
422 OS << Bit;
423 }
424 }
425 }
426 OS << "]\n";
427
428 for (unsigned I = 0, E = Fixups.size(); I != E; ++I) {
429 MCFixup &F = Fixups[I];
430 OS << " fixup " << char('A' + I) << " - "
431 << "offset: " << F.getOffset() << ", value: ";
432 MAI->printExpr(OS, *F.getValue());
433 auto Kind = F.getKind();
434 if (mc::isRelocation(Kind))
435 OS << ", relocation type: " << Kind;
436 else {
437 OS << ", kind: ";
438 auto Info = getAssembler().getBackend().getFixupKindInfo(Kind);
439 if (F.isPCRel() && StringRef(Info.Name).starts_with("FK_Data_"))
440 OS << "FK_PCRel_" << (Info.TargetSize / 8);
441 else
442 OS << Info.Name;
443 }
444 OS << "\n";
445 }
446}
447
449 const MCSubtargetInfo &STI) {
450 // Show the encoding in a comment if we have a code emitter.
451 addEncodingComment(Inst, STI);
452 EmitEOL();
453
454 InstPrinter->printInst(&Inst, 0, "", STI, OS);
455 EmitEOL();
456}
457
459 MCSymbolGOFF *Sym = static_cast<MCSymbolGOFF *>(Symbol);
460
462
463 // Emit label and ENTRY statement only if not implied by CSECT. Do not emit a
464 // label if the symbol is on a PR section.
465 bool EmitLabelAndEntry =
466 !static_cast<MCSectionGOFF *>(getCurrentSectionOnly())->isPR();
467 if (!Sym->isTemporary() && Sym->isInEDSection()) {
468 EmitLabelAndEntry =
469 Sym->getName() !=
470 static_cast<MCSectionGOFF &>(Sym->getSection()).getParent()->getName();
471 if (EmitLabelAndEntry) {
472 OS << " ENTRY " << Sym->getName();
473 EmitEOL();
474 }
475
476 emitXATTR(OS, Sym->getName(), Sym->getADA(), Sym->isIndirect(),
477 Sym->getLinkage(), Sym->getCodeData(), Sym->getBindingScope());
478 EmitEOL();
479 if (Sym->hasExternalName())
480 OS << Sym->getName() << " ALIAS C'" << Sym->getExternalName() << "'\n";
481 }
482
483 if (EmitLabelAndEntry) {
484 OS << Sym->getName() << " DS 0H";
485 EmitEOL();
486 }
487}
488
491 return static_cast<MCSymbolGOFF *>(Sym)->setSymbolAttribute(Attribute);
492}
493
495 String.consume_back("\n");
496 OS << String;
497 EmitEOL();
498}
499
500// Slight duplicate of MCExpr::print due to HLASM only recognizing limited
501// arithmetic operators (+-*/).
503 unsigned Size, bool Parens) {
504 switch (Value->getKind()) {
505 case MCExpr::Constant: {
506 OS << "XL" << Size << '\'';
507 MAI->printExpr(OS, *Value);
508 OS << '\'';
509 return;
510 }
511 case MCExpr::Binary: {
513 int64_t Const;
514 // Or is handled differently.
515 if (BE.getOpcode() == MCBinaryExpr::Or) {
516 emitHLASMValueImpl(BE.getLHS(), Size, true);
517 OS << ',';
518 emitHLASMValueImpl(BE.getRHS(), Size, true);
519 return;
520 }
521
522 if (Parens)
523 OS << "AD(";
525
526 switch (BE.getOpcode()) {
527 case MCBinaryExpr::LShr: {
528 Const = cast<MCConstantExpr>(BE.getRHS())->getValue();
529 OS << '/' << (1 << Const);
530 if (Parens)
531 OS << ')';
532 return;
533 }
535 OS << '+';
536 break;
538 OS << '/';
539 break;
541 OS << '*';
542 break;
544 OS << '-';
545 break;
546 default:
548 "Unrecognized HLASM arithmetic expression!");
549 }
551 if (Parens)
552 OS << ')';
553 return;
554 }
555 case MCExpr::Target:
556 MAI->printExpr(OS, *Value);
557 return;
558 default:
559 Parens &= isa<MCSymbolRefExpr>(Value);
560 if (Parens)
561 OS << "AD(";
562 MAI->printExpr(OS, *Value);
563 if (Parens)
564 OS << ')';
565 return;
566 }
567}
568
570 SMLoc Loc) {
571 assert(Size <= 8 && "Invalid size");
573 "Cannot emit contents before setting section!");
574
576 OS << " DC ";
578 EmitEOL();
579}
580
582 for (auto &Symbol : getAssembler().symbols()) {
583 if (Symbol.isTemporary() || !Symbol.isRegistered() || Symbol.isDefined())
584 continue;
585 auto &Sym = static_cast<MCSymbolGOFF &>(const_cast<MCSymbol &>(Symbol));
586 if (Sym.getCodeData() == GOFF::ESD_EXE_DATA) {
587 OS << Sym.getADA()->getParent()->getExternalName() << " CATTR PART("
588 << Sym.getName() << ")";
589 EmitEOL();
590 } else {
591 OS << " " << (Sym.isWeak() ? "WXTRN" : "EXTRN") << " " << Sym.getName();
592 EmitEOL();
593 }
594 emitXATTR(OS, Sym.getName(), Sym.getADA(), Sym.isIndirect(),
595 Sym.getLinkage(), Sym.getCodeData(), Sym.getBindingScope());
596 EmitEOL();
597 if (Sym.hasExternalName())
598 OS << Sym.getName() << " ALIAS C'" << Sym.getExternalName() << "'\n";
599 }
600
601 // Finish the assembly output.
602 OS << " END";
603 EmitEOL();
604}
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
MCContext & getContext() const
Definition MCStreamer.h:326
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current 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.
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 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
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
Definition Alignment.h:77
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.