mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
[llvm] Parameterizing the output stream for dumpbytes and outputting directly to stream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238453 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -228,19 +228,19 @@ static uint64_t DumpDataInCode(const uint8_t *bytes, uint64_t Length,
|
||||
case MachO::DICE_KIND_DATA:
|
||||
if (Length >= 4) {
|
||||
if (!NoShowRawInsn)
|
||||
DumpBytes(ArrayRef<uint8_t>(bytes, 4));
|
||||
dumpBytes(ArrayRef<uint8_t>(bytes, 4), outs());
|
||||
Value = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
|
||||
outs() << "\t.long " << Value;
|
||||
Size = 4;
|
||||
} else if (Length >= 2) {
|
||||
if (!NoShowRawInsn)
|
||||
DumpBytes(ArrayRef<uint8_t>(bytes, 2));
|
||||
dumpBytes(ArrayRef<uint8_t>(bytes, 2), outs());
|
||||
Value = bytes[1] << 8 | bytes[0];
|
||||
outs() << "\t.short " << Value;
|
||||
Size = 2;
|
||||
} else {
|
||||
if (!NoShowRawInsn)
|
||||
DumpBytes(ArrayRef<uint8_t>(bytes, 2));
|
||||
dumpBytes(ArrayRef<uint8_t>(bytes, 2), outs());
|
||||
Value = bytes[0];
|
||||
outs() << "\t.byte " << Value;
|
||||
Size = 1;
|
||||
@ -252,14 +252,14 @@ static uint64_t DumpDataInCode(const uint8_t *bytes, uint64_t Length,
|
||||
break;
|
||||
case MachO::DICE_KIND_JUMP_TABLE8:
|
||||
if (!NoShowRawInsn)
|
||||
DumpBytes(ArrayRef<uint8_t>(bytes, 1));
|
||||
dumpBytes(ArrayRef<uint8_t>(bytes, 1), outs());
|
||||
Value = bytes[0];
|
||||
outs() << "\t.byte " << format("%3u", Value) << "\t@ KIND_JUMP_TABLE8\n";
|
||||
Size = 1;
|
||||
break;
|
||||
case MachO::DICE_KIND_JUMP_TABLE16:
|
||||
if (!NoShowRawInsn)
|
||||
DumpBytes(ArrayRef<uint8_t>(bytes, 2));
|
||||
dumpBytes(ArrayRef<uint8_t>(bytes, 2), outs());
|
||||
Value = bytes[1] << 8 | bytes[0];
|
||||
outs() << "\t.short " << format("%5u", Value & 0xffff)
|
||||
<< "\t@ KIND_JUMP_TABLE16\n";
|
||||
@ -268,7 +268,7 @@ static uint64_t DumpDataInCode(const uint8_t *bytes, uint64_t Length,
|
||||
case MachO::DICE_KIND_JUMP_TABLE32:
|
||||
case MachO::DICE_KIND_ABS_JUMP_TABLE32:
|
||||
if (!NoShowRawInsn)
|
||||
DumpBytes(ArrayRef<uint8_t>(bytes, 4));
|
||||
dumpBytes(ArrayRef<uint8_t>(bytes, 4), outs());
|
||||
Value = bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
|
||||
outs() << "\t.long " << Value;
|
||||
if (Kind == MachO::DICE_KIND_JUMP_TABLE32)
|
||||
@ -6313,7 +6313,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
||||
DebugOut, Annotations);
|
||||
if (gotInst) {
|
||||
if (!NoShowRawInsn) {
|
||||
DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size));
|
||||
dumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size), outs());
|
||||
}
|
||||
formatted_raw_ostream FormattedOS(outs());
|
||||
Annotations.flush();
|
||||
@ -6378,7 +6378,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
||||
}
|
||||
if (!NoShowRawInsn) {
|
||||
outs() << "\t";
|
||||
DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, InstSize));
|
||||
dumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, InstSize), outs());
|
||||
}
|
||||
IP->printInst(&Inst, outs(), "", *STI);
|
||||
outs() << "\n";
|
||||
|
Reference in New Issue
Block a user