Lines Matching refs:BufferIO
47 static void llvmInitBufferIO(ProfBufferIO *BufferIO, WriterCallback FileWriter, in llvmInitBufferIO() argument
49 BufferIO->File = File; in llvmInitBufferIO()
50 BufferIO->FileWriter = FileWriter; in llvmInitBufferIO()
51 BufferIO->BufferStart = Buffer; in llvmInitBufferIO()
52 BufferIO->BufferSz = BufferSz; in llvmInitBufferIO()
53 BufferIO->CurOffset = 0; in llvmInitBufferIO()
68 COMPILER_RT_VISIBILITY void lprofDeleteBufferIO(ProfBufferIO *BufferIO) { in lprofDeleteBufferIO() argument
77 lprofBufferIOWrite(ProfBufferIO *BufferIO, const uint8_t *Data, uint32_t Size) { in lprofBufferIOWrite() argument
79 if (Size + BufferIO->CurOffset > BufferIO->BufferSz) { in lprofBufferIOWrite()
80 if (lprofBufferIOFlush(BufferIO) != 0) in lprofBufferIOWrite()
85 if (Size > BufferIO->BufferSz) { in lprofBufferIOWrite()
86 if (BufferIO->FileWriter(IO, 1, &BufferIO->File)) in lprofBufferIOWrite()
90 uint8_t *Buffer = BufferIO->BufferStart + BufferIO->CurOffset; in lprofBufferIOWrite()
92 BufferIO->CurOffset = Buffer - BufferIO->BufferStart; in lprofBufferIOWrite()
97 COMPILER_RT_VISIBILITY int lprofBufferIOFlush(ProfBufferIO *BufferIO) { in lprofBufferIOFlush() argument
98 if (BufferIO->CurOffset) { in lprofBufferIOFlush()
100 {BufferIO->BufferStart, sizeof(uint8_t), BufferIO->CurOffset}}; in lprofBufferIOFlush()
101 if (BufferIO->FileWriter(IO, 1, &BufferIO->File)) in lprofBufferIOFlush()
103 BufferIO->CurOffset = 0; in lprofBufferIOFlush()
113 static int writeOneValueProfData(ProfBufferIO *BufferIO, in writeOneValueProfData() argument
142 if (lprofBufferIOWrite(BufferIO, (const uint8_t *)&VPHeader, in writeOneValueProfData()
168 if (lprofBufferIOWrite(BufferIO, (const uint8_t *)&RecordHeader, in writeOneValueProfData()
176 if (lprofBufferIOWrite(BufferIO, SiteCountArray[I], SiteCountArraySize)) in writeOneValueProfData()
193 if (lprofBufferIOWrite(BufferIO, (const uint8_t *)&VPDataArray[0], in writeOneValueProfData()
208 ProfBufferIO *BufferIO; in writeValueProfData() local
214 BufferIO = lprofCreateBufferIO(Writer, WriterCtx); in writeValueProfData()
217 if (writeOneValueProfData(BufferIO, VPDataReader, DI)) in writeValueProfData()
221 if (lprofBufferIOFlush(BufferIO) != 0) in writeValueProfData()
223 lprofDeleteBufferIO(BufferIO); in writeValueProfData()