Make TargetSelectInstruction protected and called from FastISel.cpp
authorDan Gohman <gohman@apple.com>
Sat, 5 Dec 2009 01:27:58 +0000 (01:27 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 5 Dec 2009 01:27:58 +0000 (01:27 +0000)
instead of SelectionDAGISel.cpp.

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

include/llvm/CodeGen/FastISel.h
lib/CodeGen/SelectionDAG/FastISel.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 1efd1e08acfabf2b37335042663a67482a9a7e55..806952a168812c6e263753f49e11b58d3791a21c 100644 (file)
@@ -98,14 +98,6 @@ public:
   ///
   bool SelectOperator(User *I, unsigned Opcode);
 
-  /// TargetSelectInstruction - This method is called by target-independent
-  /// code when the normal FastISel process fails to select an instruction.
-  /// This gives targets a chance to emit code for anything that doesn't
-  /// fit into FastISel's framework. It returns true if it was successful.
-  ///
-  virtual bool
-  TargetSelectInstruction(Instruction *I) = 0;
-
   /// getRegForValue - Create a virtual register and arrange for it to
   /// be assigned the value for the given LLVM value.
   unsigned getRegForValue(Value *V);
@@ -134,6 +126,14 @@ protected:
 #endif
            );
 
+  /// TargetSelectInstruction - This method is called by target-independent
+  /// code when the normal FastISel process fails to select an instruction.
+  /// This gives targets a chance to emit code for anything that doesn't
+  /// fit into FastISel's framework. It returns true if it was successful.
+  ///
+  virtual bool
+  TargetSelectInstruction(Instruction *I) = 0;
+
   /// FastEmit_r - This method is called by target-independent code
   /// to request that an instruction with the given type and opcode
   /// be emitted.
index c6c14016d28a89176be8f12c849b4572f1ee623e..4ead9c9d8c4234b2480facf5b316a9cdd7390a2a 100644 (file)
@@ -532,7 +532,15 @@ bool FastISel::SelectBitCast(User *I) {
 
 bool
 FastISel::SelectInstruction(Instruction *I) {
-  return SelectOperator(I, I->getOpcode());
+  // First, try doing target-independent selection.
+  if (SelectOperator(I, I->getOpcode()))
+    return true;
+
+  // Next, try calling the target to attempt to handle the instruction.
+  if (TargetSelectInstruction(I))
+    return true;
+
+  return false;
 }
 
 /// FastEmitBranch - Emit an unconditional branch to the given block,
index 4a67b57cc2e8e324da9618015dd2394264082e61..ca285c14e0a03d1474103308ebbf26e465dfb288 100644 (file)
@@ -792,12 +792,6 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
           continue;
         }
 
-        // Next, try calling the target to attempt to handle the instruction.
-        if (FastIS->TargetSelectInstruction(BI)) {
-          ResetDebugLoc(SDB, FastIS);
-          continue;
-        }
-
         // Clear out the debug location so that it doesn't carry over to
         // unrelated instructions.
         ResetDebugLoc(SDB, FastIS);