Files
llvm/bolt/ProfileWriter.h
Maksim Panchenko b6cb112feb [BOLT] New profile format
Summary:
A new profile that is more resilient to minor binary modifications.

BranchData is eliminated. For calls, the data is converted into instruction
annotations if the profile matches a function. If a profile cannot be matched,
AllCallSites data should have call sites profiles.

The new profile format is YAML, which is quite verbose. It still takes
less space than the older format because we avoid function name repetition.

The plan is to get rid of the old profile format eventually.

merge-fdata does not work with the new format yet.

(cherry picked from FBD6753747)
2017-12-13 23:12:01 -08:00

54 lines
1.3 KiB
C++

//===-- ProfileWriter.cpp - serialize profiling data ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVM_BOLT_PROFILE_WRITER_H
#define LLVM_TOOLS_LLVM_BOLT_PROFILE_WRITER_H
#include "BinaryBasicBlock.h"
#include "BinaryContext.h"
#include "BinaryFunction.h"
#include "ProfileYAMLMapping.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/raw_ostream.h"
#include <system_error>
namespace llvm {
namespace bolt {
class ProfileWriter {
ProfileWriter() = delete;
std::string FileName;
std::error_code write(BinaryFunction &BF);
std::unique_ptr<raw_fd_ostream> OS;
void printBinaryFunctionProfile(const BinaryFunction &BF);
void printBinaryFunctionsProfile(std::map<uint64_t, BinaryFunction> &BFs);
public:
explicit ProfileWriter(const std::string &FileName)
: FileName(FileName) {
}
/// Write profile for functions.
std::error_code writeProfile(std::map<uint64_t, BinaryFunction> &Functions);
};
} // namespace bolt
} // namespace llvm
#endif // LLVM_TOOLS_LLVM_BOLT_PROFILE_WRITER_H