Simplify SelectRoot's interface, and factor out some common code
authorDan Gohman <gohman@apple.com>
Thu, 21 Aug 2008 16:36:34 +0000 (16:36 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 21 Aug 2008 16:36:34 +0000 (16:36 +0000)
from all targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55124 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DAGISelHeader.h
lib/Target/ARM/ARMISelDAGToDAG.cpp
lib/Target/Alpha/AlphaISelDAGToDAG.cpp
lib/Target/CellSPU/SPUISelDAGToDAG.cpp
lib/Target/IA64/IA64ISelDAGToDAG.cpp
lib/Target/Mips/MipsISelDAGToDAG.cpp
lib/Target/PIC16/PIC16ISelDAGToDAG.cpp
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
lib/Target/Sparc/SparcISelDAGToDAG.cpp
lib/Target/X86/X86ISelDAGToDAG.cpp

index 48050edc06ea502975788bf5cad985568e67655d..d67b8fe0f6621e4ee75f76b894d9193f62432475 100644 (file)
@@ -153,7 +153,7 @@ void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {
 
 /// SelectRoot - Top level entry to DAG instruction selector.
 /// Selects instructions starting at the root of the current DAG.
-SDValue SelectRoot(SDValue Root) {
+void SelectRoot() {
   SelectRootInit();
   unsigned NumBytes = (DAGSize + 7) / 8;
   ISelQueued   = new unsigned char[NumBytes];
@@ -197,7 +197,7 @@ SDValue SelectRoot(SDValue Root) {
   ISelQueued = NULL;
   delete[] ISelSelected;
   ISelSelected = NULL;
-  return Dummy.getValue();
+  CurDAG->setRoot(Dummy.getValue());
 }
 
 #endif /* LLVM_CODEGEN_DAGISEL_HEADER_H */
index b79fffe16f44e10e15d79048c5f45cfc1d98761c..ad1f63d642f9c1f0363261c530464220c138747f 100644 (file)
@@ -94,7 +94,7 @@ public:
 void ARMDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) {
   DEBUG(BB->dump());
 
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }
 
index 89dee2a4fa5f39a59b5a2a4fb117d8fca120998e..0ff735d28eb78b87ac56aa5f7e9fe5a088c28e1a 100644 (file)
@@ -236,7 +236,7 @@ void AlphaDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) {
   DEBUG(BB->dump());
   
   // Select target instructions for the DAG.
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }
 
index 84a1bd8542452360e75b763f8dd7c2bba7f707b4..c8d04b46cb58ab9e7f0c0ef013bfd143cf68dcf1 100644 (file)
@@ -347,7 +347,7 @@ SPUDAGToDAGISel::InstructionSelect(SelectionDAG &DAG)
   DEBUG(BB->dump());
 
   // Select target instructions for the DAG.
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }
 
index c5c311466d7330021e722cb55bd104b9cf06afc0..8173e96ccbfc9c6b2f37daaf20d8fa3c2cf63b40 100644 (file)
@@ -100,7 +100,7 @@ void IA64DAGToDAGISel::InstructionSelect(SelectionDAG &DAG) {
   DEBUG(BB->dump());
 
   // Select target instructions for the DAG.
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }
 
index f463d3ad7d129fac26cef133599971041c598727..94fdb3526db36454a6703954a3a740e62e922ffe 100644 (file)
@@ -113,7 +113,7 @@ InstructionSelect(SelectionDAG &SD)
   #endif
 
   // Select target instructions for the DAG.
-  SD.setRoot(SelectRoot(SD.getRoot()));
+  SelectRoot();
 
   #ifndef NDEBUG
   DOUT << "===== Instruction selection ends:\n";
index ba002bd0e32fe692343c1ce4613430569253bdee..f1eaa39155d59f720453c0d9bc50837f00cb5f95 100644 (file)
@@ -109,7 +109,7 @@ void PIC16DAGToDAGISel::InstructionSelect(SelectionDAG &SD)
 #endif
 
   // Select target instructions for the DAG.
-  SD.setRoot(SelectRoot(SD.getRoot()));
+  SelectRoot();
 
   DOUT << "===== Instruction selection ends:\n";
 
index 65ab4d2a5bd41f590e64000619a8fc411d0722b9..c64795543466ece7435ea834b3c8c4380150b5fb 100644 (file)
@@ -207,7 +207,7 @@ void PPCDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) {
   DEBUG(BB->dump());
 
   // Select target instructions for the DAG.
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }
 
index 7d2d11ec7220b015dd1a7836f7dc24684574ec92..f62387307d179e3c0dacde4559fb40f8ec13eb82 100644 (file)
@@ -66,7 +66,7 @@ void SparcDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) {
   DEBUG(BB->dump());
   
   // Select target instructions for the DAG.
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
   DAG.RemoveDeadNodes();
 }
 
index 13ed07c04c7a8273da0a7660b8f32ed94cd7e76b..21837d53d4331fb32aa22f0aade565555f0abb24 100644 (file)
@@ -592,7 +592,7 @@ void X86DAGToDAGISel::InstructionSelect(SelectionDAG &DAG) {
   DOUT << "===== Instruction selection begins:\n";
   Indent = 0;
 #endif
-  DAG.setRoot(SelectRoot(DAG.getRoot()));
+  SelectRoot();
 #ifndef NDEBUG
   DOUT << "===== Instruction selection ends:\n";
 #endif