mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Add a "PadTo" field to the emitULEB128Bytes method. This will pad out to the
indicated number of bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101684 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -174,13 +174,20 @@ public:
|
|||||||
|
|
||||||
/// emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be
|
/// emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be
|
||||||
/// written to the output stream.
|
/// written to the output stream.
|
||||||
void emitULEB128Bytes(uint64_t Value) {
|
void emitULEB128Bytes(uint64_t Value, unsigned PadTo = 0) {
|
||||||
do {
|
do {
|
||||||
uint8_t Byte = Value & 0x7f;
|
uint8_t Byte = Value & 0x7f;
|
||||||
Value >>= 7;
|
Value >>= 7;
|
||||||
if (Value) Byte |= 0x80;
|
if (Value || PadTo != 0) Byte |= 0x80;
|
||||||
emitByte(Byte);
|
emitByte(Byte);
|
||||||
} while (Value);
|
} while (Value);
|
||||||
|
|
||||||
|
if (PadTo) {
|
||||||
|
do {
|
||||||
|
uint8_t Byte = (PadTo > 1) ? 0x80 : 0x0;
|
||||||
|
emitByte(Byte);
|
||||||
|
} while (--PadTo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
|
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
|
||||||
|
Reference in New Issue
Block a user