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

Unified Diff: src/IceCfg.cpp

Issue 682983004: Subzero: Decorate the text asm output with register availability info. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Change to -asm-verbose. Make another emit helper function. Created 6 years, 1 month 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/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 84aff16b3a61f07e5e78cb95c0adea7ecd9cf7b1..e8167f4ffbea727013b56de6e029065542d1b920 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -365,20 +365,15 @@ bool Cfg::validateLiveness() const {
return Valid;
}
-// Deletes redundant assignments like "var=var". This includes
-// architecturally redundant moves like "var1:eax=var2:eax". As such,
-// this needs to be done very late in the translation to avoid
-// liveness inconsistencies.
-void Cfg::deleteRedundantAssignments() {
- for (CfgNode *Node : Nodes) {
- // Ignore Phi instructions.
- for (Inst *I : Node->getInsts())
- if (I->isRedundantAssign())
- I->setDeleted();
- }
-}
-
void Cfg::contractEmptyNodes() {
+ // If we're decorating the asm output with register liveness info,
+ // this information may become corrupted or incorrect after
+ // contracting nodes that contain only redundant assignments. As
+ // such, we disable this pass when DecorateAsm is specified. This
+ // may make the resulting code look more branchy, but it should have
+ // no effect on the register assignments.
+ if (Ctx->getFlags().DecorateAsm)
+ return;
for (CfgNode *Node : Nodes) {
Node->contractIfEmpty();
}
@@ -397,6 +392,12 @@ void Cfg::doBranchOpt() {
void Cfg::emit() {
TimerMarker T(TimerStack::TT_emit, this);
+ if (Ctx->getFlags().DecorateAsm) {
+ renumberInstructions();
+ getVMetadata()->init(VMK_Uses);
+ liveness(Liveness_Basic);
+ dump("After recomputing liveness for -decorate-asm");
+ }
Ostream &Str = Ctx->getStrEmit();
if (!Ctx->testAndSetHasEmittedFirstMethod()) {
// Print a helpful command for assembling the output.
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698