diff options
author | Dan Gohman <gohman@apple.com> | 2009-12-05 01:27:58 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-12-05 01:27:58 +0000 |
commit | 6e3ff375474c4fd78feb0b8463eb273a23cb4404 (patch) | |
tree | 3f24664a2a2050191f4a81917eec892b19cea495 | |
parent | 864e2efce2cb5d02e376933933d96074723fe77c (diff) | |
download | external_llvm-6e3ff375474c4fd78feb0b8463eb273a23cb4404.zip external_llvm-6e3ff375474c4fd78feb0b8463eb273a23cb4404.tar.gz external_llvm-6e3ff375474c4fd78feb0b8463eb273a23cb4404.tar.bz2 |
Make TargetSelectInstruction protected and called from FastISel.cpp
instead of SelectionDAGISel.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90636 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/FastISel.h | 16 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/FastISel.cpp | 10 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 6 |
3 files changed, 17 insertions, 15 deletions
diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h index 1efd1e0..806952a 100644 --- a/include/llvm/CodeGen/FastISel.h +++ b/include/llvm/CodeGen/FastISel.h @@ -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. diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index c6c1401..4ead9c9 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -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, diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 4a67b57..ca285c1 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -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); |