llvm.org GIT mirror llvm / 7253cd8
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334476 91177308-0d34-0410-b5e6-96231b3b80d8 Wei Mi 1 year, 3 months ago
5 changed file(s) with 18 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
8282 SPF_Text = 0x1,
8383 SPF_Compact_Binary = 0x2,
8484 SPF_GCC = 0x3,
85 SPF_Raw_Binary = 0xff
86 };
87
88 static inline uint64_t SPMagic(SampleProfileFormat Format = SPF_Raw_Binary) {
85 SPF_Binary = 0xff
86 };
87
88 static inline uint64_t SPMagic(SampleProfileFormat Format = SPF_Binary) {
8989 return uint64_t('S') << (64 - 8) | uint64_t('P') << (64 - 16) |
9090 uint64_t('R') << (64 - 24) | uint64_t('O') << (64 - 32) |
9191 uint64_t('F') << (64 - 40) | uint64_t('4') << (64 - 48) |
425425
426426 public:
427427 SampleProfileReaderRawBinary(std::unique_ptr B, LLVMContext &C)
428 : SampleProfileReaderBinary(std::move(B), C, SPF_Raw_Binary) {}
428 : SampleProfileReaderBinary(std::move(B), C, SPF_Binary) {}
429429
430430 /// \brief Return true if \p Buffer is in the format supported by this class.
431431 static bool hasFormat(const MemoryBuffer &Buffer);
293293 SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) {
294294 std::error_code EC;
295295 std::unique_ptr OS;
296 if (Format == SPF_Raw_Binary || Format == SPF_Compact_Binary)
296 if (Format == SPF_Binary || Format == SPF_Compact_Binary)
297297 OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_None));
298298 else
299299 OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::F_Text));
316316 std::error_code EC;
317317 std::unique_ptr Writer;
318318
319 if (Format == SPF_Raw_Binary)
319 if (Format == SPF_Binary)
320320 Writer.reset(new SampleProfileWriterRawBinary(OS));
321321 else if (Format == SPF_Compact_Binary)
322322 Writer.reset(new SampleProfileWriterCompactBinary(OS));
3838 PF_Text,
3939 PF_Compact_Binary,
4040 PF_GCC,
41 PF_Raw_Binary
41 PF_Binary
4242 };
4343
4444 static void warn(Twine Message, std::string Whence = "",
241241 if (OutputFilename.compare("-") == 0)
242242 exitWithError("Cannot write indexed profdata format to stdout.");
243243
244 if (OutputFormat != PF_Raw_Binary && OutputFormat != PF_Compact_Binary &&
244 if (OutputFormat != PF_Binary && OutputFormat != PF_Compact_Binary &&
245245 OutputFormat != PF_Text)
246246 exitWithError("Unknown format is specified.");
247247
323323
324324 static sampleprof::SampleProfileFormat FormatMap[] = {
325325 sampleprof::SPF_None, sampleprof::SPF_Text, sampleprof::SPF_Compact_Binary,
326 sampleprof::SPF_GCC, sampleprof::SPF_Raw_Binary};
326 sampleprof::SPF_GCC, sampleprof::SPF_Binary};
327327
328328 static void mergeSampleProfile(const WeightedFileVector &Inputs,
329329 StringRef OutputFilename,
470470 cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
471471 clEnumVal(sample, "Sample profile")));
472472 cl::opt OutputFormat(
473 cl::desc("Format of output profile"), cl::init(PF_Raw_Binary),
474 cl::values(
475 clEnumValN(PF_Raw_Binary, "binary", "Binary encoding (default)"),
476 clEnumValN(PF_Compact_Binary, "compbinary",
477 "Compact binary encoding"),
478 clEnumValN(PF_Text, "text", "Text encoding"),
479 clEnumValN(PF_GCC, "gcc",
480 "GCC encoding (only meaningful for -sample)")));
473 cl::desc("Format of output profile"), cl::init(PF_Binary),
474 cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding (default)"),
475 clEnumValN(PF_Compact_Binary, "compbinary",
476 "Compact binary encoding"),
477 clEnumValN(PF_Text, "text", "Text encoding"),
478 clEnumValN(PF_GCC, "gcc",
479 "GCC encoding (only meaningful for -sample)")));
481480 cl::opt OutputSparse("sparse", cl::init(false),
482481 cl::desc("Generate a sparse profile (only meaningful for -instr)"));
483482 cl::opt NumThreads(
179179 }
180180
181181 TEST_F(SampleProfTest, roundtrip_raw_binary_profile) {
182 testRoundTrip(SampleProfileFormat::SPF_Raw_Binary);
182 testRoundTrip(SampleProfileFormat::SPF_Binary);
183183 }
184184
185185 TEST_F(SampleProfTest, roundtrip_compact_binary_profile) {