Sink InstructionSelect() out of each target into SDISel, and rename it
[oota-llvm.git] / lib / Target / PIC16 / PIC16ISelDAGToDAG.h
1 //===-- PIC16ISelDAGToDAG.cpp - A dag to dag inst selector for PIC16 ------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source 
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines an instruction selector for the PIC16 target.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #define DEBUG_TYPE "pic16-isel"
15
16 #include "PIC16.h"
17 #include "PIC16ISelLowering.h"
18 #include "PIC16RegisterInfo.h"
19 #include "PIC16TargetMachine.h"
20 #include "llvm/CodeGen/SelectionDAGISel.h"
21 #include "llvm/Support/Compiler.h"
22 #include "llvm/Support/raw_ostream.h"
23 #include "llvm/Support/Debug.h"
24 #include "llvm/Intrinsics.h"
25 using namespace llvm;
26
27 namespace {
28
29 class VISIBILITY_HIDDEN PIC16DAGToDAGISel : public SelectionDAGISel {
30
31   /// TM - Keep a reference to PIC16TargetMachine.
32   PIC16TargetMachine &TM;
33
34   /// PIC16Lowering - This object fully describes how to lower LLVM code to an
35   /// PIC16-specific SelectionDAG.
36   PIC16TargetLowering &PIC16Lowering;
37
38 public:
39   explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) : 
40         SelectionDAGISel(tm),
41         TM(tm), PIC16Lowering(*TM.getTargetLowering()) { 
42     // Keep PIC16 specific DAGISel to use during the lowering
43     PIC16Lowering.ISel = this;
44   }
45   
46   // Pass Name
47   virtual const char *getPassName() const {
48     return "PIC16 DAG->DAG Pattern Instruction Selection";
49   } 
50
51 private:
52   // Include the pieces autogenerated from the target description.
53 #include "PIC16GenDAGISel.inc"
54
55   SDNode *Select(SDNode *N);
56
57   // Match direct address complex pattern.
58   bool SelectDirectAddr(SDNode *Op, SDValue N, SDValue &Address);
59
60 };
61
62 }
63