Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d4413c6

Browse filesBrowse files
committed
[NFC][MemProf] Move types shared between Analysis, ProfileData and ModuleSummary (Core) to a separate header
1 parent 532d85a commit d4413c6
Copy full SHA for d4413c6

File tree

4 files changed

+49
-21
lines changed
Filter options

4 files changed

+49
-21
lines changed

‎llvm/include/llvm/Analysis/MemoryProfileInfo.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/Analysis/MemoryProfileInfo.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#define LLVM_ANALYSIS_MEMORYPROFILEINFO_H
1515

1616
#include "llvm/IR/Metadata.h"
17-
#include "llvm/IR/ModuleSummaryIndex.h"
17+
#include "llvm/ProfileData/MemProfCommon.h"
18+
#include "llvm/IR/InstrTypes.h"
1819
#include <map>
1920

2021
namespace llvm {

‎llvm/include/llvm/IR/ModuleSummaryIndex.h

Copy file name to clipboardExpand all lines: llvm/include/llvm/IR/ModuleSummaryIndex.h
+2-20Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "llvm/IR/ConstantRange.h"
2828
#include "llvm/IR/GlobalValue.h"
2929
#include "llvm/IR/Module.h"
30+
#include "llvm/ProfileData/MemProfCommon.h"
3031
#include "llvm/Support/Allocator.h"
3132
#include "llvm/Support/Compiler.h"
3233
#include "llvm/Support/InterleavedRange.h"
@@ -306,13 +307,7 @@ template <> struct DenseMapInfo<ValueInfo> {
306307
static unsigned getHashValue(ValueInfo I) { return hash_value(I.getRef()); }
307308
};
308309

309-
// For optional hinted size reporting, holds a pair of the full stack id
310-
// (pre-trimming, from the full context in the profile), and the associated
311-
// total profiled size.
312-
struct ContextTotalSize {
313-
uint64_t FullStackId;
314-
uint64_t TotalSize;
315-
};
310+
316311

317312
/// Summary of memprof callsite metadata.
318313
struct CallsiteInfo {
@@ -350,19 +345,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const CallsiteInfo &SNI) {
350345
return OS;
351346
}
352347

353-
// Allocation type assigned to an allocation reached by a given context.
354-
// More can be added, now this is cold, notcold and hot.
355-
// Values should be powers of two so that they can be ORed, in particular to
356-
// track allocations that have different behavior with different calling
357-
// contexts.
358-
enum class AllocationType : uint8_t {
359-
None = 0,
360-
NotCold = 1,
361-
Cold = 2,
362-
Hot = 4,
363-
All = 7 // This should always be set to the OR of all values.
364-
};
365-
366348
/// Summary of a single MIB in a memprof metadata on allocations.
367349
struct MIBInfo {
368350
// The allocation type for this profiled context.
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//===- MemProfCommon.h - MemProf support ----------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file contains common types used by different parts of the MemProf code.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_PROFILEDATA_MEMPROFCOMMON_H
14+
#define LLVM_PROFILEDATA_MEMPROFCOMMON_H
15+
16+
#include <cstdint>
17+
18+
namespace llvm {
19+
20+
// For optional hinted size reporting, holds a pair of the full stack id
21+
// (pre-trimming, from the full context in the profile), and the associated
22+
// total profiled size.
23+
struct ContextTotalSize {
24+
uint64_t FullStackId;
25+
uint64_t TotalSize;
26+
};
27+
28+
// Allocation type assigned to an allocation reached by a given context.
29+
// More can be added, now this is cold, notcold and hot.
30+
// Values should be powers of two so that they can be ORed, in particular to
31+
// track allocations that have different behavior with different calling
32+
// contexts.
33+
enum class AllocationType : uint8_t {
34+
None = 0,
35+
NotCold = 1,
36+
Cold = 2,
37+
Hot = 4,
38+
All = 7 // This should always be set to the OR of all values.
39+
};
40+
41+
} // namespace llvm
42+
43+
#endif // LLVM_PROFILEDATA_MEMPROFCOMMON_H
44+

‎llvm/lib/Transforms/Instrumentation/MemProfiler.cpp

Copy file name to clipboardExpand all lines: llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "llvm/Transforms/Utils/ModuleUtils.h"
4747
#include <map>
4848
#include <set>
49+
#include <unordered_set>
4950

5051
using namespace llvm;
5152
using namespace llvm::memprof;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.