Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: src/arm/disasm-arm.cc

Issue 2871863003: [arm] Print address for load literal instructions. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/disasm-arm.cc
diff --git a/src/arm/disasm-arm.cc b/src/arm/disasm-arm.cc
index 225cd7b41197163c5a4bb2d2885d216619e9889c..e0c99caf5568dd19e111dda2b3618f702c0aa1c7 100644
--- a/src/arm/disasm-arm.cc
+++ b/src/arm/disasm-arm.cc
@@ -667,6 +667,28 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
case 'v': {
return FormatVFPinstruction(instr, format);
}
+ case 'A': {
+ // Print pc-relative address.
+ int offset = instr->Offset12Value();
+ byte* pc = reinterpret_cast<byte*>(instr) + Instruction::kPCReadOffset;
+ byte* addr;
+ switch (instr->PUField()) {
+ case db_x: {
+ addr = pc - offset;
+ break;
+ }
+ case ib_x: {
+ addr = pc + offset;
+ break;
+ }
+ default: {
+ UNREACHABLE();
+ return -1;
+ }
+ }
+ out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%p", addr);
+ return 1;
+ }
case 'S':
case 'D': {
return FormatVFPRegister(instr, format);
@@ -1033,11 +1055,19 @@ void Decoder::DecodeType2(Instruction* instr) {
break;
}
case db_x: {
- Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w");
+ if (instr->HasL() && (instr->RnValue() == kPCRegister)) {
+ Format(instr, "'memop'cond'b 'rd, [pc, #-'off12]'w (addr 'A)");
+ } else {
+ Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w");
+ }
break;
}
case ib_x: {
- Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w");
+ if (instr->HasL() && (instr->RnValue() == kPCRegister)) {
+ Format(instr, "'memop'cond'b 'rd, [pc, #+'off12]'w (addr 'A)");
+ } else {
+ Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w");
+ }
break;
}
default: {
« no previous file with comments | « no previous file | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698