PPCISelLowering.h revision 894018228b0e0bdbd7aa7e8f47d4a9458789ca82
1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===-- PPCISelLowering.h - PPC32 DAG Lowering Interface --------*- C++ -*-===//
2894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//                     The LLVM Compiler Infrastructure
4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file is distributed under the University of Illinois Open Source
6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// License. See LICENSE.TXT for details.
7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file defines the interfaces that PPC uses to lower LLVM code into a
11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// selection DAG.
12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
15894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#ifndef LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#define LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/Target/TargetLowering.h"
19894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/CodeGen/SelectionDAG.h"
20894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "PPC.h"
21894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "PPCSubtarget.h"
22894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
23894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumannamespace llvm {
24894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  namespace PPCISD {
25894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    enum NodeType {
26894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Start the numbering where the builtin ops and target ops leave off.
27894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FIRST_NUMBER = ISD::BUILTIN_OP_END,
28894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// FSEL - Traditional three-operand fsel node.
30894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///
31894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FSEL,
32894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
33894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// FCFID - The FCFID instruction, taking an f64 operand and producing
34894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// and f64 value containing the FP representation of the integer that
35894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// was temporarily in the f64 operand.
36894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FCFID,
37894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
38894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64
39894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// operand, producing an f64 value containing the integer representation
40894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// of that FP value.
41894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FCTIDZ, FCTIWZ,
42894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
43894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// STFIWX - The STFIWX instruction.  The first operand is an input token
44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// chain, then an f64 value to store, then an address to store it to.
45894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      STFIWX,
46894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
47894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking
48894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // three v4f32 operands and producing a v4f32 result.
49894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VMADDFP, VNMSUBFP,
50894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
51894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// VPERM - The PPC VPERM Instruction.
52894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///
53894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VPERM,
54894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
55894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// Hi/Lo - These represent the high and low 16-bit parts of a global
56894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// address respectively.  These nodes have two operands, the first of
57894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// which must be a TargetGlobalAddress, and the second of which must be a
58894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// Constant.  Selected naively, these turn into 'lis G+C' and 'li G+C',
59894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// though these are usually folded into other nodes.
60894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      Hi, Lo,
61894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
62894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      TOC_ENTRY,
63894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
64894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// The following three target-specific nodes are used for calls through
65894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// function pointers in the 64-bit SVR4 ABI.
66894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// Restore the TOC from the TOC save area of the current stack frame.
68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// This is basically a hard coded load instruction which additionally
69894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// takes/produces a flag.
70894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      TOC_RESTORE,
71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// Like a regular LOAD but additionally taking/producing a flag.
73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LOAD,
74894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
75894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// LOAD into r2 (also taking/producing a flag). Like TOC_RESTORE, this is
76894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// a hard coded load instruction.
77894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LOAD_TOC,
78894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
79894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// OPRC, CHAIN = DYNALLOC(CHAIN, NEGSIZE, FRAME_INDEX)
80894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to
81894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// compute an allocation on the stack.
82894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      DYNALLOC,
83894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
84894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// GlobalBaseReg - On Darwin, this node represents the result of the mflr
85894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// at function entry, used for PIC code.
86894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      GlobalBaseReg,
87894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
88894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// These nodes represent the 32-bit PPC shifts that operate on 6-bit
89894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// shift amounts.  These nodes are generated by the multi-precision shift
90894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// code.
91894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      SRL, SRA, SHL,
92894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
93894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// EXTSW_32 - This is the EXTSW instruction for use with "32-bit"
94894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// registers.
95894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      EXTSW_32,
96894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
97894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CALL - A direct function call.
98894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CALL_Darwin, CALL_SVR4,
99894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
100894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// NOP - Special NOP which follows 64-bit SVR4 calls.
101894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      NOP,
102894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
103894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a
104894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// MTCTR instruction.
105894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      MTCTR,
106894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a
108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// BCTRL instruction.
109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BCTRL_Darwin, BCTRL_SVR4,
110894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
111894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// Return with a flag operand, matched by 'blr'
112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      RET_FLAG,
113894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
114894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// R32 = MFCR(CRREG, INFLAG) - Represents the MFCRpseud/MFOCRF
115894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// instructions.  This copies the bits corresponding to the specified
116894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CRREG into the resultant GPR.  Bits corresponding to other CR regs
117894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// are undefined.
118894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      MFCR,
119894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
120894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// RESVEC = VCMP(LHS, RHS, OPC) - Represents one of the altivec VCMP*
121894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// instructions.  For lack of better number, we use the opcode number
122894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// encoding for the OPC field to identify the compare.  For example, 838
123894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// is VCMPGTSH.
124894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCMP,
125894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the
127894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// altivec VCMP*o instructions.  For lack of better number, we use the
128894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// opcode number encoding for the OPC field to identify the compare.  For
129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// example, 838 is VCMPGTSH.
130894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCMPo,
131894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This
133894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// corresponds to the COND_BRANCH pseudo instruction.  CRRC is the
134894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// condition register to branch on, OPC is the branch opcode to use (e.g.
135894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// PPC::BLE), DESTBB is the destination block to branch to, and INFLAG is
136894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// an optional input flag argument.
137894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      COND_BRANCH,
138894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
139894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // The following 5 instructions are used only as part of the
140894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // long double-to-int conversion sequence.
141894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
142894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// OUTFLAG = MFFS F8RC - This moves the FPSCR (not modelled) into the
143894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// register.
144894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      MFFS,
145894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
146894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// OUTFLAG = MTFSB0 INFLAG - This clears a bit in the FPSCR.
147894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      MTFSB0,
148894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
149894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// OUTFLAG = MTFSB1 INFLAG - This sets a bit in the FPSCR.
150894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      MTFSB1,
151894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
152894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// F8RC, OUTFLAG = FADDRTZ F8RC, F8RC, INFLAG - This is an FADD done with
153894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// rounding towards zero.  It has flags added so it won't move past the
154894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// FPSCR-setting instructions.
155894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FADDRTZ,
156894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
157894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// MTFSF = F8RC, INFLAG - This moves the register into the FPSCR.
158894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      MTFSF,
159894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
160894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// LARX = This corresponds to PPC l{w|d}arx instrcution: load and
161894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// reserve indexed. This is used to implement atomic operations.
162894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LARX,
163894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
164894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// STCX = This corresponds to PPC stcx. instrcution: store conditional
165894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// indexed. This is used to implement atomic operations.
166894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      STCX,
167894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
168894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// TC_RETURN - A tail call return.
169894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///   operand #0 chain
170894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///   operand #1 callee (register or absolute)
171894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///   operand #2 stack adjustment
172894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///   operand #3 optional in flag
173894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      TC_RETURN,
174894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
175894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// STD_32 - This is the STD instruction for use with "32-bit" registers.
176894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      STD_32 = ISD::FIRST_TARGET_MEMORY_OPCODE,
177894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
178894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a
179894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// byte-swapping store instruction.  It byte-swaps the low "Type" bits of
180894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// the GPRC input, then stores it through Ptr.  Type can be either i16 or
181894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// i32.
182894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      STBRX,
183894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
184894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a
185894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// byte-swapping load instruction.  It loads "Type" bits, byte swaps it,
186894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// then puts it in the bottom bits of the GPRC.  TYPE can be either i16
187894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// or i32.
188894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LBRX
189894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    };
190894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
191894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
192894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// Define some predicates that are used for node matching.
193894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  namespace PPC {
194894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a
195894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// VPKUHUM instruction.
196894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary);
197894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
198894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a
199894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// VPKUWUM instruction.
200894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary);
201894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
202894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isVMRGLShuffleMask - Return true if this is a shuffle mask suitable for
203894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// a VRGL* instruction with the specified unit size (1,2 or 4 bytes).
204894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isVMRGLShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
205894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            bool isUnary);
206894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
207894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isVMRGHShuffleMask - Return true if this is a shuffle mask suitable for
208894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// a VRGH* instruction with the specified unit size (1,2 or 4 bytes).
209894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
210894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            bool isUnary);
211894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
212894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the shift
213894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// amount, otherwise return -1.
214894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    int isVSLDOIShuffleMask(SDNode *N, bool isUnary);
215894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
216894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand
217894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// specifies a splat of a single element that is suitable for input to
218894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// VSPLTB/VSPLTH/VSPLTW.
219894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize);
220894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
221894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isAllNegativeZeroVector - Returns true if all elements of build_vector
222894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// are -0.0.
223894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isAllNegativeZeroVector(SDNode *N);
224894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
225894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the
226894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// specified isSplatShuffleMask VECTOR_SHUFFLE mask.
227894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize);
228894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
229894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// get_VSPLTI_elt - If this is a build_vector of constants which can be
230894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// formed by using a vspltis[bhw] instruction of the specified element
231894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// size, return the constant being splatted.  The ByteSize field indicates
232894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the number of bytes of each element [124] -> [bhw].
233894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG);
234894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
235894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
236894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class PPCTargetLowering : public TargetLowering {
237894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const PPCSubtarget &PPCSubTarget;
238894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
239894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  public:
240894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    explicit PPCTargetLowering(PPCTargetMachine &TM);
241894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
242894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getTargetNodeName() - This method returns the name of a target specific
243894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// DAG node.
244894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual const char *getTargetNodeName(unsigned Opcode) const;
245894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
246894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getSetCCResultType - Return the ISD::SETCC ValueType
247894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const;
248894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
249894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getPreIndexedAddressParts - returns true by value, base pointer and
250894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// offset pointer and addressing mode by reference if the node's address
251894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be legally represented as pre-indexed load / store address.
252894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
253894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SDValue &Offset,
254894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           ISD::MemIndexedMode &AM,
255894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SelectionDAG &DAG) const;
256894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
257894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegReg - Given the specified addressed, check to see if it
258894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be represented as an indexed [r+r] operation.  Returns false if it
259894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be more efficiently represented with [r+imm].
260894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index,
261894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             SelectionDAG &DAG) const;
262894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
263894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegImm - Returns true if the address N can be represented
264894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// by a base register plus a signed 16-bit displacement [r+imm], and if it
265894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// is not better represented as reg+reg.
266894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base,
267894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             SelectionDAG &DAG) const;
268894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
269894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegRegOnly - Given the specified addressed, force it to be
270894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// represented as an indexed [r+r] operation.
271894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index,
272894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 SelectionDAG &DAG) const;
273894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
274894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegImmShift - Returns true if the address N can be
275894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// represented by a base register plus a signed 14-bit displacement
276894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// [r+imm*4].  Suitable for use by STD and friends.
277894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegImmShift(SDValue N, SDValue &Disp, SDValue &Base,
278894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  SelectionDAG &DAG) const;
279894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
280894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
281894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LowerOperation - Provide custom lowering hooks for some operations.
282894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
283894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
284894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
285894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ReplaceNodeResults - Replace the results of node with an illegal result
286894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// type with new values built out of custom code.
287894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
288894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
289894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    SelectionDAG &DAG) const;
290894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
291894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
292894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
293894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void computeMaskedBitsForTargetNode(const SDValue Op,
294894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                const APInt &Mask,
295894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                APInt &KnownZero,
296894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                APInt &KnownOne,
297894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                const SelectionDAG &DAG,
298894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                unsigned Depth = 0) const;
299894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
300894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual MachineBasicBlock *
301894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      EmitInstrWithCustomInserter(MachineInstr *MI,
302894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  MachineBasicBlock *MBB) const;
303894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
304894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        MachineBasicBlock *MBB, bool is64Bit,
305894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        unsigned BinOpcode) const;
306894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI,
307894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                MachineBasicBlock *MBB,
308894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                            bool is8bit, unsigned Opcode) const;
309894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
310894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ConstraintType getConstraintType(const std::string &Constraint) const;
311894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    std::pair<unsigned, const TargetRegisterClass*>
312894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      getRegForInlineAsmConstraint(const std::string &Constraint,
313894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                   EVT VT) const;
314894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
315894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
316894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// function arguments in the caller parameter area.  This is the actual
317894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// alignment, not its logarithm.
318894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned getByValTypeAlignment(const Type *Ty) const;
319894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
320894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
321894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// vector.  If it is invalid, don't add anything to Ops.
322894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void LowerAsmOperandForConstraint(SDValue Op,
323894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              char ConstraintLetter,
324894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              std::vector<SDValue> &Ops,
325894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              SelectionDAG &DAG) const;
326894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
327894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressingMode - Return true if the addressing mode represented
328894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// by AM is legal for this target, for a load/store of the specified type.
329894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty)const;
330894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
331894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressImmediate - Return true if the integer value can be used
332894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// as the offset of the target addressing mode for load / store of the
333894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// given type.
334894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isLegalAddressImmediate(int64_t V, const Type *Ty) const;
335894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
336894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressImmediate - Return true if the GlobalValue can be used as
337894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the offset of the target addressing mode.
338894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
339894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
340894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
341894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
342894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getOptimalMemOpType - Returns the target specific optimal type for load
343894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// and store operations as a result of memset, memcpy, and memmove
344894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// lowering. If DstAlign is zero that means it's safe to destination
345894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// alignment can satisfy any constraint. Similarly if SrcAlign is zero it
346894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// means there isn't a need to check it against alignment requirement,
347894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// probably because the source does not need to be loaded. If
348894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// 'NonScalarIntSafe' is true, that means it's safe to return a
349894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// non-scalar-integer type, e.g. empty string source, constant, or loaded
350894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// from memory. 'MemcpyStrSrc' indicates whether the memcpy source is
351894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// constant so it does not need to be loaded.
352894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// It returns EVT::Other if the type should be determined using generic
353894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// target-independent logic.
354894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual EVT
355894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign,
356894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                        bool NonScalarIntSafe, bool MemcpyStrSrc,
357894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                        MachineFunction &MF) const;
358894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
359894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getFunctionAlignment - Return the Log2 alignment of this function.
360894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual unsigned getFunctionAlignment(const Function *F) const;
361894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
362894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  private:
363894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
364894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;
365894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
366894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool
367894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    IsEligibleForTailCallOptimization(SDValue Callee,
368894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      CallingConv::ID CalleeCC,
369894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      bool isVarArg,
370894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      const SmallVectorImpl<ISD::InputArg> &Ins,
371894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      SelectionDAG& DAG) const;
372894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
373894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG & DAG,
374894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         int SPDiff,
375894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         SDValue Chain,
376894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         SDValue &LROpOut,
377894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         SDValue &FPOpOut,
378894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         bool isDarwinABI,
379894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         DebugLoc dl) const;
380894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
381894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
382894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
383894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
384894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
385894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
386894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
387894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
388894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
389894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
390894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
391894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                         const PPCSubtarget &Subtarget) const;
392894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG,
393894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const PPCSubtarget &Subtarget) const;
394894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
395894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                const PPCSubtarget &Subtarget) const;
396894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG,
397894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      const PPCSubtarget &Subtarget) const;
398894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
399894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG, DebugLoc dl) const;
400894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
401894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
402894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const;
403894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const;
404894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const;
405894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
406894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
407894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
408894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
409894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;
410894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
411894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
412894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            CallingConv::ID CallConv, bool isVarArg,
413894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            const SmallVectorImpl<ISD::InputArg> &Ins,
414894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            DebugLoc dl, SelectionDAG &DAG,
415894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            SmallVectorImpl<SDValue> &InVals) const;
416894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue FinishCall(CallingConv::ID CallConv, DebugLoc dl, bool isTailCall,
417894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       bool isVarArg,
418894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SelectionDAG &DAG,
419894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SmallVector<std::pair<unsigned, SDValue>, 8>
420894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                         &RegsToPass,
421894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SDValue InFlag, SDValue Chain,
422894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SDValue &Callee,
423894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       int SPDiff, unsigned NumBytes,
424894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<ISD::InputArg> &Ins,
425894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SmallVectorImpl<SDValue> &InVals) const;
426894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
427894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
428894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments(SDValue Chain,
429894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           CallingConv::ID CallConv, bool isVarArg,
430894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           const SmallVectorImpl<ISD::InputArg> &Ins,
431894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           DebugLoc dl, SelectionDAG &DAG,
432894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           SmallVectorImpl<SDValue> &InVals) const;
433894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
434894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
435894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall(SDValue Chain, SDValue Callee,
436894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                CallingConv::ID CallConv, bool isVarArg, bool &isTailCall,
437894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<ISD::OutputArg> &Outs,
438894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<SDValue> &OutVals,
439894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<ISD::InputArg> &Ins,
440894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                DebugLoc dl, SelectionDAG &DAG,
441894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                SmallVectorImpl<SDValue> &InVals) const;
442894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
443894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
444894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerReturn(SDValue Chain,
445894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  CallingConv::ID CallConv, bool isVarArg,
446894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  const SmallVectorImpl<ISD::OutputArg> &Outs,
447894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  const SmallVectorImpl<SDValue> &OutVals,
448894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  DebugLoc dl, SelectionDAG &DAG) const;
449894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
450894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
451894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments_Darwin(SDValue Chain,
452894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  CallingConv::ID CallConv, bool isVarArg,
453894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  const SmallVectorImpl<ISD::InputArg> &Ins,
454894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  DebugLoc dl, SelectionDAG &DAG,
455894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  SmallVectorImpl<SDValue> &InVals) const;
456894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
457894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments_SVR4(SDValue Chain,
458894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                CallingConv::ID CallConv, bool isVarArg,
459894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                const SmallVectorImpl<ISD::InputArg> &Ins,
460894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                DebugLoc dl, SelectionDAG &DAG,
461894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                SmallVectorImpl<SDValue> &InVals) const;
462894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
463894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
464894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall_Darwin(SDValue Chain, SDValue Callee,
465894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
466894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<ISD::OutputArg> &Outs,
467894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<SDValue> &OutVals,
468894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<ISD::InputArg> &Ins,
469894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       DebugLoc dl, SelectionDAG &DAG,
470894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SmallVectorImpl<SDValue> &InVals) const;
471894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
472894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall_SVR4(SDValue Chain, SDValue Callee,
473894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
474894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     const SmallVectorImpl<ISD::OutputArg> &Outs,
475894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     const SmallVectorImpl<SDValue> &OutVals,
476894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     const SmallVectorImpl<ISD::InputArg> &Ins,
477894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     DebugLoc dl, SelectionDAG &DAG,
478894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     SmallVectorImpl<SDValue> &InVals) const;
479894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  };
480894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
481894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
482894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#endif   // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
483