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/IceTranslator.cpp b/src/IceTranslator.cpp
index dad0fa9..0391b6c 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -28,6 +28,16 @@
 
 using namespace Ice;
 
+namespace {
+
+// Match a symbol name against a match string.  An empty match string
+// means match everything.  Returns true if there is a match.
+bool matchSymbolName(const IceString &SymbolName, const IceString &Match) {
+  return Match.empty() || Match == SymbolName;
+}
+
+} // end of anonymous namespace
+
 Translator::~Translator() {}
 
 IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) {
@@ -58,9 +68,13 @@
 void Translator::translateFcn(Cfg *Fcn) {
   Ctx->resetStats();
   Func.reset(Fcn);
-  if (Ctx->getFlags().DisableInternal)
-    Func->setInternal(false);
-  if (Ctx->getFlags().DisableTranslation) {
+  VerboseMask OldVerboseMask = Ctx->getVerbose();
+  if (!matchSymbolName(Func->getFunctionName(), Ctx->getFlags().VerboseFocusOn))
+    Ctx->setVerbose(IceV_None);
+
+  if (Ctx->getFlags().DisableTranslation ||
+      !matchSymbolName(Func->getFunctionName(),
+                       Ctx->getFlags().TranslateOnly)) {
     Func->dump();
   } else {
     Func->translate();
@@ -72,6 +86,8 @@
     Func->emit();
     Ctx->dumpStats(Func->getFunctionName());
   }
+
+  Ctx->setVerbose(OldVerboseMask);
 }
 
 void Translator::emitConstants() {
@@ -84,12 +100,15 @@
   llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering(
       TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
   bool DisableTranslation = Ctx->getFlags().DisableTranslation;
-  bool DumpGlobalVariables = Ctx->isVerbose();
+  bool DumpGlobalVariables =
+      Ctx->isVerbose() && Ctx->getFlags().VerboseFocusOn.empty();
   Ostream &Stream = Ctx->getStrDump();
+  const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly;
   for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
     if (DumpGlobalVariables)
       Global->dump(getContext(), Stream);
-    if(!DisableTranslation)
+    if (!DisableTranslation &&
+        matchSymbolName(Global->getName(), TranslateOnly))
       GlobalLowering->lower(*Global);
   }
   GlobalLowering.reset();