summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index 4c7f5de26aa..7945469268c 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -14,12 +14,16 @@
#include "llvm/ProfileData/InstrProfWriter.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/OnDiskHashTable.h"
#include <tuple>
using namespace llvm;
+static cl::opt<bool> WriteVPInBE("write-vp-data-in-big", cl::ReallyHidden,
+ cl::init(false));
+
// A struct to define how the data stream should be patched. For Indexed
// profiling, only uint64_t data type is needed.
struct PatchItem {
@@ -74,8 +78,6 @@ public:
}
namespace {
-static support::endianness ValueProfDataEndianness = support::little;
-
class InstrProfRecordTrait {
public:
typedef StringRef key_type;
@@ -134,17 +136,18 @@ public:
std::unique_ptr<ValueProfData> VDataPtr =
ValueProfData::serializeFrom(ProfileData.second);
uint32_t S = VDataPtr->getSize();
- VDataPtr->swapBytesFromHost(ValueProfDataEndianness);
+ VDataPtr->swapBytesFromHost(
+ InstrProfWriter::getValueProfDataEndianness());
Out.write((const char *)VDataPtr.get(), S);
}
}
};
}
-// Internal interface for testing purpose only.
-void InstrProfWriter::setValueProfDataEndianness(
- support::endianness Endianness) {
- ValueProfDataEndianness = Endianness;
+support::endianness InstrProfWriter::getValueProfDataEndianness() {
+ if (WriteVPInBE)
+ return support::big;
+ return support::little;
}
std::error_code InstrProfWriter::addRecord(InstrProfRecord &&I,
OpenPOWER on IntegriCloud