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"
16 #include "llvm/Support/ErrorHandling.h"
17 #include "PIC16ISelDAGToDAG.h"
20 /// createPIC16ISelDag - This pass converts a legalized DAG into a
21 /// PIC16-specific DAG, ready for instruction scheduling.
22 FunctionPass *llvm::createPIC16ISelDag(PIC16TargetMachine &TM) {
23 return new PIC16DAGToDAGISel(TM);
27 /// Select - Select instructions not customized! Used for
28 /// expanded, promoted and normal instructions.
29 SDNode* PIC16DAGToDAGISel::Select(SDNode *N) {
31 // Select the default instruction.
32 SDNode *ResNode = SelectCode(N);
38 // SelectDirectAddr - Match a direct address for DAG.
39 // A direct address could be a globaladdress or externalsymbol.
40 bool PIC16DAGToDAGISel::SelectDirectAddr(SDNode *Op, SDValue N,
42 // Return true if TGA or ES.
43 if (N.getOpcode() == ISD::TargetGlobalAddress
44 || N.getOpcode() == ISD::TargetExternalSymbol) {