[MC] Add MCStreamer::emitInt{8,16,32,64}
Similar to AsmPrinter::emitInt{8,16,32,64}.
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 82dfecc..8dda75e 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -172,7 +172,7 @@
MCSymbol *StringBegin = Ctx.createTempSymbol("strtab_begin", false),
*StringEnd = Ctx.createTempSymbol("strtab_end", false);
- OS.emitIntValue(unsigned(DebugSubsectionKind::StringTable), 4);
+ OS.emitInt32(uint32_t(DebugSubsectionKind::StringTable));
OS.emitAbsoluteSymbolDiff(StringEnd, StringBegin, 4);
OS.emitLabel(StringBegin);
@@ -199,7 +199,7 @@
MCSymbol *FileBegin = Ctx.createTempSymbol("filechecksums_begin", false),
*FileEnd = Ctx.createTempSymbol("filechecksums_end", false);
- OS.emitIntValue(unsigned(DebugSubsectionKind::FileChecksums), 4);
+ OS.emitInt32(uint32_t(DebugSubsectionKind::FileChecksums));
OS.emitAbsoluteSymbolDiff(FileEnd, FileBegin, 4);
OS.emitLabel(FileBegin);
@@ -221,16 +221,16 @@
CurrentOffset = alignTo(CurrentOffset, 4);
}
- OS.emitIntValue(File.StringTableOffset, 4);
+ OS.emitInt32(File.StringTableOffset);
if (!File.ChecksumKind) {
// There is no checksum. Therefore zero the next two fields and align
// back to 4 bytes.
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
continue;
}
- OS.emitIntValue(static_cast<uint8_t>(File.Checksum.size()), 1);
- OS.emitIntValue(File.ChecksumKind, 1);
+ OS.emitInt8(static_cast<uint8_t>(File.Checksum.size()));
+ OS.emitInt8(File.ChecksumKind);
OS.emitBytes(toStringRef(File.Checksum));
OS.emitValueToAlignment(4);
}
@@ -331,7 +331,7 @@
MCSymbol *LineBegin = Ctx.createTempSymbol("linetable_begin", false),
*LineEnd = Ctx.createTempSymbol("linetable_end", false);
- OS.emitIntValue(unsigned(DebugSubsectionKind::Lines), 4);
+ OS.emitInt32(uint32_t(DebugSubsectionKind::Lines));
OS.emitAbsoluteSymbolDiff(LineEnd, LineBegin, 4);
OS.emitLabel(LineBegin);
OS.EmitCOFFSecRel32(FuncBegin, /*Offset=*/0);
@@ -342,7 +342,7 @@
bool HaveColumns = any_of(Locs, [](const MCCVLoc &LineEntry) {
return LineEntry.getColumn() != 0;
});
- OS.emitIntValue(HaveColumns ? int(LF_HaveColumns) : 0, 2);
+ OS.emitInt16(HaveColumns ? int(LF_HaveColumns) : 0);
OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 4);
for (auto I = Locs.begin(), E = Locs.end(); I != E;) {
@@ -359,24 +359,24 @@
->getContents()[Files[CurFileNum - 1].StringTableOffset]) +
"' begins");
OS.EmitCVFileChecksumOffsetDirective(CurFileNum);
- OS.emitIntValue(EntryCount, 4);
+ OS.emitInt32(EntryCount);
uint32_t SegmentSize = 12;
SegmentSize += 8 * EntryCount;
if (HaveColumns)
SegmentSize += 4 * EntryCount;
- OS.emitIntValue(SegmentSize, 4);
+ OS.emitInt32(SegmentSize);
for (auto J = I; J != FileSegEnd; ++J) {
OS.emitAbsoluteSymbolDiff(J->getLabel(), FuncBegin, 4);
unsigned LineData = J->getLine();
if (J->isStmt())
LineData |= LineInfo::StatementFlag;
- OS.emitIntValue(LineData, 4);
+ OS.emitInt32(LineData);
}
if (HaveColumns) {
for (auto J = I; J != FileSegEnd; ++J) {
- OS.emitIntValue(J->getColumn(), 2);
- OS.emitIntValue(0, 2);
+ OS.emitInt16(J->getColumn());
+ OS.emitInt16(0);
}
}
I = FileSegEnd;
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index ffe6bb3..ecf7581 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -163,38 +163,38 @@
if (FileNum != LineEntry.getFileNum()) {
FileNum = LineEntry.getFileNum();
- MCOS->emitIntValue(dwarf::DW_LNS_set_file, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_set_file);
MCOS->emitULEB128IntValue(FileNum);
}
if (Column != LineEntry.getColumn()) {
Column = LineEntry.getColumn();
- MCOS->emitIntValue(dwarf::DW_LNS_set_column, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_set_column);
MCOS->emitULEB128IntValue(Column);
}
if (Discriminator != LineEntry.getDiscriminator() &&
MCOS->getContext().getDwarfVersion() >= 4) {
Discriminator = LineEntry.getDiscriminator();
unsigned Size = getULEB128Size(Discriminator);
- MCOS->emitIntValue(dwarf::DW_LNS_extended_op, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_extended_op);
MCOS->emitULEB128IntValue(Size + 1);
- MCOS->emitIntValue(dwarf::DW_LNE_set_discriminator, 1);
+ MCOS->emitInt8(dwarf::DW_LNE_set_discriminator);
MCOS->emitULEB128IntValue(Discriminator);
}
if (Isa != LineEntry.getIsa()) {
Isa = LineEntry.getIsa();
- MCOS->emitIntValue(dwarf::DW_LNS_set_isa, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_set_isa);
MCOS->emitULEB128IntValue(Isa);
}
if ((LineEntry.getFlags() ^ Flags) & DWARF2_FLAG_IS_STMT) {
Flags = LineEntry.getFlags();
- MCOS->emitIntValue(dwarf::DW_LNS_negate_stmt, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_negate_stmt);
}
if (LineEntry.getFlags() & DWARF2_FLAG_BASIC_BLOCK)
- MCOS->emitIntValue(dwarf::DW_LNS_set_basic_block, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_set_basic_block);
if (LineEntry.getFlags() & DWARF2_FLAG_PROLOGUE_END)
- MCOS->emitIntValue(dwarf::DW_LNS_set_prologue_end, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_set_prologue_end);
if (LineEntry.getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
- MCOS->emitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
+ MCOS->emitInt8(dwarf::DW_LNS_set_epilogue_begin);
MCSymbol *Label = LineEntry.getLabel();
@@ -335,7 +335,7 @@
MCOS->emitBytes(Dir); // The DirectoryName, and...
MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
}
- MCOS->emitIntValue(0, 1); // Terminate the directory list.
+ MCOS->emitInt8(0); // Terminate the directory list.
// Second the file table.
for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
@@ -343,10 +343,10 @@
MCOS->emitBytes(MCDwarfFiles[i].Name); // FileName and...
MCOS->emitBytes(StringRef("\0", 1)); // its null terminator.
MCOS->emitULEB128IntValue(MCDwarfFiles[i].DirIndex); // Directory number.
- MCOS->emitIntValue(0, 1); // Last modification timestamp (always 0).
- MCOS->emitIntValue(0, 1); // File size (always 0).
+ MCOS->emitInt8(0); // Last modification timestamp (always 0).
+ MCOS->emitInt8(0); // File size (always 0).
}
- MCOS->emitIntValue(0, 1); // Terminate the file list.
+ MCOS->emitInt8(0); // Terminate the file list.
}
static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
@@ -382,7 +382,7 @@
// The directory format, which is just a list of the directory paths. In a
// non-split object, these are references to .debug_line_str; in a split
// object, they are inline strings.
- MCOS->emitIntValue(1, 1);
+ MCOS->emitInt8(1);
MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
: dwarf::DW_FORM_string);
@@ -414,7 +414,7 @@
Entries += 1;
if (HasSource)
Entries += 1;
- MCOS->emitIntValue(Entries, 1);
+ MCOS->emitInt8(Entries);
MCOS->emitULEB128IntValue(dwarf::DW_LNCT_path);
MCOS->emitULEB128IntValue(LineStr ? dwarf::DW_FORM_line_strp
: dwarf::DW_FORM_string);
@@ -467,7 +467,7 @@
// Next 2 bytes is the Version.
unsigned LineTableVersion = context.getDwarfVersion();
- MCOS->emitIntValue(LineTableVersion, 2);
+ MCOS->emitInt16(LineTableVersion);
// Keep track of the bytes between the very start and where the header length
// comes out.
@@ -475,8 +475,8 @@
// In v5, we get address info next.
if (LineTableVersion >= 5) {
- MCOS->emitIntValue(context.getAsmInfo()->getCodePointerSize(), 1);
- MCOS->emitIntValue(0, 1); // Segment selector; same as EmitGenDwarfAranges.
+ MCOS->emitInt8(context.getAsmInfo()->getCodePointerSize());
+ MCOS->emitInt8(0); // Segment selector; same as EmitGenDwarfAranges.
PreHeaderLengthBytes += 2;
}
@@ -491,20 +491,20 @@
4);
// Parameters of the state machine, are next.
- MCOS->emitIntValue(context.getAsmInfo()->getMinInstAlignment(), 1);
+ MCOS->emitInt8(context.getAsmInfo()->getMinInstAlignment());
// maximum_operations_per_instruction
// For non-VLIW architectures this field is always 1.
// FIXME: VLIW architectures need to update this field accordingly.
if (LineTableVersion >= 4)
- MCOS->emitIntValue(1, 1);
- MCOS->emitIntValue(DWARF2_LINE_DEFAULT_IS_STMT, 1);
- MCOS->emitIntValue(Params.DWARF2LineBase, 1);
- MCOS->emitIntValue(Params.DWARF2LineRange, 1);
- MCOS->emitIntValue(StandardOpcodeLengths.size() + 1, 1);
+ MCOS->emitInt8(1);
+ MCOS->emitInt8(DWARF2_LINE_DEFAULT_IS_STMT);
+ MCOS->emitInt8(Params.DWARF2LineBase);
+ MCOS->emitInt8(Params.DWARF2LineRange);
+ MCOS->emitInt8(StandardOpcodeLengths.size() + 1);
// Standard opcode lengths
for (char Length : StandardOpcodeLengths)
- MCOS->emitIntValue(Length, 1);
+ MCOS->emitInt8(Length);
// Put out the directory and file tables. The formats vary depending on
// the version.
@@ -803,7 +803,7 @@
// DW_TAG_compile_unit DIE abbrev (1).
MCOS->emitULEB128IntValue(1);
MCOS->emitULEB128IntValue(dwarf::DW_TAG_compile_unit);
- MCOS->emitIntValue(dwarf::DW_CHILDREN_yes, 1);
+ MCOS->emitInt8(dwarf::DW_CHILDREN_yes);
EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, context.getDwarfVersion() >= 4
? dwarf::DW_FORM_sec_offset
: dwarf::DW_FORM_data4);
@@ -829,7 +829,7 @@
// DW_TAG_label DIE abbrev (2).
MCOS->emitULEB128IntValue(2);
MCOS->emitULEB128IntValue(dwarf::DW_TAG_label);
- MCOS->emitIntValue(dwarf::DW_CHILDREN_yes, 1);
+ MCOS->emitInt8(dwarf::DW_CHILDREN_yes);
EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
EmitAbbrev(MCOS, dwarf::DW_AT_decl_line, dwarf::DW_FORM_data4);
@@ -840,11 +840,11 @@
// DW_TAG_unspecified_parameters DIE abbrev (3).
MCOS->emitULEB128IntValue(3);
MCOS->emitULEB128IntValue(dwarf::DW_TAG_unspecified_parameters);
- MCOS->emitIntValue(dwarf::DW_CHILDREN_no, 1);
+ MCOS->emitInt8(dwarf::DW_CHILDREN_no);
EmitAbbrev(MCOS, 0, 0);
// Terminate the abbreviations for this compilation unit.
- MCOS->emitIntValue(0, 1);
+ MCOS->emitInt8(0);
}
// When generating dwarf for assembly source files this emits the data for
@@ -880,23 +880,23 @@
// Emit the header for this section.
// The 4 byte length not including the 4 byte value for the length.
- MCOS->emitIntValue(Length - 4, 4);
+ MCOS->emitInt32(Length - 4);
// The 2 byte version, which is 2.
- MCOS->emitIntValue(2, 2);
+ MCOS->emitInt16(2);
// The 4 byte offset to the compile unit in the .debug_info from the start
// of the .debug_info.
if (InfoSectionSymbol)
MCOS->emitSymbolValue(InfoSectionSymbol, 4,
asmInfo->needsDwarfSectionOffsetDirective());
else
- MCOS->emitIntValue(0, 4);
+ MCOS->emitInt32(0);
// The 1 byte size of an address.
- MCOS->emitIntValue(AddrSize, 1);
+ MCOS->emitInt8(AddrSize);
// The 1 byte size of a segment descriptor, we use a value of zero.
- MCOS->emitIntValue(0, 1);
+ MCOS->emitInt8(0);
// Align the header with the padding if needed, before we put out the table.
for(int i = 0; i < Pad; i++)
- MCOS->emitIntValue(0, 1);
+ MCOS->emitInt8(0);
// Now emit the table of pairs of PointerSize'ed values for the section
// addresses and sizes.
@@ -944,25 +944,25 @@
emitAbsValue(*MCOS, Length, 4);
// The 2 byte DWARF version.
- MCOS->emitIntValue(context.getDwarfVersion(), 2);
+ MCOS->emitInt16(context.getDwarfVersion());
// The DWARF v5 header has unit type, address size, abbrev offset.
// Earlier versions have abbrev offset, address size.
const MCAsmInfo &AsmInfo = *context.getAsmInfo();
int AddrSize = AsmInfo.getCodePointerSize();
if (context.getDwarfVersion() >= 5) {
- MCOS->emitIntValue(dwarf::DW_UT_compile, 1);
- MCOS->emitIntValue(AddrSize, 1);
+ MCOS->emitInt8(dwarf::DW_UT_compile);
+ MCOS->emitInt8(AddrSize);
}
// The 4 byte offset to the debug abbrevs from the start of the .debug_abbrev,
// it is at the start of that section so this is zero.
if (AbbrevSectionSymbol == nullptr)
- MCOS->emitIntValue(0, 4);
+ MCOS->emitInt32(0);
else
MCOS->emitSymbolValue(AbbrevSectionSymbol, 4,
AsmInfo.needsDwarfSectionOffsetDirective());
if (context.getDwarfVersion() <= 4)
- MCOS->emitIntValue(AddrSize, 1);
+ MCOS->emitInt8(AddrSize);
// Second part: the compile_unit DIE.
@@ -975,7 +975,7 @@
MCOS->emitSymbolValue(LineSectionSymbol, 4,
AsmInfo.needsDwarfSectionOffsetDirective());
else
- MCOS->emitIntValue(0, 4);
+ MCOS->emitInt32(0);
if (RangesSectionSymbol) {
// There are multiple sections containing code, so we must use the
@@ -1025,19 +1025,19 @@
? context.getMCDwarfLineTable(/*CUID=*/0).getRootFile()
: MCDwarfFiles[1];
MCOS->emitBytes(RootFile.Name);
- MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
+ MCOS->emitInt8(0); // NULL byte to terminate the string.
// AT_comp_dir, the working directory the assembly was done in.
if (!context.getCompilationDir().empty()) {
MCOS->emitBytes(context.getCompilationDir());
- MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
+ MCOS->emitInt8(0); // NULL byte to terminate the string.
}
// AT_APPLE_flags, the command line arguments of the assembler tool.
StringRef DwarfDebugFlags = context.getDwarfDebugFlags();
if (!DwarfDebugFlags.empty()){
MCOS->emitBytes(DwarfDebugFlags);
- MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
+ MCOS->emitInt8(0); // NULL byte to terminate the string.
}
// AT_producer, the version of the assembler tool.
@@ -1046,11 +1046,11 @@
MCOS->emitBytes(DwarfDebugProducer);
else
MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
- MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
+ MCOS->emitInt8(0); // NULL byte to terminate the string.
// AT_language, a 4 byte value. We use DW_LANG_Mips_Assembler as the dwarf2
// draft has no standard code for assembler.
- MCOS->emitIntValue(dwarf::DW_LANG_Mips_Assembler, 2);
+ MCOS->emitInt16(dwarf::DW_LANG_Mips_Assembler);
// Third part: the list of label DIEs.
@@ -1063,13 +1063,13 @@
// AT_name, of the label without any leading underbar.
MCOS->emitBytes(Entry.getName());
- MCOS->emitIntValue(0, 1); // NULL byte to terminate the string.
+ MCOS->emitInt8(0); // NULL byte to terminate the string.
// AT_decl_file, index into the file table.
- MCOS->emitIntValue(Entry.getFileNumber(), 4);
+ MCOS->emitInt32(Entry.getFileNumber());
// AT_decl_line, source line number.
- MCOS->emitIntValue(Entry.getLineNumber(), 4);
+ MCOS->emitInt32(Entry.getLineNumber());
// AT_low_pc, start address of the label.
const MCExpr *AT_low_pc = MCSymbolRefExpr::create(Entry.getLabel(),
@@ -1077,17 +1077,17 @@
MCOS->emitValue(AT_low_pc, AddrSize);
// DW_AT_prototyped, a one byte flag value of 0 saying we have no prototype.
- MCOS->emitIntValue(0, 1);
+ MCOS->emitInt8(0);
// The DW_TAG_unspecified_parameters DIE abbrev (3).
MCOS->emitULEB128IntValue(3);
// Add the NULL DIE terminating the DW_TAG_unspecified_parameters DIE's.
- MCOS->emitIntValue(0, 1);
+ MCOS->emitInt8(0);
}
// Add the NULL DIE terminating the Compile Unit DIE's.
- MCOS->emitIntValue(0, 1);
+ MCOS->emitInt8(0);
// Now set the value of the symbol at the end of the info section.
MCOS->emitLabel(InfoEnd);
@@ -1323,7 +1323,7 @@
} // end anonymous namespace
static void emitEncodingByte(MCObjectStreamer &Streamer, unsigned Encoding) {
- Streamer.emitIntValue(Encoding, 1);
+ Streamer.emitInt8(Encoding);
}
void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
@@ -1338,22 +1338,22 @@
Reg1 = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg1);
Reg2 = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg2);
}
- Streamer.emitIntValue(dwarf::DW_CFA_register, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_register);
Streamer.emitULEB128IntValue(Reg1);
Streamer.emitULEB128IntValue(Reg2);
return;
}
case MCCFIInstruction::OpWindowSave:
- Streamer.emitIntValue(dwarf::DW_CFA_GNU_window_save, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_GNU_window_save);
return;
case MCCFIInstruction::OpNegateRAState:
- Streamer.emitIntValue(dwarf::DW_CFA_AARCH64_negate_ra_state, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_AARCH64_negate_ra_state);
return;
case MCCFIInstruction::OpUndefined: {
unsigned Reg = Instr.getRegister();
- Streamer.emitIntValue(dwarf::DW_CFA_undefined, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_undefined);
Streamer.emitULEB128IntValue(Reg);
return;
}
@@ -1362,7 +1362,7 @@
const bool IsRelative =
Instr.getOperation() == MCCFIInstruction::OpAdjustCfaOffset;
- Streamer.emitIntValue(dwarf::DW_CFA_def_cfa_offset, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_def_cfa_offset);
if (IsRelative)
CFAOffset += Instr.getOffset();
@@ -1377,7 +1377,7 @@
unsigned Reg = Instr.getRegister();
if (!IsEH)
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
- Streamer.emitIntValue(dwarf::DW_CFA_def_cfa, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_def_cfa);
Streamer.emitULEB128IntValue(Reg);
CFAOffset = -Instr.getOffset();
Streamer.emitULEB128IntValue(CFAOffset);
@@ -1388,7 +1388,7 @@
unsigned Reg = Instr.getRegister();
if (!IsEH)
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
- Streamer.emitIntValue(dwarf::DW_CFA_def_cfa_register, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_def_cfa_register);
Streamer.emitULEB128IntValue(Reg);
return;
@@ -1408,28 +1408,28 @@
Offset = Offset / dataAlignmentFactor;
if (Offset < 0) {
- Streamer.emitIntValue(dwarf::DW_CFA_offset_extended_sf, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_offset_extended_sf);
Streamer.emitULEB128IntValue(Reg);
Streamer.emitSLEB128IntValue(Offset);
} else if (Reg < 64) {
- Streamer.emitIntValue(dwarf::DW_CFA_offset + Reg, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_offset + Reg);
Streamer.emitULEB128IntValue(Offset);
} else {
- Streamer.emitIntValue(dwarf::DW_CFA_offset_extended, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_offset_extended);
Streamer.emitULEB128IntValue(Reg);
Streamer.emitULEB128IntValue(Offset);
}
return;
}
case MCCFIInstruction::OpRememberState:
- Streamer.emitIntValue(dwarf::DW_CFA_remember_state, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_remember_state);
return;
case MCCFIInstruction::OpRestoreState:
- Streamer.emitIntValue(dwarf::DW_CFA_restore_state, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_restore_state);
return;
case MCCFIInstruction::OpSameValue: {
unsigned Reg = Instr.getRegister();
- Streamer.emitIntValue(dwarf::DW_CFA_same_value, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_same_value);
Streamer.emitULEB128IntValue(Reg);
return;
}
@@ -1438,15 +1438,15 @@
if (!IsEH)
Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg);
if (Reg < 64) {
- Streamer.emitIntValue(dwarf::DW_CFA_restore | Reg, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_restore | Reg);
} else {
- Streamer.emitIntValue(dwarf::DW_CFA_restore_extended, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_restore_extended);
Streamer.emitULEB128IntValue(Reg);
}
return;
}
case MCCFIInstruction::OpGnuArgsSize:
- Streamer.emitIntValue(dwarf::DW_CFA_GNU_args_size, 1);
+ Streamer.emitInt8(dwarf::DW_CFA_GNU_args_size);
Streamer.emitULEB128IntValue(Instr.getOffset());
return;
@@ -1574,11 +1574,11 @@
// CIE ID
unsigned CIE_ID = IsEH ? 0 : -1;
- Streamer.emitIntValue(CIE_ID, 4);
+ Streamer.emitInt32(CIE_ID);
// Version
uint8_t CIEVersion = getCIEVersion(IsEH, context.getDwarfVersion());
- Streamer.emitIntValue(CIEVersion, 1);
+ Streamer.emitInt8(CIEVersion);
if (IsEH) {
SmallString<8> Augmentation;
@@ -1594,14 +1594,14 @@
Augmentation += "B";
Streamer.emitBytes(Augmentation);
}
- Streamer.emitIntValue(0, 1);
+ Streamer.emitInt8(0);
if (CIEVersion >= 4) {
// Address Size
- Streamer.emitIntValue(context.getAsmInfo()->getCodePointerSize(), 1);
+ Streamer.emitInt8(context.getAsmInfo()->getCodePointerSize());
// Segment Descriptor Size
- Streamer.emitIntValue(0, 1);
+ Streamer.emitInt8(0);
}
// Code Alignment Factor
@@ -1618,7 +1618,7 @@
if (CIEVersion == 1) {
assert(RAReg <= 255 &&
"DWARF 2 encodes return_address_register in one byte");
- Streamer.emitIntValue(RAReg, 1);
+ Streamer.emitInt8(RAReg);
} else {
Streamer.emitULEB128IntValue(RAReg);
}
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index a449e80..71f30d3 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -368,11 +368,11 @@
PushSection();
SwitchSection(Comment);
if (!SeenIdent) {
- emitIntValue(0, 1);
+ emitInt8(0);
SeenIdent = true;
}
emitBytes(IdentString);
- emitIntValue(0, 1);
+ emitInt8(0);
PopSection();
}
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 57e1521..a3d2d9f 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3104,11 +3104,11 @@
if (parseHexOcta(*this, hi, lo))
return true;
if (MAI.isLittleEndian()) {
- getStreamer().emitIntValue(lo, 8);
- getStreamer().emitIntValue(hi, 8);
+ getStreamer().emitInt64(lo);
+ getStreamer().emitInt64(hi);
} else {
- getStreamer().emitIntValue(hi, 8);
- getStreamer().emitIntValue(lo, 8);
+ getStreamer().emitInt64(hi);
+ getStreamer().emitInt64(lo);
}
return false;
};
@@ -3993,7 +3993,7 @@
// Put the string in the table and emit the offset.
std::pair<StringRef, unsigned> Insertion =
getCVContext().addToStringTable(Data);
- getStreamer().emitIntValue(Insertion.second, 4);
+ getStreamer().emitInt32(Insertion.second);
return false;
}
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 7e1c073..6d8a8a7 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -806,12 +806,12 @@
getStreamer().PushSection();
getStreamer().SwitchSection(Note);
- getStreamer().emitIntValue(Data.size()+1, 4); // namesz.
- getStreamer().emitIntValue(0, 4); // descsz = 0 (no description).
- getStreamer().emitIntValue(1, 4); // type = NT_VERSION.
- getStreamer().emitBytes(Data); // name.
- getStreamer().emitIntValue(0, 1); // terminate the string.
- getStreamer().emitValueToAlignment(4); // ensure 4 byte alignment.
+ getStreamer().emitInt32(Data.size() + 1); // namesz
+ getStreamer().emitInt32(0); // descsz = 0 (no description).
+ getStreamer().emitInt32(1); // type = NT_VERSION
+ getStreamer().emitBytes(Data); // name
+ getStreamer().emitInt8(0); // NUL
+ getStreamer().emitValueToAlignment(4);
getStreamer().PopSection();
return false;
}
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index 9e08e82..ac288ca 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -69,59 +69,59 @@
case Win64EH::UOP_PushNonVol:
EmitAbsDifference(streamer, inst.Label, begin);
b2 |= (inst.Register & 0x0F) << 4;
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
break;
case Win64EH::UOP_AllocLarge:
EmitAbsDifference(streamer, inst.Label, begin);
if (inst.Offset > 512 * 1024 - 8) {
b2 |= 0x10;
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
w = inst.Offset & 0xFFF8;
- streamer.emitIntValue(w, 2);
+ streamer.emitInt16(w);
w = inst.Offset >> 16;
} else {
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
w = inst.Offset >> 3;
}
- streamer.emitIntValue(w, 2);
+ streamer.emitInt16(w);
break;
case Win64EH::UOP_AllocSmall:
b2 |= (((inst.Offset - 8) >> 3) & 0x0F) << 4;
EmitAbsDifference(streamer, inst.Label, begin);
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
break;
case Win64EH::UOP_SetFPReg:
EmitAbsDifference(streamer, inst.Label, begin);
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
break;
case Win64EH::UOP_SaveNonVol:
case Win64EH::UOP_SaveXMM128:
b2 |= (inst.Register & 0x0F) << 4;
EmitAbsDifference(streamer, inst.Label, begin);
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
w = inst.Offset >> 3;
if (inst.Operation == Win64EH::UOP_SaveXMM128)
w >>= 1;
- streamer.emitIntValue(w, 2);
+ streamer.emitInt16(w);
break;
case Win64EH::UOP_SaveNonVolBig:
case Win64EH::UOP_SaveXMM128Big:
b2 |= (inst.Register & 0x0F) << 4;
EmitAbsDifference(streamer, inst.Label, begin);
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
if (inst.Operation == Win64EH::UOP_SaveXMM128Big)
w = inst.Offset & 0xFFF0;
else
w = inst.Offset & 0xFFF8;
- streamer.emitIntValue(w, 2);
+ streamer.emitInt16(w);
w = inst.Offset >> 16;
- streamer.emitIntValue(w, 2);
+ streamer.emitInt16(w);
break;
case Win64EH::UOP_PushMachFrame:
if (inst.Offset == 1)
b2 |= 0x10;
EmitAbsDifference(streamer, inst.Label, begin);
- streamer.emitIntValue(b2, 1);
+ streamer.emitInt8(b2);
break;
}
}
@@ -173,15 +173,15 @@
if (info->HandlesExceptions)
flags |= Win64EH::UNW_ExceptionHandler << 3;
}
- streamer.emitIntValue(flags, 1);
+ streamer.emitInt8(flags);
if (info->PrologEnd)
EmitAbsDifference(streamer, info->PrologEnd, info->Begin);
else
- streamer.emitIntValue(0, 1);
+ streamer.emitInt8(0);
uint8_t numCodes = CountOfUnwindCodes(info->Instructions);
- streamer.emitIntValue(numCodes, 1);
+ streamer.emitInt8(numCodes);
uint8_t frame = 0;
if (info->LastFrameInst >= 0) {
@@ -189,7 +189,7 @@
assert(frameInst.Operation == Win64EH::UOP_SetFPReg);
frame = (frameInst.Register & 0x0F) | (frameInst.Offset & 0xF0);
}
- streamer.emitIntValue(frame, 1);
+ streamer.emitInt8(frame);
// Emit unwind instructions (in reverse order).
uint8_t numInst = info->Instructions.size();
@@ -204,7 +204,7 @@
// the array will be one longer than indicated by the count of unwind codes
// field).
if (numCodes & 1) {
- streamer.emitIntValue(0, 2);
+ streamer.emitInt16(0);
}
if (flags & (Win64EH::UNW_ChainInfo << 3))
@@ -218,7 +218,7 @@
// The minimum size of an UNWIND_INFO struct is 8 bytes. If we're not
// a chained unwind info, if there is no handler, and if there are fewer
// than 2 slots used in the unwind code array, we have to pad to 8 bytes.
- streamer.emitIntValue(0, 4);
+ streamer.emitInt32(0);
}
}
@@ -337,121 +337,121 @@
llvm_unreachable("Unsupported ARM64 unwind code");
case Win64EH::UOP_AllocSmall:
b = (inst.Offset >> 4) & 0x1F;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_AllocMedium: {
uint16_t hw = (inst.Offset >> 4) & 0x7FF;
b = 0xC0;
b |= (hw >> 8);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = hw & 0xFF;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
}
case Win64EH::UOP_AllocLarge: {
uint32_t w;
b = 0xE0;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
w = inst.Offset >> 4;
b = (w & 0x00FF0000) >> 16;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = (w & 0x0000FF00) >> 8;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = w & 0x000000FF;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
}
case Win64EH::UOP_SetFP:
b = 0xE1;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_AddFP:
b = 0xE2;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = (inst.Offset >> 3);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_Nop:
b = 0xE3;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveFPLRX:
b = 0x80;
b |= ((inst.Offset - 1) >> 3) & 0x3F;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveFPLR:
b = 0x40;
b |= (inst.Offset >> 3) & 0x3F;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveReg:
assert(inst.Register >= 19 && "Saved reg must be >= 19");
reg = inst.Register - 19;
b = 0xD0 | ((reg & 0xC) >> 2);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveRegX:
assert(inst.Register >= 19 && "Saved reg must be >= 19");
reg = inst.Register - 19;
b = 0xD4 | ((reg & 0x8) >> 3);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x7) << 5) | ((inst.Offset >> 3) - 1);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveRegP:
assert(inst.Register >= 19 && "Saved registers must be >= 19");
reg = inst.Register - 19;
b = 0xC8 | ((reg & 0xC) >> 2);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveRegPX:
assert(inst.Register >= 19 && "Saved registers must be >= 19");
reg = inst.Register - 19;
b = 0xCC | ((reg & 0xC) >> 2);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x3) << 6) | ((inst.Offset >> 3) - 1);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveFReg:
assert(inst.Register >= 8 && "Saved dreg must be >= 8");
reg = inst.Register - 8;
b = 0xDC | ((reg & 0x4) >> 2);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveFRegX:
assert(inst.Register >= 8 && "Saved dreg must be >= 8");
reg = inst.Register - 8;
b = 0xDE;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x7) << 5) | ((inst.Offset >> 3) - 1);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveFRegP:
assert(inst.Register >= 8 && "Saved dregs must be >= 8");
reg = inst.Register - 8;
b = 0xD8 | ((reg & 0x4) >> 2);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x3) << 6) | (inst.Offset >> 3);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_SaveFRegPX:
assert(inst.Register >= 8 && "Saved dregs must be >= 8");
reg = inst.Register - 8;
b = 0xDA | ((reg & 0x4) >> 2);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
b = ((reg & 0x3) << 6) | ((inst.Offset >> 3) - 1);
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
case Win64EH::UOP_End:
b = 0xE4;
- streamer.emitIntValue(b, 1);
+ streamer.emitInt8(b);
break;
}
}
@@ -585,7 +585,7 @@
if (info->HandlesExceptions) // X
row1 |= 1 << 20;
row1 |= FuncLength & 0x3FFFF;
- streamer.emitIntValue(row1, 4);
+ streamer.emitInt32(row1);
// Extended Code Words, Extended Epilog Count
if (ExtensionWord) {
@@ -597,7 +597,7 @@
uint32_t row2 = 0x0;
row2 |= (CodeWords & 0xFF) << 16;
row2 |= (EpilogCount & 0xFFFF);
- streamer.emitIntValue(row2, 4);
+ streamer.emitInt32(row2);
}
// Epilog Start Index, Epilog Start Offset
@@ -610,7 +610,7 @@
EpilogOffset /= 4;
uint32_t row3 = EpilogOffset;
row3 |= (EpilogIndex & 0x3FF) << 22;
- streamer.emitIntValue(row3, 4);
+ streamer.emitInt32(row3);
}
// Emit prolog unwind instructions (in reverse order).
@@ -633,7 +633,7 @@
int32_t BytesMod = CodeWords * 4 - TotalCodeBytes;
assert(BytesMod >= 0);
for (int i = 0; i < BytesMod; i++)
- streamer.emitIntValue(0xE3, 1);
+ streamer.emitInt8(0xE3);
if (info->HandlesExceptions)
streamer.emitValue(