@@ -551,7 +551,7 @@ void CodeViewDebug::maybeRecordLocation(const DebugLoc &DL,
551
551
void CodeViewDebug::emitCodeViewMagicVersion () {
552
552
OS.emitValueToAlignment (4 );
553
553
OS.AddComment (" Debug section magic" );
554
- OS.emitIntValue (COFF::DEBUG_SECTION_MAGIC, 4 );
554
+ OS.emitInt32 (COFF::DEBUG_SECTION_MAGIC);
555
555
}
556
556
557
557
void CodeViewDebug::endModule () {
@@ -676,11 +676,11 @@ void CodeViewDebug::emitTypeGlobalHashes() {
676
676
677
677
OS.emitValueToAlignment (4 );
678
678
OS.AddComment (" Magic" );
679
- OS.emitIntValue (COFF::DEBUG_HASHES_SECTION_MAGIC, 4 );
679
+ OS.emitInt32 (COFF::DEBUG_HASHES_SECTION_MAGIC);
680
680
OS.AddComment (" Section Version" );
681
- OS.emitIntValue ( 0 , 2 );
681
+ OS.emitInt16 ( 0 );
682
682
OS.AddComment (" Hash Algorithm" );
683
- OS.emitIntValue (uint16_t (GlobalTypeHashAlg::SHA1_8), 2 );
683
+ OS.emitInt16 (uint16_t (GlobalTypeHashAlg::SHA1_8));
684
684
685
685
TypeIndex TI (TypeIndex::FirstNonSimpleIndex);
686
686
for (const auto &GHR : TypeTable.hashes ()) {
@@ -775,16 +775,16 @@ void CodeViewDebug::emitCompilerInformation() {
775
775
// TODO: Figure out which other flags need to be set.
776
776
777
777
OS.AddComment (" Flags and language" );
778
- OS.emitIntValue (Flags, 4 );
778
+ OS.emitInt32 (Flags);
779
779
780
780
OS.AddComment (" CPUType" );
781
- OS.emitIntValue (static_cast <uint64_t >(TheCPU), 2 );
781
+ OS.emitInt16 (static_cast <uint64_t >(TheCPU));
782
782
783
783
StringRef CompilerVersion = CU->getProducer ();
784
784
Version FrontVer = parseVersion (CompilerVersion);
785
785
OS.AddComment (" Frontend version" );
786
786
for (int N = 0 ; N < 4 ; ++N)
787
- OS.emitIntValue (FrontVer.Part [N], 2 );
787
+ OS.emitInt16 (FrontVer.Part [N]);
788
788
789
789
// Some Microsoft tools, like Binscope, expect a backend version number of at
790
790
// least 8.something, so we'll coerce the LLVM version into a form that
@@ -797,7 +797,7 @@ void CodeViewDebug::emitCompilerInformation() {
797
797
Version BackVer = {{ Major, 0 , 0 , 0 }};
798
798
OS.AddComment (" Backend version" );
799
799
for (int N = 0 ; N < 4 ; ++N)
800
- OS.emitIntValue (BackVer.Part [N], 2 );
800
+ OS.emitInt16 (BackVer.Part [N]);
801
801
802
802
OS.AddComment (" Null-terminated compiler version string" );
803
803
emitNullTerminatedSymbolName (OS, CompilerVersion);
@@ -841,7 +841,7 @@ void CodeViewDebug::emitBuildInfo() {
841
841
MCSymbol *BISubsecEnd = beginCVSubsection (DebugSubsectionKind::Symbols);
842
842
MCSymbol *BIEnd = beginSymbolRecord (SymbolKind::S_BUILDINFO);
843
843
OS.AddComment (" LF_BUILDINFO index" );
844
- OS.emitIntValue (BuildInfoIndex.getIndex (), 4 );
844
+ OS.emitInt32 (BuildInfoIndex.getIndex ());
845
845
endSymbolRecord (BIEnd);
846
846
endCVSubsection (BISubsecEnd);
847
847
}
@@ -858,7 +858,7 @@ void CodeViewDebug::emitInlineeLinesSubsection() {
858
858
// for instance, will display a warning that the breakpoints are not valid if
859
859
// the pdb does not match the source.
860
860
OS.AddComment (" Inlinee lines signature" );
861
- OS.emitIntValue (unsigned (InlineeLinesSignature::Normal), 4 );
861
+ OS.emitInt32 (unsigned (InlineeLinesSignature::Normal));
862
862
863
863
for (const DISubprogram *SP : InlinedSubprograms) {
864
864
assert (TypeIndices.count ({SP, nullptr }));
@@ -870,11 +870,11 @@ void CodeViewDebug::emitInlineeLinesSubsection() {
870
870
SP->getFilename () + Twine (' :' ) + Twine (SP->getLine ()));
871
871
OS.AddBlankLine ();
872
872
OS.AddComment (" Type index of inlined function" );
873
- OS.emitIntValue (InlineeIdx.getIndex (), 4 );
873
+ OS.emitInt32 (InlineeIdx.getIndex ());
874
874
OS.AddComment (" Offset into filechecksum table" );
875
875
OS.EmitCVFileChecksumOffsetDirective (FileId);
876
876
OS.AddComment (" Starting line number" );
877
- OS.emitIntValue (SP->getLine (), 4 );
877
+ OS.emitInt32 (SP->getLine ());
878
878
}
879
879
880
880
endCVSubsection (InlineEnd);
@@ -890,11 +890,11 @@ void CodeViewDebug::emitInlinedCallSite(const FunctionInfo &FI,
890
890
MCSymbol *InlineEnd = beginSymbolRecord (SymbolKind::S_INLINESITE);
891
891
892
892
OS.AddComment (" PtrParent" );
893
- OS.emitIntValue ( 0 , 4 );
893
+ OS.emitInt32 ( 0 );
894
894
OS.AddComment (" PtrEnd" );
895
- OS.emitIntValue ( 0 , 4 );
895
+ OS.emitInt32 ( 0 );
896
896
OS.AddComment (" Inlinee type index" );
897
- OS.emitIntValue (InlineeIdx.getIndex (), 4 );
897
+ OS.emitInt32 (InlineeIdx.getIndex ());
898
898
899
899
unsigned FileId = maybeRecordFile (Site.Inlinee ->getFile ());
900
900
unsigned StartLineNum = Site.Inlinee ->getLine ();
@@ -953,19 +953,19 @@ void CodeViewDebug::emitDebugInfoForThunk(const Function *GV,
953
953
// Emit S_THUNK32
954
954
MCSymbol *ThunkRecordEnd = beginSymbolRecord (SymbolKind::S_THUNK32);
955
955
OS.AddComment (" PtrParent" );
956
- OS.emitIntValue ( 0 , 4 );
956
+ OS.emitInt32 ( 0 );
957
957
OS.AddComment (" PtrEnd" );
958
- OS.emitIntValue ( 0 , 4 );
958
+ OS.emitInt32 ( 0 );
959
959
OS.AddComment (" PtrNext" );
960
- OS.emitIntValue ( 0 , 4 );
960
+ OS.emitInt32 ( 0 );
961
961
OS.AddComment (" Thunk section relative address" );
962
962
OS.EmitCOFFSecRel32 (Fn, /* Offset=*/ 0 );
963
963
OS.AddComment (" Thunk section index" );
964
964
OS.EmitCOFFSectionIndex (Fn);
965
965
OS.AddComment (" Code size" );
966
966
OS.emitAbsoluteSymbolDiff (FI.End , Fn, 2 );
967
967
OS.AddComment (" Ordinal" );
968
- OS.emitIntValue (unsigned (ordinal), 1 );
968
+ OS.emitInt8 (unsigned (ordinal));
969
969
OS.AddComment (" Function name" );
970
970
emitNullTerminatedSymbolName (OS, FuncName);
971
971
// Additional fields specific to the thunk ordinal would go here.
@@ -1023,27 +1023,27 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
1023
1023
1024
1024
// These fields are filled in by tools like CVPACK which run after the fact.
1025
1025
OS.AddComment (" PtrParent" );
1026
- OS.emitIntValue ( 0 , 4 );
1026
+ OS.emitInt32 ( 0 );
1027
1027
OS.AddComment (" PtrEnd" );
1028
- OS.emitIntValue ( 0 , 4 );
1028
+ OS.emitInt32 ( 0 );
1029
1029
OS.AddComment (" PtrNext" );
1030
- OS.emitIntValue ( 0 , 4 );
1030
+ OS.emitInt32 ( 0 );
1031
1031
// This is the important bit that tells the debugger where the function
1032
1032
// code is located and what's its size:
1033
1033
OS.AddComment (" Code size" );
1034
1034
OS.emitAbsoluteSymbolDiff (FI.End , Fn, 4 );
1035
1035
OS.AddComment (" Offset after prologue" );
1036
- OS.emitIntValue ( 0 , 4 );
1036
+ OS.emitInt32 ( 0 );
1037
1037
OS.AddComment (" Offset before epilogue" );
1038
- OS.emitIntValue ( 0 , 4 );
1038
+ OS.emitInt32 ( 0 );
1039
1039
OS.AddComment (" Function type index" );
1040
- OS.emitIntValue (getFuncIdForSubprogram (GV->getSubprogram ()).getIndex (), 4 );
1040
+ OS.emitInt32 (getFuncIdForSubprogram (GV->getSubprogram ()).getIndex ());
1041
1041
OS.AddComment (" Function section relative address" );
1042
1042
OS.EmitCOFFSecRel32 (Fn, /* Offset=*/ 0 );
1043
1043
OS.AddComment (" Function section index" );
1044
1044
OS.EmitCOFFSectionIndex (Fn);
1045
1045
OS.AddComment (" Flags" );
1046
- OS.emitIntValue ( 0 , 1 );
1046
+ OS.emitInt8 ( 0 );
1047
1047
// Emit the function display name as a null-terminated string.
1048
1048
OS.AddComment (" Function name" );
1049
1049
// Truncate the name so we won't overflow the record length field.
@@ -1053,19 +1053,19 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
1053
1053
MCSymbol *FrameProcEnd = beginSymbolRecord (SymbolKind::S_FRAMEPROC);
1054
1054
// Subtract out the CSR size since MSVC excludes that and we include it.
1055
1055
OS.AddComment (" FrameSize" );
1056
- OS.emitIntValue (FI.FrameSize - FI.CSRSize , 4 );
1056
+ OS.emitInt32 (FI.FrameSize - FI.CSRSize );
1057
1057
OS.AddComment (" Padding" );
1058
- OS.emitIntValue ( 0 , 4 );
1058
+ OS.emitInt32 ( 0 );
1059
1059
OS.AddComment (" Offset of padding" );
1060
- OS.emitIntValue ( 0 , 4 );
1060
+ OS.emitInt32 ( 0 );
1061
1061
OS.AddComment (" Bytes of callee saved registers" );
1062
- OS.emitIntValue (FI.CSRSize , 4 );
1062
+ OS.emitInt32 (FI.CSRSize );
1063
1063
OS.AddComment (" Exception handler offset" );
1064
- OS.emitIntValue ( 0 , 4 );
1064
+ OS.emitInt32 ( 0 );
1065
1065
OS.AddComment (" Exception handler section" );
1066
- OS.emitIntValue ( 0 , 2 );
1066
+ OS.emitInt16 ( 0 );
1067
1067
OS.AddComment (" Flags (defines frame register)" );
1068
- OS.emitIntValue (uint32_t (FI.FrameProcOpts ), 4 );
1068
+ OS.emitInt32 (uint32_t (FI.FrameProcOpts ));
1069
1069
endSymbolRecord (FrameProcEnd);
1070
1070
1071
1071
emitLocalVariableList (FI, FI.Locals );
@@ -1089,7 +1089,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
1089
1089
OS.EmitCOFFSecRel32 (Label, /* Offset=*/ 0 );
1090
1090
// FIXME: Make sure we don't overflow the max record size.
1091
1091
OS.EmitCOFFSectionIndex (Label);
1092
- OS.emitIntValue (Strs->getNumOperands (), 2 );
1092
+ OS.emitInt16 (Strs->getNumOperands ());
1093
1093
for (Metadata *MD : Strs->operands ()) {
1094
1094
// MDStrings are null terminated, so we can do EmitBytes and get the
1095
1095
// nice .asciz directive.
@@ -1112,7 +1112,7 @@ void CodeViewDebug::emitDebugInfoForFunction(const Function *GV,
1112
1112
OS.AddComment (" Call instruction length" );
1113
1113
OS.emitAbsoluteSymbolDiff (EndLabel, BeginLabel, 2 );
1114
1114
OS.AddComment (" Type index" );
1115
- OS.emitIntValue (getCompleteTypeIndex (DITy).getIndex (), 4 );
1115
+ OS.emitInt32 (getCompleteTypeIndex (DITy).getIndex ());
1116
1116
endSymbolRecord (HeapAllocEnd);
1117
1117
}
1118
1118
@@ -2626,9 +2626,9 @@ void CodeViewDebug::emitLocalVariable(const FunctionInfo &FI,
2626
2626
TypeIndex TI = Var.UseReferenceType
2627
2627
? getTypeIndexForReferenceTo (Var.DIVar ->getType ())
2628
2628
: getCompleteTypeIndex (Var.DIVar ->getType ());
2629
- OS.emitIntValue (TI.getIndex (), 4 );
2629
+ OS.emitInt32 (TI.getIndex ());
2630
2630
OS.AddComment (" Flags" );
2631
- OS.emitIntValue (static_cast <uint16_t >(Flags), 2 );
2631
+ OS.emitInt16 (static_cast <uint16_t >(Flags));
2632
2632
// Truncate the name so we won't overflow the record length field.
2633
2633
emitNullTerminatedSymbolName (OS, Var.DIVar ->getName ());
2634
2634
endSymbolRecord (LocalEnd);
@@ -2705,9 +2705,9 @@ void CodeViewDebug::emitLexicalBlock(const LexicalBlock &Block,
2705
2705
const FunctionInfo& FI) {
2706
2706
MCSymbol *RecordEnd = beginSymbolRecord (SymbolKind::S_BLOCK32);
2707
2707
OS.AddComment (" PtrParent" );
2708
- OS.emitIntValue ( 0 , 4 ); // PtrParent
2708
+ OS.emitInt32 ( 0 ); // PtrParent
2709
2709
OS.AddComment (" PtrEnd" );
2710
- OS.emitIntValue ( 0 , 4 ); // PtrEnd
2710
+ OS.emitInt32 ( 0 ); // PtrEnd
2711
2711
OS.AddComment (" Code size" );
2712
2712
OS.emitAbsoluteSymbolDiff (Block.End , Block.Begin , 4 ); // Code Size
2713
2713
OS.AddComment (" Function section relative address" );
@@ -2915,7 +2915,7 @@ void CodeViewDebug::beginInstruction(const MachineInstr *MI) {
2915
2915
MCSymbol *CodeViewDebug::beginCVSubsection (DebugSubsectionKind Kind) {
2916
2916
MCSymbol *BeginLabel = MMI->getContext ().createTempSymbol (),
2917
2917
*EndLabel = MMI->getContext ().createTempSymbol ();
2918
- OS.emitIntValue (unsigned (Kind), 4 );
2918
+ OS.emitInt32 (unsigned (Kind));
2919
2919
OS.AddComment (" Subsection size" );
2920
2920
OS.emitAbsoluteSymbolDiff (EndLabel, BeginLabel, 4 );
2921
2921
OS.emitLabel (BeginLabel);
@@ -2943,7 +2943,7 @@ MCSymbol *CodeViewDebug::beginSymbolRecord(SymbolKind SymKind) {
2943
2943
OS.emitLabel (BeginLabel);
2944
2944
if (OS.isVerboseAsm ())
2945
2945
OS.AddComment (" Record kind: " + getSymbolName (SymKind));
2946
- OS.emitIntValue (unsigned (SymKind), 2 );
2946
+ OS.emitInt16 (unsigned (SymKind));
2947
2947
return EndLabel;
2948
2948
}
2949
2949
@@ -2958,10 +2958,10 @@ void CodeViewDebug::endSymbolRecord(MCSymbol *SymEnd) {
2958
2958
2959
2959
void CodeViewDebug::emitEndSymbolRecord (SymbolKind EndKind) {
2960
2960
OS.AddComment (" Record length" );
2961
- OS.emitIntValue ( 2 , 2 );
2961
+ OS.emitInt16 ( 2 );
2962
2962
if (OS.isVerboseAsm ())
2963
2963
OS.AddComment (" Record kind: " + getSymbolName (EndKind));
2964
- OS.emitIntValue ( unsigned (EndKind), 2 ); // Record Kind
2964
+ OS.emitInt16 ( uint16_t (EndKind)); // Record Kind
2965
2965
}
2966
2966
2967
2967
void CodeViewDebug::emitDebugInfoForUDTs (
@@ -2972,7 +2972,7 @@ void CodeViewDebug::emitDebugInfoForUDTs(
2972
2972
2973
2973
MCSymbol *UDTRecordEnd = beginSymbolRecord (SymbolKind::S_UDT);
2974
2974
OS.AddComment (" Type" );
2975
- OS.emitIntValue (getCompleteTypeIndex (T).getIndex (), 4 );
2975
+ OS.emitInt32 (getCompleteTypeIndex (T).getIndex ());
2976
2976
emitNullTerminatedSymbolName (OS, UDT.first );
2977
2977
endSymbolRecord (UDTRecordEnd);
2978
2978
}
@@ -3088,7 +3088,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
3088
3088
: SymbolKind::S_GDATA32);
3089
3089
MCSymbol *DataEnd = beginSymbolRecord (DataSym);
3090
3090
OS.AddComment (" Type" );
3091
- OS.emitIntValue (getCompleteTypeIndex (DIGV->getType ()).getIndex (), 4 );
3091
+ OS.emitInt32 (getCompleteTypeIndex (DIGV->getType ()).getIndex ());
3092
3092
OS.AddComment (" DataOffset" );
3093
3093
OS.EmitCOFFSecRel32 (GVSym, /* Offset=*/ 0 );
3094
3094
OS.AddComment (" Segment" );
@@ -3107,7 +3107,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
3107
3107
3108
3108
MCSymbol *SConstantEnd = beginSymbolRecord (SymbolKind::S_CONSTANT);
3109
3109
OS.AddComment (" Type" );
3110
- OS.emitIntValue (getTypeIndex (DIGV->getType ()).getIndex (), 4 );
3110
+ OS.emitInt32 (getTypeIndex (DIGV->getType ()).getIndex ());
3111
3111
OS.AddComment (" Value" );
3112
3112
3113
3113
// Encoded integers shouldn't need more than 10 bytes.
0 commit comments