Go to the documentation of this file.
16 #include "llvm/Config/config.h"
35 return "LLVM was not built with LLVM_ENABLE_ZLIB or did not find zlib at "
40 return "LLVM was not built with LLVM_ENABLE_ZSTD or did not find zstd at "
59 uint8_t *Output,
size_t UncompressedSize) {
71 size_t UncompressedSize) {
83 size_t UncompressedSize) {
92 return "zlib error: Z_MEM_ERROR";
94 return "zlib error: Z_BUF_ERROR";
96 return "zlib error: Z_STREAM_ERROR";
98 return "zlib error: Z_DATA_ERROR";
109 unsigned long CompressedSize = ::compressBound(Input.
size());
111 int Res = ::compress2((Bytef *)CompressedBuffer.data(), &CompressedSize,
112 (
const Bytef *)Input.
data(), Input.
size(), Level);
113 if (Res == Z_MEM_ERROR)
119 if (CompressedSize < CompressedBuffer.size())
120 CompressedBuffer.
truncate(CompressedSize);
124 size_t &UncompressedSize) {
125 int Res =
::uncompress((Bytef *)Output, (uLongf *)&UncompressedSize,
126 (
const Bytef *)Input.
data(), Input.
size());
137 size_t UncompressedSize) {
140 if (UncompressedSize < Output.size())
152 size_t &UncompressedSize) {
157 size_t UncompressedSize) {
168 unsigned long CompressedBufferSize = ::ZSTD_compressBound(Input.
size());
170 unsigned long CompressedSize =
171 ::ZSTD_compress((
char *)CompressedBuffer.data(), CompressedBufferSize,
172 (
const char *)Input.
data(), Input.
size(), Level);
173 if (ZSTD_isError(CompressedSize))
178 if (CompressedSize < CompressedBuffer.size())
179 CompressedBuffer.
truncate(CompressedSize);
183 size_t &UncompressedSize) {
184 const size_t Res = ::ZSTD_decompress(
185 Output, UncompressedSize, (
const uint8_t *)Input.
data(), Input.
size());
186 UncompressedSize = Res;
190 return ZSTD_isError(Res) ? make_error<StringError>(ZSTD_getErrorName(Res),
197 size_t UncompressedSize) {
200 if (UncompressedSize < Output.size())
212 size_t &UncompressedSize) {
217 size_t UncompressedSize) {
Error decompress(ArrayRef< uint8_t > Input, uint8_t *Output, size_t &UncompressedSize)
This is an optimization pass for GlobalISel generic memory operations.
bool uncompress(MCInst &OutInst, const MCInst &MI, const MCSubtargetInfo &STI)
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
static ErrorSuccess success()
Create a success value.
void truncate(size_type N)
Like resize, but requires that N is less than size().
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static StringRef convertZlibCodeToString(int Code)
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
void report_bad_alloc_error(const char *Reason, bool GenCrashDiag=true)
Reports a bad alloc error, calling any user defined bad alloc error handler.
Error decompress(ArrayRef< uint8_t > Input, uint8_t *Output, size_t &UncompressedSize)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
#define __msan_unpoison(p, size)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void compress(ArrayRef< uint8_t > Input, SmallVectorImpl< uint8_t > &CompressedBuffer, int Level=DefaultCompression)
void compress(Params P, ArrayRef< uint8_t > Input, SmallVectorImpl< uint8_t > &Output)
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Lightweight error class with error context and mandatory checking.
void compress(ArrayRef< uint8_t > Input, SmallVectorImpl< uint8_t > &CompressedBuffer, int Level=DefaultCompression)
const char * getReasonIfUnsupported(Format F)
Format formatFor(DebugCompressionType Type)
size_t size() const
size - Get the array size.
Error decompress(DebugCompressionType T, ArrayRef< uint8_t > Input, uint8_t *Output, size_t UncompressedSize)