43 class MCAsmStreamer final :
public MCStreamer {
44 std::unique_ptr<formatted_raw_ostream> OSOwner;
47 std::unique_ptr<MCInstPrinter> InstPrinter;
48 std::unique_ptr<MCAssembler> Assembler;
55 unsigned IsVerboseAsm : 1;
56 unsigned ShowInst : 1;
57 unsigned UseDwarfDirectory : 1;
59 void EmitRegisterName(int64_t
Register);
65 bool isVerboseAsm,
bool useDwarfDirectory,
66 MCInstPrinter *printer, std::unique_ptr<MCCodeEmitter> emitter,
67 std::unique_ptr<MCAsmBackend> asmbackend,
bool showInst)
69 MAI(Context.getAsmInfo()), InstPrinter(printer),
71 Context,
std::move(asmbackend),
std::move(emitter),
72 (asmbackend) ? asmbackend->createObjectWriter(NullStream)
74 CommentStream(CommentToEmit), IsVerboseAsm(isVerboseAsm),
75 ShowInst(showInst), UseDwarfDirectory(useDwarfDirectory) {
78 InstPrinter->setCommentStream(CommentStream);
82 MCAssembler *getAssemblerPtr()
override {
return nullptr; }
84 inline void EmitEOL() {
86 emitExplicitComments();
95 void EmitSyntaxDirective()
override;
97 void EmitCommentsAndEOL();
100 bool isVerboseAsm()
const override {
return IsVerboseAsm; }
103 bool hasRawTextSupport()
const override {
return true; }
108 void AddComment(
const Twine &
T,
bool EOL =
true)
override;
114 bool PrintSchedInfo);
122 return CommentStream;
125 void emitRawComment(
const Twine &
T,
bool TabPrefix =
true)
override;
127 void addExplicitComment(
const Twine &
T)
override;
128 void emitExplicitComments()
override;
131 void AddBlankLine()
override {
140 void emitELFSymverDirective(
StringRef AliasName,
151 void EmitBuildVersion(
unsigned Platform,
unsigned Major,
unsigned Minor,
153 void EmitThumbFunc(
MCSymbol *Func)
override;
159 void EmitSymbolDesc(
MCSymbol *Symbol,
unsigned DescValue)
override;
160 void BeginCOFFSymbolDef(
const MCSymbol *Symbol)
override;
161 void EmitCOFFSymbolStorageClass(
int StorageClass)
override;
162 void EmitCOFFSymbolType(
int Type)
override;
163 void EndCOFFSymbolDef()
override;
164 void EmitCOFFSafeSEH(
MCSymbol const *Symbol)
override;
165 void EmitCOFFSymbolIndex(
MCSymbol const *Symbol)
override;
166 void EmitCOFFSectionIndex(
MCSymbol const *Symbol)
override;
167 void EmitCOFFSecRel32(
MCSymbol const *Symbol, uint64_t
Offset)
override;
168 void EmitCOFFImgRel32(
MCSymbol const *Symbol, int64_t
Offset)
override;
178 void EmitLocalCommonSymbol(
MCSymbol *Symbol, uint64_t
Size,
188 void EmitBinaryData(
StringRef Data)
override;
194 void EmitIntValue(uint64_t Value,
unsigned Size)
override;
196 void EmitULEB128Value(
const MCExpr *Value)
override;
198 void EmitSLEB128Value(
const MCExpr *Value)
override;
200 void EmitDTPRel32Value(
const MCExpr *Value)
override;
201 void EmitDTPRel64Value(
const MCExpr *Value)
override;
202 void EmitTPRel32Value(
const MCExpr *Value)
override;
203 void EmitTPRel64Value(
const MCExpr *Value)
override;
205 void EmitGPRel64Value(
const MCExpr *Value)
override;
207 void EmitGPRel32Value(
const MCExpr *Value)
override;
209 void emitFill(
const MCExpr &NumBytes, uint64_t FillValue,
212 void emitFill(
const MCExpr &NumValues, int64_t Size, int64_t Expr,
215 void EmitValueToAlignment(
unsigned ByteAlignment, int64_t Value = 0,
216 unsigned ValueSize = 1,
217 unsigned MaxBytesToEmit = 0)
override;
220 unsigned MaxBytesToEmit = 0)
override;
226 void EmitFileDirective(
StringRef Filename)
override;
232 unsigned CUID = 0)
override;
236 unsigned CUID = 0)
override;
237 void EmitDwarfLocDirective(
unsigned FileNo,
unsigned Line,
238 unsigned Column,
unsigned Flags,
239 unsigned Isa,
unsigned Discriminator,
241 MCSymbol *getDwarfLineTableSymbol(
unsigned CUID)
override;
243 bool EmitCVFileDirective(
unsigned FileNo,
StringRef Filename,
246 bool EmitCVFuncIdDirective(
unsigned FuncId)
override;
247 bool EmitCVInlineSiteIdDirective(
unsigned FunctionId,
unsigned IAFunc,
248 unsigned IAFile,
unsigned IALine,
249 unsigned IACol,
SMLoc Loc)
override;
250 void EmitCVLocDirective(
unsigned FunctionId,
unsigned FileNo,
unsigned Line,
251 unsigned Column,
bool PrologueEnd,
bool IsStmt,
253 void EmitCVLinetableDirective(
unsigned FunctionId,
const MCSymbol *FnStart,
255 void EmitCVInlineLinetableDirective(
unsigned PrimaryFunctionId,
256 unsigned SourceFileId,
257 unsigned SourceLineNum,
260 void EmitCVDefRangeDirective(
261 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
263 void EmitCVStringTableDirective()
override;
264 void EmitCVFileChecksumsDirective()
override;
265 void EmitCVFileChecksumOffsetDirective(
unsigned FileNo)
override;
266 void EmitCVFPOData(
const MCSymbol *ProcSym,
SMLoc L)
override;
268 void EmitIdent(
StringRef IdentString)
override;
269 void EmitCFIBKeyFrame()
override;
270 void EmitCFISections(
bool EH,
bool Debug)
override;
272 void EmitCFIDefCfaOffset(int64_t
Offset)
override;
273 void EmitCFIDefCfaRegister(int64_t
Register)
override;
275 void EmitCFIPersonality(
const MCSymbol *Sym,
unsigned Encoding)
override;
276 void EmitCFILsda(
const MCSymbol *Sym,
unsigned Encoding)
override;
277 void EmitCFIRememberState()
override;
278 void EmitCFIRestoreState()
override;
279 void EmitCFIRestore(int64_t
Register)
override;
280 void EmitCFISameValue(int64_t
Register)
override;
282 void EmitCFIAdjustCfaOffset(int64_t Adjustment)
override;
283 void EmitCFIEscape(
StringRef Values)
override;
284 void EmitCFIGnuArgsSize(int64_t Size)
override;
285 void EmitCFISignalFrame()
override;
286 void EmitCFIUndefined(int64_t
Register)
override;
287 void EmitCFIRegister(int64_t Register1, int64_t Register2)
override;
288 void EmitCFIWindowSave()
override;
289 void EmitCFINegateRAState()
override;
290 void EmitCFIReturnColumn(int64_t
Register)
override;
292 void EmitWinCFIStartProc(
const MCSymbol *Symbol,
SMLoc Loc)
override;
293 void EmitWinCFIEndProc(
SMLoc Loc)
override;
294 void EmitWinCFIFuncletOrFuncEnd(
SMLoc Loc)
override;
295 void EmitWinCFIStartChained(
SMLoc Loc)
override;
296 void EmitWinCFIEndChained(
SMLoc Loc)
override;
297 void EmitWinCFIPushReg(
unsigned Register,
SMLoc Loc)
override;
300 void EmitWinCFIAllocStack(
unsigned Size,
SMLoc Loc)
override;
305 void EmitWinCFIPushFrame(
bool Code,
SMLoc Loc)
override;
306 void EmitWinCFIEndProlog(
SMLoc Loc)
override;
308 void EmitWinEHHandler(
const MCSymbol *Sym,
bool Unwind,
bool Except,
310 void EmitWinEHHandlerData(
SMLoc Loc)
override;
316 bool PrintSchedInfo)
override;
318 void EmitBundleAlignMode(
unsigned AlignPow2)
override;
319 void EmitBundleLock(
bool AlignToEnd)
override;
320 void EmitBundleUnlock()
override;
326 void EmitAddrsig()
override;
327 void EmitAddrsigSym(
const MCSymbol *Sym)
override;
332 void EmitRawTextImpl(
StringRef String)
override;
334 void FinishImpl()
override;
339 void MCAsmStreamer::AddComment(
const Twine &
T,
bool EOL) {
340 if (!IsVerboseAsm)
return;
348 void MCAsmStreamer::EmitCommentsAndEOL() {
357 "Comment array not newline terminated");
364 Comments = Comments.
substr(Position+1);
365 }
while (!Comments.
empty());
367 CommentToEmit.
clear();
371 assert(Bytes > 0 && Bytes <= 8 &&
"Invalid size!");
372 return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8));
375 void MCAsmStreamer::emitRawComment(
const Twine &T,
bool TabPrefix) {
382 void MCAsmStreamer::addExplicitComment(
const Twine &T) {
387 ExplicitCommentToEmit.
append(
"\t");
392 size_t p = 2, len = c.
size() - 2;
396 ExplicitCommentToEmit.
append(
"\t");
401 ExplicitCommentToEmit.
append(
"\n");
405 ExplicitCommentToEmit.
append(
"\t");
407 }
else if (c.
front() ==
'#') {
409 ExplicitCommentToEmit.
append(
"\t");
413 assert(
false &&
"Unexpected Assembly Comment");
415 if (c.
back() ==
'\n')
416 emitExplicitComments();
419 void MCAsmStreamer::emitExplicitComments() {
420 StringRef Comments = ExplicitCommentToEmit;
421 if (!Comments.
empty())
423 ExplicitCommentToEmit.
clear();
426 void MCAsmStreamer::ChangeSection(
MCSection *Section,
427 const MCExpr *Subsection) {
428 assert(Section &&
"Cannot switch to a null section!");
430 TS->changeSection(getCurrentSectionOnly(), Section, Subsection, OS);
433 *MAI, getContext().getObjectFileInfo()->getTargetTriple(), OS,
438 void MCAsmStreamer::emitELFSymverDirective(
StringRef AliasName,
441 Aliasee->
print(OS, MAI);
442 OS <<
", " << AliasName;
449 Symbol->
print(OS, MAI);
460 assert(NbArgs != -1 && ((
size_t)NbArgs) == Args.
size() &&
"Malformed LOH!");
461 assert(str !=
"" &&
"Invalid LOH name");
487 assert(!Options.
empty() &&
"At least one option is required!");
488 OS <<
"\t.linker_option \"" << Options[0] <<
'"';
490 ie = Options.end(); it != ie; ++it) {
491 OS <<
", " <<
'"' << *it <<
'"';
521 if (SDKVersion.
empty())
523 OS <<
'\t' <<
"sdk_version " << SDKVersion.
getMajor();
524 if (
auto Minor = SDKVersion.
getMinor()) {
525 OS <<
", " << *Minor;
527 OS <<
", " << *Subminor;
533 unsigned Minor,
unsigned Update,
537 OS <<
", " << Update;
556 void MCAsmStreamer::EmitBuildVersion(
unsigned Platform,
unsigned Major,
557 unsigned Minor,
unsigned Update,
560 OS <<
"\t.build_version " << PlatformName <<
", " << Major <<
", " << Minor;
562 OS <<
", " << Update;
567 void MCAsmStreamer::EmitThumbFunc(
MCSymbol *Func) {
570 OS <<
"\t.thumb_func";
574 Func->
print(OS, MAI);
579 void MCAsmStreamer::EmitAssignment(
MCSymbol *Symbol,
const MCExpr *Value) {
582 if (
auto *
E = dyn_cast<MCTargetExpr>(Value))
583 if (
E->inlineAssignedExpr())
587 Symbol->
print(OS, MAI);
589 Value->
print(OS, MAI);
597 void MCAsmStreamer::EmitWeakReference(
MCSymbol *Alias,
const MCSymbol *Symbol) {
599 Alias->
print(OS, MAI);
601 Symbol->
print(OS, MAI);
605 bool MCAsmStreamer::EmitSymbolAttribute(
MCSymbol *Symbol,
619 Symbol->
print(OS, MAI);
622 default:
return false;
644 OS <<
"\t.no_dead_strip\t";
649 OS <<
"\t.private_extern\t";
655 OS <<
"\t.weak_definition\t";
662 Symbol->
print(OS, MAI);
668 void MCAsmStreamer::EmitSymbolDesc(
MCSymbol *Symbol,
unsigned DescValue) {
669 OS <<
".desc" <<
' ';
670 Symbol->
print(OS, MAI);
671 OS <<
',' << DescValue;
675 void MCAsmStreamer::EmitSyntaxDirective() {
677 OS <<
"\t.intel_syntax noprefix";
685 void MCAsmStreamer::BeginCOFFSymbolDef(
const MCSymbol *Symbol) {
687 Symbol->
print(OS, MAI);
692 void MCAsmStreamer::EmitCOFFSymbolStorageClass (
int StorageClass) {
693 OS <<
"\t.scl\t" << StorageClass <<
';';
697 void MCAsmStreamer::EmitCOFFSymbolType (
int Type) {
698 OS <<
"\t.type\t" << Type <<
';';
702 void MCAsmStreamer::EndCOFFSymbolDef() {
707 void MCAsmStreamer::EmitCOFFSafeSEH(
MCSymbol const *Symbol) {
708 OS <<
"\t.safeseh\t";
709 Symbol->
print(OS, MAI);
713 void MCAsmStreamer::EmitCOFFSymbolIndex(
MCSymbol const *Symbol) {
715 Symbol->
print(OS, MAI);
719 void MCAsmStreamer::EmitCOFFSectionIndex(
MCSymbol const *Symbol) {
721 Symbol->
print(OS, MAI);
725 void MCAsmStreamer::EmitCOFFSecRel32(
MCSymbol const *Symbol, uint64_t
Offset) {
726 OS <<
"\t.secrel32\t";
727 Symbol->
print(OS, MAI);
733 void MCAsmStreamer::EmitCOFFImgRel32(
MCSymbol const *Symbol, int64_t Offset) {
735 Symbol->
print(OS, MAI);
743 void MCAsmStreamer::emitELFSize(
MCSymbol *Symbol,
const MCExpr *Value) {
746 Symbol->
print(OS, MAI);
748 Value->
print(OS, MAI);
752 void MCAsmStreamer::EmitCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
755 Symbol->
print(OS, MAI);
758 if (ByteAlignment != 0) {
760 OS <<
',' << ByteAlignment;
762 OS <<
',' <<
Log2_32(ByteAlignment);
767 void MCAsmStreamer::EmitLocalCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
768 unsigned ByteAlign) {
770 Symbol->
print(OS, MAI);
778 OS <<
',' << ByteAlign;
782 OS <<
',' <<
Log2_32(ByteAlign);
790 uint64_t Size,
unsigned ByteAlignment,
799 ".zerofill is a Mach-O specific directive");
803 OS << MOSection->
getSegmentName() <<
"," << MOSection->getSectionName();
807 Symbol->
print(OS, MAI);
809 if (ByteAlignment != 0)
810 OS <<
',' <<
Log2_32(ByteAlignment);
819 uint64_t Size,
unsigned ByteAlignment) {
822 assert(Symbol &&
"Symbol shouldn't be NULL!");
826 ".zerofill is a Mach-O specific directive");
830 Symbol->
print(OS, MAI);
835 if (ByteAlignment > 1) OS <<
", " <<
Log2_32(ByteAlignment);
840 static inline char toOctal(
int X) {
return (X&7)+
'0'; }
845 for (
unsigned i = 0, e = Data.
size(); i != e; ++i) {
846 unsigned char C = Data[i];
847 if (C ==
'"' || C ==
'\\') {
848 OS <<
'\\' << (
char)C;
858 case '\b': OS <<
"\\b";
break;
859 case '\f': OS <<
"\\f";
break;
860 case '\n': OS <<
"\\n";
break;
861 case '\r': OS <<
"\\r";
break;
862 case '\t': OS <<
"\\t";
break;
865 OS << toOctal(C >> 6);
866 OS << toOctal(C >> 3);
867 OS << toOctal(C >> 0);
876 assert(getCurrentSectionOnly() &&
877 "Cannot emit contents before setting section!");
878 if (Data.
empty())
return;
882 if (Data.
size() == 1 ||
885 TS->emitRawBytes(Data);
888 for (
const unsigned char C : Data.
bytes()) {
909 void MCAsmStreamer::EmitBinaryData(
StringRef Data) {
911 const size_t Cols = 4;
912 for (
size_t I = 0, EI =
alignTo(Data.
size(), Cols);
I < EI;
I += Cols) {
913 size_t J =
I, EJ = std::min(
I + Cols, Data.
size());
916 for (; J < EJ - 1; ++J)
917 OS <<
format(
"0x%02x", uint8_t(Data[J])) <<
", ";
918 OS <<
format(
"0x%02x", uint8_t(Data[J]));
923 void MCAsmStreamer::EmitIntValue(uint64_t Value,
unsigned Size) {
927 void MCAsmStreamer::EmitValueImpl(
const MCExpr *Value,
unsigned Size,
929 assert(Size <= 8 &&
"Invalid size");
930 assert(getCurrentSectionOnly() &&
931 "Cannot emit contents before setting section!");
932 const char *Directive =
nullptr;
943 if (!Value->evaluateAsAbsolute(IntValue))
951 for (
unsigned Emitted = 0; Emitted !=
Size;) {
952 unsigned Remaining = Size - Emitted;
955 unsigned EmissionSize =
PowerOf2Floor(std::min(Remaining, Size - 1));
958 unsigned ByteOffset =
959 IsLittleEndian ? Emitted : (Remaining - EmissionSize);
960 uint64_t ValueToEmit = IntValue >> (ByteOffset * 8);
964 uint64_t Shift = 64 - EmissionSize * 8;
965 assert(Shift < static_cast<uint64_t>(
966 std::numeric_limits<unsigned long long>::digits) &&
967 "undefined behavior");
968 ValueToEmit &= ~0ULL >> Shift;
969 EmitIntValue(ValueToEmit, EmissionSize);
970 Emitted += EmissionSize;
975 assert(Directive &&
"Invalid size for machine code value!");
978 TS->emitValue(Value);
980 Value->
print(OS, MAI);
985 void MCAsmStreamer::EmitULEB128Value(
const MCExpr *Value) {
987 if (Value->evaluateAsAbsolute(IntValue)) {
988 EmitULEB128IntValue(IntValue);
992 Value->
print(OS, MAI);
996 void MCAsmStreamer::EmitSLEB128Value(
const MCExpr *Value) {
998 if (Value->evaluateAsAbsolute(IntValue)) {
999 EmitSLEB128IntValue(IntValue);
1002 OS <<
"\t.sleb128 ";
1003 Value->
print(OS, MAI);
1007 void MCAsmStreamer::EmitDTPRel64Value(
const MCExpr *Value) {
1010 Value->
print(OS, MAI);
1014 void MCAsmStreamer::EmitDTPRel32Value(
const MCExpr *Value) {
1017 Value->
print(OS, MAI);
1021 void MCAsmStreamer::EmitTPRel64Value(
const MCExpr *Value) {
1024 Value->
print(OS, MAI);
1028 void MCAsmStreamer::EmitTPRel32Value(
const MCExpr *Value) {
1031 Value->
print(OS, MAI);
1035 void MCAsmStreamer::EmitGPRel64Value(
const MCExpr *Value) {
1038 Value->
print(OS, MAI);
1042 void MCAsmStreamer::EmitGPRel32Value(
const MCExpr *Value) {
1045 Value->
print(OS, MAI);
1049 void MCAsmStreamer::emitFill(
const MCExpr &NumBytes, uint64_t FillValue,
1051 int64_t IntNumBytes;
1052 if (NumBytes.evaluateAsAbsolute(IntNumBytes) && IntNumBytes == 0)
1057 OS << ZeroDirective;
1058 NumBytes.
print(OS, MAI);
1060 OS <<
',' << (int)FillValue;
1068 void MCAsmStreamer::emitFill(
const MCExpr &NumValues, int64_t Size,
1069 int64_t Expr,
SMLoc Loc) {
1072 NumValues.
print(OS, MAI);
1073 OS <<
", " << Size <<
", 0x";
1078 void MCAsmStreamer::EmitValueToAlignment(
unsigned ByteAlignment, int64_t Value,
1080 unsigned MaxBytesToEmit) {
1084 switch (ValueSize) {
1088 OS <<
"\t.p2align\t";
1102 if (Value || MaxBytesToEmit) {
1107 OS <<
", " << MaxBytesToEmit;
1115 switch (ValueSize) {
1117 case 1: OS <<
".balign";
break;
1118 case 2: OS <<
".balignw";
break;
1119 case 4: OS <<
".balignl";
break;
1126 OS <<
", " << MaxBytesToEmit;
1130 void MCAsmStreamer::EmitCodeAlignment(
unsigned ByteAlignment,
1131 unsigned MaxBytesToEmit) {
1137 void MCAsmStreamer::emitValueToOffset(
const MCExpr *Offset,
1138 unsigned char Value,
1142 Offset->
print(OS, MAI);
1147 void MCAsmStreamer::EmitFileDirective(
StringRef Filename) {
1158 bool UseDwarfDirectory,
1162 if (!UseDwarfDirectory && !Directory.
empty()) {
1166 FullPathName = Directory;
1169 Filename = FullPathName;
1173 OS <<
"\t.file\t" << FileNo <<
' ';
1174 if (!Directory.
empty()) {
1180 OS <<
" md5 0x" << Checksum->
digest();
1190 assert(CUID == 0 &&
"multiple CUs not supported by MCAsmStreamer");
1195 Table.
tryGetFile(Directory, Filename, Checksum, Source, FileNo);
1198 FileNo = FileNoOrErr.
get();
1205 UseDwarfDirectory, OS1);
1208 TS->emitDwarfFileDirective(OS1.
str());
1210 EmitRawText(OS1.
str());
1215 void MCAsmStreamer::emitDwarfFile0Directive(
StringRef Directory,
1222 if (getContext().getDwarfVersion() < 5)
1225 getContext().setMCLineTableRootFile(CUID, Directory, Filename, Checksum,
1231 UseDwarfDirectory, OS1);
1234 TS->emitDwarfFileDirective(OS1.
str());
1236 EmitRawText(OS1.
str());
1239 void MCAsmStreamer::EmitDwarfLocDirective(
unsigned FileNo,
unsigned Line,
1240 unsigned Column,
unsigned Flags,
1242 unsigned Discriminator,
1244 OS <<
"\t.loc\t" << FileNo <<
" " << Line <<
" " << Column;
1247 OS <<
" basic_block";
1249 OS <<
" prologue_end";
1251 OS <<
" epilogue_begin";
1253 unsigned OldFlags = getContext().getCurrentDwarfLoc().getFlags();
1257 if (Flags & DWARF2_FLAG_IS_STMT)
1264 OS <<
" isa " << Isa;
1266 OS <<
" discriminator " << Discriminator;
1272 << Line <<
':' << Column;
1276 Isa, Discriminator, FileName);
1279 MCSymbol *MCAsmStreamer::getDwarfLineTableSymbol(
unsigned CUID) {
1285 bool MCAsmStreamer::EmitCVFileDirective(
unsigned FileNo,
StringRef Filename,
1288 if (!getContext().getCVContext().addFile(*
this, FileNo, Filename, Checksum,
1292 OS <<
"\t.cv_file\t" << FileNo <<
' ';
1295 if (!ChecksumKind) {
1308 bool MCAsmStreamer::EmitCVFuncIdDirective(
unsigned FuncId) {
1309 OS <<
"\t.cv_func_id " << FuncId <<
'\n';
1313 bool MCAsmStreamer::EmitCVInlineSiteIdDirective(
unsigned FunctionId,
1316 unsigned IALine,
unsigned IACol,
1318 OS <<
"\t.cv_inline_site_id " << FunctionId <<
" within " << IAFunc
1319 <<
" inlined_at " << IAFile <<
' ' << IALine <<
' ' << IACol <<
'\n';
1321 IALine, IACol, Loc);
1324 void MCAsmStreamer::EmitCVLocDirective(
unsigned FunctionId,
unsigned FileNo,
1325 unsigned Line,
unsigned Column,
1326 bool PrologueEnd,
bool IsStmt,
1329 if (!checkCVLocSection(FunctionId, FileNo, Loc))
1332 OS <<
"\t.cv_loc\t" << FunctionId <<
" " << FileNo <<
" " << Line <<
" " 1335 OS <<
" prologue_end";
1348 void MCAsmStreamer::EmitCVLinetableDirective(
unsigned FunctionId,
1351 OS <<
"\t.cv_linetable\t" << FunctionId <<
", ";
1352 FnStart->
print(OS, MAI);
1354 FnEnd->
print(OS, MAI);
1359 void MCAsmStreamer::EmitCVInlineLinetableDirective(
unsigned PrimaryFunctionId,
1360 unsigned SourceFileId,
1361 unsigned SourceLineNum,
1364 OS <<
"\t.cv_inline_linetable\t" << PrimaryFunctionId <<
' ' << SourceFileId
1365 <<
' ' << SourceLineNum <<
' ';
1366 FnStartSym->
print(OS, MAI);
1368 FnEndSym->
print(OS, MAI);
1371 PrimaryFunctionId, SourceFileId, SourceLineNum, FnStartSym, FnEndSym);
1374 void MCAsmStreamer::EmitCVDefRangeDirective(
1375 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
1377 OS <<
"\t.cv_def_range\t";
1378 for (std::pair<const MCSymbol *, const MCSymbol *> Range : Ranges) {
1380 Range.first->print(OS, MAI);
1382 Range.second->print(OS, MAI);
1390 void MCAsmStreamer::EmitCVStringTableDirective() {
1391 OS <<
"\t.cv_stringtable";
1395 void MCAsmStreamer::EmitCVFileChecksumsDirective() {
1396 OS <<
"\t.cv_filechecksums";
1400 void MCAsmStreamer::EmitCVFileChecksumOffsetDirective(
unsigned FileNo) {
1401 OS <<
"\t.cv_filechecksumoffset\t" << FileNo;
1405 void MCAsmStreamer::EmitCVFPOData(
const MCSymbol *ProcSym,
SMLoc L) {
1406 OS <<
"\t.cv_fpo_data\t";
1407 ProcSym->
print(OS, MAI);
1411 void MCAsmStreamer::EmitIdent(
StringRef IdentString) {
1418 void MCAsmStreamer::EmitCFISections(
bool EH,
bool Debug) {
1420 OS <<
"\t.cfi_sections ";
1424 OS <<
", .debug_frame";
1426 OS <<
".debug_frame";
1433 OS <<
"\t.cfi_startproc";
1441 OS <<
"\t.cfi_endproc";
1445 void MCAsmStreamer::EmitRegisterName(int64_t
Register) {
1452 if (LLVMRegister != -1) {
1453 InstPrinter->printRegName(OS, LLVMRegister);
1460 void MCAsmStreamer::EmitCFIDefCfa(int64_t Register, int64_t Offset) {
1462 OS <<
"\t.cfi_def_cfa ";
1463 EmitRegisterName(Register);
1468 void MCAsmStreamer::EmitCFIDefCfaOffset(int64_t Offset) {
1470 OS <<
"\t.cfi_def_cfa_offset " <<
Offset;
1475 OS <<
"\t.cfi_escape ";
1476 if (!Values.
empty()) {
1477 size_t e = Values.
size() - 1;
1478 for (
size_t i = 0; i < e; ++i)
1479 OS <<
format(
"0x%02x", uint8_t(Values[i])) <<
", ";
1480 OS <<
format(
"0x%02x", uint8_t(Values[e]));
1484 void MCAsmStreamer::EmitCFIEscape(
StringRef Values) {
1490 void MCAsmStreamer::EmitCFIGnuArgsSize(int64_t Size) {
1493 uint8_t Buffer[16] = { dwarf::DW_CFA_GNU_args_size };
1500 void MCAsmStreamer::EmitCFIDefCfaRegister(int64_t Register) {
1502 OS <<
"\t.cfi_def_cfa_register ";
1503 EmitRegisterName(Register);
1507 void MCAsmStreamer::EmitCFIOffset(int64_t Register, int64_t Offset) {
1509 OS <<
"\t.cfi_offset ";
1510 EmitRegisterName(Register);
1515 void MCAsmStreamer::EmitCFIPersonality(
const MCSymbol *Sym,
1516 unsigned Encoding) {
1518 OS <<
"\t.cfi_personality " << Encoding <<
", ";
1519 Sym->
print(OS, MAI);
1523 void MCAsmStreamer::EmitCFILsda(
const MCSymbol *Sym,
unsigned Encoding) {
1525 OS <<
"\t.cfi_lsda " << Encoding <<
", ";
1526 Sym->
print(OS, MAI);
1530 void MCAsmStreamer::EmitCFIRememberState() {
1532 OS <<
"\t.cfi_remember_state";
1536 void MCAsmStreamer::EmitCFIRestoreState() {
1538 OS <<
"\t.cfi_restore_state";
1542 void MCAsmStreamer::EmitCFIRestore(int64_t Register) {
1544 OS <<
"\t.cfi_restore ";
1545 EmitRegisterName(Register);
1549 void MCAsmStreamer::EmitCFISameValue(int64_t Register) {
1551 OS <<
"\t.cfi_same_value ";
1552 EmitRegisterName(Register);
1556 void MCAsmStreamer::EmitCFIRelOffset(int64_t Register, int64_t Offset) {
1558 OS <<
"\t.cfi_rel_offset ";
1559 EmitRegisterName(Register);
1564 void MCAsmStreamer::EmitCFIAdjustCfaOffset(int64_t Adjustment) {
1566 OS <<
"\t.cfi_adjust_cfa_offset " << Adjustment;
1570 void MCAsmStreamer::EmitCFISignalFrame() {
1572 OS <<
"\t.cfi_signal_frame";
1576 void MCAsmStreamer::EmitCFIUndefined(int64_t Register) {
1578 OS <<
"\t.cfi_undefined " <<
Register;
1582 void MCAsmStreamer::EmitCFIRegister(int64_t Register1, int64_t Register2) {
1584 OS <<
"\t.cfi_register " << Register1 <<
", " << Register2;
1588 void MCAsmStreamer::EmitCFIWindowSave() {
1590 OS <<
"\t.cfi_window_save";
1594 void MCAsmStreamer::EmitCFINegateRAState() {
1596 OS <<
"\t.cfi_negate_ra_state";
1600 void MCAsmStreamer::EmitCFIReturnColumn(int64_t Register) {
1602 OS <<
"\t.cfi_return_column " <<
Register;
1606 void MCAsmStreamer::EmitCFIBKeyFrame() {
1608 OS <<
"\t.cfi_b_key_frame";
1612 void MCAsmStreamer::EmitWinCFIStartProc(
const MCSymbol *Symbol,
SMLoc Loc) {
1616 Symbol->
print(OS, MAI);
1620 void MCAsmStreamer::EmitWinCFIEndProc(
SMLoc Loc) {
1623 OS <<
"\t.seh_endproc";
1628 void MCAsmStreamer::EmitWinCFIFuncletOrFuncEnd(
SMLoc Loc) {
1631 void MCAsmStreamer::EmitWinCFIStartChained(
SMLoc Loc) {
1634 OS <<
"\t.seh_startchained";
1638 void MCAsmStreamer::EmitWinCFIEndChained(
SMLoc Loc) {
1641 OS <<
"\t.seh_endchained";
1645 void MCAsmStreamer::EmitWinEHHandler(
const MCSymbol *Sym,
bool Unwind,
1646 bool Except,
SMLoc Loc) {
1649 OS <<
"\t.seh_handler ";
1650 Sym->
print(OS, MAI);
1658 void MCAsmStreamer::EmitWinEHHandlerData(
SMLoc Loc) {
1667 MCSection *XData = getAssociatedXDataSection(TextSec);
1668 SwitchSectionNoChange(XData);
1670 OS <<
"\t.seh_handlerdata";
1674 void MCAsmStreamer::EmitWinCFIPushReg(
unsigned Register,
SMLoc Loc) {
1677 OS <<
"\t.seh_pushreg " <<
Register;
1681 void MCAsmStreamer::EmitWinCFISetFrame(
unsigned Register,
unsigned Offset,
1685 OS <<
"\t.seh_setframe " << Register <<
", " <<
Offset;
1689 void MCAsmStreamer::EmitWinCFIAllocStack(
unsigned Size,
SMLoc Loc) {
1692 OS <<
"\t.seh_stackalloc " <<
Size;
1696 void MCAsmStreamer::EmitWinCFISaveReg(
unsigned Register,
unsigned Offset,
1700 OS <<
"\t.seh_savereg " << Register <<
", " <<
Offset;
1704 void MCAsmStreamer::EmitWinCFISaveXMM(
unsigned Register,
unsigned Offset,
1708 OS <<
"\t.seh_savexmm " << Register <<
", " <<
Offset;
1712 void MCAsmStreamer::EmitWinCFIPushFrame(
bool Code,
SMLoc Loc) {
1715 OS <<
"\t.seh_pushframe";
1721 void MCAsmStreamer::EmitWinCFIEndProlog(
SMLoc Loc) {
1724 OS <<
"\t.seh_endprologue";
1731 OS <<
"\t.cg_profile ";
1735 OS <<
", " << Count;
1739 void MCAsmStreamer::AddEncodingComment(
const MCInst &Inst,
1741 bool PrintSchedInfo) {
1748 if (!getAssembler().getEmitterPtr())
1751 getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
1758 for (
unsigned i = 0, e = Code.
size() * 8; i != e; ++i)
1761 for (
unsigned i = 0, e = Fixups.
size(); i != e; ++i) {
1764 getAssembler().getBackend().getFixupKindInfo(F.
getKind());
1765 for (
unsigned j = 0; j != Info.
TargetSize; ++j) {
1767 assert(Index < Code.
size() * 8 &&
"Invalid offset in fixup!");
1768 FixupMap[
Index] = 1 + i;
1774 OS <<
"encoding: [";
1775 for (
unsigned i = 0, e = Code.
size(); i != e; ++i) {
1780 uint8_t MapEntry = FixupMap[i * 8 + 0];
1781 for (
unsigned j = 1; j != 8; ++j) {
1782 if (FixupMap[i * 8 + j] == MapEntry)
1785 MapEntry = uint8_t(~0U);
1789 if (MapEntry != uint8_t(~0U)) {
1790 if (MapEntry == 0) {
1791 OS <<
format(
"0x%02x", uint8_t(Code[i]));
1795 OS <<
format(
"0x%02x", uint8_t(Code[i])) <<
'\'' 1796 <<
char(
'A' + MapEntry - 1) <<
'\'';
1798 OS <<
char(
'A' + MapEntry - 1);
1803 for (
unsigned j = 8; j--;) {
1804 unsigned Bit = (Code[i] >> j) & 1;
1808 FixupBit = i * 8 + j;
1810 FixupBit = i * 8 + (7-j);
1812 if (uint8_t MapEntry = FixupMap[FixupBit]) {
1813 assert(Bit == 0 &&
"Encoder wrote into fixed up bit!");
1814 OS <<
char(
'A' + MapEntry - 1);
1823 if (Fixups.
size() || !PrintSchedInfo)
1826 for (
unsigned i = 0, e = Fixups.
size(); i != e; ++i) {
1829 getAssembler().getBackend().getFixupKindInfo(F.
getKind());
1830 OS <<
" fixup " <<
char(
'A' + i) <<
" - " <<
"offset: " << F.
getOffset()
1831 <<
", value: " << *F.
getValue() <<
", kind: " << Info.
Name <<
"\n";
1835 void MCAsmStreamer::EmitInstruction(
const MCInst &Inst,
1837 bool PrintSchedInfo) {
1838 assert(getCurrentSectionOnly() &&
1839 "Cannot emit contents before setting section!");
1842 AddEncodingComment(Inst, STI, PrintSchedInfo);
1847 GetCommentOS() <<
"\n";
1848 Inst.
dump_pretty(GetCommentOS(), InstPrinter.get(),
"\n ");
1849 GetCommentOS() <<
"\n";
1852 if(getTargetStreamer())
1853 getTargetStreamer()->prettyPrintAsm(*InstPrinter, OS, Inst, STI);
1855 InstPrinter->printInst(&Inst, OS,
"", STI);
1857 if (PrintSchedInfo) {
1860 GetCommentOS() <<
SI;
1864 if (Comments.
size() && Comments.
back() !=
'\n')
1865 GetCommentOS() <<
"\n";
1870 void MCAsmStreamer::EmitBundleAlignMode(
unsigned AlignPow2) {
1871 OS <<
"\t.bundle_align_mode " << AlignPow2;
1875 void MCAsmStreamer::EmitBundleLock(
bool AlignToEnd) {
1876 OS <<
"\t.bundle_lock";
1878 OS <<
" align_to_end";
1882 void MCAsmStreamer::EmitBundleUnlock() {
1883 OS <<
"\t.bundle_unlock";
1891 Offset.
print(OS, MAI);
1895 Expr->
print(OS, MAI);
1901 void MCAsmStreamer::EmitAddrsig() {
1906 void MCAsmStreamer::EmitAddrsigSym(
const MCSymbol *Sym) {
1907 OS <<
"\t.addrsig_sym ";
1908 Sym->
print(OS, MAI);
1915 void MCAsmStreamer::EmitRawTextImpl(
StringRef String) {
1916 if (!String.
empty() && String.
back() ==
'\n')
1922 void MCAsmStreamer::FinishImpl() {
1924 if (getContext().getGenDwarfForAssembly())
1930 auto &Tables = getContext().getMCDwarfLineTables();
1931 if (!Tables.empty()) {
1932 assert(Tables.size() == 1 &&
"asm output only supports one line table");
1933 if (
auto *Label = Tables.begin()->second.getLabel()) {
1934 SwitchSection(getContext().getObjectFileInfo()->getDwarfLineSection());
1941 std::unique_ptr<formatted_raw_ostream> OS,
1942 bool isVerboseAsm,
bool useDwarfDirectory,
1944 std::unique_ptr<MCCodeEmitter> &&CE,
1945 std::unique_ptr<MCAsmBackend> &&MAB,
1947 return new MCAsmStreamer(Context, std::move(OS), isVerboseAsm,
1948 useDwarfDirectory, IP, std::move(CE), std::move(MAB),
bool doesSupportDataRegionDirectives() const
bool getCOMMDirectiveAlignmentIsInBytes() const
virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName)
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
Instances of this class represent a uniqued identifier for a section in the current translation unit...
virtual void EmitCFISameValue(int64_t Register)
const char * getLabelSuffix() const
virtual void EmitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol *>> Ranges, StringRef FixedSizePortion)
This implements the CodeView '.cv_def_range' assembler directive.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
virtual void EmitCFIPersonality(const MCSymbol *Sym, unsigned Encoding)
virtual void EmitWinCFIPushReg(unsigned Register, SMLoc Loc=SMLoc())
This represents a section on a Mach-O system (used by Mac OS X).
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
virtual void EmitCFIGnuArgsSize(int64_t Size)
bool isPrint(char C)
Checks whether character C is printable.
#define DWARF2_FLAG_PROLOGUE_END
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
const char * getGlobalDirective() const
.type _foo, STT_OBJECT # aka
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc=SMLoc())
bool hasSingleParameterDotFile() const
A raw_ostream that discards all output.
void push_back(const T &Elt)
virtual void EmitWinCFISaveXMM(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
SmallString< 32 > digest() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ") const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
Target specific streamer interface.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
const char * getCode16Directive() const
bool hasDotTypeDotSizeDirective() const
int getLLVMRegNumFromEH(unsigned RegNum) const
Map a DWARF EH register back to a target register (same as getLLVMRegNum(RegNum, true)) but return -1...
A raw_ostream that writes to an SmallVector or SmallString.
const char * getData64bitsDirective() const
virtual void EmitCFIRegister(int64_t Register1, int64_t Register2)
const char * getTPRel64Directive() const
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique(Args &&... args)
Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object...
Error takeError()
Take ownership of the stored error.
virtual void EmitCFIDefCfaOffset(int64_t Offset)
.type _foo, STT_NOTYPE # aka
virtual MCSymbol * getDwarfLineTableSymbol(unsigned CUID)
COFF::SymbolStorageClass StorageClass
bool hasIdentDirective() const
unsigned TargetOffset
The bit offset to write the relocation into.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
virtual void EmitCFISections(bool EH, bool Debug)
const char * getDTPRel64Directive() const
static int64_t truncateToSize(int64_t Value, unsigned Bytes)
virtual void EmitCFIRememberState()
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
virtual void EmitCFILsda(const MCSymbol *Sym, unsigned Encoding)
virtual std::string getSchedInfoStr(MCInst const &MCI) const
Returns string representation of scheduler comment.
#define DWARF2_FLAG_IS_STMT
amdgpu Simplify well known AMD library false Value Value const Twine & Name
const char * getAscizDirective() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
virtual void EmitWinCFIEndProc(SMLoc Loc=SMLoc())
virtual void EmitCFIEscape(StringRef Values)
const char * getZeroDirective() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
virtual void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except, SMLoc Loc=SMLoc())
bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
const char * Name
A target specific name for the fixup kind.
Represent a reference to a symbol from inside an expression.
iterator_range< const unsigned char * > bytes() const
const char * getGPRel64Directive() const
Tagged union holding either a T or a Error.
static void EmitSDKVersionSuffix(raw_ostream &OS, const VersionTuple &SDKVersion)
StringRef getSingleStringRef() const
This returns the twine as a single StringRef.
const char * getWeakRefDirective() const
Position
Position to insert a new instruction relative to an existing instruction.
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
virtual void EmitWinCFIStartChained(SMLoc Loc=SMLoc())
Context object for machine code objects.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
const char * getWeakDirective() const
.code16 (X86) / .code 16 (ARM)
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame)
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
.type _foo, STT_GNU_IFUNC
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
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)...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
virtual void EmitCFIRestoreState()
const char * getTPRel32Directive() const
bool hasNoDeadStrip() const
StringRef getSegmentName() const
Analysis containing CSE Info
Instances of this class represent a single low-level machine instruction.
bool supportsExtendedDwarfLocDirective() const
virtual void EmitCFIRestore(int64_t Register)
const char * getData8bitsDirective() const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
void append(in_iter S, in_iter E)
Append from an iterator pair.
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Streaming machine code generation interface.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
unsigned const MachineRegisterInfo * MRI
.weak_def_can_be_hidden (MachO)
bool useDwarfRegNumForCFI() const
const char * getData16bitsDirective() const
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
The instances of the Type class are immutable: once they are created, they are never changed...
virtual void EmitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)
This implements the CodeView '.cv_linetable' assembler directive.
static char toOctal(int X)
unsigned getAssemblerDialect() const
#define DWARF2_FLAG_EPILOGUE_BEGIN
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const char * getSeparatorString() const
unsigned getMajor() const
Retrieve the major version number.
virtual void EmitCFIDefCfaRegister(int64_t Register)
MCLOHType
Linker Optimization Hint Type.
StringRef getCommentString() const
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
.subsections_via_symbols (MachO)
LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const
#define DWARF2_FLAG_BASIC_BLOCK
virtual void EmitWinEHHandlerData(SMLoc Loc=SMLoc())
static const char * getVersionMinDirective(MCVersionMinType Type)
uint32_t getOffset() const
SectionVariant getVariant() const
virtual void EmitCFIUndefined(int64_t Register)
virtual void EmitCFINegateRAState()
bool hasSubsectionsViaSymbols() const
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
const char * getData32bitsDirective() const
virtual void EmitWinCFIEndChained(SMLoc Loc=SMLoc())
LLVM_NODISCARD char back() const
back - Get the last character in the string.
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const =0
virtual void EmitWinCFISetFrame(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
virtual void EmitWinCFIPushFrame(bool Code, SMLoc Loc=SMLoc())
static void PrintCFIEscape(llvm::formatted_raw_ostream &OS, StringRef Values)
static void printDwarfFileDirective(unsigned FileNo, StringRef Directory, StringRef Filename, MD5::MD5Result *Checksum, Optional< StringRef > Source, bool UseDwarfDirectory, raw_svector_ostream &OS)
const MCDummyFragment & getDummyFragment() const
virtual void EmitCFIReturnColumn(int64_t Register)
BlockVerifier::State From
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
const MCSymbol & getSymbol() const
virtual void EmitCFIOffset(int64_t Register, int64_t Offset)
Expected< unsigned > tryGetFile(StringRef &Directory, StringRef &FileName, MD5::MD5Result *Checksum, Optional< StringRef > Source, unsigned FileNumber=0)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
virtual void EmitWinCFIEndProlog(SMLoc Loc=SMLoc())
virtual void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc=SMLoc())
.type _foo, STT_TLS # aka
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Promote Memory to Register
virtual void EmitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
This implements the CodeView '.cv_inline_linetable' assembler directive.
unsigned TargetSize
The number of bits written by this fixup.
StringRef str()
Return a StringRef for the vector contents.
reference get()
Returns a reference to the stored T value.
static StringRef MCLOHDirectiveName()
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
const MCSymbol * Function
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
size_t GetNumBytesInBuffer() const
static void Emit(MCStreamer *MCOS)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
.code32 (X86) / .code 32 (ARM)
amdgpu Simplify well known AMD library false Value Value * Arg
.type _foo, STT_COMMON # aka
static const char * getPlatformName(MachO::PlatformType Type)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Represents a version number in the form major[.minor[.subminor[.build]]].
virtual void EmitWinCFISaveReg(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void EmitCFISignalFrame()
virtual void EmitCFIRelOffset(int64_t Register, int64_t Offset)
LLVM_NODISCARD bool empty() const
.type _foo, STT_FUNC # aka
LLVM_NODISCARD size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
const char * getDTPRel32Directive() const
Generic base class for all target subtargets.
bool isLittleEndian() const
True if the target is little endian.
void emitFill(uint64_t NumBytes, uint8_t FillValue)
Emit NumBytes bytes worth of the value specified by FillValue.
virtual void EmitCFIDefCfa(int64_t Register, int64_t Offset)
Target independent information on a fixup kind.
const char * getAsciiDirective() const
const char * getGPRel32Directive() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getTextAlignFillValue() const
LLVM_NODISCARD char front() const
front - Get the first character in the string.
unsigned getCommentColumn() const
This indicates the column (zero-based) at which asm comments should be printed.
static int MCLOHIdToNbArgs(MCLOHType Kind)
virtual bool EmitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol, SMLoc Loc)
Introduces an inline call site id for use with .cv_loc.
uint64_t PowerOf2Floor(uint64_t A)
Returns the power of two which is less than or equal to the given value.
LLVM Value Representation.
static cl::opt< bool, true > Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag))
virtual bool EmitCVFuncIdDirective(unsigned FunctionId)
Introduces a function id for use with .cv_loc.
raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
virtual void EmitCFIBKeyFrame()
static StringRef MCLOHIdToName(MCLOHType Kind)
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
This class implements an extremely fast bulk output stream that can only output to a stream...
const MCExpr * getValue() const
const char * getCode64Directive() const
StringRef - Represent a constant reference to a string, i.e.
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero)...
static void PrintQuotedString(StringRef Data, raw_ostream &OS)
Represents a location in source code.
std::string toHex(StringRef Input, bool LowerCase=false)
Convert buffer Input to its hexadecimal representation.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment)
MCFixupKind getKind() const
bool empty() const
empty - Check if the array is empty.
const char * getCode32Directive() const
virtual void EmitCFIWindowSave()
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.