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

Unified Diff: runtime/vm/assembler_mips.h

Issue 12519007: Adds MIPS instructions to 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 | « no previous file | runtime/vm/assembler_mips_test.cc » ('j') | runtime/vm/assembler_mips_test.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_mips.h
===================================================================
--- runtime/vm/assembler_mips.h (revision 19730)
+++ runtime/vm/assembler_mips.h (working copy)
@@ -221,13 +221,13 @@
// CPU instructions.
void addi(Register rt, Register rs, const Immediate& imm) {
regis 2013/03/11 17:31:11 As discussed, we may never use this instruction, b
- ASSERT(Utils::IsUint(16, imm.value()));
+ ASSERT(Utils::IsInt(16, imm.value()));
uint16_t imm_value = static_cast<uint16_t>(imm.value());
EmitIType(ADDI, rs, rt, imm_value);
}
void addiu(Register rt, Register rs, const Immediate& imm) {
- ASSERT(Utils::IsUint(16, imm.value()));
+ ASSERT(Utils::IsInt(16, imm.value()));
uint16_t imm_value = static_cast<uint16_t>(imm.value());
EmitIType(ADDIU, rs, rt, imm_value);
}
@@ -262,12 +262,59 @@
EmitRType(SPECIAL, rs, rt, R0, 0, DIVU);
}
+ // Extract bit field.
+ void ext(Register rt, Register rs, int32_t pos, int32_t size) {
+ ASSERT((0 <= pos) && (pos < 32));
+ ASSERT((0 < size) && (size <= 32));
+ ASSERT((0 < pos + size) && (pos + size <= 32));
regis 2013/03/11 17:31:11 You could express these 3 asserts using Utils::IsU
+ EmitRType(SPECIAL3, rs, rt, static_cast<Register>(size - 1), pos, EXT);
Ivan Posva 2013/03/11 17:29:04 Maybe we should have a EmitRType which takes a int
+ }
+
+ // Insert bit field.
+ void ins(Register rt, Register rs, int32_t pos, int32_t size) {
+ ASSERT((0 <= pos) && (pos < 32));
+ ASSERT((0 < size) && (size <= 32));
+ ASSERT((0 < pos + size) && (pos + size <= 32));
regis 2013/03/11 17:31:11 ditto Btw, I am not sure we are going to use ext
zra 2013/03/11 18:36:06 If these won't be used, as with addi, I'd be happy
zra 2013/03/11 20:00:11 As discussed, I have removed ext and ins.
+ EmitRType(SPECIAL3, rs, rt,
+ static_cast<Register>(pos + size - 1), pos, INS);
+ }
+
+ void lb(Register rt, const Immediate& off, Register base) {
Ivan Posva 2013/03/11 17:29:04 The correct parameters here should be void lb(Regi
zra 2013/03/11 18:36:06 As far as I understand, the addressing modes in MI
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(LB, base, rt, off_value);
+ }
+
+ void lbu(Register rt, const Immediate& off, Register base) {
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(LBU, base, rt, off_value);
+ }
+
+ void lh(Register rt, const Immediate& off, Register base) {
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(LH, base, rt, off_value);
+ }
+
+ void lhu(Register rt, const Immediate& off, Register base) {
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(LHU, base, rt, off_value);
+ }
+
void lui(Register rt, const Immediate& imm) {
ASSERT(Utils::IsUint(16, imm.value()));
uint16_t imm_value = static_cast<uint16_t>(imm.value());
EmitIType(LUI, R0, rt, imm_value);
}
+ void lw(Register rt, const Immediate& off, Register base) {
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(LW, base, rt, off_value);
+ }
+
void mfhi(Register rd) {
EmitRType(SPECIAL, R0, R0, rd, 0, MFHI);
}
@@ -289,6 +336,24 @@
delay_slot_available_ = true;
}
+ void sb(Register rt, const Immediate& off, Register base) {
Ivan Posva 2013/03/11 17:29:04 ditto.
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(SB, base, rt, off_value);
+ }
+
+ void sh(Register rt, const Immediate& off, Register base) {
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(SH, base, rt, off_value);
+ }
+
+ void sw(Register rt, const Immediate& off, Register base) {
+ ASSERT(Utils::IsInt(16, off.value()));
+ uint16_t off_value = static_cast<uint16_t>(off.value());
+ EmitIType(SW, base, rt, off_value);
+ }
+
void sll(Register rd, Register rt, int sa) {
EmitRType(SPECIAL, R0, rt, rd, sa, SLL);
}
« no previous file with comments | « no previous file | runtime/vm/assembler_mips_test.cc » ('j') | runtime/vm/assembler_mips_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698