1 //===-- PIC16ISelDAGToDAG.cpp - A dag to dag inst selector for PIC16 ------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines an instruction selector for the PIC16 target.
12 //===----------------------------------------------------------------------===//
14 #define DEBUG_TYPE "pic16-isel"
17 #include "PIC16RegisterInfo.h"
18 #include "PIC16TargetMachine.h"
19 #include "PIC16MachineFunctionInfo.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"
29 class LLVM_LIBRARY_VISIBILITY PIC16DAGToDAGISel : public SelectionDAGISel {
31 /// TM - Keep a reference to PIC16TargetMachine.
32 const PIC16TargetMachine &TM;
34 /// PIC16Lowering - This object fully describes how to lower LLVM code to an
35 /// PIC16-specific SelectionDAG.
36 const PIC16TargetLowering &PIC16Lowering;
39 explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) :
41 TM(tm), PIC16Lowering(*TM.getTargetLowering()) {}
44 virtual const char *getPassName() const {
45 return "PIC16 DAG->DAG Pattern Instruction Selection";
49 // Include the pieces autogenerated from the target description.
50 #include "PIC16GenDAGISel.inc"
52 SDNode *Select(SDNode *N);
54 // Match direct address complex pattern.
55 bool SelectDirectAddr(SDNode *Op, SDValue N, SDValue &Address);