15#define DEBUG_TYPE "cg-data-writer"
20 using namespace support;
25 for (
const auto &K :
P) {
26 FDOStream.
seek(K.Pos);
27 for (
int I = 0;
I < K.N;
I++)
33 FDOStream.
seek(LastPos);
36 std::string &
Data = SOStream.
str();
37 for (
const auto &K :
P) {
38 for (
int I = 0;
I < K.N;
I++) {
40 endian::byte_swap<uint64_t, llvm::endianness::little>(K.D[
I]);
42 reinterpret_cast<const char *
>(&Bytes),
sizeof(
uint64_t));
49 assert(
Record.HashTree &&
"empty hash tree in the record");
57 return writeImpl(COS);
61 using namespace support;
72 Header.OutlinedHashTreeOffset = 0;
76 COS.
write(Header.Magic);
81 OutlinedHashTreeOffset = COS.
tell();
90 if (
Error E = writeHeader(COS))
99 {OutlinedHashTreeOffset, &OutlinedHashTreeFieldStart, 1}};
100 COS.
patch(PatchItems);
107 OS <<
"# Outlined stable hash tree\n:outlined_hash_tree\n";
115 if (
Error E = writeHeaderText(
OS))
118 yaml::Output YOS(
OS);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A wrapper class to abstract writer stream with support of bytes back patching.
void patch(ArrayRef< CGDataPatchItem > P)
Error writeText(raw_fd_ostream &OS)
Write the codegen data in text format to OS.
Error write(raw_fd_ostream &OS)
Write the codegen data to OS.
bool hasOutlinedHashTree() const
Return true if the header indicates the data has an outlined hash tree.
void addRecord(OutlinedHashTreeRecord &Record)
Add the outlined hash tree record. The input Record is released.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
A raw_ostream that writes to a file descriptor.
uint64_t seek(uint64_t off)
Flushes the stream and repositions the underlying file descriptor position to the offset specified fr...
uint64_t tell() const
tell - Return the current offset with the file.
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
This is an optimization pass for GlobalISel generic memory operations.
@ FunctionOutlinedHashTree
A struct to define how the data stream should be patched.
void serializeYAML(yaml::Output &YOS) const
Serialize the outlined hash tree to a YAML stream.
void serialize(raw_ostream &OS) const
Serialize the outlined hash tree to a raw_ostream.
std::unique_ptr< OutlinedHashTree > HashTree