blob: d9172f2b3622be0f91fa6bf666b47f590e47ac37 [file] [log] [blame]
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +00001//===-- 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/Intrinsics.h"
23using namespace llvm;
24
25namespace {
26
27class VISIBILITY_HIDDEN PIC16DAGToDAGISel : public SelectionDAGISel {
28
29 /// TM - Keep a reference to PIC16TargetMachine.
30 PIC16TargetMachine &TM;
31
32 /// PIC16Lowering - This object fully describes how to lower LLVM code to an
33 /// PIC16-specific SelectionDAG.
Chris Lattner03708c52009-07-28 03:05:40 +000034 PIC16TargetLowering &PIC16Lowering;
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000035
36public:
37 explicit PIC16DAGToDAGISel(PIC16TargetMachine &tm) :
Dan Gohman96eb47a2009-01-15 19:20:50 +000038 SelectionDAGISel(tm),
Sanjiv Guptac7768832009-12-23 11:19:09 +000039 TM(tm), PIC16Lowering(*TM.getTargetLowering()) {
40 // Keep PIC16 specific DAGISel to use during the lowering
41 PIC16Lowering.ISel = this;
42 }
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000043
44 // Pass Name
45 virtual const char *getPassName() const {
46 return "PIC16 DAG->DAG Pattern Instruction Selection";
47 }
48
49 virtual void InstructionSelect();
50
51private:
52 // Include the pieces autogenerated from the target description.
53#include "PIC16GenDAGISel.inc"
54
55 SDNode *Select(SDValue N);
56
57 // Match direct address complex pattern.
58 bool SelectDirectAddr(SDValue Op, SDValue N, SDValue &Address);
59
60};
61
62}
63