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

Unified Diff: src/mips/constants-mips.cc

Issue 1320006: Updates and fixes for MIPS support. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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
Index: src/mips/constants-mips.cc
===================================================================
--- src/mips/constants-mips.cc (revision 4259)
+++ src/mips/constants-mips.cc (working copy)
@@ -190,9 +190,14 @@
int op = OpcodeFieldRaw();
switch (op) {
case JAL:
- case BGEZAL:
- case BLTZAL:
- return true;
+ case REGIMM:
+ switch (RtFieldRaw()) {
+ case BGEZAL:
+ case BLTZAL:
+ return true;
+ default:
+ return false;
+ };
case SPECIAL:
switch (FunctionFieldRaw()) {
case JALR:
@@ -261,6 +266,8 @@
case TLTU:
case TEQ:
case TNE:
+ case MOVZ:
+ case MOVN:
return kRegisterType;
default:
UNREACHABLE();
@@ -269,13 +276,23 @@
case SPECIAL2:
switch (FunctionFieldRaw()) {
case MUL:
+ case CLZ:
return kRegisterType;
default:
UNREACHABLE();
};
break;
+ case SPECIAL3:
+ switch (FunctionFieldRaw()) {
+ case INS:
+ case EXT:
+ return kRegisterType;
+ default:
+ UNREACHABLE();
+ };
+ break;
case COP1: // Coprocessor instructions
- switch (FunctionFieldRaw()) {
+ switch (RsFieldRawNoAssert()) {
case BC1: // branch on coprocessor condition
return kImmediateType;
default:
@@ -301,9 +318,12 @@
case BLEZL:
case BGTZL:
case LB:
+ case LH:
case LW:
case LBU:
+ case LHU:
case SB:
+ case SH:
case SW:
case LWC1:
case LDC1:
@@ -320,4 +340,42 @@
return kUnsupported;
}
+
+// -----------------------------------------------------------------------------
+// MIPS Assembly utils.
+
+int32_t ISA_utils_instr_at(int32_t* pc) { return *pc; }
+int32_t* ISA_utils_target_address_at(int32_t* pc) {
+ int32_t instr1 = ISA_utils_instr_at(pc);
+ int32_t instr2 = ISA_utils_instr_at(pc + 1);
+ // Check we have 2 instructions generated by li.
+ if (((instr1 & kOpcodeMask) == LUI && (instr2 & kOpcodeMask) == ORI) ||
+ ((instr1 == nopInstr) && ((instr2 & kOpcodeMask) == ADDI ||
+ (instr2 & kOpcodeMask) == ORI ||
+ (instr2 & kOpcodeMask) == LUI))) {
+ // Interpret these 2 instructions.
+ if (instr1 == nopInstr) {
+ if ((instr2 & kOpcodeMask) == ADDI) {
+ return reinterpret_cast<int32_t*>(((instr2 & kImm16Mask) << 16) >> 16);
+ } else if ((instr2 & kOpcodeMask) == ORI) {
+ return reinterpret_cast<int32_t*>(instr2 & kImm16Mask);
+ } else if ((instr2 & kOpcodeMask) == LUI) {
+ return reinterpret_cast<int32_t*>((instr2 & kImm16Mask) << 16);
+ }
+ } else if ((instr1 & kOpcodeMask) == LUI && (instr2 & kOpcodeMask) == ORI) {
+ // 32 bits value.
+ return reinterpret_cast<int32_t*>(
+ (instr1 & kImm16Mask) << 16 | (instr2 & kImm16Mask));
+ }
+
+ // We should never get here.
+ UNREACHABLE();
+ return reinterpret_cast<int32_t*>(0x0);
+
+ } else {
+ return reinterpret_cast<int32_t*>(*pc);
+ }
+}
+
+
} } // namespace assembler::mips

Powered by Google App Engine
This is Rietveld 408576698