@@ -105,8 +105,8 @@ inline uint64_t getInstrMaxCountValue() {
105
105
// / \p AddSegmentInfo is true, a segment prefix and additional linker hints may
106
106
// / be added to the section name (this is the default).
107
107
LLVM_ABI std::string getInstrProfSectionName (InstrProfSectKind IPSK,
108
- Triple::ObjectFormatType OF,
109
- bool AddSegmentInfo = true );
108
+ Triple::ObjectFormatType OF,
109
+ bool AddSegmentInfo = true );
110
110
111
111
// / Return the name profile runtime entry point to do value profiling
112
112
// / for a given site.
@@ -222,17 +222,17 @@ LLVM_ABI bool isGPUProfTarget(const Module &M);
222
222
// / Return the modified name for function \c F suitable to be
223
223
// / used the key for profile lookup. Variable \c InLTO indicates if this
224
224
// / is called in LTO optimization passes.
225
- LLVM_ABI std::string getPGOFuncName (const Function &F, bool InLTO = false ,
226
- uint64_t Version = INSTR_PROF_INDEX_VERSION);
225
+ LLVM_ABI std::string
226
+ getPGOFuncName (const Function &F, bool InLTO = false ,
227
+ uint64_t Version = INSTR_PROF_INDEX_VERSION);
227
228
228
229
// / Return the modified name for a function suitable to be
229
230
// / used the key for profile lookup. The function's original
230
231
// / name is \c RawFuncName and has linkage of type \c Linkage.
231
232
// / The function is defined in module \c FileName.
232
- LLVM_ABI std::string getPGOFuncName (StringRef RawFuncName,
233
- GlobalValue::LinkageTypes Linkage,
234
- StringRef FileName,
235
- uint64_t Version = INSTR_PROF_INDEX_VERSION);
233
+ LLVM_ABI std::string
234
+ getPGOFuncName (StringRef RawFuncName, GlobalValue::LinkageTypes Linkage,
235
+ StringRef FileName, uint64_t Version = INSTR_PROF_INDEX_VERSION);
236
236
237
237
// / \return the modified name for function \c F suitable to be
238
238
// / used as the key for IRPGO profile lookup. \c InLTO indicates if this is
@@ -241,36 +241,38 @@ LLVM_ABI std::string getIRPGOFuncName(const Function &F, bool InLTO = false);
241
241
242
242
// / \return the filename and the function name parsed from the output of
243
243
// / \c getIRPGOFuncName()
244
- LLVM_ABI std::pair<StringRef, StringRef> getParsedIRPGOName (StringRef IRPGOName);
244
+ LLVM_ABI std::pair<StringRef, StringRef>
245
+ getParsedIRPGOName (StringRef IRPGOName);
245
246
246
247
// / Return the name of the global variable used to store a function
247
248
// / name in PGO instrumentation. \c FuncName is the IRPGO function name
248
249
// / (returned by \c getIRPGOFuncName) for LLVM IR instrumentation and PGO
249
250
// / function name (returned by \c getPGOFuncName) for front-end instrumentation.
250
251
LLVM_ABI std::string getPGOFuncNameVarName (StringRef FuncName,
251
- GlobalValue::LinkageTypes Linkage);
252
+ GlobalValue::LinkageTypes Linkage);
252
253
253
254
// / Create and return the global variable for function name used in PGO
254
255
// / instrumentation. \c FuncName is the IRPGO function name (returned by
255
256
// / \c getIRPGOFuncName) for LLVM IR instrumentation and PGO function name
256
257
// / (returned by \c getPGOFuncName) for front-end instrumentation.
257
- LLVM_ABI GlobalVariable *createPGOFuncNameVar (Function &F, StringRef PGOFuncName);
258
+ LLVM_ABI GlobalVariable *createPGOFuncNameVar (Function &F,
259
+ StringRef PGOFuncName);
258
260
259
261
// / Create and return the global variable for function name used in PGO
260
262
// / instrumentation. \c FuncName is the IRPGO function name (returned by
261
263
// / \c getIRPGOFuncName) for LLVM IR instrumentation and PGO function name
262
264
// / (returned by \c getPGOFuncName) for front-end instrumentation.
263
265
LLVM_ABI GlobalVariable *createPGOFuncNameVar (Module &M,
264
- GlobalValue::LinkageTypes Linkage,
265
- StringRef PGOFuncName);
266
+ GlobalValue::LinkageTypes Linkage,
267
+ StringRef PGOFuncName);
266
268
267
269
// / Return the initializer in string of the PGO name var \c NameVar.
268
270
LLVM_ABI StringRef getPGOFuncNameVarInitializer (GlobalVariable *NameVar);
269
271
270
272
// / Given a PGO function name, remove the filename prefix and return
271
273
// / the original (static) function name.
272
274
LLVM_ABI StringRef getFuncNameWithoutPrefix (StringRef PGOFuncName,
273
- StringRef FileName = " <unknown>" );
275
+ StringRef FileName = " <unknown>" );
274
276
275
277
// / Given a vector of strings (names of global objects like functions or,
276
278
// / virtual tables) \c NameStrs, the method generates a combined string \c
@@ -282,18 +284,20 @@ LLVM_ABI StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName,
282
284
// / compressed string. When the string compression is off, the
283
285
// / second field will have value zero.
284
286
LLVM_ABI Error collectGlobalObjectNameStrings (ArrayRef<std::string> NameStrs,
285
- bool doCompression, std::string &Result);
287
+ bool doCompression,
288
+ std::string &Result);
286
289
287
290
// / Produce \c Result string with the same format described above. The input
288
291
// / is vector of PGO function name variables that are referenced.
289
292
// / The global variable element in 'NameVars' is a string containing the pgo
290
293
// / name of a function. See `createPGOFuncNameVar` that creates these global
291
294
// / variables.
292
295
LLVM_ABI Error collectPGOFuncNameStrings (ArrayRef<GlobalVariable *> NameVars,
293
- std::string &Result, bool doCompression = true );
296
+ std::string &Result,
297
+ bool doCompression = true );
294
298
295
299
LLVM_ABI Error collectVTableStrings (ArrayRef<GlobalVariable *> VTables,
296
- std::string &Result, bool doCompression);
300
+ std::string &Result, bool doCompression);
297
301
298
302
// / Check if INSTR_PROF_RAW_VERSION_VAR is defined. This global is only being
299
303
// / set in IR PGO compilation.
@@ -302,7 +306,8 @@ LLVM_ABI bool isIRPGOFlagSet(const Module *M);
302
306
// / Check if we can safely rename this Comdat function. Instances of the same
303
307
// / comdat function may have different control flows thus can not share the
304
308
// / same counter variable.
305
- LLVM_ABI bool canRenameComdatFunc (const Function &F, bool CheckAddressTaken = false );
309
+ LLVM_ABI bool canRenameComdatFunc (const Function &F,
310
+ bool CheckAddressTaken = false );
306
311
307
312
enum InstrProfValueKind : uint32_t {
308
313
#define VALUE_PROF_KIND (Enumerator, Value, Descr ) Enumerator = Value,
@@ -313,16 +318,17 @@ enum InstrProfValueKind : uint32_t {
313
318
// / and annotate the instruction \p Inst with the value profile meta data.
314
319
// / Annotate up to \p MaxMDCount (default 3) number of records per value site.
315
320
LLVM_ABI void annotateValueSite (Module &M, Instruction &Inst,
316
- const InstrProfRecord &InstrProfR,
317
- InstrProfValueKind ValueKind, uint32_t SiteIndx,
318
- uint32_t MaxMDCount = 3 );
321
+ const InstrProfRecord &InstrProfR,
322
+ InstrProfValueKind ValueKind, uint32_t SiteIndx,
323
+ uint32_t MaxMDCount = 3 );
319
324
320
325
// / Same as the above interface but using an ArrayRef, as well as \p Sum.
321
326
// / This function will not annotate !prof metadata on the instruction if the
322
327
// / referenced array is empty.
323
328
LLVM_ABI void annotateValueSite (Module &M, Instruction &Inst,
324
- ArrayRef<InstrProfValueData> VDs, uint64_t Sum,
325
- InstrProfValueKind ValueKind, uint32_t MaxMDCount);
329
+ ArrayRef<InstrProfValueData> VDs, uint64_t Sum,
330
+ InstrProfValueKind ValueKind,
331
+ uint32_t MaxMDCount);
326
332
327
333
// TODO: Unify metadata name 'PGOFuncName' and 'PGOName', by supporting read
328
334
// of this metadata for backward compatibility and generating 'PGOName' only.
@@ -361,8 +367,8 @@ LLVM_ABI bool needsComdatForCounter(const GlobalObject &GV, const Module &M);
361
367
// / sub-strings. The substrings are separated by `\01` (returned by
362
368
// / InstrProf.h:getInstrProfNameSeparator). This method decodes the string and
363
369
// / calls `NameCallback` for each substring.
364
- LLVM_ABI Error readAndDecodeStrings (StringRef NameStrings,
365
- std::function<Error(StringRef)> NameCallback);
370
+ LLVM_ABI Error readAndDecodeStrings (
371
+ StringRef NameStrings, std::function<Error(StringRef)> NameCallback);
366
372
367
373
// / An enum describing the attributes of an instrumented profile.
368
374
enum class InstrProfKind {
@@ -431,9 +437,10 @@ struct TemporalProfTraceTy {
431
437
// / Use a set of temporal profile traces to create a list of balanced
432
438
// / partitioning function nodes used by BalancedPartitioning to generate a
433
439
// / function order that reduces page faults during startup
434
- LLVM_ABI static void createBPFunctionNodes (ArrayRef<TemporalProfTraceTy> Traces,
435
- std::vector<BPFunctionNode> &Nodes,
436
- bool RemoveOutlierUNs = true );
440
+ LLVM_ABI static void
441
+ createBPFunctionNodes (ArrayRef<TemporalProfTraceTy> Traces,
442
+ std::vector<BPFunctionNode> &Nodes,
443
+ bool RemoveOutlierUNs = true );
437
444
};
438
445
439
446
inline std::error_code make_error_code (instrprof_error E) {
@@ -592,7 +599,8 @@ class InstrProfSymtab {
592
599
593
600
// / Initialize 'this' with the set of vtable names encoded in
594
601
// / \c CompressedVTableNames.
595
- LLVM_ABI Error initVTableNamesFromCompressedStrings (StringRef CompressedVTableNames);
602
+ LLVM_ABI Error
603
+ initVTableNamesFromCompressedStrings (StringRef CompressedVTableNames);
596
604
597
605
// / This interface is used by reader of CoverageMapping test
598
606
// / format.
@@ -604,7 +612,8 @@ class InstrProfSymtab {
604
612
// / indicates if this is called from LTO optimization passes.
605
613
// / A canonical name, removing non-__uniq suffixes, is added if
606
614
// / \c AddCanonical is true.
607
- LLVM_ABI Error create (Module &M, bool InLTO = false , bool AddCanonical = true );
615
+ LLVM_ABI Error create (Module &M, bool InLTO = false ,
616
+ bool AddCanonical = true );
608
617
609
618
// / Create InstrProfSymtab from a set of names iteratable from
610
619
// / \p IterRange. This interface is used by IndexedProfReader.
@@ -822,7 +831,7 @@ struct OverlapStats {
822
831
}
823
832
824
833
LLVM_ABI Error accumulateCounts (const std::string &BaseFilename,
825
- const std::string &TestFilename, bool IsCS);
834
+ const std::string &TestFilename, bool IsCS);
826
835
LLVM_ABI void addOneMismatch (const CountSumOrPercent &MismatchFunc);
827
836
LLVM_ABI void addOneUnique (const CountSumOrPercent &UniqueFunc);
828
837
@@ -862,13 +871,14 @@ struct InstrProfValueSiteRecord {
862
871
// / Merge data from another InstrProfValueSiteRecord
863
872
// / Optionally scale merged counts by \p Weight.
864
873
LLVM_ABI void merge (InstrProfValueSiteRecord &Input, uint64_t Weight,
865
- function_ref<void (instrprof_error)> Warn);
874
+ function_ref<void (instrprof_error)> Warn);
866
875
// / Scale up value profile data counts by N (Numerator) / D (Denominator).
867
- LLVM_ABI void scale (uint64_t N, uint64_t D, function_ref<void (instrprof_error)> Warn);
876
+ LLVM_ABI void scale (uint64_t N, uint64_t D,
877
+ function_ref<void (instrprof_error)> Warn);
868
878
869
879
// / Compute the overlap b/w this record and Input record.
870
880
LLVM_ABI void overlap (InstrProfValueSiteRecord &Input, uint32_t ValueKind,
871
- OverlapStats &Overlap, OverlapStats &FuncLevelOverlap);
881
+ OverlapStats &Overlap, OverlapStats &FuncLevelOverlap);
872
882
};
873
883
874
884
// / Profiling information for a single function.
@@ -921,17 +931,18 @@ struct InstrProfRecord {
921
931
// / Add ValueData for ValueKind at value Site. We do not support adding sites
922
932
// / out of order. Site must go up from 0 one by one.
923
933
LLVM_ABI void addValueData (uint32_t ValueKind, uint32_t Site,
924
- ArrayRef<InstrProfValueData> VData,
925
- InstrProfSymtab *SymTab);
934
+ ArrayRef<InstrProfValueData> VData,
935
+ InstrProfSymtab *SymTab);
926
936
927
937
// / Merge the counts in \p Other into this one.
928
938
// / Optionally scale merged counts by \p Weight.
929
939
LLVM_ABI void merge (InstrProfRecord &Other, uint64_t Weight,
930
- function_ref<void (instrprof_error)> Warn);
940
+ function_ref<void (instrprof_error)> Warn);
931
941
932
942
// / Scale up profile counts (including value profile data) by
933
943
// / a factor of (N / D).
934
- LLVM_ABI void scale (uint64_t N, uint64_t D, function_ref<void (instrprof_error)> Warn);
944
+ LLVM_ABI void scale (uint64_t N, uint64_t D,
945
+ function_ref<void (instrprof_error)> Warn);
935
946
936
947
// / Sort value profile data (per site) by count.
937
948
void sortValueData () {
@@ -954,12 +965,12 @@ struct InstrProfRecord {
954
965
955
966
// / Compute the overlap b/w this IntrprofRecord and Other.
956
967
LLVM_ABI void overlap (InstrProfRecord &Other, OverlapStats &Overlap,
957
- OverlapStats &FuncLevelOverlap, uint64_t ValueCutoff);
968
+ OverlapStats &FuncLevelOverlap, uint64_t ValueCutoff);
958
969
959
970
// / Compute the overlap of value profile counts.
960
971
LLVM_ABI void overlapValueProfData (uint32_t ValueKind, InstrProfRecord &Src,
961
- OverlapStats &Overlap,
962
- OverlapStats &FuncLevelOverlap);
972
+ OverlapStats &Overlap,
973
+ OverlapStats &FuncLevelOverlap);
963
974
964
975
enum CountPseudoKind {
965
976
NotPseudo = 0 ,
0 commit comments