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

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: Expand asm-verbose comments 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
« no previous file with comments | « 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..82b0f7cb3dc54ff3578efac37945d172387a311a 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -798,6 +798,9 @@ void TargetX8632::addProlog(CfgNode *Node) {
Variable *esp = getPhysicalRegister(RegX8632::Reg_esp);
_push(ebp);
_mov(ebp, esp);
+ // Keep ebp live for late-stage liveness analysis
+ // (e.g. asm-verbose mode).
+ Context.insert(InstFakeUse::create(Func, ebp));
}
// Align the variables area. SpillAreaPaddingBytes is the size of
@@ -940,6 +943,10 @@ void TargetX8632::addEpilog(CfgNode *Node) {
Variable *esp = getPhysicalRegister(RegX8632::Reg_esp);
if (IsEbpBasedFrame) {
Variable *ebp = getPhysicalRegister(RegX8632::Reg_ebp);
+ // For late-stage liveness analysis (e.g. 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 +4316,10 @@ 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 during late-stage liveness
+ // analysis (e.g. asm-verbose mode).
+ Context.insert(InstFakeDef::create(Func, Preg));
if (IsVector)
_movp(SpillLoc, Preg);
else
@@ -4335,6 +4346,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
+ // for late-stage liveness analysis (e.g. asm-verbose mode).
+ Context.insert(InstFakeUse::create(Func, Preg));
}
}
// Update register availability before moving to the previous
« no previous file with comments | « src/IceInstX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698