Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/include/llvm/Analysis/MemoryProfileInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#ifndef LLVM_ANALYSIS_MEMORYPROFILEINFO_H
#define LLVM_ANALYSIS_MEMORYPROFILEINFO_H

#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/ProfileData/MemProfCommon.h"
#include <map>

namespace llvm {
Expand Down
22 changes: 1 addition & 21 deletions llvm/include/llvm/IR/ModuleSummaryIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Module.h"
#include "llvm/ProfileData/MemProfCommon.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/InterleavedRange.h"
Expand Down Expand Up @@ -306,14 +307,6 @@ template <> struct DenseMapInfo<ValueInfo> {
static unsigned getHashValue(ValueInfo I) { return hash_value(I.getRef()); }
};

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

/// Summary of memprof callsite metadata.
struct CallsiteInfo {
// Actual callee function.
Expand Down Expand Up @@ -350,19 +343,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const CallsiteInfo &SNI) {
return OS;
}

// Allocation type assigned to an allocation reached by a given context.
// More can be added, now this is cold, notcold and hot.
// Values should be powers of two so that they can be ORed, in particular to
// track allocations that have different behavior with different calling
// contexts.
enum class AllocationType : uint8_t {
None = 0,
NotCold = 1,
Cold = 2,
Hot = 4,
All = 7 // This should always be set to the OR of all values.
};

/// Summary of a single MIB in a memprof metadata on allocations.
struct MIBInfo {
// The allocation type for this profiled context.
Expand Down
43 changes: 43 additions & 0 deletions llvm/include/llvm/ProfileData/MemProfCommon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//===- MemProfCommon.h - MemProf support ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains common types used by different parts of the MemProf code.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_PROFILEDATA_MEMPROFCOMMON_H
#define LLVM_PROFILEDATA_MEMPROFCOMMON_H

#include <cstdint>

namespace llvm {

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

// Allocation type assigned to an allocation reached by a given context.
// More can be added, now this is cold, notcold and hot.
// Values should be powers of two so that they can be ORed, in particular to
// track allocations that have different behavior with different calling
// contexts.
enum class AllocationType : uint8_t {
None = 0,
NotCold = 1,
Cold = 2,
Hot = 4,
All = 7 // This should always be set to the OR of all values.
};

} // namespace llvm

#endif // LLVM_PROFILEDATA_MEMPROFCOMMON_H
1 change: 0 additions & 1 deletion llvm/lib/ProfileData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ add_llvm_component_library(LLVMProfileData

LINK_COMPONENTS
BitstreamReader
Core
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ProfileData still depends on Core.

Object
Support
Demangle
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <map>
#include <set>
#include <unordered_set>

using namespace llvm;
using namespace llvm::memprof;
Expand Down
Loading