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

Unified Diff: src/IceInstMIPS32.cpp

Issue 1724643002: Subzero: Basic unconditional branch for Mips. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 10 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/IceInstMIPS32.cpp
diff --git a/src/IceInstMIPS32.cpp b/src/IceInstMIPS32.cpp
index ad33992ea363612bbd4ccf96da3e09d2cf94b6e5..823e7d3069baa6d3cdf05c8b7516fc505a0b7096 100644
--- a/src/IceInstMIPS32.cpp
+++ b/src/IceInstMIPS32.cpp
@@ -106,6 +106,20 @@ template <> void InstMIPS32Multu::emit(const Cfg *Func) const {
emitThreeAddrLoHi(Opcode, this, Func);
}
+InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue,
+ const CfgNode *TargetFalse,
+ const InstMIPS32Label *Label)
+ : InstMIPS32(Func, InstMIPS32::Br, 0, nullptr), TargetTrue(TargetTrue),
+ TargetFalse(TargetFalse), Label(Label) {}
+
+InstMIPS32Label::InstMIPS32Label(Cfg *Func, TargetMIPS32 *Target)
Jim Stichnoth 2016/02/23 06:18:51 You may want to consider alphabetizing or otherwis
rkotlerimgtec 2016/02/23 23:17:20 Let's alphabetize in another patch. Otherwise it w
+ : InstMIPS32(Func, InstMIPS32::Label, 0, nullptr),
+ Number(Target->makeNextLabelNumber()) {}
+
+IceString InstMIPS32Label::getName(const Cfg *Func) const {
+ return ".L" + Func->getFunctionName() + "$local$__" + std::to_string(Number);
Jim Stichnoth 2016/02/23 06:18:51 This method should probably start with something l
rkotlerimgtec 2016/02/23 23:17:20 Done.
+}
+
InstMIPS32Call::InstMIPS32Call(Cfg *Func, Variable *Dest, Operand *CallTarget)
: InstMIPS32(Func, InstMIPS32::Call, 1, Dest) {
HasSideEffects = true;
@@ -225,6 +239,23 @@ void InstMIPS32Ret::emit(const Cfg *Func) const {
RA->emit(Func);
}
+void InstMIPS32Br::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+ Ostream &Str = Func->getContext()->getStrEmit();
+ Str << "\t"
+ "b"
+ << "\t";
+ if (Label) {
+ Str << Label->getName(Func);
+ } else {
+ if (isUnconditionalBranch()) {
+ Str << getTargetFalse()->getAsmName();
+ } else {
+ }
Jim Stichnoth 2016/02/23 06:18:51 Leave something here, like a TODO or an assert?
rkotlerimgtec 2016/02/23 23:17:20 Done.
+ }
+}
+
void InstMIPS32Call::emit(const Cfg *Func) const {
if (!BuildDefs::dump())
return;

Powered by Google App Engine
This is Rietveld 408576698