瀏覽代碼

[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 7 年之前
父節點
當前提交
7253cd8580

+ 2 - 2
include/llvm/ProfileData/SampleProf.h

@@ -83,10 +83,10 @@ enum SampleProfileFormat {
   SPF_Text = 0x1,
   SPF_Compact_Binary = 0x2,
   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) |
          uint64_t('R') << (64 - 24) | uint64_t('O') << (64 - 32) |
          uint64_t('F') << (64 - 40) | uint64_t('4') << (64 - 48) |

+ 1 - 1
include/llvm/ProfileData/SampleProfReader.h

@@ -426,7 +426,7 @@ private:
 
 public:
   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.
   static bool hasFormat(const MemoryBuffer &Buffer);

+ 2 - 2
lib/ProfileData/SampleProfWriter.cpp

@@ -294,7 +294,7 @@ ErrorOr<std::unique_ptr<SampleProfileWriter>>
 SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) {
   std::error_code EC;
   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));
   else
     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::unique_ptr<SampleProfileWriter> Writer;
 
-  if (Format == SPF_Raw_Binary)
+  if (Format == SPF_Binary)
     Writer.reset(new SampleProfileWriterRawBinary(OS));
   else if (Format == SPF_Compact_Binary)
     Writer.reset(new SampleProfileWriterCompactBinary(OS));

+ 10 - 11
tools/llvm-profdata/llvm-profdata.cpp

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

+ 1 - 1
unittests/ProfileData/SampleProfTest.cpp

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