unsigned Size ///< The size of the block
) {}
- /// @brief Handle a variable bit rate 32 bit unsigned
- virtual void handleVBR32(
- unsigned Size ///< Number of bytes the vbr_uint took up
- ) {}
-
- /// @brief Handle a variable bit rate 64 bit unsigned
- virtual void handleVBR64(
- unsigned Size ///< Number of byte sthe vbr_uint64 took up
- ) {}
/// @}
};
#include <iomanip>
#include <sstream>
#include <ios>
-
using namespace llvm;
namespace {
bca.BlockSizes[llvm::BytecodeFormat::Reserved_DoNotUse] += 4;
}
- virtual void handleVBR32(unsigned Size ) {
- bca.vbrCount32++;
- bca.vbrCompBytes += Size;
- bca.vbrExpdBytes += sizeof(uint32_t);
- if (currFunc) {
- currFunc->vbrCount32++;
- currFunc->vbrCompBytes += Size;
- currFunc->vbrExpdBytes += sizeof(uint32_t);
- }
- }
-
- virtual void handleVBR64(unsigned Size ) {
- bca.vbrCount64++;
- bca.vbrCompBytes += Size;
- bca.vbrExpdBytes += sizeof(uint64_t);
- if ( currFunc ) {
- currFunc->vbrCount64++;
- currFunc->vbrCompBytes += Size;
- currFunc->vbrExpdBytes += sizeof(uint64_t);
- }
- }
};
inline unsigned BytecodeReader::read_vbr_uint() {
unsigned Shift = 0;
unsigned Result = 0;
- BufPtr Save = At;
do {
if (At == BlockEnd)
Result |= (unsigned)((*At++) & 0x7F) << Shift;
Shift += 7;
} while (At[-1] & 0x80);
- if (Handler) Handler->handleVBR32(At-Save);
return Result;
}
inline uint64_t BytecodeReader::read_vbr_uint64() {
unsigned Shift = 0;
uint64_t Result = 0;
- BufPtr Save = At;
do {
if (At == BlockEnd)
Result |= (uint64_t)((*At++) & 0x7F) << Shift;
Shift += 7;
} while (At[-1] & 0x80);
- if (Handler) Handler->handleVBR64(At-Save);
return Result;
}