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

Unified Diff: src/IceInstMIPS32.h

Issue 2301303003: [SubZero] Implement load and store for MIPS (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 3 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 | src/IceInstMIPS32.cpp » ('j') | src/IceTargetLoweringMIPS32.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/IceInstMIPS32.cpp » ('j') | src/IceTargetLoweringMIPS32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698