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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 396993009: Lower stacksave and restore intrinsics. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase Created 6 years, 5 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 | « crosstest/test_stacksave_main.c ('k') | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index b38481b44ef93f34a9596f66ddb28d1ef778a58e..b572578cbe9feca25aebdc86c2ab386bb11a6eb4 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -2705,7 +2705,7 @@ void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
}
case Intrinsics::Memset: {
// The value operand needs to be extended to a stack slot size
- // because we "push" only works for a specific operand size.
+ // because "push" only works for a specific operand size.
Operand *ValOp = Instr->getArg(1);
assert(ValOp->getType() == IceType_i8);
Variable *ValExt = makeReg(stackSlotType());
@@ -2741,11 +2741,17 @@ void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
_mov(Dest, T);
return;
}
- case Intrinsics::Stacksave:
- case Intrinsics::Stackrestore:
- // TODO(jvoung): fill it in.
- Func->setError("Unhandled intrinsic");
+ case Intrinsics::Stacksave: {
+ Variable *esp = Func->getTarget()->getPhysicalRegister(Reg_esp);
+ Variable *Dest = Instr->getDest();
+ _mov(Dest, esp);
+ return;
+ }
+ case Intrinsics::Stackrestore: {
+ Variable *esp = Func->getTarget()->getPhysicalRegister(Reg_esp);
+ _mov(esp, Instr->getArg(0));
return;
+ }
case Intrinsics::Trap:
_ud2();
return;
« no previous file with comments | « crosstest/test_stacksave_main.c ('k') | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698