[llvm] 692e0c9 - [MC] Add MCStreamer::emitInt{8,16,32,64}
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 29 09:41:05 PST 2020
Author: Fangrui Song
Date: 2020-02-29T09:40:21-08:00
New Revision: 692e0c964872cc31b7e873564d6334a986f47dc8
URL: https://github.com/llvm/llvm-project/commit/692e0c964872cc31b7e873564d6334a986f47dc8
DIFF: https://github.com/llvm/llvm-project/commit/692e0c964872cc31b7e873564d6334a986f47dc8.diff
LOG: [MC] Add MCStreamer::emitInt{8,16,32,64}
Similar to AsmPrinter::emitInt{8,16,32,64}.
Added:
Modified:
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/WinException.cpp
llvm/lib/CodeGen/FaultMaps.cpp
llvm/lib/CodeGen/StackMaps.cpp
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/MC/MCCodeView.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCParser/ELFAsmParser.cpp
llvm/lib/MC/MCWin64EH.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/lib/Target/BPF/BTFDebug.cpp
llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp
llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index 8a447731f679..4a34e1497ccf 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -663,6 +663,11 @@ class MCStreamer {
emitIntValue(Value, Size);
}
+ void emitInt8(uint64_t Value) { emitIntValue(Value, 1); }
+ void emitInt16(uint64_t Value) { emitIntValue(Value, 2); }
+ void emitInt32(uint64_t Value) { emitIntValue(Value, 4); }
+ void emitInt64(uint64_t Value) { emitIntValue(Value, 8); }
+
/// Special case of EmitValue that avoids the client having to pass
/// in a MCExpr for constant integers & prints in Hex format for certain
/// modes, pads the field with leading zeros to Size width
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index c38823b741a4..a99a60e89120 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2162,23 +2162,17 @@ void AsmPrinter::emitModuleCommandLines(Module &M) {
/// Emit a byte directive and value.
///
-void AsmPrinter::emitInt8(int Value) const {
- OutStreamer->emitIntValue(Value, 1);
-}
+void AsmPrinter::emitInt8(int Value) const { OutStreamer->emitInt8(Value); }
/// Emit a short directive and value.
-void AsmPrinter::emitInt16(int Value) const {
- OutStreamer->emitIntValue(Value, 2);
-}
+void AsmPrinter::emitInt16(int Value) const { OutStreamer->emitInt16(Value); }
/// Emit a long directive and value.
-void AsmPrinter::emitInt32(int Value) const {
- OutStreamer->emitIntValue(Value, 4);
-}
+void AsmPrinter::emitInt32(int Value) const { OutStreamer->emitInt32(Value); }
/// Emit a long long directive and value.
void AsmPrinter::emitInt64(uint64_t Value) const {
- OutStreamer->emitIntValue(Value, 8);
+ OutStreamer->emitInt64(Value);
}
/// Emit something like ".long Hi-Lo" where the size in bytes of the directive
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index c63738425513..45fe3cfafa9d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -551,7 +551,7 @@ void CodeViewDebug::maybeRecordLocation(const DebugLoc &DL,
void CodeViewDebug::emitCodeViewMagicVersion() {
OS.emitValueToAlignment(4);
OS.AddComment("Debug section magic");
- OS.emitIntValue(COFF::DEBUG_SECTION_MAGIC, 4);
+ OS.emitInt32(COFF::DEBUG_SECTION_MAGIC);
}
void CodeViewDebug::endModule() {
@@ -676,11 +676,11 @@ void CodeViewDebug::emitTypeGlobalHashes() {
OS.emitValueToAlignment(4);
OS.AddComment("Magic");
- OS.emitIntValue(COFF::DEBUG_HASHES_SECTION_MAGIC, 4);
+ OS.emitInt32(COFF::DEBUG_HASHES_SECTION_MAGIC);
OS.AddComment("Section Version");
- OS.emitIntValue(0, 2);
+ OS.emitInt16(0);
OS.AddComment("Hash Algorithm");
- OS.emitIntValue(uint16_t(GlobalTypeHashAlg::SHA1_8), 2);
+ OS.emitInt16(uint16_t(GlobalTypeHashAlg::SHA1_8));
TypeIndex TI(TypeIndex::FirstNonSimpleIndex);
for (const auto &GHR : TypeTable.hashes()) {
@@ -775,16 +775,16 @@ void CodeViewDebug::emitCompilerInformation() {
// TODO: Figure out which other flags need to be set.
OS.AddComment("Flags and language");
- OS.emitIntValue(Flags, 4);
+ OS.emitInt32(Flags);
OS.AddComment("CPUType");
- OS.emitIntValue(static_cast<uint64_t>(TheCPU), 2);
+ OS.emitInt16(static_cast<uint64_t>(TheCPU));
StringRef CompilerVersion = CU->getProducer();
Version FrontVer = parseVersion(CompilerVersion);
OS.AddComment("Frontend version");
for (int N = 0; N < 4; ++N)
- OS.emitIntValue(FrontVer.Part[N], 2);
+ OS.emitInt16(FrontVer.Part[N]);
// Some Microsoft tools, like Binscope, expect a backend version number of at
// least 8.something, so we'll coerce the LLVM version into a form that
@@ -797,7 +797,7 @@ void CodeViewDebug::emitCompilerInformation() {
Version BackVer = {{ Major, 0, 0, 0 }};
OS.AddComment("Backend version");
for (int N = 0; N < 4; ++N)
- OS.emitIntValue(BackVer.Part[N], 2);
+ OS.emitInt16(BackVer.Part[N]);
OS.AddComment("Null-terminated compiler version string");
emitNullTerminatedSymbolName(OS, CompilerVersion);
@@ -841,7 +841,7 @@ void CodeViewDebug::emitBuildInfo() {
MCSymbol *BISubsecEnd = beginCVSubsection(DebugSubsectionKind::Symbols);
MCSymbol *BIEnd = beginSymbolRecord(SymbolKind::S_BUILDINFO);
OS.AddComment("LF_BUILDINFO index");
- OS.emitIntValue(BuildInfoIndex.getIndex(), 4);
+ OS.emitInt32(BuildInfoIndex.getIndex());
endSymbolRecord(BIEnd);
endCVSubsection(BISubsecEnd);
}
@@ -858,7 +858,7 @@ void CodeViewDebug::emitInlineeLinesSubsection() {
// for instance, will display a warning that the breakpoints are not valid if
// the pdb does not match the source.
OS.AddComment("Inlinee lines signature");
- OS.emitIntValue(unsigned(InlineeLinesSignature::Normal), 4);
+ OS.emitInt32(unsigned(InlineeLinesSignature::Normal));
for (const DISubprogram *SP : InlinedSubprograms) {
assert(TypeIndices.count({SP, nullptr}));
@@ -870,11 +870,11 @@ void CodeViewDebug::emitInlineeLinesSubsection() {
SP->getFilename() + Twine(':') + Twine(SP->getLine()));
OS.AddBlankLine();
OS.AddComment("Type index of inlined function");
- OS.emitIntValue(InlineeIdx.getIndex(), 4);
+ OS.emitInt32(InlineeIdx.getIndex());
OS.AddComment("Offset into filechecksum table");
OS.EmitCVFileChecksumOffsetDirective(FileId);
OS.AddComment("Starting line number");
- OS.emitIntValue(SP->getLine(), 4);
+ OS.emitInt32(SP->getLine());
}
endCVSubsection(InlineEnd);
@@ -890,11 +890,11 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI,
MCSymbol *InlineEnd = beginSymbolRecord(SymbolKind::S_INLINESITE);
OS.AddComment("PtrParent");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("PtrEnd");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Inlinee type index");
- OS.emitIntValue(InlineeIdx.getIndex(), 4);
+ OS.emitInt32(InlineeIdx.getIndex());
unsigned FileId = maybeRecordFile(Site.Inlinee->getFile());
unsigned StartLineNum = Site.Inlinee->getLine();
@@ -953,11 +953,11 @@ void CodeViewDebug::emitDebugInfoForThunk(const Function *GV,
// Emit S_THUNK32
MCSymbol *ThunkRecordEnd = beginSymbolRecord(SymbolKind::S_THUNK32);
OS.AddComment("PtrParent");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("PtrEnd");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("PtrNext");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Thunk section relative address");
OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
OS.AddComment("Thunk section index");
@@ -965,7 +965,7 @@ void CodeViewDebug::emitDebugInfoForThunk(const Function *GV,
OS.AddComment("Code size");
OS.emitAbsoluteSymbolDiff(FI.End, Fn, 2);
OS.AddComment("Ordinal");
- OS.emitIntValue(unsigned(ordinal), 1);
+ OS.emitInt8(unsigned(ordinal));
OS.AddComment("Function name");
emitNullTerminatedSymbolName(OS, FuncName);
// Additional fields specific to the thunk ordinal would go here.
@@ -1023,27 +1023,27 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
// These fields are filled in by tools like CVPACK which run after the fact.
OS.AddComment("PtrParent");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("PtrEnd");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("PtrNext");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
// This is the important bit that tells the debugger where the function
// code is located and what's its size:
OS.AddComment("Code size");
OS.emitAbsoluteSymbolDiff(FI.End, Fn, 4);
OS.AddComment("Offset after prologue");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Offset before epilogue");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Function type index");
- OS.emitIntValue(getFuncIdForSubprogram(GV->getSubprogram()).getIndex(), 4);
+ OS.emitInt32(getFuncIdForSubprogram(GV->getSubprogram()).getIndex());
OS.AddComment("Function section relative address");
OS.EmitCOFFSecRel32(Fn, /*Offset=*/0);
OS.AddComment("Function section index");
OS.EmitCOFFSectionIndex(Fn);
OS.AddComment("Flags");
- OS.emitIntValue(0, 1);
+ OS.emitInt8(0);
// Emit the function display name as a null-terminated string.
OS.AddComment("Function name");
// Truncate the name so we won't overflow the record length field.
@@ -1053,19 +1053,19 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
MCSymbol *FrameProcEnd = beginSymbolRecord(SymbolKind::S_FRAMEPROC);
// Subtract out the CSR size since MSVC excludes that and we include it.
OS.AddComment("FrameSize");
- OS.emitIntValue(FI.FrameSize - FI.CSRSize, 4);
+ OS.emitInt32(FI.FrameSize - FI.CSRSize);
OS.AddComment("Padding");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Offset of padding");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Bytes of callee saved registers");
- OS.emitIntValue(FI.CSRSize, 4);
+ OS.emitInt32(FI.CSRSize);
OS.AddComment("Exception handler offset");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
OS.AddComment("Exception handler section");
- OS.emitIntValue(0, 2);
+ OS.emitInt16(0);
OS.AddComment("Flags (defines frame register)");
- OS.emitIntValue(uint32_t(FI.FrameProcOpts), 4);
+ OS.emitInt32(uint32_t(FI.FrameProcOpts));
endSymbolRecord(FrameProcEnd);
emitLocalVariableList(FI, FI.Locals);
@@ -1089,7 +1089,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
OS.EmitCOFFSecRel32(Label, /*Offset=*/0);
// FIXME: Make sure we don't overflow the max record size.
OS.EmitCOFFSectionIndex(Label);
- OS.emitIntValue(Strs->getNumOperands(), 2);
+ OS.emitInt16(Strs->getNumOperands());
for (Metadata *MD : Strs->operands()) {
// MDStrings are null terminated, so we can do EmitBytes and get the
// nice .asciz directive.
@@ -1112,7 +1112,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
OS.AddComment("Call instruction length");
OS.emitAbsoluteSymbolDiff(EndLabel, BeginLabel, 2);
OS.AddComment("Type index");
- OS.emitIntValue(getCompleteTypeIndex(DITy).getIndex(), 4);
+ OS.emitInt32(getCompleteTypeIndex(DITy).getIndex());
endSymbolRecord(HeapAllocEnd);
}
@@ -2626,9 +2626,9 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI,
TypeIndex TI = Var.UseReferenceType
? getTypeIndexForReferenceTo(Var.DIVar->getType())
: getCompleteTypeIndex(Var.DIVar->getType());
- OS.emitIntValue(TI.getIndex(), 4);
+ OS.emitInt32(TI.getIndex());
OS.AddComment("Flags");
- OS.emitIntValue(static_cast<uint16_t>(Flags), 2);
+ OS.emitInt16(static_cast<uint16_t>(Flags));
// Truncate the name so we won't overflow the record length field.
emitNullTerminatedSymbolName(OS, Var.DIVar->getName());
endSymbolRecord(LocalEnd);
@@ -2705,9 +2705,9 @@ void CodeViewDebug::emitLexicalBlock(const LexicalBlock &Block,
const FunctionInfo& FI) {
MCSymbol *RecordEnd = beginSymbolRecord(SymbolKind::S_BLOCK32);
OS.AddComment("PtrParent");
- OS.emitIntValue(0, 4); // PtrParent
+ OS.emitInt32(0); // PtrParent
OS.AddComment("PtrEnd");
- OS.emitIntValue(0, 4); // PtrEnd
+ OS.emitInt32(0); // PtrEnd
OS.AddComment("Code size");
OS.emitAbsoluteSymbolDiff(Block.End, Block.Begin, 4); // Code Size
OS.AddComment("Function section relative address");
@@ -2915,7 +2915,7 @@ void CodeViewDebug::beginInstruction(const MachineInstr *MI) {
MCSymbol *CodeViewDebug::beginCVSubsection(DebugSubsectionKind Kind) {
MCSymbol *BeginLabel = MMI->getContext().createTempSymbol(),
*EndLabel = MMI->getContext().createTempSymbol();
- OS.emitIntValue(unsigned(Kind), 4);
+ OS.emitInt32(unsigned(Kind));
OS.AddComment("Subsection size");
OS.emitAbsoluteSymbolDiff(EndLabel, BeginLabel, 4);
OS.emitLabel(BeginLabel);
@@ -2943,7 +2943,7 @@ MCSymbol *CodeViewDebug::beginSymbolRecord(SymbolKind SymKind) {
OS.emitLabel(BeginLabel);
if (OS.isVerboseAsm())
OS.AddComment("Record kind: " + getSymbolName(SymKind));
- OS.emitIntValue(unsigned(SymKind), 2);
+ OS.emitInt16(unsigned(SymKind));
return EndLabel;
}
@@ -2958,10 +2958,10 @@ void CodeViewDebug::endSymbolRecord(MCSymbol *SymEnd) {
void CodeViewDebug::emitEndSymbolRecord(SymbolKind EndKind) {
OS.AddComment("Record length");
- OS.emitIntValue(2, 2);
+ OS.emitInt16(2);
if (OS.isVerboseAsm())
OS.AddComment("Record kind: " + getSymbolName(EndKind));
- OS.emitIntValue(unsigned(EndKind), 2); // Record Kind
+ OS.emitInt16(uint16_t(EndKind)); // Record Kind
}
void CodeViewDebug::emitDebugInfoForUDTs(
@@ -2972,7 +2972,7 @@ void CodeViewDebug::emitDebugInfoForUDTs(
MCSymbol *UDTRecordEnd = beginSymbolRecord(SymbolKind::S_UDT);
OS.AddComment("Type");
- OS.emitIntValue(getCompleteTypeIndex(T).getIndex(), 4);
+ OS.emitInt32(getCompleteTypeIndex(T).getIndex());
emitNullTerminatedSymbolName(OS, UDT.first);
endSymbolRecord(UDTRecordEnd);
}
@@ -3088,7 +3088,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
: SymbolKind::S_GDATA32);
MCSymbol *DataEnd = beginSymbolRecord(DataSym);
OS.AddComment("Type");
- OS.emitIntValue(getCompleteTypeIndex(DIGV->getType()).getIndex(), 4);
+ OS.emitInt32(getCompleteTypeIndex(DIGV->getType()).getIndex());
OS.AddComment("DataOffset");
OS.EmitCOFFSecRel32(GVSym, /*Offset=*/0);
OS.AddComment("Segment");
@@ -3107,7 +3107,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
MCSymbol *SConstantEnd = beginSymbolRecord(SymbolKind::S_CONSTANT);
OS.AddComment("Type");
- OS.emitIntValue(getTypeIndex(DIGV->getType()).getIndex(), 4);
+ OS.emitInt32(getTypeIndex(DIGV->getType()).getIndex());
OS.AddComment("Value");
// Encoded integers shouldn't need more than 10 bytes.
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index 839453ee84d2..bbf0e46db14a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -717,36 +717,36 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
OS.emitLabel(FuncInfoXData);
AddComment("MagicNumber");
- OS.emitIntValue(0x19930522, 4);
+ OS.emitInt32(0x19930522);
AddComment("MaxState");
- OS.emitIntValue(FuncInfo.CxxUnwindMap.size(), 4);
+ OS.emitInt32(FuncInfo.CxxUnwindMap.size());
AddComment("UnwindMap");
OS.emitValue(create32bitRef(UnwindMapXData), 4);
AddComment("NumTryBlocks");
- OS.emitIntValue(FuncInfo.TryBlockMap.size(), 4);
+ OS.emitInt32(FuncInfo.TryBlockMap.size());
AddComment("TryBlockMap");
OS.emitValue(create32bitRef(TryBlockMapXData), 4);
AddComment("IPMapEntries");
- OS.emitIntValue(IPToStateTable.size(), 4);
+ OS.emitInt32(IPToStateTable.size());
AddComment("IPToStateXData");
OS.emitValue(create32bitRef(IPToStateXData), 4);
if (Asm->MAI->usesWindowsCFI()) {
AddComment("UnwindHelp");
- OS.emitIntValue(UnwindHelpOffset, 4);
+ OS.emitInt32(UnwindHelpOffset);
}
AddComment("ESTypeList");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
AddComment("EHFlags");
- OS.emitIntValue(1, 4);
+ OS.emitInt32(1);
// UnwindMapEntry {
// int32_t ToState;
@@ -758,7 +758,7 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
MCSymbol *CleanupSym =
getMCSymbolForMBB(Asm, UME.Cleanup.dyn_cast<MachineBasicBlock *>());
AddComment("ToState");
- OS.emitIntValue(UME.ToState, 4);
+ OS.emitInt32(UME.ToState);
AddComment("Action");
OS.emitValue(create32bitRef(CleanupSym), 4);
@@ -795,16 +795,16 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
"bad trymap interval");
AddComment("TryLow");
- OS.emitIntValue(TBME.TryLow, 4);
+ OS.emitInt32(TBME.TryLow);
AddComment("TryHigh");
- OS.emitIntValue(TBME.TryHigh, 4);
+ OS.emitInt32(TBME.TryHigh);
AddComment("CatchHigh");
- OS.emitIntValue(TBME.CatchHigh, 4);
+ OS.emitInt32(TBME.CatchHigh);
AddComment("NumCatches");
- OS.emitIntValue(TBME.HandlerArray.size(), 4);
+ OS.emitInt32(TBME.HandlerArray.size());
AddComment("HandlerArray");
OS.emitValue(create32bitRef(HandlerMapXData), 4);
@@ -847,7 +847,7 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
getMCSymbolForMBB(Asm, HT.Handler.dyn_cast<MachineBasicBlock *>());
AddComment("Adjectives");
- OS.emitIntValue(HT.Adjectives, 4);
+ OS.emitInt32(HT.Adjectives);
AddComment("Type");
OS.emitValue(create32bitRef(HT.TypeDescriptor), 4);
@@ -860,7 +860,7 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
if (shouldEmitPersonality) {
AddComment("ParentFrameOffset");
- OS.emitIntValue(ParentFrameOffset, 4);
+ OS.emitInt32(ParentFrameOffset);
}
}
}
@@ -876,7 +876,7 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
AddComment("IP");
OS.emitValue(IPStatePair.first, 4);
AddComment("ToState");
- OS.emitIntValue(IPStatePair.second, 4);
+ OS.emitInt32(IPStatePair.second);
}
}
}
@@ -1028,13 +1028,13 @@ void WinException::emitExceptHandlerTable(const MachineFunction *MF) {
}
AddComment("GSCookieOffset");
- OS.emitIntValue(GSCookieOffset, 4);
+ OS.emitInt32(GSCookieOffset);
AddComment("GSCookieXOROffset");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
AddComment("EHCookieOffset");
- OS.emitIntValue(EHCookieOffset, 4);
+ OS.emitInt32(EHCookieOffset);
AddComment("EHCookieXOROffset");
- OS.emitIntValue(0, 4);
+ OS.emitInt32(0);
BaseState = -2;
}
@@ -1047,7 +1047,7 @@ void WinException::emitExceptHandlerTable(const MachineFunction *MF) {
// _except_handler4 it's -2. Do that replacement here if necessary.
int ToState = UME.ToState == -1 ? BaseState : UME.ToState;
AddComment("ToState");
- OS.emitIntValue(ToState, 4);
+ OS.emitInt32(ToState);
AddComment(UME.IsFinally ? "Null" : "FilterFunction");
OS.emitValue(create32bitRef(UME.Filter), 4);
AddComment(UME.IsFinally ? "FinallyFunclet" : "ExceptionHandler");
@@ -1124,9 +1124,9 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
// Write out a sentinel indicating the end of the standard (Windows) xdata
// and the start of the additional (CLR) info.
- OS.emitIntValue(0xffffffff, 4);
+ OS.emitInt32(0xffffffff);
// Write out the number of funclets
- OS.emitIntValue(NumStates, 4);
+ OS.emitInt32(NumStates);
// Walk the machine blocks/instrs, computing and emitting a few things:
// 1. Emit a list of the offsets to each handler entry, in lexical order.
@@ -1217,7 +1217,7 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
}
// Now emit the clause info, starting with the number of clauses.
- OS.emitIntValue(Clauses.size(), 4);
+ OS.emitInt32(Clauses.size());
for (ClrClause &Clause : Clauses) {
// Emit a CORINFO_EH_CLAUSE :
/*
@@ -1299,7 +1299,7 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
assert(Clause.EnclosingState > MinClauseMap[Clause.State]);
Flags |= 8;
}
- OS.emitIntValue(Flags, 4);
+ OS.emitInt32(Flags);
// Write the clause start/end
OS.emitValue(ClauseBegin, 4);
@@ -1311,6 +1311,6 @@ void WinException::emitCLRExceptionTable(const MachineFunction *MF) {
// Write out the type token or filter offset
assert(Entry.HandlerType != ClrHandlerType::Filter && "NYI: filters");
- OS.emitIntValue(Entry.TypeToken, 4);
+ OS.emitInt32(Entry.TypeToken);
}
}
diff --git a/llvm/lib/CodeGen/FaultMaps.cpp b/llvm/lib/CodeGen/FaultMaps.cpp
index d9edbefaeab3..23560b4cd136 100644
--- a/llvm/lib/CodeGen/FaultMaps.cpp
+++ b/llvm/lib/CodeGen/FaultMaps.cpp
@@ -64,10 +64,10 @@ void FaultMaps::serializeToFaultMapSection() {
// Header
OS.emitIntValue(FaultMapVersion, 1); // Version.
OS.emitIntValue(0, 1); // Reserved.
- OS.emitIntValue(0, 2); // Reserved.
+ OS.emitInt16(0); // Reserved.
LLVM_DEBUG(dbgs() << WFMP << "#functions = " << FunctionInfos.size() << "\n");
- OS.emitIntValue(FunctionInfos.size(), 4);
+ OS.emitInt32(FunctionInfos.size());
LLVM_DEBUG(dbgs() << WFMP << "functions:\n");
@@ -83,14 +83,14 @@ void FaultMaps::emitFunctionInfo(const MCSymbol *FnLabel,
OS.emitSymbolValue(FnLabel, 8);
LLVM_DEBUG(dbgs() << WFMP << " #faulting PCs: " << FFI.size() << "\n");
- OS.emitIntValue(FFI.size(), 4);
+ OS.emitInt32(FFI.size());
- OS.emitIntValue(0, 4); // Reserved
+ OS.emitInt32(0); // Reserved
for (auto &Fault : FFI) {
LLVM_DEBUG(dbgs() << WFMP << " fault type: "
<< faultTypeToString(Fault.Kind) << "\n");
- OS.emitIntValue(Fault.Kind, 4);
+ OS.emitInt32(Fault.Kind);
LLVM_DEBUG(dbgs() << WFMP << " faulting PC offset: "
<< *Fault.FaultingOffsetExpr << "\n");
diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp
index daf3fd36c006..1e060ecbeb43 100644
--- a/llvm/lib/CodeGen/StackMaps.cpp
+++ b/llvm/lib/CodeGen/StackMaps.cpp
@@ -415,17 +415,17 @@ void StackMaps::emitStackmapHeader(MCStreamer &OS) {
// Header.
OS.emitIntValue(StackMapVersion, 1); // Version.
OS.emitIntValue(0, 1); // Reserved.
- OS.emitIntValue(0, 2); // Reserved.
+ OS.emitInt16(0); // Reserved.
// Num functions.
LLVM_DEBUG(dbgs() << WSMP << "#functions = " << FnInfos.size() << '\n');
- OS.emitIntValue(FnInfos.size(), 4);
+ OS.emitInt32(FnInfos.size());
// Num constants.
LLVM_DEBUG(dbgs() << WSMP << "#constants = " << ConstPool.size() << '\n');
- OS.emitIntValue(ConstPool.size(), 4);
+ OS.emitInt32(ConstPool.size());
// Num callsites.
LLVM_DEBUG(dbgs() << WSMP << "#callsites = " << CSInfos.size() << '\n');
- OS.emitIntValue(CSInfos.size(), 4);
+ OS.emitInt32(CSInfos.size());
}
/// Emit the function frame record for each function.
@@ -503,11 +503,11 @@ void StackMaps::emitCallsiteEntries(MCStreamer &OS) {
if (CSLocs.size() > UINT16_MAX || LiveOuts.size() > UINT16_MAX) {
OS.emitIntValue(UINT64_MAX, 8); // Invalid ID.
OS.emitValue(CSI.CSOffsetExpr, 4);
- OS.emitIntValue(0, 2); // Reserved.
- OS.emitIntValue(0, 2); // 0 locations.
- OS.emitIntValue(0, 2); // padding.
- OS.emitIntValue(0, 2); // 0 live-out registers.
- OS.emitIntValue(0, 4); // padding.
+ OS.emitInt16(0); // Reserved.
+ OS.emitInt16(0); // 0 locations.
+ OS.emitInt16(0); // padding.
+ OS.emitInt16(0); // 0 live-out registers.
+ OS.emitInt32(0); // padding.
continue;
}
@@ -515,27 +515,27 @@ void StackMaps::emitCallsiteEntries(MCStreamer &OS) {
OS.emitValue(CSI.CSOffsetExpr, 4);
// Reserved for flags.
- OS.emitIntValue(0, 2);
- OS.emitIntValue(CSLocs.size(), 2);
+ OS.emitInt16(0);
+ OS.emitInt16(CSLocs.size());
for (const auto &Loc : CSLocs) {
OS.emitIntValue(Loc.Type, 1);
OS.emitIntValue(0, 1); // Reserved
- OS.emitIntValue(Loc.Size, 2);
- OS.emitIntValue(Loc.Reg, 2);
- OS.emitIntValue(0, 2); // Reserved
- OS.emitIntValue(Loc.Offset, 4);
+ OS.emitInt16(Loc.Size);
+ OS.emitInt16(Loc.Reg);
+ OS.emitInt16(0); // Reserved
+ OS.emitInt32(Loc.Offset);
}
// Emit alignment to 8 byte.
OS.emitValueToAlignment(8);
// Num live-out registers and padding to align to 4 byte.
- OS.emitIntValue(0, 2);
- OS.emitIntValue(LiveOuts.size(), 2);
+ OS.emitInt16(0);
+ OS.emitInt16(LiveOuts.size());
for (const auto &LO : LiveOuts) {
- OS.emitIntValue(LO.DwarfRegNum, 2);
+ OS.emitInt16(LO.DwarfRegNum);
OS.emitIntValue(0, 1);
OS.emitIntValue(LO.Size, 1);
}
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index ff23b2d8386c..ad0914862b4d 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -278,7 +278,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
report_fatal_error("invalid llvm.linker.options");
for (const auto &Option : cast<MDNode>(Operand)->operands()) {
Streamer.emitBytes(cast<MDString>(Option)->getString());
- Streamer.emitIntValue(0, 1);
+ Streamer.emitInt8(0);
}
}
}
@@ -292,7 +292,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
for (const auto *Operand : DependentLibraries->operands()) {
Streamer.emitBytes(
cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
- Streamer.emitIntValue(0, 1);
+ Streamer.emitInt8(0);
}
}
@@ -305,8 +305,8 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
Streamer.SwitchSection(S);
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
- Streamer.emitIntValue(Version, 4);
- Streamer.emitIntValue(Flags, 4);
+ Streamer.emitInt32(Version);
+ Streamer.emitInt32(Flags);
Streamer.AddBlankLine();
}
@@ -922,8 +922,8 @@ void TargetLoweringObjectFileMachO::emitModuleMetadata(MCStreamer &Streamer,
Streamer.SwitchSection(S);
Streamer.emitLabel(getContext().
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
- Streamer.emitIntValue(VersionVal, 4);
- Streamer.emitIntValue(ImageInfoFlags, 4);
+ Streamer.emitInt32(VersionVal);
+ Streamer.emitInt32(ImageInfoFlags);
Streamer.AddBlankLine();
}
@@ -1475,8 +1475,8 @@ void TargetLoweringObjectFileCOFF::emitModuleMetadata(MCStreamer &Streamer,
SectionKind::getReadOnly());
Streamer.SwitchSection(S);
Streamer.emitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
- Streamer.emitIntValue(Version, 4);
- Streamer.emitIntValue(Flags, 4);
+ Streamer.emitInt32(Version);
+ Streamer.emitInt32(Flags);
Streamer.AddBlankLine();
}
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 82dfeccc8b38..8dda75e14301 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -172,7 +172,7 @@ void CodeViewContext::emitStringTable(MCObjectStreamer &OS) {
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 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
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 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
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 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
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 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
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 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS,
->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 ffe6bb3e26d4..ecf7581b3ef3 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -163,38 +163,38 @@ static inline void emitDwarfLineTable(
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 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
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 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
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 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
// 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 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
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 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
// 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 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
// 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 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
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 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
// 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 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
// 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 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
// 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 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
// 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 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
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 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
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 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
? 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 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
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 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
// 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 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
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 @@ class FrameEmitterImpl {
} // 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 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
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 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
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 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
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 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
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 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
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 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) {
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 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
// 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 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
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 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
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 a449e8038986..71f30d38f121 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -368,11 +368,11 @@ void MCELFStreamer::emitIdent(StringRef IdentString) {
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 57e152156475..a3d2d9f3d3ba 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3104,11 +3104,11 @@ bool AsmParser::parseDirectiveOctaValue(StringRef IDVal) {
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 @@ bool AsmParser::parseDirectiveCVString() {
// 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 7e1c0734f9d5..6d8a8a71468c 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -806,12 +806,12 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
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 9e08e8278c75..ac288ca08c93 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -69,59 +69,59 @@ static void EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin,
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 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
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 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
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 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
// 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 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
// 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 @@ static void ARM64EmitUnwindCode(MCStreamer &streamer, const MCSymbol *begin,
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 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
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 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
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 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
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 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
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(
diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index f6f80059920f..d3b5bb002102 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -226,16 +226,16 @@ void AArch64AsmPrinter::emitStartOfAsmFile(Module &M) {
// Emit the note header.
emitAlignment(Align(8));
- OutStreamer->emitIntValue(4, 4); // data size for "GNU\0"
- OutStreamer->emitIntValue(4 * 4, 4); // Elf_Prop size
- OutStreamer->emitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4);
+ OutStreamer->emitInt32(4); // data size for "GNU\0"
+ OutStreamer->emitInt32(4 * 4); // Elf_Prop size
+ OutStreamer->emitInt32(ELF::NT_GNU_PROPERTY_TYPE_0);
OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
// Emit the PAC/BTI properties.
- OutStreamer->emitIntValue(ELF::GNU_PROPERTY_AARCH64_FEATURE_1_AND, 4);
- OutStreamer->emitIntValue(4, 4); // data size
- OutStreamer->emitIntValue(Flags, 4); // data
- OutStreamer->emitIntValue(0, 4); // pad
+ OutStreamer->emitInt32(ELF::GNU_PROPERTY_AARCH64_FEATURE_1_AND);
+ OutStreamer->emitInt32(4); // data size
+ OutStreamer->emitInt32(Flags); // data
+ OutStreamer->emitInt32(0); // pad
OutStreamer->endSection(Nt);
OutStreamer->SwitchSection(Cur);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 0d8447dc3f01..c1915464d177 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -1124,40 +1124,41 @@ void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,
unsigned RsrcReg = getRsrcReg(MF.getFunction().getCallingConv());
if (AMDGPU::isCompute(MF.getFunction().getCallingConv())) {
- OutStreamer->emitIntValue(R_00B848_COMPUTE_PGM_RSRC1, 4);
+ OutStreamer->emitInt32(R_00B848_COMPUTE_PGM_RSRC1);
- OutStreamer->emitIntValue(CurrentProgramInfo.ComputePGMRSrc1, 4);
+ OutStreamer->emitInt32(CurrentProgramInfo.ComputePGMRSrc1);
- OutStreamer->emitIntValue(R_00B84C_COMPUTE_PGM_RSRC2, 4);
- OutStreamer->emitIntValue(CurrentProgramInfo.ComputePGMRSrc2, 4);
+ OutStreamer->emitInt32(R_00B84C_COMPUTE_PGM_RSRC2);
+ OutStreamer->emitInt32(CurrentProgramInfo.ComputePGMRSrc2);
- OutStreamer->emitIntValue(R_00B860_COMPUTE_TMPRING_SIZE, 4);
- OutStreamer->emitIntValue(S_00B860_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
+ OutStreamer->emitInt32(R_00B860_COMPUTE_TMPRING_SIZE);
+ OutStreamer->emitInt32(S_00B860_WAVESIZE(CurrentProgramInfo.ScratchBlocks));
// TODO: Should probably note flat usage somewhere. SC emits a "FlatPtr32 =
// 0" comment but I don't see a corresponding field in the register spec.
} else {
- OutStreamer->emitIntValue(RsrcReg, 4);
+ OutStreamer->emitInt32(RsrcReg);
OutStreamer->emitIntValue(S_00B028_VGPRS(CurrentProgramInfo.VGPRBlocks) |
S_00B028_SGPRS(CurrentProgramInfo.SGPRBlocks), 4);
- OutStreamer->emitIntValue(R_0286E8_SPI_TMPRING_SIZE, 4);
+ OutStreamer->emitInt32(R_0286E8_SPI_TMPRING_SIZE);
OutStreamer->emitIntValue(
S_0286E8_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
}
if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_PS) {
- OutStreamer->emitIntValue(R_00B02C_SPI_SHADER_PGM_RSRC2_PS, 4);
- OutStreamer->emitIntValue(S_00B02C_EXTRA_LDS_SIZE(CurrentProgramInfo.LDSBlocks), 4);
- OutStreamer->emitIntValue(R_0286CC_SPI_PS_INPUT_ENA, 4);
- OutStreamer->emitIntValue(MFI->getPSInputEnable(), 4);
- OutStreamer->emitIntValue(R_0286D0_SPI_PS_INPUT_ADDR, 4);
- OutStreamer->emitIntValue(MFI->getPSInputAddr(), 4);
+ OutStreamer->emitInt32(R_00B02C_SPI_SHADER_PGM_RSRC2_PS);
+ OutStreamer->emitInt32(
+ S_00B02C_EXTRA_LDS_SIZE(CurrentProgramInfo.LDSBlocks));
+ OutStreamer->emitInt32(R_0286CC_SPI_PS_INPUT_ENA);
+ OutStreamer->emitInt32(MFI->getPSInputEnable());
+ OutStreamer->emitInt32(R_0286D0_SPI_PS_INPUT_ADDR);
+ OutStreamer->emitInt32(MFI->getPSInputAddr());
}
- OutStreamer->emitIntValue(R_SPILLED_SGPRS, 4);
- OutStreamer->emitIntValue(MFI->getNumSpilledSGPRs(), 4);
- OutStreamer->emitIntValue(R_SPILLED_VGPRS, 4);
- OutStreamer->emitIntValue(MFI->getNumSpilledVGPRs(), 4);
+ OutStreamer->emitInt32(R_SPILLED_SGPRS);
+ OutStreamer->emitInt32(MFI->getNumSpilledSGPRs());
+ OutStreamer->emitInt32(R_SPILLED_VGPRS);
+ OutStreamer->emitInt32(MFI->getNumSpilledVGPRs());
}
// This is the equivalent of EmitProgramInfoSI above, but for when the OS type
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
index c7ccd0aa04ac..362952fe813f 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -441,9 +441,9 @@ void AMDGPUTargetELFStreamer::EmitNote(
S.PushSection();
S.SwitchSection(Context.getELFSection(
ElfNote::SectionName, ELF::SHT_NOTE, ELF::SHF_ALLOC));
- S.emitIntValue(NameSZ, 4); // namesz
+ S.emitInt32(NameSZ); // namesz
S.emitValue(DescSZ, 4); // descz
- S.emitIntValue(NoteType, 4); // type
+ S.emitInt32(NoteType); // type
S.emitBytes(Name); // name
S.emitValueToAlignment(4, 0, 1, 0); // padding 0
EmitDesc(S); // desc
@@ -458,8 +458,8 @@ void AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectVersion(
EmitNote(ElfNote::NoteNameV2, MCConstantExpr::create(8, getContext()),
ElfNote::NT_AMDGPU_HSA_CODE_OBJECT_VERSION, [&](MCELFStreamer &OS) {
- OS.emitIntValue(Major, 4);
- OS.emitIntValue(Minor, 4);
+ OS.emitInt32(Major);
+ OS.emitInt32(Minor);
});
}
@@ -478,15 +478,15 @@ AMDGPUTargetELFStreamer::EmitDirectiveHSACodeObjectISA(uint32_t Major,
EmitNote(ElfNote::NoteNameV2, MCConstantExpr::create(DescSZ, getContext()),
ElfNote::NT_AMDGPU_HSA_ISA, [&](MCELFStreamer &OS) {
- OS.emitIntValue(VendorNameSize, 2);
- OS.emitIntValue(ArchNameSize, 2);
- OS.emitIntValue(Major, 4);
- OS.emitIntValue(Minor, 4);
- OS.emitIntValue(Stepping, 4);
+ OS.emitInt16(VendorNameSize);
+ OS.emitInt16(ArchNameSize);
+ OS.emitInt32(Major);
+ OS.emitInt32(Minor);
+ OS.emitInt32(Stepping);
OS.emitBytes(VendorName);
- OS.emitIntValue(0, 1); // NULL terminate VendorName
+ OS.emitInt8(0); // NULL terminate VendorName
OS.emitBytes(ArchName);
- OS.emitIntValue(0, 1); // NULL terminte ArchName
+ OS.emitInt8(0); // NULL terminte ArchName
});
}
@@ -604,7 +604,7 @@ bool AMDGPUTargetELFStreamer::EmitCodeEnd() {
OS.PushSection();
OS.emitValueToAlignment(64, Encoded_s_code_end, 4);
for (unsigned I = 0; I < 48; ++I)
- OS.emitIntValue(Encoded_s_code_end, 4);
+ OS.emitInt32(Encoded_s_code_end);
OS.PopSection();
return true;
}
diff --git a/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp b/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
index e811dde4bf01..d363baa15507 100644
--- a/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
@@ -88,14 +88,14 @@ void R600AsmPrinter::EmitProgramInfoR600(const MachineFunction &MF) {
}
}
- OutStreamer->emitIntValue(RsrcReg, 4);
+ OutStreamer->emitInt32(RsrcReg);
OutStreamer->emitIntValue(S_NUM_GPRS(MaxGPR + 1) |
S_STACK_SIZE(MFI->CFStackSize), 4);
- OutStreamer->emitIntValue(R_02880C_DB_SHADER_CONTROL, 4);
- OutStreamer->emitIntValue(S_02880C_KILL_ENABLE(killPixel), 4);
+ OutStreamer->emitInt32(R_02880C_DB_SHADER_CONTROL);
+ OutStreamer->emitInt32(S_02880C_KILL_ENABLE(killPixel));
if (AMDGPU::isCompute(MF.getFunction().getCallingConv())) {
- OutStreamer->emitIntValue(R_0288E8_SQ_LDS_ALLOC, 4);
+ OutStreamer->emitInt32(R_0288E8_SQ_LDS_ALLOC);
OutStreamer->emitIntValue(alignTo(MFI->getLDSSize(), 4) >> 2, 4);
}
}
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index ef9804ab63a5..6aeb57dbb5dc 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -1079,7 +1079,7 @@ void ARMTargetELFStreamer::finishAttributeSection() {
Streamer.SwitchSection(AttributeSection);
// Format version
- Streamer.emitIntValue(0x41, 1);
+ Streamer.emitInt8(0x41);
}
// Vendor size + Vendor name + '\0'
@@ -1090,12 +1090,12 @@ void ARMTargetELFStreamer::finishAttributeSection() {
const size_t ContentsSize = calculateContentSize();
- Streamer.emitIntValue(VendorHeaderSize + TagHeaderSize + ContentsSize, 4);
+ Streamer.emitInt32(VendorHeaderSize + TagHeaderSize + ContentsSize);
Streamer.emitBytes(CurrentVendor);
- Streamer.emitIntValue(0, 1); // '\0'
+ Streamer.emitInt8(0); // '\0'
- Streamer.emitIntValue(ARMBuildAttrs::File, 1);
- Streamer.emitIntValue(TagHeaderSize + ContentsSize, 4);
+ Streamer.emitInt8(ARMBuildAttrs::File);
+ Streamer.emitInt32(TagHeaderSize + ContentsSize);
// Size should have been accounted for already, now
// emit each field as its type (ULEB or String)
@@ -1109,12 +1109,12 @@ void ARMTargetELFStreamer::finishAttributeSection() {
break;
case AttributeItem::TextAttribute:
Streamer.emitBytes(item.StringValue);
- Streamer.emitIntValue(0, 1); // '\0'
+ Streamer.emitInt8(0); // '\0'
break;
case AttributeItem::NumericAndTextAttributes:
Streamer.emitULEB128IntValue(item.IntValue);
Streamer.emitBytes(item.StringValue);
- Streamer.emitIntValue(0, 1); // '\0'
+ Streamer.emitInt8(0); // '\0'
break;
}
}
@@ -1275,7 +1275,7 @@ void ARMELFStreamer::emitFnEnd() {
emitValue(FnStartRef, 4);
if (CantUnwind) {
- emitIntValue(ARM::EHABI::EXIDX_CANTUNWIND, 4);
+ emitInt32(ARM::EHABI::EXIDX_CANTUNWIND);
} else if (ExTab) {
// Emit a reference to the unwind opcodes in the ".ARM.extab" section.
const MCSymbolRefExpr *ExTabEntryRef =
@@ -1374,7 +1374,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
Opcodes[I + 1] << 8 |
Opcodes[I + 2] << 16 |
Opcodes[I + 3] << 24;
- emitIntValue(Intval, 4);
+ emitInt32(Intval);
}
// According to ARM EHABI section 9.2, if the __aeabi_unwind_cpp_pr1() or
@@ -1385,7 +1385,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
// In case that the .handlerdata directive is not specified by the
// programmer, we should emit zero to terminate the handler data.
if (NoHandlerData && !Personality)
- emitIntValue(0, 4);
+ emitInt32(0);
}
void ARMELFStreamer::emitHandlerData() { FlushUnwindOpcodes(false); }
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 529b612967fc..da9dfad93029 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -34,10 +34,10 @@ static const char *BTFKindStr[] = {
void BTFTypeBase::emitType(MCStreamer &OS) {
OS.AddComment(std::string(BTFKindStr[Kind]) + "(id = " + std::to_string(Id) +
")");
- OS.emitIntValue(BTFType.NameOff, 4);
+ OS.emitInt32(BTFType.NameOff);
OS.AddComment("0x" + Twine::utohexstr(BTFType.Info));
- OS.emitIntValue(BTFType.Info, 4);
- OS.emitIntValue(BTFType.Size, 4);
+ OS.emitInt32(BTFType.Info);
+ OS.emitInt32(BTFType.Size);
}
BTFTypeDerived::BTFTypeDerived(const DIDerivedType *DTy, unsigned Tag,
@@ -148,7 +148,7 @@ void BTFTypeInt::completeType(BTFDebug &BDebug) {
void BTFTypeInt::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
OS.AddComment("0x" + Twine::utohexstr(IntVal));
- OS.emitIntValue(IntVal, 4);
+ OS.emitInt32(IntVal);
}
BTFTypeEnum::BTFTypeEnum(const DICompositeType *ETy, uint32_t VLen) : ETy(ETy) {
@@ -179,8 +179,8 @@ void BTFTypeEnum::completeType(BTFDebug &BDebug) {
void BTFTypeEnum::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
for (const auto &Enum : EnumValues) {
- OS.emitIntValue(Enum.NameOff, 4);
- OS.emitIntValue(Enum.Val, 4);
+ OS.emitInt32(Enum.NameOff);
+ OS.emitInt32(Enum.Val);
}
}
@@ -209,9 +209,9 @@ void BTFTypeArray::completeType(BTFDebug &BDebug) {
void BTFTypeArray::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
- OS.emitIntValue(ArrayInfo.ElemType, 4);
- OS.emitIntValue(ArrayInfo.IndexType, 4);
- OS.emitIntValue(ArrayInfo.Nelems, 4);
+ OS.emitInt32(ArrayInfo.ElemType);
+ OS.emitInt32(ArrayInfo.IndexType);
+ OS.emitInt32(ArrayInfo.Nelems);
}
/// Represent either a struct or a union.
@@ -252,10 +252,10 @@ void BTFTypeStruct::completeType(BTFDebug &BDebug) {
void BTFTypeStruct::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
for (const auto &Member : Members) {
- OS.emitIntValue(Member.NameOff, 4);
- OS.emitIntValue(Member.Type, 4);
+ OS.emitInt32(Member.NameOff);
+ OS.emitInt32(Member.Type);
OS.AddComment("0x" + Twine::utohexstr(Member.Offset));
- OS.emitIntValue(Member.Offset, 4);
+ OS.emitInt32(Member.Offset);
}
}
@@ -303,8 +303,8 @@ void BTFTypeFuncProto::completeType(BTFDebug &BDebug) {
void BTFTypeFuncProto::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
for (const auto &Param : Parameters) {
- OS.emitIntValue(Param.NameOff, 4);
- OS.emitIntValue(Param.Type, 4);
+ OS.emitInt32(Param.NameOff);
+ OS.emitInt32(Param.Type);
}
}
@@ -340,7 +340,7 @@ void BTFKindVar::completeType(BTFDebug &BDebug) {
void BTFKindVar::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
- OS.emitIntValue(Info, 4);
+ OS.emitInt32(Info);
}
BTFKindDataSec::BTFKindDataSec(AsmPrinter *AsmPrt, std::string SecName)
@@ -359,9 +359,9 @@ void BTFKindDataSec::emitType(MCStreamer &OS) {
BTFTypeBase::emitType(OS);
for (const auto &V : Vars) {
- OS.emitIntValue(std::get<0>(V), 4);
+ OS.emitInt32(std::get<0>(V));
Asm->emitLabelReference(std::get<1>(V), 4);
- OS.emitIntValue(std::get<2>(V), 4);
+ OS.emitInt32(std::get<2>(V));
}
}
@@ -712,8 +712,8 @@ void BTFDebug::constructLineInfo(const DISubprogram *SP, MCSymbol *Label,
void BTFDebug::emitCommonHeader() {
OS.AddComment("0x" + Twine::utohexstr(BTF::MAGIC));
OS.emitIntValue(BTF::MAGIC, 2);
- OS.emitIntValue(BTF::VERSION, 1);
- OS.emitIntValue(0, 1);
+ OS.emitInt8(BTF::VERSION);
+ OS.emitInt8(0);
}
void BTFDebug::emitBTFSection() {
@@ -726,17 +726,17 @@ void BTFDebug::emitBTFSection() {
// Emit header.
emitCommonHeader();
- OS.emitIntValue(BTF::HeaderSize, 4);
+ OS.emitInt32(BTF::HeaderSize);
uint32_t TypeLen = 0, StrLen;
for (const auto &TypeEntry : TypeEntries)
TypeLen += TypeEntry->getSize();
StrLen = StringTable.getSize();
- OS.emitIntValue(0, 4);
- OS.emitIntValue(TypeLen, 4);
- OS.emitIntValue(TypeLen, 4);
- OS.emitIntValue(StrLen, 4);
+ OS.emitInt32(0);
+ OS.emitInt32(TypeLen);
+ OS.emitInt32(TypeLen);
+ OS.emitInt32(StrLen);
// Emit type table.
for (const auto &TypeEntry : TypeEntries)
@@ -764,7 +764,7 @@ void BTFDebug::emitBTFExtSection() {
// Emit header.
emitCommonHeader();
- OS.emitIntValue(BTF::ExtHeaderSize, 4);
+ OS.emitInt32(BTF::ExtHeaderSize);
// Account for FuncInfo/LineInfo record size as well.
uint32_t FuncLen = 4, LineLen = 4;
@@ -786,59 +786,59 @@ void BTFDebug::emitBTFExtSection() {
if (FieldRelocLen)
FieldRelocLen += 4;
- OS.emitIntValue(0, 4);
- OS.emitIntValue(FuncLen, 4);
- OS.emitIntValue(FuncLen, 4);
- OS.emitIntValue(LineLen, 4);
- OS.emitIntValue(FuncLen + LineLen, 4);
- OS.emitIntValue(FieldRelocLen, 4);
+ OS.emitInt32(0);
+ OS.emitInt32(FuncLen);
+ OS.emitInt32(FuncLen);
+ OS.emitInt32(LineLen);
+ OS.emitInt32(FuncLen + LineLen);
+ OS.emitInt32(FieldRelocLen);
// Emit func_info table.
OS.AddComment("FuncInfo");
- OS.emitIntValue(BTF::BPFFuncInfoSize, 4);
+ OS.emitInt32(BTF::BPFFuncInfoSize);
for (const auto &FuncSec : FuncInfoTable) {
OS.AddComment("FuncInfo section string offset=" +
std::to_string(FuncSec.first));
- OS.emitIntValue(FuncSec.first, 4);
- OS.emitIntValue(FuncSec.second.size(), 4);
+ OS.emitInt32(FuncSec.first);
+ OS.emitInt32(FuncSec.second.size());
for (const auto &FuncInfo : FuncSec.second) {
Asm->emitLabelReference(FuncInfo.Label, 4);
- OS.emitIntValue(FuncInfo.TypeId, 4);
+ OS.emitInt32(FuncInfo.TypeId);
}
}
// Emit line_info table.
OS.AddComment("LineInfo");
- OS.emitIntValue(BTF::BPFLineInfoSize, 4);
+ OS.emitInt32(BTF::BPFLineInfoSize);
for (const auto &LineSec : LineInfoTable) {
OS.AddComment("LineInfo section string offset=" +
std::to_string(LineSec.first));
- OS.emitIntValue(LineSec.first, 4);
- OS.emitIntValue(LineSec.second.size(), 4);
+ OS.emitInt32(LineSec.first);
+ OS.emitInt32(LineSec.second.size());
for (const auto &LineInfo : LineSec.second) {
Asm->emitLabelReference(LineInfo.Label, 4);
- OS.emitIntValue(LineInfo.FileNameOff, 4);
- OS.emitIntValue(LineInfo.LineOff, 4);
+ OS.emitInt32(LineInfo.FileNameOff);
+ OS.emitInt32(LineInfo.LineOff);
OS.AddComment("Line " + std::to_string(LineInfo.LineNum) + " Col " +
std::to_string(LineInfo.ColumnNum));
- OS.emitIntValue(LineInfo.LineNum << 10 | LineInfo.ColumnNum, 4);
+ OS.emitInt32(LineInfo.LineNum << 10 | LineInfo.ColumnNum);
}
}
// Emit field reloc table.
if (FieldRelocLen) {
OS.AddComment("FieldReloc");
- OS.emitIntValue(BTF::BPFFieldRelocSize, 4);
+ OS.emitInt32(BTF::BPFFieldRelocSize);
for (const auto &FieldRelocSec : FieldRelocTable) {
OS.AddComment("Field reloc section string offset=" +
std::to_string(FieldRelocSec.first));
- OS.emitIntValue(FieldRelocSec.first, 4);
- OS.emitIntValue(FieldRelocSec.second.size(), 4);
+ OS.emitInt32(FieldRelocSec.first);
+ OS.emitInt32(FieldRelocSec.second.size());
for (const auto &FieldRelocInfo : FieldRelocSec.second) {
Asm->emitLabelReference(FieldRelocInfo.Label, 4);
- OS.emitIntValue(FieldRelocInfo.TypeID, 4);
- OS.emitIntValue(FieldRelocInfo.OffsetNameOff, 4);
- OS.emitIntValue(FieldRelocInfo.RelocKind, 4);
+ OS.emitInt32(FieldRelocInfo.TypeID);
+ OS.emitInt32(FieldRelocInfo.OffsetNameOff);
+ OS.emitInt32(FieldRelocInfo.RelocKind);
}
}
}
diff --git a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp
index e8a120c652ec..87ee312424c8 100644
--- a/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp
+++ b/llvm/lib/Target/MSP430/MCTargetDesc/MSP430ELFStreamer.cpp
@@ -43,26 +43,26 @@ MSP430TargetELFStreamer::MSP430TargetELFStreamer(MCStreamer &S,
Streamer.SwitchSection(AttributeSection);
// Format version.
- Streamer.emitIntValue(0x41, 1);
+ Streamer.emitInt8(0x41);
// Subsection length.
- Streamer.emitIntValue(22, 4);
+ Streamer.emitInt32(22);
// Vendor name string, zero-terminated.
Streamer.emitBytes("mspabi");
- Streamer.emitIntValue(0, 1);
+ Streamer.emitInt8(0);
// Attribute vector scope tag. 1 stands for the entire file.
- Streamer.emitIntValue(1, 1);
+ Streamer.emitInt8(1);
// Attribute vector length.
- Streamer.emitIntValue(11, 4);
+ Streamer.emitInt32(11);
// OFBA_MSPABI_Tag_ISA(4) = 1, MSP430
- Streamer.emitIntValue(4, 1);
- Streamer.emitIntValue(1, 1);
+ Streamer.emitInt8(4);
+ Streamer.emitInt8(1);
// OFBA_MSPABI_Tag_Code_Model(6) = 1, Small
- Streamer.emitIntValue(6, 1);
- Streamer.emitIntValue(1, 1);
+ Streamer.emitInt8(6);
+ Streamer.emitInt8(1);
// OFBA_MSPABI_Tag_Data_Model(8) = 1, Small
- Streamer.emitIntValue(8, 1);
- Streamer.emitIntValue(1, 1);
+ Streamer.emitInt8(8);
+ Streamer.emitInt8(1);
}
MCELFStreamer &MSP430TargetELFStreamer::getStreamer() {
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index 99d5e61ffffc..7046f03cf082 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -3389,7 +3389,7 @@ bool MipsAsmParser::expandLoadSingleImmToFPR(MCInst &Inst, SMLoc IDLoc,
getStreamer().SwitchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
- getStreamer().emitIntValue(ImmOp32, 4);
+ getStreamer().emitInt32(ImmOp32);
getStreamer().SwitchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
index 509dc46289f0..a4a953bcd7c3 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
@@ -40,16 +40,16 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
Sec->setAlignment(Align(8));
Streamer->SwitchSection(Sec);
- Streamer->emitIntValue(ELF::ODK_REGINFO, 1); // kind
- Streamer->emitIntValue(40, 1); // size
- Streamer->emitIntValue(0, 2); // section
- Streamer->emitIntValue(0, 4); // info
- Streamer->emitIntValue(ri_gprmask, 4);
- Streamer->emitIntValue(0, 4); // pad
- Streamer->emitIntValue(ri_cprmask[0], 4);
- Streamer->emitIntValue(ri_cprmask[1], 4);
- Streamer->emitIntValue(ri_cprmask[2], 4);
- Streamer->emitIntValue(ri_cprmask[3], 4);
+ Streamer->emitInt8(ELF::ODK_REGINFO); // kind
+ Streamer->emitInt8(40); // size
+ Streamer->emitInt16(0); // section
+ Streamer->emitInt32(0); // info
+ Streamer->emitInt32(ri_gprmask);
+ Streamer->emitInt32(0); // pad
+ Streamer->emitInt32(ri_cprmask[0]);
+ Streamer->emitInt32(ri_cprmask[1]);
+ Streamer->emitInt32(ri_cprmask[2]);
+ Streamer->emitInt32(ri_cprmask[3]);
Streamer->emitIntValue(ri_gp_value, 8);
} else {
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
@@ -58,13 +58,13 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
Sec->setAlignment(MTS->getABI().IsN32() ? Align(8) : Align(4));
Streamer->SwitchSection(Sec);
- Streamer->emitIntValue(ri_gprmask, 4);
- Streamer->emitIntValue(ri_cprmask[0], 4);
- Streamer->emitIntValue(ri_cprmask[1], 4);
- Streamer->emitIntValue(ri_cprmask[2], 4);
- Streamer->emitIntValue(ri_cprmask[3], 4);
+ Streamer->emitInt32(ri_gprmask);
+ Streamer->emitInt32(ri_cprmask[0]);
+ Streamer->emitInt32(ri_cprmask[1]);
+ Streamer->emitInt32(ri_cprmask[2]);
+ Streamer->emitInt32(ri_cprmask[3]);
assert((ri_gp_value & 0xffffffff) == ri_gp_value);
- Streamer->emitIntValue(ri_gp_value, 4);
+ Streamer->emitInt32(ri_gp_value);
}
Streamer->PopSection();
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
index cd863a410da4..11251fb2b2ba 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp
@@ -372,13 +372,13 @@ void FPOStateMachine::emitFrameDataRecord(MCStreamer &OS, MCSymbol *Label) {
OS.emitAbsoluteSymbolDiff(Label, FPO->Begin, 4); // RvaStart
OS.emitAbsoluteSymbolDiff(FPO->End, Label, 4); // CodeSize
- OS.emitIntValue(LocalSize, 4);
- OS.emitIntValue(FPO->ParamsSize, 4);
- OS.emitIntValue(MaxStackSize, 4);
- OS.emitIntValue(FrameFuncStrTabOff, 4); // FrameFunc
+ OS.emitInt32(LocalSize);
+ OS.emitInt32(FPO->ParamsSize);
+ OS.emitInt32(MaxStackSize);
+ OS.emitInt32(FrameFuncStrTabOff); // FrameFunc
OS.emitAbsoluteSymbolDiff(FPO->PrologueEnd, Label, 2);
- OS.emitIntValue(SavedRegSize, 2);
- OS.emitIntValue(CurFlags, 4);
+ OS.emitInt16(SavedRegSize);
+ OS.emitInt32(CurFlags);
}
/// Compute and emit the real CodeView FrameData subsection.
@@ -398,7 +398,7 @@ bool X86WinCOFFTargetStreamer::emitFPOData(const MCSymbol *ProcSym, SMLoc L) {
MCSymbol *FrameBegin = Ctx.createTempSymbol(),
*FrameEnd = Ctx.createTempSymbol();
- OS.emitIntValue(unsigned(DebugSubsectionKind::FrameData), 4);
+ OS.emitInt32(unsigned(DebugSubsectionKind::FrameData));
OS.emitAbsoluteSymbolDiff(FrameEnd, FrameBegin, 4);
OS.emitLabel(FrameBegin);
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index f526e9f07951..5cfaf8d4fa05 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -604,9 +604,9 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
OutStreamer->emitBytes(StringRef("GNU", 4)); // note name
// Emitting an Elf_Prop for the CET properties.
- OutStreamer->emitIntValue(ELF::GNU_PROPERTY_X86_FEATURE_1_AND, 4);
- OutStreamer->emitIntValue(4, 4); // data size
- OutStreamer->emitIntValue(FeatureFlagsAnd, 4); // data
+ OutStreamer->emitInt32(ELF::GNU_PROPERTY_X86_FEATURE_1_AND);
+ OutStreamer->emitInt32(4); // data size
+ OutStreamer->emitInt32(FeatureFlagsAnd); // data
emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding
OutStreamer->endSection(Nt);
More information about the llvm-commits
mailing list