PPCISelLowering.h revision 15701f8969fcb36899a75ca2df6fdcbc52141106
121e463b2bf864671a87ebe386cb100ef9349a540Nate Begeman//===-- PPCISelLowering.h - PPC32 DAG Lowering Interface --------*- C++ -*-===//
27c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//
37c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//                     The LLVM Compiler Infrastructure
47c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//
54ee451de366474b9c228b4e5fa573795a715216dChris Lattner// This file is distributed under the University of Illinois Open Source
64ee451de366474b9c228b4e5fa573795a715216dChris Lattner// License. See LICENSE.TXT for details.
77c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//
87c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//===----------------------------------------------------------------------===//
97c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//
107c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner// This file defines the interfaces that PPC uses to lower LLVM code into a
117c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner// selection DAG.
127c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//
137c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner//===----------------------------------------------------------------------===//
147c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner
157c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner#ifndef LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
167c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner#define LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
177c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner
187c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner#include "llvm/Target/TargetLowering.h"
190bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner#include "llvm/CodeGen/SelectionDAG.h"
202668959b8879097db368aec7d76c455260abc75bChris Lattner#include "PPC.h"
21331d1bc5dfe1be9090e29f9af9579888a63a9a79Chris Lattner#include "PPCSubtarget.h"
227c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner
237c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattnernamespace llvm {
240bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner  namespace PPCISD {
250bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner    enum NodeType {
263c983c3dc19bb83807f978c04737b4572be90a93Nate Begeman      // Start the numbering where the builtin ops and target ops leave off.
270ba2bcfcc3149a25d08aa8aa00fb6c34a4e25bddDan Gohman      FIRST_NUMBER = ISD::BUILTIN_OP_END,
280bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner
290bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner      /// FSEL - Traditional three-operand fsel node.
300bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner      ///
310bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner      FSEL,
3295771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
33c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      /// FCFID - The FCFID instruction, taking an f64 operand and producing
34c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      /// and f64 value containing the FP representation of the integer that
35c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      /// was temporarily in the f64 operand.
36c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      FCFID,
3795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
3895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson      /// FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64
39c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      /// operand, producing an f64 value containing the integer representation
40c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      /// of that FP value.
41c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      FCTIDZ, FCTIWZ,
4295771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
435126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner      /// STFIWX - The STFIWX instruction.  The first operand is an input token
44c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// chain, then an f64 value to store, then an address to store it to.
455126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner      STFIWX,
4695771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
47993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman      // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking
48993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman      // three v4f32 operands and producing a v4f32 result.
49993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman      VMADDFP, VNMSUBFP,
5095771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
51f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner      /// VPERM - The PPC VPERM Instruction.
52f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner      ///
53f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner      VPERM,
5495771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
55860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// Hi/Lo - These represent the high and low 16-bit parts of a global
56860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// address respectively.  These nodes have two operands, the first of
57860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// which must be a TargetGlobalAddress, and the second of which must be a
58860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// Constant.  Selected naively, these turn into 'lis G+C' and 'li G+C',
59860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// though these are usually folded into other nodes.
60860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      Hi, Lo,
6195771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
626b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller      TOC_ENTRY,
636b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller
643a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// The following three target-specific nodes are used for calls through
653a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// function pointers in the 64-bit SVR4 ABI.
663a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller
673a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// Restore the TOC from the TOC save area of the current stack frame.
683a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// This is basically a hard coded load instruction which additionally
693a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// takes/produces a flag.
703a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      TOC_RESTORE,
713a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller
723a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// Like a regular LOAD but additionally taking/producing a flag.
733a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      LOAD,
743a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller
753a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// LOAD into r2 (also taking/producing a flag). Like TOC_RESTORE, this is
763a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      /// a hard coded load instruction.
773a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller      LOAD_TOC,
783a84dae654630a89a91a73807201b6067c4774ecTilmann Scheller
792f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      /// OPRC, CHAIN = DYNALLOC(CHAIN, NEGSIZE, FRAME_INDEX)
802f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to
812f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      /// compute an allocation on the stack.
822f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      DYNALLOC,
8395771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
84860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// GlobalBaseReg - On Darwin, this node represents the result of the mflr
85860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// at function entry, used for PIC code.
86860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      GlobalBaseReg,
8795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
884172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      /// These nodes represent the 32-bit PPC shifts that operate on 6-bit
894172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      /// shift amounts.  These nodes are generated by the multi-precision shift
904172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      /// code.
914172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      SRL, SRA, SHL,
9295771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
93ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      /// EXTSW_32 - This is the EXTSW instruction for use with "32-bit"
94ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      /// registers.
95ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      EXTSW_32,
969e4dd9dfc97f3930f58ca6e47bebbd8eb5cdd8a1Nate Begeman
97c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// CALL - A direct function call.
982a9ddfb903ae3baede7282348afae1f750905248Tilmann Scheller      CALL_Darwin, CALL_SVR4,
9995771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
1006b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller      /// NOP - Special NOP which follows 64-bit SVR4 calls.
1016b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller      NOP,
1026b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller
103c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a
104c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// MTCTR instruction.
105c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      MTCTR,
10695771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
107c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a
108c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// BCTRL instruction.
1092a9ddfb903ae3baede7282348afae1f750905248Tilmann Scheller      BCTRL_Darwin, BCTRL_SVR4,
11095771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
1119e4dd9dfc97f3930f58ca6e47bebbd8eb5cdd8a1Nate Begeman      /// Return with a flag operand, matched by 'blr'
1129e4dd9dfc97f3930f58ca6e47bebbd8eb5cdd8a1Nate Begeman      RET_FLAG,
11395771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
1145f07d5224ddc32f405d7e19de8e58e91ab2816bcDale Johannesen      /// R32 = MFCR(CRREG, INFLAG) - Represents the MFCRpseud/MFOCRF
1155f07d5224ddc32f405d7e19de8e58e91ab2816bcDale Johannesen      /// instructions.  This copies the bits corresponding to the specified
1165f07d5224ddc32f405d7e19de8e58e91ab2816bcDale Johannesen      /// CRREG into the resultant GPR.  Bits corresponding to other CR regs
1175f07d5224ddc32f405d7e19de8e58e91ab2816bcDale Johannesen      /// are undefined.
1186d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      MFCR,
119a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner
120a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// RESVEC = VCMP(LHS, RHS, OPC) - Represents one of the altivec VCMP*
121a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// instructions.  For lack of better number, we use the opcode number
122a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// encoding for the OPC field to identify the compare.  For example, 838
123a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// is VCMPGTSH.
124a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      VCMP,
12595771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
1266d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the
12795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson      /// altivec VCMP*o instructions.  For lack of better number, we use the
1286d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// opcode number encoding for the OPC field to identify the compare.  For
1296d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// example, 838 is VCMPGTSH.
13090564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      VCMPo,
13195771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
13290564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This
13390564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// corresponds to the COND_BRANCH pseudo instruction.  CRRC is the
13490564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// condition register to branch on, OPC is the branch opcode to use (e.g.
13590564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// PPC::BLE), DESTBB is the destination block to branch to, and INFLAG is
13690564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// an optional input flag argument.
137d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      COND_BRANCH,
13895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
1396eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      // The following 5 instructions are used only as part of the
1406eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      // long double-to-int conversion sequence.
1416eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen
1426eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// OUTFLAG = MFFS F8RC - This moves the FPSCR (not modelled) into the
1436eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// register.
1446eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      MFFS,
1456eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen
1466eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// OUTFLAG = MTFSB0 INFLAG - This clears a bit in the FPSCR.
1476eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      MTFSB0,
1486eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen
1496eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// OUTFLAG = MTFSB1 INFLAG - This sets a bit in the FPSCR.
1506eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      MTFSB1,
1516eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen
1526eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// F8RC, OUTFLAG = FADDRTZ F8RC, F8RC, INFLAG - This is an FADD done with
15395771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson      /// rounding towards zero.  It has flags added so it won't move past the
1546eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// FPSCR-setting instructions.
1556eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      FADDRTZ,
1566eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen
1576eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// MTFSF = F8RC, INFLAG - This moves the register into the FPSCR.
15854fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng      MTFSF,
15954fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng
1608608f2eff2dab5345243c40d0bca9138f2dce6f1Evan Cheng      /// LARX = This corresponds to PPC l{w|d}arx instrcution: load and
16154fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng      /// reserve indexed. This is used to implement atomic operations.
1628608f2eff2dab5345243c40d0bca9138f2dce6f1Evan Cheng      LARX,
16354fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng
1648608f2eff2dab5345243c40d0bca9138f2dce6f1Evan Cheng      /// STCX = This corresponds to PPC stcx. instrcution: store conditional
1658608f2eff2dab5345243c40d0bca9138f2dce6f1Evan Cheng      /// indexed. This is used to implement atomic operations.
1668608f2eff2dab5345243c40d0bca9138f2dce6f1Evan Cheng      STCX,
16754fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng
16830e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer      /// TC_RETURN - A tail call return.
16930e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer      ///   operand #0 chain
17030e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer      ///   operand #1 callee (register or absolute)
17130e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer      ///   operand #2 stack adjustment
17230e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer      ///   operand #3 optional in flag
173c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      TC_RETURN,
174c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman
175c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// STD_32 - This is the STD instruction for use with "32-bit" registers.
176c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      STD_32 = ISD::FIRST_TARGET_MEMORY_OPCODE,
17795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
17895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson      /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a
179c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// byte-swapping store instruction.  It byte-swaps the low "Type" bits of
180c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// the GPRC input, then stores it through Ptr.  Type can be either i16 or
181c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// i32.
18295771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson      STBRX,
18395771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
18495771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson      /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a
185c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// byte-swapping load instruction.  It loads "Type" bits, byte swaps it,
186c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// then puts it in the bottom bits of the GPRC.  TYPE can be either i16
187c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      /// or i32.
188c76909abfec876c6b751d693ebd3df07df686aa0Dan Gohman      LBRX
189281b55ebeccd3f0d723888c1bb9ec6e476f708f1Chris Lattner    };
1903c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  }
1913c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner
1923c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  /// Define some predicates that are used for node matching.
1933c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  namespace PPC {
194ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a
195ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// VPKUHUM instruction.
1969008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary);
19795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
198ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a
199ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// VPKUWUM instruction.
2009008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary);
201116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner
202116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// isVMRGLShuffleMask - Return true if this is a shuffle mask suitable for
203116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// a VRGL* instruction with the specified unit size (1,2 or 4 bytes).
2049008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVMRGLShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
2059008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman                            bool isUnary);
206116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner
207116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// isVMRGHShuffleMask - Return true if this is a shuffle mask suitable for
208116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// a VRGH* instruction with the specified unit size (1,2 or 4 bytes).
2099008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
2109008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman                            bool isUnary);
21195771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
212d0608e191ff9c00af68985f246410c219d1bec57Chris Lattner    /// isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the shift
213d0608e191ff9c00af68985f246410c219d1bec57Chris Lattner    /// amount, otherwise return -1.
214f24380e78ecc8a2db1b2116867d878b1e7c6f6edChris Lattner    int isVSLDOIShuffleMask(SDNode *N, bool isUnary);
21595771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
2163c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand
2173c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// specifies a splat of a single element that is suitable for input to
2183c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// VSPLTB/VSPLTH/VSPLTW.
2199008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize);
22095771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
22166ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng    /// isAllNegativeZeroVector - Returns true if all elements of build_vector
22266ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng    /// are -0.0.
22366ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng    bool isAllNegativeZeroVector(SDNode *N);
22466ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng
2253c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the
2263c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// specified isSplatShuffleMask VECTOR_SHUFFLE mask.
2277ff7e674580adad7a5bccdbd74cf9c9f05e46d0fChris Lattner    unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize);
22895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
229e87192a854ff0f2f1904dd9ea282eb36059bb5afChris Lattner    /// get_VSPLTI_elt - If this is a build_vector of constants which can be
230140a58f9dfda30dbb80edd3da1b5632c178f7efcChris Lattner    /// formed by using a vspltis[bhw] instruction of the specified element
231140a58f9dfda30dbb80edd3da1b5632c178f7efcChris Lattner    /// size, return the constant being splatted.  The ByteSize field indicates
232140a58f9dfda30dbb80edd3da1b5632c178f7efcChris Lattner    /// the number of bytes of each element [124] -> [bhw].
233475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG);
2343c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  }
23595771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
23621e463b2bf864671a87ebe386cb100ef9349a540Nate Begeman  class PPCTargetLowering : public TargetLowering {
237331d1bc5dfe1be9090e29f9af9579888a63a9a79Chris Lattner    const PPCSubtarget &PPCSubTarget;
2381e93df6f0b5ee6e36d7ec18e6035f0f5a53e5ec6Dan Gohman
2397c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner  public:
24061e729e2e9517ab2d8887bab86fb377900fa1081Dan Gohman    explicit PPCTargetLowering(PPCTargetMachine &TM);
24195771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
242da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner    /// getTargetNodeName() - This method returns the name of a target specific
243da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner    /// DAG node.
244da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner    virtual const char *getTargetNodeName(unsigned Opcode) const;
245fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
24695771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson    virtual MVT getShiftAmountTy(EVT LHSTy) const { return MVT::i32; }
24795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
2485b8f82e35b51bf007de07a7ca9347d804084ddf8Scott Michel    /// getSetCCResultType - Return the ISD::SETCC ValueType
24928b77e968d2b01fc9da724762bd8ddcd80650e32Duncan Sands    virtual EVT getSetCCResultType(EVT VT) const;
2505b8f82e35b51bf007de07a7ca9347d804084ddf8Scott Michel
251fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// getPreIndexedAddressParts - returns true by value, base pointer and
252fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// offset pointer and addressing mode by reference if the node's address
253fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// can be legally represented as pre-indexed load / store address.
254475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
255475871a144eb604ddaf37503397ba0941442e5fbDan Gohman                                           SDValue &Offset,
256144d8f09e139f691cafadbc17873943ba4c465f3Evan Cheng                                           ISD::MemIndexedMode &AM,
25773e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                                           SelectionDAG &DAG) const;
25895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
259fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegReg - Given the specified addressed, check to see if it
260fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// can be represented as an indexed [r+r] operation.  Returns false if it
261fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// can be more efficiently represented with [r+imm].
262475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index,
26373e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                             SelectionDAG &DAG) const;
26495771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
265fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegImm - Returns true if the address N can be represented
266fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// by a base register plus a signed 16-bit displacement [r+imm], and if it
267fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// is not better represented as reg+reg.
268475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base,
26973e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                             SelectionDAG &DAG) const;
27095771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
271fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegRegOnly - Given the specified addressed, force it to be
272fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// represented as an indexed [r+r] operation.
273475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index,
27473e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                                 SelectionDAG &DAG) const;
275fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
276fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegImmShift - Returns true if the address N can be
277fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// represented by a base register plus a signed 14-bit displacement
278fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// [r+imm*4].  Suitable for use by STD and friends.
279475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegImmShift(SDValue N, SDValue &Disp, SDValue &Base,
28073e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                                  SelectionDAG &DAG) const;
281fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
28295771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
283e4bc9ea0a560d8a0ba42f5a2da617e1f1f834710Chris Lattner    /// LowerOperation - Provide custom lowering hooks for some operations.
284e4bc9ea0a560d8a0ba42f5a2da617e1f1f834710Chris Lattner    ///
285d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
2861f873003266fbdec7c2c48a965c60f4e2e35a158Chris Lattner
2871607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    /// ReplaceNodeResults - Replace the results of node with an illegal result
2881607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    /// type with new values built out of custom code.
2891607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    ///
2901607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
291d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                                    SelectionDAG &DAG) const;
2921607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands
293475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
29495771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
295475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual void computeMaskedBitsForTargetNode(const SDValue Op,
296977a76fbb6ea1b87dfd7fbbe2ae2afb63e982ff3Dan Gohman                                                const APInt &Mask,
29795771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson                                                APInt &KnownZero,
298fd29e0eb060ea8b4d490860329234d2ae5f5952eDan Gohman                                                APInt &KnownOne,
299ea859be53ca13a1547c4675549946b74dc3c6f41Dan Gohman                                                const SelectionDAG &DAG,
300bbe77de450ef36b4f83cc3b57705a9758adbd925Chris Lattner                                                unsigned Depth = 0) const;
3014a95945fa5aa431110f50092f4a45d24772a553bNate Begeman
302af1d8ca44a18f304f207e209b3bdb94b590f86ffDan Gohman    virtual MachineBasicBlock *
303af1d8ca44a18f304f207e209b3bdb94b590f86ffDan Gohman      EmitInstrWithCustomInserter(MachineInstr *MI,
304af1d8ca44a18f304f207e209b3bdb94b590f86ffDan Gohman                                  MachineBasicBlock *MBB) const;
30595771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson    MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
306bdab93a2ef5d9574bb4e322e020849f9bc9c90d7Dale Johannesen                                        MachineBasicBlock *MBB, bool is64Bit,
3071fdbc1dd4e9cb42c79a30e8dc308c322e923cc52Dan Gohman                                        unsigned BinOpcode) const;
30895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson    MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI,
30995771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson                                                MachineBasicBlock *MBB,
3101fdbc1dd4e9cb42c79a30e8dc308c322e923cc52Dan Gohman                                            bool is8bit, unsigned Opcode) const;
31195771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
3124234f57fa02b1f04a9f52a7b3c2aa22d32ac521cChris Lattner    ConstraintType getConstraintType(const std::string &Constraint) const;
31344ab89eb376af838d1123293a79975aede501464John Thompson
31444ab89eb376af838d1123293a79975aede501464John Thompson    /// Examine constraint string and operand type and determine a weight value.
31544ab89eb376af838d1123293a79975aede501464John Thompson    /// The operand object must already have been set up with the operand type.
31644ab89eb376af838d1123293a79975aede501464John Thompson    ConstraintWeight getSingleConstraintMatchWeight(
31744ab89eb376af838d1123293a79975aede501464John Thompson      AsmOperandInfo &info, const char *constraint) const;
31844ab89eb376af838d1123293a79975aede501464John Thompson
31995771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson    std::pair<unsigned, const TargetRegisterClass*>
320331d1bc5dfe1be9090e29f9af9579888a63a9a79Chris Lattner      getRegForInlineAsmConstraint(const std::string &Constraint,
321e50ed30282bb5b4a9ed952580523f2dda16215acOwen Anderson                                   EVT VT) const;
322c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng
32328d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
32428d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    /// function arguments in the caller parameter area.  This is the actual
32528d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    /// alignment, not its logarithm.
326db125cfaf57cc83e7dd7453de2d509bc8efd0e5eChris Lattner    unsigned getByValTypeAlignment(Type *Ty) const;
32728d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen
32848884cd80b52be1528618f2e9b3425ac24e7b5caChris Lattner    /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
3291784d160e4efa75782884d451d0788b9457e67dcDale Johannesen    /// vector.  If it is invalid, don't add anything to Ops.
330475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual void LowerAsmOperandForConstraint(SDValue Op,
331100c83341676d8aae8fc34b5452563ed08b14f3eEric Christopher                                              std::string &Constraint,
332475871a144eb604ddaf37503397ba0941442e5fbDan Gohman                                              std::vector<SDValue> &Ops,
3335e764233f398b6929b67701672a5e78fec20ce2eChris Lattner                                              SelectionDAG &DAG) const;
33495771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
335c9addb74883fef318140272768422656a694341fChris Lattner    /// isLegalAddressingMode - Return true if the addressing mode represented
336c9addb74883fef318140272768422656a694341fChris Lattner    /// by AM is legal for this target, for a load/store of the specified type.
337db125cfaf57cc83e7dd7453de2d509bc8efd0e5eChris Lattner    virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty)const;
33895771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
339c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng    /// isLegalAddressImmediate - Return true if the integer value can be used
340861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// as the offset of the target addressing mode for load / store of the
341861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// given type.
342db125cfaf57cc83e7dd7453de2d509bc8efd0e5eChris Lattner    virtual bool isLegalAddressImmediate(int64_t V, Type *Ty) const;
343861939152debbaa15a55a196a4321837c7bc379dEvan Cheng
344861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// isLegalAddressImmediate - Return true if the GlobalValue can be used as
345861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// the offset of the target addressing mode.
346861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
34743c6e7cd9b0d9a3b0006650ddfac256848f10d51Nicolas Geoffray
34854aeea39a743effe88eedb43d2f7f4805e806ab5Dan Gohman    virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
34995771afbfd604ad003fa3723cac66c9370fed55dOwen Anderson
35042642d06c915a26af1400de6ce6a53c333e5c247Evan Cheng    /// getOptimalMemOpType - Returns the target specific optimal type for load
351f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    /// and store operations as a result of memset, memcpy, and memmove
352f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    /// lowering. If DstAlign is zero that means it's safe to destination
353f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    /// alignment can satisfy any constraint. Similarly if SrcAlign is zero it
354f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    /// means there isn't a need to check it against alignment requirement,
355f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    /// probably because the source does not need to be loaded. If
35615701f8969fcb36899a75ca2df6fdcbc52141106Lang Hames    /// 'IsZeroVal' is true, that means it's safe to return a
357f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    /// non-scalar-integer type, e.g. empty string source, constant, or loaded
358c3b0c341e731b27b550ee9dcded9c17232b296b8Evan Cheng    /// from memory. 'MemcpyStrSrc' indicates whether the memcpy source is
359c3b0c341e731b27b550ee9dcded9c17232b296b8Evan Cheng    /// constant so it does not need to be loaded.
36037f32ee7ffe77d7c2bc1b185802e98979612f041Dan Gohman    /// It returns EVT::Other if the type should be determined using generic
36137f32ee7ffe77d7c2bc1b185802e98979612f041Dan Gohman    /// target-independent logic.
362f28f8bc40eedc6304ab25dd8bed486fa08f51f70Evan Cheng    virtual EVT
363c3b0c341e731b27b550ee9dcded9c17232b296b8Evan Cheng    getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign,
36415701f8969fcb36899a75ca2df6fdcbc52141106Lang Hames                        bool IsZeroVal, bool MemcpyStrSrc,
36537f32ee7ffe77d7c2bc1b185802e98979612f041Dan Gohman                        MachineFunction &MF) const;
36654aeea39a743effe88eedb43d2f7f4805e806ab5Dan Gohman
36754fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng  private:
368475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
369475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;
37030e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer
3710c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng    bool
3720c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng    IsEligibleForTailCallOptimization(SDValue Callee,
3730c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng                                      CallingConv::ID CalleeCC,
3740c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng                                      bool isVarArg,
3750c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng                                      const SmallVectorImpl<ISD::InputArg> &Ins,
3760c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng                                      SelectionDAG& DAG) const;
3770c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng
378475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG & DAG,
37933c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         int SPDiff,
38033c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         SDValue Chain,
38133c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         SDValue &LROpOut,
38233c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         SDValue &FPOpOut,
3832a9ddfb903ae3baede7282348afae1f750905248Tilmann Scheller                                         bool isDarwinABI,
384d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                                         DebugLoc dl) const;
385d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman
386d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
387d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
388d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
389d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
390d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
391d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
392d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
3934a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands    SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
3944a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands    SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
395475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
396d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                         const PPCSubtarget &Subtarget) const;
3971e93df6f0b5ee6e36d7ec18e6035f0f5a53e5ec6Dan Gohman    SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG,
398d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                       const PPCSubtarget &Subtarget) const;
399475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
400d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                                const PPCSubtarget &Subtarget) const;
401475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG,
402d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                                      const PPCSubtarget &Subtarget) const;
403d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
404d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG, DebugLoc dl) const;
405d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
406d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
407d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const;
408d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const;
409d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const;
410d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
411d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
412d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
413d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
414d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman    SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;
41598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
41698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
41765c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                            CallingConv::ID CallConv, bool isVarArg,
41898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                            const SmallVectorImpl<ISD::InputArg> &Ins,
41998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                            DebugLoc dl, SelectionDAG &DAG,
420d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                            SmallVectorImpl<SDValue> &InVals) const;
42165c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel    SDValue FinishCall(CallingConv::ID CallConv, DebugLoc dl, bool isTailCall,
42298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       bool isVarArg,
42398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SelectionDAG &DAG,
42498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SmallVector<std::pair<unsigned, SDValue>, 8>
42598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                         &RegsToPass,
42698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SDValue InFlag, SDValue Chain,
42798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SDValue &Callee,
42898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       int SPDiff, unsigned NumBytes,
42998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       const SmallVectorImpl<ISD::InputArg> &Ins,
430d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                       SmallVectorImpl<SDValue> &InVals) const;
43198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
43298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual SDValue
43398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerFormalArguments(SDValue Chain,
43465c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                           CallingConv::ID CallConv, bool isVarArg,
43598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                           const SmallVectorImpl<ISD::InputArg> &Ins,
43698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                           DebugLoc dl, SelectionDAG &DAG,
437d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                           SmallVectorImpl<SDValue> &InVals) const;
43898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
43998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual SDValue
440022d9e1cef7586a80a96446ae8691a37def9bbf4Evan Cheng      LowerCall(SDValue Chain, SDValue Callee,
4410c439eb2c8397996cbccaf2798e598052d9982c8Evan Cheng                CallingConv::ID CallConv, bool isVarArg, bool &isTailCall,
44298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                const SmallVectorImpl<ISD::OutputArg> &Outs,
443c9403659a98bf6487ab6fbf40b81628b5695c02eDan Gohman                const SmallVectorImpl<SDValue> &OutVals,
44498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                const SmallVectorImpl<ISD::InputArg> &Ins,
44598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                DebugLoc dl, SelectionDAG &DAG,
446d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                SmallVectorImpl<SDValue> &InVals) const;
44798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
448d712f935f7e027a733741e6ca67b3237a59f65d1Hal Finkel    virtual bool
449d712f935f7e027a733741e6ca67b3237a59f65d1Hal Finkel      CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
450d712f935f7e027a733741e6ca67b3237a59f65d1Hal Finkel                   bool isVarArg,
451d712f935f7e027a733741e6ca67b3237a59f65d1Hal Finkel                   const SmallVectorImpl<ISD::OutputArg> &Outs,
452d712f935f7e027a733741e6ca67b3237a59f65d1Hal Finkel                   LLVMContext &Context) const;
453d712f935f7e027a733741e6ca67b3237a59f65d1Hal Finkel
45498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual SDValue
45598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerReturn(SDValue Chain,
45665c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                  CallingConv::ID CallConv, bool isVarArg,
45798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                  const SmallVectorImpl<ISD::OutputArg> &Outs,
458c9403659a98bf6487ab6fbf40b81628b5695c02eDan Gohman                  const SmallVectorImpl<SDValue> &OutVals,
459d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                  DebugLoc dl, SelectionDAG &DAG) const;
46098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
46198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
46298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerFormalArguments_Darwin(SDValue Chain,
46365c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                                  CallingConv::ID CallConv, bool isVarArg,
46498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                  const SmallVectorImpl<ISD::InputArg> &Ins,
46598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                  DebugLoc dl, SelectionDAG &DAG,
466d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                                  SmallVectorImpl<SDValue> &InVals) const;
46798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
46898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerFormalArguments_SVR4(SDValue Chain,
46965c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                                CallingConv::ID CallConv, bool isVarArg,
47098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                const SmallVectorImpl<ISD::InputArg> &Ins,
47198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                DebugLoc dl, SelectionDAG &DAG,
472d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                                SmallVectorImpl<SDValue> &InVals) const;
47398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
47498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
47598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerCall_Darwin(SDValue Chain, SDValue Callee,
47665c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                       CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
47798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       const SmallVectorImpl<ISD::OutputArg> &Outs,
478c9403659a98bf6487ab6fbf40b81628b5695c02eDan Gohman                       const SmallVectorImpl<SDValue> &OutVals,
47998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       const SmallVectorImpl<ISD::InputArg> &Ins,
48098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       DebugLoc dl, SelectionDAG &DAG,
481d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                       SmallVectorImpl<SDValue> &InVals) const;
48298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
48398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerCall_SVR4(SDValue Chain, SDValue Callee,
48465c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                     CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
48598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     const SmallVectorImpl<ISD::OutputArg> &Outs,
486c9403659a98bf6487ab6fbf40b81628b5695c02eDan Gohman                     const SmallVectorImpl<SDValue> &OutVals,
48798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     const SmallVectorImpl<ISD::InputArg> &Ins,
48898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     DebugLoc dl, SelectionDAG &DAG,
489d858e90f039f5fcdc2fa93035e911a5a9505cc50Dan Gohman                     SmallVectorImpl<SDValue> &InVals) const;
4907c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner  };
4917c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner}
4927c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner
4937c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner#endif   // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
494