Commit 3469b024 by Jan Voung

Followup to previous MIPS commit: implement dump(), rebase more.

When compiling with DEBUG, there is a problem linking InstMIPS32. It overrides dump, but never defined that. Also, update the code for some recent changes. Namely, we no longer check ALLOW_DUMP but instead check BuildDefs::dump(). Also, the instruction dtors have been deleted. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4167 R=kschimpf@google.com Review URL: https://codereview.chromium.org/1214863019 .
parent d00d48da
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
namespace Ice { namespace Ice {
const char *InstMIPS32::getWidthString(Type Ty) {
(void)Ty;
return "TBD";
}
InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source) InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source)
: InstMIPS32(Func, InstMIPS32::Ret, Source ? 2 : 1, nullptr) { : InstMIPS32(Func, InstMIPS32::Ret, Source ? 2 : 1, nullptr) {
...@@ -32,8 +36,18 @@ InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source) ...@@ -32,8 +36,18 @@ InstMIPS32Ret::InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source)
addSource(Source); addSource(Source);
} }
// ======================== Dump routines ======================== //
void InstMIPS32::dump(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrDump();
Str << "[MIPS32] ";
Inst::dump(Func);
}
void InstMIPS32Ret::emit(const Cfg *Func) const { void InstMIPS32Ret::emit(const Cfg *Func) const {
if (!ALLOW_DUMP) if (!BuildDefs::dump())
return; return;
assert(getSrcSize() > 0); assert(getSrcSize() > 0);
Variable *RA = llvm::cast<Variable>(getSrc(0)); Variable *RA = llvm::cast<Variable>(getSrc(0));
...@@ -52,7 +66,7 @@ void InstMIPS32Ret::emitIAS(const Cfg *Func) const { ...@@ -52,7 +66,7 @@ void InstMIPS32Ret::emitIAS(const Cfg *Func) const {
} }
void InstMIPS32Ret::dump(const Cfg *Func) const { void InstMIPS32Ret::dump(const Cfg *Func) const {
if (!ALLOW_DUMP) if (!BuildDefs::dump())
return; return;
Ostream &Str = Func->getContext()->getStrDump(); Ostream &Str = Func->getContext()->getStrDump();
Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType()); Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType());
......
...@@ -42,7 +42,6 @@ public: ...@@ -42,7 +42,6 @@ public:
protected: protected:
InstMIPS32(Cfg *Func, InstKindMIPS32 Kind, SizeT Maxsrcs, Variable *Dest) InstMIPS32(Cfg *Func, InstKindMIPS32 Kind, SizeT Maxsrcs, Variable *Dest)
: InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {}
~InstMIPS32() override {}
static bool isClassof(const Inst *Inst, InstKindMIPS32 MyKind) { static bool isClassof(const Inst *Inst, InstKindMIPS32 MyKind) {
return Inst->getKind() == static_cast<InstKind>(MyKind); return Inst->getKind() == static_cast<InstKind>(MyKind);
} }
...@@ -74,7 +73,6 @@ public: ...@@ -74,7 +73,6 @@ public:
private: private:
InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source); InstMIPS32Ret(Cfg *Func, Variable *RA, Variable *Source);
~InstMIPS32Ret() override {}
}; };
} // end of namespace Ice } // end of namespace Ice
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment