Index: src/IceInstARM32.cpp |
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp |
index 713df3a7db596fa28b3fea9d455250c5a9446d99..3e1664d59377bb070a3c2e43e3b9925aa4b4bf49 100644 |
--- a/src/IceInstARM32.cpp |
+++ b/src/IceInstARM32.cpp |
@@ -260,6 +260,25 @@ InstARM32Mla::InstARM32Mla(Cfg *Func, Variable *Dest, Variable *Src0, |
addSource(Acc); |
} |
+InstARM32Pop::InstARM32Pop(Cfg *Func, const VarList &Dests) |
+ : InstARM32(Func, InstARM32::Pop, 0, Dests[0]), Dests(Dests) { |
+ // We only track the first Dest directly. Other Dests should be |
Jim Stichnoth
2015/05/30 16:58:54
I think we should consider treating the Dests valu
jvoung (off chromium)
2015/06/01 18:00:23
Yeah that seems cleaner, and it's already storing
|
+ // modeled with a FakeDef. |
+ // A pop instruction affects the stack pointer and so it should not |
+ // be allowed to be automatically dead-code eliminated. (The |
+ // corresponding push instruction doesn't need this treatment |
+ // because it has no dest variable and therefore won't be dead-code |
+ // eliminated.) This is needed for late-stage liveness analysis |
+ // (e.g. asm-verbose mode). |
+ HasSideEffects = true; |
+} |
+ |
+InstARM32Push::InstARM32Push(Cfg *Func, const VarList &Srcs) |
+ : InstARM32(Func, InstARM32::Push, Srcs.size(), nullptr) { |
+ for (Variable *Source : Srcs) |
+ addSource(Source); |
+} |
+ |
InstARM32Ret::InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source) |
: InstARM32(Func, InstARM32::Ret, Source ? 2 : 1, nullptr) { |
addSource(LR); |
@@ -554,6 +573,66 @@ template <> void InstARM32Movt::emit(const Cfg *Func) const { |
} |
} |
+void InstARM32Pop::emit(const Cfg *Func) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ assert(Dests.size() > 0); |
+ Ostream &Str = Func->getContext()->getStrEmit(); |
+ Str << "\t" |
+ << "pop" |
+ << "\t{"; |
+ for (SizeT I = 0; I < Dests.size(); ++I) { |
+ if (I > 0) |
+ Str << ", "; |
+ Dests[I]->emit(Func); |
+ } |
+ Str << "}"; |
+} |
+ |
+void InstARM32Pop::emitIAS(const Cfg *Func) const { |
+ (void)Func; |
+ llvm_unreachable("Not yet implemented"); |
+} |
+ |
+void InstARM32Pop::dump(const Cfg *Func) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ Ostream &Str = Func->getContext()->getStrDump(); |
+ Str << "pop" |
+ << " "; |
+ for (SizeT I = 0; I < Dests.size(); ++I) { |
+ if (I > 0) |
+ Str << ", "; |
+ Dests[I]->dump(Func); |
+ } |
+} |
+ |
+void InstARM32Push::emit(const Cfg *Func) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ assert(getSrcSize() > 0); |
+ Ostream &Str = Func->getContext()->getStrEmit(); |
+ Str << "\t" |
+ << "push" |
+ << "\t{"; |
+ emitSources(Func); |
+ Str << "}"; |
+} |
+ |
+void InstARM32Push::emitIAS(const Cfg *Func) const { |
+ (void)Func; |
+ llvm_unreachable("Not yet implemented"); |
+} |
+ |
+void InstARM32Push::dump(const Cfg *Func) const { |
+ if (!ALLOW_DUMP) |
+ return; |
+ Ostream &Str = Func->getContext()->getStrDump(); |
+ Str << "push" |
+ << " "; |
+ dumpSources(Func); |
+} |
+ |
void InstARM32Ret::emit(const Cfg *Func) const { |
if (!ALLOW_DUMP) |
return; |
@@ -683,7 +762,7 @@ void OperandARM32Mem::dump(const Cfg *Func, Ostream &Str) const { |
} else { |
getOffset()->dump(Func, Str); |
} |
- Str << "] AddrMode==" << getAddrMode() << "\n"; |
+ Str << "] AddrMode==" << getAddrMode(); |
} |
void OperandARM32FlexImm::emit(const Cfg *Func) const { |