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

Unified Diff: runtime/vm/disassembler_mips.cc

Issue 12634030: Adds branch instructions and labels to the MIPS simulator, assembler, disassembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « runtime/vm/constants_mips.h ('k') | runtime/vm/simulator_mips.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/disassembler_mips.cc
===================================================================
--- runtime/vm/disassembler_mips.cc (revision 20399)
+++ runtime/vm/disassembler_mips.cc (working copy)
@@ -39,6 +39,7 @@
void DecodeSpecial(Instr* instr);
void DecodeSpecial2(Instr* instr);
+ void DecodeRegImm(Instr* instr);
// Convenience functions.
char* get_buffer() const { return buffer_; }
@@ -137,6 +138,16 @@
}
return 4;
}
+ case 'd': {
+ ASSERT(STRING_STARTS_WITH(format, "dest"));
+ int off = instr->SImmField() << 2;
+ uword destination = reinterpret_cast<uword>(instr) + off;
+ buffer_pos_ += OS::SNPrint(current_position_in_buffer(),
+ remaining_size_in_buffer(),
+ "%#"Px"",
+ destination);
+ return 4;
+ }
case 'i': {
ASSERT(STRING_STARTS_WITH(format, "imm"));
if (format[3] == 'u') {
@@ -359,6 +370,33 @@
}
+void MIPSDecoder::DecodeRegImm(Instr* instr) {
+ ASSERT(instr->OpcodeField() == REGIMM);
+ switch (instr->RegImmFnField()) {
+ case BGEZ: {
+ Format(instr, "bgez 'rs, 'dest");
+ break;
+ }
+ case BGEZL: {
+ Format(instr, "bgezl 'rs, 'dest");
+ break;
+ }
+ case BLTZ: {
+ Format(instr, "bltz 'rs, 'dest");
+ break;
+ }
+ case BLTZL: {
+ Format(instr, "bltzl 'rs, 'dest");
+ break;
+ }
+ default: {
+ Unknown(instr);
+ break;
+ }
+ }
+}
+
+
void MIPSDecoder::InstructionDecode(Instr* instr) {
switch (instr->OpcodeField()) {
case SPECIAL: {
@@ -369,6 +407,10 @@
DecodeSpecial2(instr);
break;
}
+ case REGIMM: {
+ DecodeRegImm(instr);
+ break;
+ }
case ADDIU: {
Format(instr, "addiu 'rt, 'rs, 'imms");
break;
@@ -377,6 +419,38 @@
Format(instr, "andi 'rt, 'rs, 'immu");
break;
}
+ case BEQ: {
+ Format(instr, "beq 'rs, 'rt, 'dest");
+ break;
+ }
+ case BEQL: {
+ Format(instr, "beql 'rs, 'rt, 'dest");
+ break;
+ }
+ case BGTZ: {
+ Format(instr, "bgtz 'rs, 'dest");
+ break;
+ }
+ case BGTZL: {
+ Format(instr, "bgtzl 'rs, 'dest");
+ break;
+ }
+ case BLEZ: {
+ Format(instr, "blez 'rs, 'dest");
+ break;
+ }
+ case BLEZL: {
+ Format(instr, "blezl 'rs, 'dest");
+ break;
+ }
+ case BNE: {
+ Format(instr, "bne 'rs, 'rt, 'dest");
+ break;
+ }
+ case BNEL: {
+ Format(instr, "bnel 'rs, 'rt, 'dest");
+ break;
+ }
case LB: {
Format(instr, "lb 'rt, 'imms('rs)");
break;
« no previous file with comments | « runtime/vm/constants_mips.h ('k') | runtime/vm/simulator_mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698