mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-23 17:28:54 +00:00
[Objdump] Removing size limit on DumpBytes and changing to range based for loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232654 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -196,28 +196,15 @@ static const Target *getTarget(const ObjectFile *Obj = nullptr) {
|
|||||||
|
|
||||||
void llvm::DumpBytes(StringRef bytes) {
|
void llvm::DumpBytes(StringRef bytes) {
|
||||||
static const char hex_rep[] = "0123456789abcdef";
|
static const char hex_rep[] = "0123456789abcdef";
|
||||||
// FIXME: The real way to do this is to figure out the longest instruction
|
SmallString<64> output;
|
||||||
// and align to that size before printing. I'll fix this when I get
|
|
||||||
// around to outputting relocations.
|
|
||||||
// 15 is the longest x86 instruction
|
|
||||||
// 3 is for the hex rep of a byte + a space.
|
|
||||||
// 1 is for the null terminator.
|
|
||||||
enum { OutputSize = (15 * 3) + 1 };
|
|
||||||
char output[OutputSize];
|
|
||||||
|
|
||||||
assert(bytes.size() <= 15
|
for (char i: bytes) {
|
||||||
&& "DumpBytes only supports instructions of up to 15 bytes");
|
output.push_back(hex_rep[(i & 0xF0) >> 4]);
|
||||||
memset(output, ' ', sizeof(output));
|
output.push_back(hex_rep[i & 0xF]);
|
||||||
unsigned index = 0;
|
output.push_back(' ');
|
||||||
for (StringRef::iterator i = bytes.begin(),
|
|
||||||
e = bytes.end(); i != e; ++i) {
|
|
||||||
output[index] = hex_rep[(*i & 0xF0) >> 4];
|
|
||||||
output[index + 1] = hex_rep[*i & 0xF];
|
|
||||||
index += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output[sizeof(output) - 1] = 0;
|
outs() << output.c_str();
|
||||||
outs() << output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool llvm::RelocAddressLess(RelocationRef a, RelocationRef b) {
|
bool llvm::RelocAddressLess(RelocationRef a, RelocationRef b) {
|
||||||
|
Reference in New Issue
Block a user