Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/disassembler.h" | 5 #include "vm/disassembler.h" |
| 6 | 6 |
| 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 8 #if defined(TARGET_ARCH_MIPS) | 8 #if defined(TARGET_ARCH_MIPS) |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 break; | 222 break; |
| 223 } | 223 } |
| 224 case DIV: { | 224 case DIV: { |
| 225 Format(instr, "div 'rs, 'rt"); | 225 Format(instr, "div 'rs, 'rt"); |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 case DIVU: { | 228 case DIVU: { |
| 229 Format(instr, "divu 'rs, 'rt"); | 229 Format(instr, "divu 'rs, 'rt"); |
| 230 break; | 230 break; |
| 231 } | 231 } |
| 232 case JALR: { | |
| 233 Format(instr, "jalr'hint 'rd, 'rs"); | |
| 234 break; | |
| 235 } | |
| 236 case JR: { | |
| 237 Format(instr, "jr'hint 'rs"); | |
| 238 break; | |
| 239 } | |
| 232 case MFHI: { | 240 case MFHI: { |
| 233 Format(instr, "mfhi 'rd"); | 241 Format(instr, "mfhi 'rd"); |
| 234 break; | 242 break; |
| 235 } | 243 } |
| 236 case MFLO: { | 244 case MFLO: { |
| 237 Format(instr, "mflo 'rd"); | 245 Format(instr, "mflo 'rd"); |
| 238 break; | 246 break; |
| 239 } | 247 } |
| 248 case MOVN: { | |
| 249 Format(instr, "movn 'rd, 'rs, 'rt"); | |
| 250 break; | |
| 251 } | |
| 252 case MOVZ: { | |
| 253 Format(instr, "movz 'rd, 'rs, 'rt"); | |
| 254 break; | |
| 255 } | |
| 256 case MULT: { | |
| 257 Format(instr, "mult 'rs, 'rt"); | |
| 258 break; | |
| 259 } | |
| 260 case MULTU: { | |
| 261 Format(instr, "multu 'rs, 'rt"); | |
| 262 break; | |
| 263 } | |
| 264 case NOR: { | |
| 265 Format(instr, "nor 'rd, 'rs, 'rt"); | |
| 266 break; | |
| 267 } | |
| 268 case OR: { | |
| 269 if (instr->RsField() == R0) { | |
| 270 Format(instr, "mov 'rd, 'rt"); | |
|
Ivan Posva
2013/03/20 01:54:51
Is the expectation that if it is "or RD, R0, R0" t
zra
2013/03/20 15:53:50
Done.
| |
| 271 } else if (instr->RtField() == R0) { | |
| 272 Format(instr, "mov 'rd, 'rs"); | |
| 273 } else { | |
| 274 Format(instr, "or 'rd, 'rs, 'rt"); | |
| 275 } | |
| 276 break; | |
| 277 } | |
| 240 case SLL: { | 278 case SLL: { |
| 241 if ((instr->RdField() == R0) && | 279 if ((instr->RdField() == R0) && |
| 242 (instr->RtField() == R0) && | 280 (instr->RtField() == R0) && |
| 243 (instr->SaField() == 0)) { | 281 (instr->SaField() == 0)) { |
| 244 Format(instr, "nop"); | 282 Format(instr, "nop"); |
| 245 } else { | 283 } else { |
| 246 Format(instr, "sll 'rd, 'rt, 'sa"); | 284 Format(instr, "sll 'rd, 'rt, 'sa"); |
| 247 } | 285 } |
| 248 break; | 286 break; |
| 249 } | 287 } |
| 250 case JR: { | 288 case SLLV: { |
| 251 Format(instr, "jr'hint 'rs"); | 289 Format(instr, "sllv 'rd, 'rt, 'rs"); |
| 290 break; | |
| 291 } | |
| 292 case SLT: { | |
| 293 Format(instr, "slt 'rd, 'rs, 'rt"); | |
| 294 break; | |
| 295 } | |
| 296 case SLTU: { | |
| 297 Format(instr, "sltu 'rd, 'rs, 'rt"); | |
| 298 break; | |
| 299 } | |
| 300 case SRA: { | |
| 301 Format(instr, "sra 'rd, 'rt, 'sa"); | |
|
Ivan Posva
2013/03/20 01:54:51
Here and others: The SRA instruction expects the R
zra
2013/03/20 15:53:50
In the assembler, sra() passes 0 for rs to EmitRTy
Ivan Posva
2013/03/21 00:08:06
You could do Unkown(instr) like you do in SRL.
| |
| 302 break; | |
| 303 } | |
| 304 case SRAV: { | |
| 305 Format(instr, "srav 'rd, 'rt, 'rs"); | |
| 306 break; | |
| 307 } | |
| 308 case SRL: { | |
| 309 if (instr->RsField() == 0) { | |
| 310 Format(instr, "srl 'rd, 'rt, 'sa"); | |
| 311 } else { | |
| 312 Unknown(instr); | |
| 313 } | |
| 314 break; | |
| 315 } | |
| 316 case SRLV: { | |
| 317 if (instr->SaField() == 0) { | |
| 318 Format(instr, "srlv 'rd, 'rt, 'rs"); | |
| 319 } else { | |
| 320 Unknown(instr); | |
| 321 } | |
| 322 break; | |
| 323 } | |
| 324 case SUB: { | |
| 325 Format(instr, "sub 'rd, 'rs, 'rt"); | |
| 326 break; | |
| 327 } | |
| 328 case SUBU: { | |
| 329 Format(instr, "subu 'rd, 'rs, 'rt"); | |
| 330 break; | |
| 331 } | |
| 332 case XOR: { | |
| 333 Format(instr, "xor 'rd, 'rs, 'rt"); | |
| 252 break; | 334 break; |
| 253 } | 335 } |
| 254 default: { | 336 default: { |
| 255 Unknown(instr); | 337 Unknown(instr); |
| 256 break; | 338 break; |
| 257 } | 339 } |
| 258 } | 340 } |
| 259 } | 341 } |
| 260 | 342 |
| 261 | 343 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 pc); | 469 pc); |
| 388 pc += instruction_length; | 470 pc += instruction_length; |
| 389 } | 471 } |
| 390 | 472 |
| 391 return success; | 473 return success; |
| 392 } | 474 } |
| 393 | 475 |
| 394 } // namespace dart | 476 } // namespace dart |
| 395 | 477 |
| 396 #endif // defined TARGET_ARCH_MIPS | 478 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |