Chromium Code Reviews| Index: src/IceInstMIPS32.h |
| diff --git a/src/IceInstMIPS32.h b/src/IceInstMIPS32.h |
| index 5dac52728582eec5770387adfd738244df6320f4..c043ff8c59d51c223d0ac374b04cf5b9cb6a0961 100644 |
| --- a/src/IceInstMIPS32.h |
| +++ b/src/IceInstMIPS32.h |
| @@ -110,8 +110,21 @@ public: |
| static bool canHoldOffset(Type Ty, bool SignExt, int32_t Offset); |
| void dump(const Cfg *Func, Ostream &Str) const override { |
| - (void)Func; |
| - (void)Str; |
| + if (!BuildDefs::dump()) |
| + return; |
| + Str << "["; |
| + if (Func) |
| + getBase()->dump(Func); |
| + else |
| + getBase()->dump(Str); |
| + Str << ", "; |
| + getOffset()->dump(Func, Str); |
| + Str << "] AddrMode=="; |
| + if (getAddrMode() == Offset) { |
| + Str << "Offset"; |
| + } else { |
| + Str << "Unknown"; |
| + } |
| } |
| private: |
| @@ -515,8 +528,20 @@ public: |
| if (!BuildDefs::dump()) |
| return; |
| Ostream &Str = Func->getContext()->getStrEmit(); |
| - assert(getSrcSize() == 1); |
| - Str << "\t" << Opcode << "\t"; |
| + const Type Ty = getDest()->getType(); |
| + if (Ty == IceType_i8 || Ty == IceType_i1) { |
|
Jim Stichnoth
2016/09/03 13:47:13
Maybe use a switch statement instead? (here and b
jaydeep.patil
2016/09/04 06:24:30
Done.
|
| + Str << "\t" << "lb" << "\t"; |
| + } else if (Ty == IceType_i16) { |
| + Str << "\t" << "lh" << "\t"; |
| + } else if (Ty == IceType_i32) { |
| + Str << "\t" << "lw" << "\t"; |
| + } else if (Ty == IceType_f32) { |
| + Str << "\t" << "lwc1" << "\t"; |
| + } else if (Ty == IceType_f64) { |
| + Str << "\t" << "ldc1" << "\t"; |
| + } else { |
| + llvm_unreachable("InstMIPS32Load unknown type"); |
| + } |
| getDest()->emit(Func); |
| Str << ", "; |
| emitRelocOp(Str, Reloc); |
| @@ -532,13 +557,12 @@ public: |
| if (!BuildDefs::dump()) |
| return; |
| Ostream &Str = Func->getContext()->getStrDump(); |
| - Str << "\t" << Opcode << "\t"; |
| + dumpOpcode(Str, Opcode, getDest()->getType()); |
| + Str << " "; |
| getDest()->dump(Func); |
| Str << ", "; |
| emitRelocOp(Str, Reloc); |
| - Str << (Reloc ? "(" : ""); |
| getSrc(0)->dump(Func); |
| - Str << (Reloc ? ")" : ""); |
| } |
| static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| @@ -572,7 +596,20 @@ public: |
| return; |
| Ostream &Str = Func->getContext()->getStrEmit(); |
| assert(getSrcSize() == 2); |
| - Str << "\t" << Opcode << "\t"; |
| + const Type Ty = getSrc(0)->getType(); |
| + if (Ty == IceType_i8 || Ty == IceType_i1) { |
| + Str << "\t" << "sb" << "\t"; |
| + } else if (Ty == IceType_i16) { |
| + Str << "\t" << "sh" << "\t"; |
| + } else if (Ty == IceType_i32) { |
| + Str << "\t" << "sw" << "\t"; |
| + } else if (Ty == IceType_f32) { |
| + Str << "\t" << "swc1" << "\t"; |
| + } else if (Ty == IceType_f64) { |
| + Str << "\t" << "sdc1" << "\t"; |
| + } else { |
| + llvm_unreachable("InstMIPS32Store unknown type"); |
| + } |
| getSrc(0)->emit(Func); |
| Str << ", "; |
| emitRelocOp(Str, Reloc); |
| @@ -581,20 +618,19 @@ public: |
| void emitIAS(const Cfg *Func) const override { |
| (void)Func; |
| - llvm_unreachable("Not yet implemented"); |
| + llvm_unreachable("InstMIPS32Store: Not yet implemented"); |
| } |
| void dump(const Cfg *Func) const override { |
| if (!BuildDefs::dump()) |
| return; |
| Ostream &Str = Func->getContext()->getStrDump(); |
| - Str << "\t" << Opcode << "\t"; |
| + dumpOpcode(Str, Opcode, getSrc(0)->getType()); |
| + Str << " "; |
| getSrc(0)->dump(Func); |
| Str << ", "; |
| emitRelocOp(Str, Reloc); |
| - Str << (Reloc ? "(" : ""); |
| getSrc(1)->dump(Func); |
| - Str << (Reloc ? ")" : ""); |
| } |
| static bool classof(const Inst *Inst) { return isClassof(Inst, K); } |
| @@ -775,11 +811,12 @@ public: |
| if (!BuildDefs::dump()) |
| return; |
| Ostream &Str = Func->getContext()->getStrDump(); |
| + dumpOpcode(Str, Opcode, getDest()->getType()); |
| Str << " "; |
| - Str << "\t" << Opcode << "\t"; |
| dumpDest(Func); |
| Str << ", "; |
| dumpSources(Func); |
| + Str << ", "; |
| if (Signed) |
| Str << (int32_t)Imm; |
| else |