1 //===-- PIC16ISelLowering.h - PIC16 DAG Lowering Interface ------*- C++ -*-===//
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 the interfaces that PIC16 uses to lower LLVM code into a
13 //===----------------------------------------------------------------------===//
15 #ifndef PIC16ISELLOWERING_H
16 #define PIC16ISELLOWERING_H
19 #include "PIC16Subtarget.h"
20 #include "llvm/CodeGen/SelectionDAG.h"
21 #include "llvm/Target/TargetLowering.h"
26 // Start the numbering from where ISD NodeType finishes.
27 FIRST_NUMBER = ISD::BUILTIN_OP_END+PIC16::INSTRUCTION_LIST_END,
29 // used for encapsulating the expanded nodes into one node.
32 // Get the Higher 16 bits from a 32-bit immediate
35 // Get the Lower 16 bits from a 32-bit immediate
38 Cmp, // PIC16 Generic Comparison instruction.
39 Branch, // PIC16 Generic Branch Instruction.
40 BTFSS, // PIC16 BitTest Instruction (Skip if set).
41 BTFSC, // PIC16 BitTest Instruction (Skip if clear).
43 // PIC16 comparison to be converted to either XOR or SUB
44 // Following instructions cater to those convertions.
48 // Get the Global Address wrapped into a wrapper that also captures
56 //===--------------------------------------------------------------------===//
57 // TargetLowering Implementation
58 //===--------------------------------------------------------------------===//
59 class PIC16TargetLowering : public TargetLowering
62 typedef std::map<SDNode *, SDNode *> NodeMap_t;
64 explicit PIC16TargetLowering(PIC16TargetMachine &TM);
66 /// LowerOperation - Provide custom lowering hooks for some operations.
67 virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
69 SDOperand LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG);
70 SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG);
71 SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG);
72 SDOperand LowerFrameIndex(SDOperand Op, SelectionDAG &DAG);
73 SDOperand LowerBR_CC(SDOperand Op, SelectionDAG &DAG);
75 SDOperand RemoveHiLo(SDNode *, SelectionDAG &DAG,
76 DAGCombinerInfo &DCI) const;
77 SDOperand LowerADDSUB(SDNode *, SelectionDAG &DAG,
78 DAGCombinerInfo &DCI) const;
79 SDOperand LowerLOAD(SDNode *, SelectionDAG &DAG,
80 DAGCombinerInfo &DCI) const;
82 /// getTargetNodeName - This method returns the name of a target specific
84 virtual const char *getTargetNodeName(unsigned Opcode) const;
85 virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
88 const SDOperand *findLoadi8(const SDOperand &Src, SelectionDAG &DAG) const;
92 #endif // PIC16ISELLOWERING_H