summaryrefslogtreecommitdiff
path: root/lib/Target/PIC16/PIC16ISelLowering.h
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2008-05-13 09:02:57 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2008-05-13 09:02:57 +0000
commit0e68771536a8a3f92b81b6d57011eadf010a4fd7 (patch)
treecfd4a927ef4bb5bbfabb6694b6214b3bd890ceb2 /lib/Target/PIC16/PIC16ISelLowering.h
parent77f0b7a50a08614b5ffd58f1864b68a9a30d0cb0 (diff)
downloadllvm-0e68771536a8a3f92b81b6d57011eadf010a4fd7.tar.gz
llvm-0e68771536a8a3f92b81b6d57011eadf010a4fd7.tar.bz2
llvm-0e68771536a8a3f92b81b6d57011eadf010a4fd7.tar.xz
Adding files for Microchip's PIC16 target.
A brief description about PIC16: =============================== PIC16 is an 8-bit microcontroller with only one 8-bit register which is the accumulator. All arithmetic/load/store operations are 8-bit only. The architecture has two address spaces: program and data. The program memory is divided into 2K pages and the data memory is divided into banks of 128 byte, with only 80 usable bytes, resulting in an non-contiguous data memory. It supports direct data memory access (by specifying the address as part of the instruction) and indirect data and program memory access (in an unorthodox fashion which utilize a 16 bit pointer register). Two classes of registers exist: (8-bit class which is only one accumulator) (16-bit class, which contains one or more 16 bit pointer(s)) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/PIC16ISelLowering.h')
-rw-r--r--lib/Target/PIC16/PIC16ISelLowering.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/lib/Target/PIC16/PIC16ISelLowering.h b/lib/Target/PIC16/PIC16ISelLowering.h
new file mode 100644
index 0000000000..a94ec4ab96
--- /dev/null
+++ b/lib/Target/PIC16/PIC16ISelLowering.h
@@ -0,0 +1,92 @@
+//===-- PIC16ISelLowering.h - PIC16 DAG Lowering Interface ------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the interfaces that PIC16 uses to lower LLVM code into a
+// selection DAG.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef PIC16ISELLOWERING_H
+#define PIC16ISELLOWERING_H
+
+#include "llvm/CodeGen/SelectionDAG.h"
+#include "llvm/Target/TargetLowering.h"
+#include "PIC16.h"
+#include "PIC16Subtarget.h"
+
+namespace llvm {
+ namespace PIC16ISD {
+ enum NodeType {
+ // Start the numbering from where ISD NodeType finishes.
+ FIRST_NUMBER = ISD::BUILTIN_OP_END+PIC16::INSTRUCTION_LIST_END,
+
+ // used for encapsulating the expanded nodes into one node.
+ Package,
+
+ // Get the Higher 16 bits from a 32-bit immediate
+ Hi,
+
+ // Get the Lower 16 bits from a 32-bit immediate
+ Lo,
+
+ Cmp, // PIC16 Generic Comparison instruction.
+ Branch, // PIC16 Generic Branch Instruction.
+ BTFSS, // PIC16 BitTest Instruction (Skip if set).
+ BTFSC, // PIC16 BitTest Instruction (Skip if clear).
+
+ // PIC16 comparison to be converted to either XOR or SUB
+ // Following instructions cater to those convertions.
+ XORCC,
+ SUBCC,
+
+ // Get the Global Address wrapped into a wrapper that also captures
+ // the bank or page.
+ Wrapper,
+ SetBank,
+ SetPage
+ };
+ }
+
+ //===--------------------------------------------------------------------===//
+ // TargetLowering Implementation
+ //===--------------------------------------------------------------------===//
+ class PIC16TargetLowering : public TargetLowering
+ {
+ public:
+ typedef std::map<SDNode *, SDNode *> NodeMap_t;
+
+ explicit PIC16TargetLowering(PIC16TargetMachine &TM);
+
+ /// LowerOperation - Provide custom lowering hooks for some operations.
+ virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
+
+ SDOperand LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG);
+ SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG);
+ SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG);
+ SDOperand LowerFrameIndex(SDOperand Op, SelectionDAG &DAG);
+ SDOperand LowerBR_CC(SDOperand Op, SelectionDAG &DAG);
+
+ SDOperand RemoveHiLo(SDNode *, SelectionDAG &DAG,
+ DAGCombinerInfo &DCI) const;
+ SDOperand LowerADDSUB(SDNode *, SelectionDAG &DAG,
+ DAGCombinerInfo &DCI) const;
+ SDOperand LowerLOAD(SDNode *, SelectionDAG &DAG,
+ DAGCombinerInfo &DCI) const;
+
+ /// getTargetNodeName - This method returns the name of a target specific
+ // DAG node.
+ virtual const char *getTargetNodeName(unsigned Opcode) const;
+ virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
+
+ // utility function.
+ const SDOperand *findLoadi8(const SDOperand &Src, SelectionDAG &DAG) const;
+ };
+} // namespace llvm
+
+#endif // PIC16ISELLOWERING_H