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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1113683002: Subzero: Produce actually correct code in -asm-verbose mode. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 8 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
« src/IceInstX8632.cpp ('K') | « src/IceInstX8632.cpp ('k') | no next file » | 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 d4c4c54b3b90d7b849531361b65e0c192b93b11d..313ff41ad7090500fa5e79d43077972afe368060 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -798,6 +798,8 @@ void TargetX8632::addProlog(CfgNode *Node) {
Variable *esp = getPhysicalRegister(RegX8632::Reg_esp);
_push(ebp);
_mov(ebp, esp);
+ // Keep ebp live in asm-verbose mode.
+ Context.insert(InstFakeUse::create(Func, ebp));
}
// Align the variables area. SpillAreaPaddingBytes is the size of
@@ -940,6 +942,10 @@ void TargetX8632::addEpilog(CfgNode *Node) {
Variable *esp = getPhysicalRegister(RegX8632::Reg_esp);
if (IsEbpBasedFrame) {
Variable *ebp = getPhysicalRegister(RegX8632::Reg_ebp);
+ // For asm-verbose mode, adding a fake use of esp before the
+ // assignment of esp=ebp keeps previous esp adjustments from being
+ // dead-code eliminated.
+ Context.insert(InstFakeUse::create(Func, esp));
_mov(esp, ebp);
_pop(ebp);
} else {
@@ -4309,6 +4315,9 @@ void TargetX8632::lowerPhiAssignments(CfgNode *Node,
RegNum = RegsForType.find_first();
Preg = getPhysicalRegister(RegNum, Dest->getType());
SpillLoc = Func->makeVariable(Dest->getType());
+ // Create a fake def of the physical register to avoid
+ // liveness inconsistency problems in asm-verbose mode.
+ Context.insert(InstFakeDef::create(Func, Preg));
if (IsVector)
_movp(SpillLoc, Preg);
else
@@ -4335,6 +4344,9 @@ void TargetX8632::lowerPhiAssignments(CfgNode *Node,
_movp(Preg, SpillLoc);
else
_mov(Preg, SpillLoc);
+ // Create a fake use of the physical register to keep it live
+ // in asm-verbose mode.
+ Context.insert(InstFakeUse::create(Func, Preg));
}
}
// Update register availability before moving to the previous
« src/IceInstX8632.cpp ('K') | « src/IceInstX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698