1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[NFC] Change sample profile format enum name SPF_Raw_Binary to SPF_Binary.

Some out-of-tree targets depend on the enum name SPF_Binary. Keep the name
can avoid unnecessary churn to those targets.

llvm-svn: 334476
This commit is contained in:
Wei Mi 2018-06-12 05:53:49 +00:00
parent 1c4a539d54
commit f54428be08
5 changed files with 16 additions and 17 deletions

View File

@ -83,10 +83,10 @@ enum SampleProfileFormat {
SPF_Text = 0x1, SPF_Text = 0x1,
SPF_Compact_Binary = 0x2, SPF_Compact_Binary = 0x2,
SPF_GCC = 0x3, SPF_GCC = 0x3,
SPF_Raw_Binary = 0xff SPF_Binary = 0xff
}; };
static inline uint64_t SPMagic(SampleProfileFormat Format = SPF_Raw_Binary) { static inline uint64_t SPMagic(SampleProfileFormat Format = SPF_Binary) {
return uint64_t('S') << (64 - 8) | uint64_t('P') << (64 - 16) | return uint64_t('S') << (64 - 8) | uint64_t('P') << (64 - 16) |
uint64_t('R') << (64 - 24) | uint64_t('O') << (64 - 32) | uint64_t('R') << (64 - 24) | uint64_t('O') << (64 - 32) |
uint64_t('F') << (64 - 40) | uint64_t('4') << (64 - 48) | uint64_t('F') << (64 - 40) | uint64_t('4') << (64 - 48) |

View File

@ -426,7 +426,7 @@ private:
public: public:
SampleProfileReaderRawBinary(std::unique_ptr<MemoryBuffer> B, LLVMContext &C) SampleProfileReaderRawBinary(std::unique_ptr<MemoryBuffer> B, LLVMContext &C)
: SampleProfileReaderBinary(std::move(B), C, SPF_Raw_Binary) {} : SampleProfileReaderBinary(std::move(B), C, SPF_Binary) {}
/// \brief Return true if \p Buffer is in the format supported by this class. /// \brief Return true if \p Buffer is in the format supported by this class.
static bool hasFormat(const MemoryBuffer &Buffer); static bool hasFormat(const MemoryBuffer &Buffer);

View File

@ -294,7 +294,7 @@ ErrorOr<std::unique_ptr<SampleProfileWriter>>
SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) { SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) {
std::error_code EC; std::error_code EC;
std::unique_ptr<raw_ostream> OS; std::unique_ptr<raw_ostream> OS;
if (Format == SPF_Raw_Binary || Format == SPF_Compact_Binary) if (Format == SPF_Binary || Format == SPF_Compact_Binary)
OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_None)); OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_None));
else else
OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_Text)); OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_Text));
@ -317,7 +317,7 @@ SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
std::error_code EC; std::error_code EC;
std::unique_ptr<SampleProfileWriter> Writer; std::unique_ptr<SampleProfileWriter> Writer;
if (Format == SPF_Raw_Binary) if (Format == SPF_Binary)
Writer.reset(new SampleProfileWriterRawBinary(OS)); Writer.reset(new SampleProfileWriterRawBinary(OS));
else if (Format == SPF_Compact_Binary) else if (Format == SPF_Compact_Binary)
Writer.reset(new SampleProfileWriterCompactBinary(OS)); Writer.reset(new SampleProfileWriterCompactBinary(OS));

View File

@ -39,7 +39,7 @@ enum ProfileFormat {
PF_Text, PF_Text,
PF_Compact_Binary, PF_Compact_Binary,
PF_GCC, PF_GCC,
PF_Raw_Binary PF_Binary
}; };
static void warn(Twine Message, std::string Whence = "", static void warn(Twine Message, std::string Whence = "",
@ -242,7 +242,7 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs,
if (OutputFilename.compare("-") == 0) if (OutputFilename.compare("-") == 0)
exitWithError("Cannot write indexed profdata format to stdout."); exitWithError("Cannot write indexed profdata format to stdout.");
if (OutputFormat != PF_Raw_Binary && OutputFormat != PF_Compact_Binary && if (OutputFormat != PF_Binary && OutputFormat != PF_Compact_Binary &&
OutputFormat != PF_Text) OutputFormat != PF_Text)
exitWithError("Unknown format is specified."); exitWithError("Unknown format is specified.");
@ -324,7 +324,7 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs,
static sampleprof::SampleProfileFormat FormatMap[] = { static sampleprof::SampleProfileFormat FormatMap[] = {
sampleprof::SPF_None, sampleprof::SPF_Text, sampleprof::SPF_Compact_Binary, sampleprof::SPF_None, sampleprof::SPF_Text, sampleprof::SPF_Compact_Binary,
sampleprof::SPF_GCC, sampleprof::SPF_Raw_Binary}; sampleprof::SPF_GCC, sampleprof::SPF_Binary};
static void mergeSampleProfile(const WeightedFileVector &Inputs, static void mergeSampleProfile(const WeightedFileVector &Inputs,
StringRef OutputFilename, StringRef OutputFilename,
@ -471,14 +471,13 @@ static int merge_main(int argc, const char *argv[]) {
cl::values(clEnumVal(instr, "Instrumentation profile (default)"), cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
clEnumVal(sample, "Sample profile"))); clEnumVal(sample, "Sample profile")));
cl::opt<ProfileFormat> OutputFormat( cl::opt<ProfileFormat> OutputFormat(
cl::desc("Format of output profile"), cl::init(PF_Raw_Binary), cl::desc("Format of output profile"), cl::init(PF_Binary),
cl::values( cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding (default)"),
clEnumValN(PF_Raw_Binary, "binary", "Binary encoding (default)"), clEnumValN(PF_Compact_Binary, "compbinary",
clEnumValN(PF_Compact_Binary, "compbinary", "Compact binary encoding"),
"Compact binary encoding"), clEnumValN(PF_Text, "text", "Text encoding"),
clEnumValN(PF_Text, "text", "Text encoding"), clEnumValN(PF_GCC, "gcc",
clEnumValN(PF_GCC, "gcc", "GCC encoding (only meaningful for -sample)")));
"GCC encoding (only meaningful for -sample)")));
cl::opt<bool> OutputSparse("sparse", cl::init(false), cl::opt<bool> OutputSparse("sparse", cl::init(false),
cl::desc("Generate a sparse profile (only meaningful for -instr)")); cl::desc("Generate a sparse profile (only meaningful for -instr)"));
cl::opt<unsigned> NumThreads( cl::opt<unsigned> NumThreads(

View File

@ -180,7 +180,7 @@ TEST_F(SampleProfTest, roundtrip_text_profile) {
} }
TEST_F(SampleProfTest, roundtrip_raw_binary_profile) { TEST_F(SampleProfTest, roundtrip_raw_binary_profile) {
testRoundTrip(SampleProfileFormat::SPF_Raw_Binary); testRoundTrip(SampleProfileFormat::SPF_Binary);
} }
TEST_F(SampleProfTest, roundtrip_compact_binary_profile) { TEST_F(SampleProfTest, roundtrip_compact_binary_profile) {