LLVM: lib/Support/LEB128.cpp Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

9

10

11

12

13

15

16namespace llvm {

17

18

20 unsigned Size = 0;

21 do {

23 Size += sizeof(int8_t);

26}

27

28

30 unsigned Size = 0;

31 int Sign = Value >> (8 * sizeof(Value) - 1);

32 bool IsMore;

33

34 do {

35 unsigned Byte = Value & 0x7f;

37 IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;

38 Size += sizeof(int8_t);

39 } while (IsMore);

41}

42

43}

LLVM Value Representation.

This is an optimization pass for GlobalISel generic memory operations.

unsigned getULEB128Size(uint64_t Value)

Utility function to get the size of the ULEB128-encoded value.

unsigned getSLEB128Size(int64_t Value)

Utility function to get the size of the SLEB128-encoded value.