Simplify SelectRoot's interface, and factor out some common code
from all targets.

llvm-svn: 55124
diff --git a/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
index 89dee2a..0ff735d 100644
--- a/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
@@ -236,7 +236,7 @@
   DEBUG(BB->dump());
   
   // Select target instructions for the DAG.
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }