Merge branch 'master' into msp430
[llvm/msp430.git] / lib / Target / PIC16 / PIC16ISelDAGToDAG.h
blob83abed3958a4a9987a1abc05d846b6c13ddcd3d5
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.
12 //===----------------------------------------------------------------------===//
14 #define DEBUG_TYPE "pic16-isel"
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/Intrinsics.h"
23 using namespace llvm;
25 namespace {
27 class VISIBILITY_HIDDEN PIC16DAGToDAGISel : public SelectionDAGISel {
29 /// TM - Keep a reference to PIC16TargetMachine.
30 PIC16TargetMachine &TM;
32 /// PIC16Lowering - This object fully describes how to lower LLVM code to an
33 /// PIC16-specific SelectionDAG.
34 PIC16TargetLowering PIC16Lowering;
36 public:
37 explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) :
38 SelectionDAGISel(tm),
39 TM(tm), PIC16Lowering(*TM.getTargetLowering()) {}
41 // Pass Name
42 virtual const char *getPassName() const {
43 return "PIC16 DAG->DAG Pattern Instruction Selection";
46 virtual void InstructionSelect();
48 private:
49 // Include the pieces autogenerated from the target description.
50 #include "PIC16GenDAGISel.inc"
52 SDNode *Select(SDValue N);
54 // Match direct address complex pattern.
55 bool SelectDirectAddr(SDValue Op, SDValue N, SDValue &Address);