@@ -993,17 +993,24 @@ class CoverageMapping {
993
993
std::vector<FunctionRecord> Functions;
994
994
DenseMap<size_t , SmallVector<unsigned , 0 >> FilenameHash2RecordIndices;
995
995
std::vector<std::pair<std::string, uint64_t >> FuncHashMismatches;
996
+ StringRef Arch;
996
997
997
998
std::optional<bool > SingleByteCoverage;
998
999
999
1000
CoverageMapping () = default ;
1000
1001
1001
1002
// Load coverage records from readers.
1002
1003
static Error loadFromReaders (
1003
- ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
1004
- std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1005
- &ProfileReader,
1006
- CoverageMapping &Coverage);
1004
+ ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
1005
+ std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1006
+ &ProfileReader,
1007
+ CoverageMapping &Coverage, StringRef Arch);
1008
+
1009
+ static Error loadFromReaders (
1010
+ ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
1011
+ std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1012
+ &ProfileReader,
1013
+ CoverageMapping &Coverage);
1007
1014
1008
1015
// Load coverage records from file.
1009
1016
static Error
@@ -1018,6 +1025,8 @@ class CoverageMapping {
1018
1025
const CoverageMappingRecord &Record,
1019
1026
const std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1020
1027
&ProfileReader);
1028
+
1029
+ Error loadFunctionRecord (const CoverageMappingRecord &Record, const std::optional<std::reference_wrapper<IndexedInstrProfReader>> &ProfileReader, const std::string &Arch);
1021
1030
1022
1031
// / Look up the indices for function records which are at least partially
1023
1032
// / defined in the specified file. This is guaranteed to return a superset of
@@ -1027,6 +1036,13 @@ class CoverageMapping {
1027
1036
getImpreciseRecordIndicesForFilename (StringRef Filename) const ;
1028
1037
1029
1038
public:
1039
+
1040
+ const StringRef &getArchitecture () const { return Arch; }
1041
+
1042
+ void setArchitecture (StringRef NewArch){
1043
+ Arch = StringRef (NewArch);
1044
+ }
1045
+
1030
1046
CoverageMapping (const CoverageMapping &) = delete ;
1031
1047
CoverageMapping &operator =(const CoverageMapping &) = delete ;
1032
1048
@@ -1234,8 +1250,9 @@ uint64_t getFuncNameRef(const FuncRecordTy *Record) {
1234
1250
// / a hash.
1235
1251
template <class FuncRecordTy , llvm::endianness Endian>
1236
1252
Error getFuncNameViaRef (const FuncRecordTy *Record,
1237
- InstrProfSymtab &ProfileNames, StringRef &FuncName) {
1253
+ InstrProfSymtab &ProfileNames, StringRef &FuncName, StringRef Arch = " " ) {
1238
1254
uint64_t NameRef = getFuncNameRef<FuncRecordTy, Endian>(Record);
1255
+ ProfileNames.setArchitecture (Arch.str ());
1239
1256
FuncName = ProfileNames.getFuncOrVarName (NameRef);
1240
1257
return Error::success ();
1241
1258
}
@@ -1285,7 +1302,7 @@ struct CovMapFunctionRecordV1 {
1285
1302
1286
1303
// / Return the PGO name of the function.
1287
1304
template <llvm::endianness Endian>
1288
- Error getFuncName (InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
1305
+ Error getFuncName (InstrProfSymtab &ProfileNames, StringRef &FuncName, StringRef Arch = " " ) const {
1289
1306
IntPtrT NameRef = getFuncNameRef<Endian>();
1290
1307
uint32_t NameS = support::endian::byte_swap<uint32_t , Endian>(NameSize);
1291
1308
FuncName = ProfileNames.getFuncName (NameRef, NameS);
@@ -1334,7 +1351,7 @@ struct CovMapFunctionRecordV2 {
1334
1351
}
1335
1352
1336
1353
template <llvm::endianness Endian>
1337
- Error getFuncName (InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
1354
+ Error getFuncName (InstrProfSymtab &ProfileNames, StringRef &FuncName, StringRef Arch = " " ) const {
1338
1355
return accessors::getFuncNameViaRef<ThisT, Endian>(this , ProfileNames,
1339
1356
FuncName);
1340
1357
}
@@ -1378,9 +1395,9 @@ struct CovMapFunctionRecordV3 {
1378
1395
}
1379
1396
1380
1397
template <llvm::endianness Endian>
1381
- Error getFuncName (InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
1398
+ Error getFuncName (InstrProfSymtab &ProfileNames, StringRef &FuncName, StringRef Arch = " " ) const {
1382
1399
return accessors::getFuncNameViaRef<ThisT, Endian>(this , ProfileNames,
1383
- FuncName);
1400
+ FuncName, Arch );
1384
1401
}
1385
1402
1386
1403
// / Get the filename set reference.
0 commit comments