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

Unified Diff: src/IceInstARM32.cpp

Issue 1144923008: Use ldr for movs out of stack slots (instead of mov reg, [sp/fp]). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: scope better Created 5 years, 7 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 | tests_lit/llvm2ice_tests/alloc.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstARM32.cpp
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp
index 2c33c4317b650d45dc2a5aa89fec5f2afb82b88c..713df3a7db596fa28b3fea9d455250c5a9446d99 100644
--- a/src/IceInstARM32.cpp
+++ b/src/IceInstARM32.cpp
@@ -313,8 +313,18 @@ template <> void InstARM32Mov::emit(const Cfg *Func) const {
assert(getSrcSize() == 1);
Variable *Dest = getDest();
if (Dest->hasReg()) {
- Str << "\t"
- << "mov" << getPredicate() << "\t";
+ const char *Opcode = "mov";
+ Operand *Src0 = getSrc(0);
+ if (const auto *Src0V = llvm::dyn_cast<Variable>(Src0)) {
+ if (!Src0V->hasReg()) {
+ Opcode = "ldr"; // Always load the full stack slot (vs ldrb, ldrh).
+ }
+ } else {
+ // If Src isn't a variable, it shouldn't be a memory operand either
+ // (otherwise Opcode will have to be ldr).
+ assert(!llvm::isa<OperandARM32Mem>(Src0));
+ }
+ Str << "\t" << Opcode << getPredicate() << "\t";
getDest()->emit(Func);
Str << ", ";
getSrc(0)->emit(Func);
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/alloc.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698