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,
3219bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
3719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
3819bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
4219bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
4619bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
5019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
51894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// VPERM - The PPC VPERM Instruction.
52894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      ///
53894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VPERM,
5419bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
6119bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
8319bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
8719bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
9219bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
9919bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
10619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a
108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// BCTRL instruction.
109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BCTRL_Darwin, BCTRL_SVR4,
11019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
111894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// Return with a flag operand, matched by 'blr'
112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      RET_FLAG,
11319bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
12519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the
12719bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
13119bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
13819bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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
15319bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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,
17719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
17819bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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.
18219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      STBRX,
18319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
18419bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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);
19719bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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);
21119bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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);
21519bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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);
22019bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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);
22819bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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  }
23519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
236894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class PPCTargetLowering : public TargetLowering {
237894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const PPCSubtarget &PPCSubTarget;
238894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
239894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  public:
240894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    explicit PPCTargetLowering(PPCTargetMachine &TM);
24119bac1e08be200c31efd26f0f5fd144c9b3eefd3John 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
24619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i32; }
24719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
248894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getSetCCResultType - Return the ISD::SETCC ValueType
24919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual EVT getSetCCResultType(EVT VT) const;
250894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
251894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getPreIndexedAddressParts - returns true by value, base pointer and
252894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// offset pointer and addressing mode by reference if the node's address
253894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be legally represented as pre-indexed load / store address.
254894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
255894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SDValue &Offset,
256894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           ISD::MemIndexedMode &AM,
257894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SelectionDAG &DAG) const;
25819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
259894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegReg - Given the specified addressed, check to see if it
260894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be represented as an indexed [r+r] operation.  Returns false if it
261894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be more efficiently represented with [r+imm].
262894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index,
263894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             SelectionDAG &DAG) const;
26419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
265894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegImm - Returns true if the address N can be represented
266894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// by a base register plus a signed 16-bit displacement [r+imm], and if it
267894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// is not better represented as reg+reg.
268894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base,
269894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             SelectionDAG &DAG) const;
27019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
271894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegRegOnly - Given the specified addressed, force it to be
272894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// represented as an indexed [r+r] operation.
273894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index,
274894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 SelectionDAG &DAG) const;
275894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
276894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// SelectAddressRegImmShift - Returns true if the address N can be
277894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// represented by a base register plus a signed 14-bit displacement
278894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// [r+imm*4].  Suitable for use by STD and friends.
279894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool SelectAddressRegImmShift(SDValue N, SDValue &Disp, SDValue &Base,
280894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  SelectionDAG &DAG) const;
281894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
28219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
283894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LowerOperation - Provide custom lowering hooks for some operations.
284894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
285894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
286894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
287894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ReplaceNodeResults - Replace the results of node with an illegal result
288894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// type with new values built out of custom code.
289894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
290894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
291894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    SelectionDAG &DAG) const;
292894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
293894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
29419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
295894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void computeMaskedBitsForTargetNode(const SDValue Op,
296894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                const APInt &Mask,
29719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                                APInt &KnownZero,
298894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                APInt &KnownOne,
299894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                const SelectionDAG &DAG,
300894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                unsigned Depth = 0) const;
301894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
302894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual MachineBasicBlock *
303894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      EmitInstrWithCustomInserter(MachineInstr *MI,
304894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  MachineBasicBlock *MBB) const;
30519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
306894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        MachineBasicBlock *MBB, bool is64Bit,
307894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        unsigned BinOpcode) const;
30819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI,
30919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                                MachineBasicBlock *MBB,
310894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                            bool is8bit, unsigned Opcode) const;
31119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
312894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ConstraintType getConstraintType(const std::string &Constraint) const;
31319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
31419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// Examine constraint string and operand type and determine a weight value.
31519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// The operand object must already have been set up with the operand type.
31619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    ConstraintWeight getSingleConstraintMatchWeight(
31719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      AsmOperandInfo &info, const char *constraint) const;
31819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
31919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    std::pair<unsigned, const TargetRegisterClass*>
320894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      getRegForInlineAsmConstraint(const std::string &Constraint,
321894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                   EVT VT) const;
322894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
323894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
324894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// function arguments in the caller parameter area.  This is the actual
325894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// alignment, not its logarithm.
32619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    unsigned getByValTypeAlignment(Type *Ty) const;
327894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
328894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
329894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// vector.  If it is invalid, don't add anything to Ops.
330894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void LowerAsmOperandForConstraint(SDValue Op,
33119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                              std::string &Constraint,
332894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              std::vector<SDValue> &Ops,
333894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              SelectionDAG &DAG) const;
33419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
335894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressingMode - Return true if the addressing mode represented
336894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// by AM is legal for this target, for a load/store of the specified type.
33719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty)const;
33819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
339894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressImmediate - Return true if the integer value can be used
340894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// as the offset of the target addressing mode for load / store of the
341894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// given type.
34219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool isLegalAddressImmediate(int64_t V, Type *Ty) const;
343894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
344894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressImmediate - Return true if the GlobalValue can be used as
345894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the offset of the target addressing mode.
346894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
347894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
348894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
34919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
350894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getOptimalMemOpType - Returns the target specific optimal type for load
351894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// and store operations as a result of memset, memcpy, and memmove
352894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// lowering. If DstAlign is zero that means it's safe to destination
353894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// alignment can satisfy any constraint. Similarly if SrcAlign is zero it
354894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// means there isn't a need to check it against alignment requirement,
355894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// probably because the source does not need to be loaded. If
356894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// 'NonScalarIntSafe' is true, that means it's safe to return a
357894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// non-scalar-integer type, e.g. empty string source, constant, or loaded
358894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// from memory. 'MemcpyStrSrc' indicates whether the memcpy source is
359894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// constant so it does not need to be loaded.
360894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// It returns EVT::Other if the type should be determined using generic
361894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// target-independent logic.
362894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual EVT
363894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign,
364894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                        bool NonScalarIntSafe, bool MemcpyStrSrc,
365894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                        MachineFunction &MF) const;
366894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
367894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  private:
368894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
369894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;
370894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
371894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool
372894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    IsEligibleForTailCallOptimization(SDValue Callee,
373894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      CallingConv::ID CalleeCC,
374894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      bool isVarArg,
375894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      const SmallVectorImpl<ISD::InputArg> &Ins,
376894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      SelectionDAG& DAG) const;
377894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
378894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG & DAG,
379894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         int SPDiff,
380894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         SDValue Chain,
381894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         SDValue &LROpOut,
382894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         SDValue &FPOpOut,
383894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         bool isDarwinABI,
384894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         DebugLoc dl) const;
385894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
386894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
387894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
388894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
389894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
390894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
391894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
392894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
39319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
39419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
395894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
396894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                         const PPCSubtarget &Subtarget) const;
397894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG,
398894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const PPCSubtarget &Subtarget) const;
399894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
400894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                const PPCSubtarget &Subtarget) const;
401894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG,
402894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                      const PPCSubtarget &Subtarget) const;
403894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
404894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG, DebugLoc dl) const;
405894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
406894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
407894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const;
408894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const;
409894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const;
410894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
411894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
412894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
413894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
414894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;
415894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
416894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
417894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            CallingConv::ID CallConv, bool isVarArg,
418894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            const SmallVectorImpl<ISD::InputArg> &Ins,
419894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            DebugLoc dl, SelectionDAG &DAG,
420894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            SmallVectorImpl<SDValue> &InVals) const;
421894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue FinishCall(CallingConv::ID CallConv, DebugLoc dl, bool isTailCall,
422894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       bool isVarArg,
423894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SelectionDAG &DAG,
424894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SmallVector<std::pair<unsigned, SDValue>, 8>
425894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                         &RegsToPass,
426894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SDValue InFlag, SDValue Chain,
427894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SDValue &Callee,
428894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       int SPDiff, unsigned NumBytes,
429894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<ISD::InputArg> &Ins,
430894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SmallVectorImpl<SDValue> &InVals) const;
431894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
432894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
433894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments(SDValue Chain,
434894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           CallingConv::ID CallConv, bool isVarArg,
435894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           const SmallVectorImpl<ISD::InputArg> &Ins,
436894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           DebugLoc dl, SelectionDAG &DAG,
437894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           SmallVectorImpl<SDValue> &InVals) const;
438894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
439894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
440894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall(SDValue Chain, SDValue Callee,
441894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                CallingConv::ID CallConv, bool isVarArg, bool &isTailCall,
442894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<ISD::OutputArg> &Outs,
443894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<SDValue> &OutVals,
444894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<ISD::InputArg> &Ins,
445894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                DebugLoc dl, SelectionDAG &DAG,
446894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                SmallVectorImpl<SDValue> &InVals) const;
447894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
44819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool
44919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
45019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                   bool isVarArg,
45119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                   const SmallVectorImpl<ISD::OutputArg> &Outs,
45219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                   LLVMContext &Context) const;
45319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
454894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
455894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerReturn(SDValue Chain,
456894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  CallingConv::ID CallConv, bool isVarArg,
457894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  const SmallVectorImpl<ISD::OutputArg> &Outs,
458894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  const SmallVectorImpl<SDValue> &OutVals,
459894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  DebugLoc dl, SelectionDAG &DAG) const;
460894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
461894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
462894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments_Darwin(SDValue Chain,
463894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  CallingConv::ID CallConv, bool isVarArg,
464894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  const SmallVectorImpl<ISD::InputArg> &Ins,
465894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  DebugLoc dl, SelectionDAG &DAG,
466894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  SmallVectorImpl<SDValue> &InVals) const;
467894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
468894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments_SVR4(SDValue Chain,
469894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                CallingConv::ID CallConv, bool isVarArg,
470894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                const SmallVectorImpl<ISD::InputArg> &Ins,
471894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                DebugLoc dl, SelectionDAG &DAG,
472894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                SmallVectorImpl<SDValue> &InVals) const;
473894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
474894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
475894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall_Darwin(SDValue Chain, SDValue Callee,
476894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
477894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<ISD::OutputArg> &Outs,
478894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<SDValue> &OutVals,
479894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       const SmallVectorImpl<ISD::InputArg> &Ins,
480894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       DebugLoc dl, SelectionDAG &DAG,
481894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                       SmallVectorImpl<SDValue> &InVals) const;
482894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue
483894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall_SVR4(SDValue Chain, SDValue Callee,
484894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
485894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     const SmallVectorImpl<ISD::OutputArg> &Outs,
486894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     const SmallVectorImpl<SDValue> &OutVals,
487894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     const SmallVectorImpl<ISD::InputArg> &Ins,
488894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     DebugLoc dl, SelectionDAG &DAG,
489894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                     SmallVectorImpl<SDValue> &InVals) const;
490894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  };
491894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
492894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
493894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#endif   // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
494