Subzero: Improve debugging controls, plus minor refactoring. 1. Decorate the list of live-in and live-out variables with register assignments in the dump() output. This helps one to assess register pressure. 2. Fix a bug where the DisableInternal flag wasn't being honored for function definitions. 3. Add a -translate-only=<symbol> to limit translation to a single function or global variable. This makes it easier to focus on debugging a single function. 4. Change the -no-phi-edge-split option to -phi-edge-split and invert the meaning, to better not avoid the non double negatives. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/673783002
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp index 767c9c3..4e4d36b 100644 --- a/src/IceCfgNode.cpp +++ b/src/IceCfgNode.cpp
@@ -30,9 +30,7 @@ IceString CfgNode::getName() const { if (!Name.empty()) return Name; - char buf[30]; - snprintf(buf, llvm::array_lengthof(buf), "__%u", getIndex()); - return buf; + return "__" + std::to_string(getIndex()); } // Adds an instruction to either the Phi list or the regular @@ -65,7 +63,7 @@ InstCountEstimate = Func->getNextInstNumber() - FirstNumber; } -// When a node is created, the OutEdges are immediately knows, but the +// When a node is created, the OutEdges are immediately known, but the // InEdges have to be built up incrementally. After the CFG has been // constructed, the computePredecessors() pass finalizes it by // creating the InEdges list. @@ -557,7 +555,12 @@ Str << " // LiveIn:"; for (SizeT i = 0; i < LiveIn.size(); ++i) { if (LiveIn[i]) { - Str << " %" << Liveness->getVariable(i, this)->getName(); + Variable *Var = Liveness->getVariable(i, this); + Str << " %" << Var->getName(); + if (Func->getContext()->isVerbose(IceV_RegOrigins) && Var->hasReg()) { + Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), + Var->getType()); + } } } Str << "\n"; @@ -577,7 +580,12 @@ Str << " // LiveOut:"; for (SizeT i = 0; i < LiveOut.size(); ++i) { if (LiveOut[i]) { - Str << " %" << Liveness->getVariable(i, this)->getName(); + Variable *Var = Liveness->getVariable(i, this); + Str << " %" << Var->getName(); + if (Func->getContext()->isVerbose(IceV_RegOrigins) && Var->hasReg()) { + Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), + Var->getType()); + } } } Str << "\n";