PPCISelLowering.h revision fb2e752e4175920d0531f2afc93a23d0cdf4db14
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,
32f76053269ecc6c7bd3d0b1e90ebdd0cef1bb2bdcChris Lattner
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,
37c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman
38c09eeec0ebc378644bafd04916e5efafa7d98152Nate Begeman      /// 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,
42860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner
435126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner      /// STFIWX - The STFIWX instruction.  The first operand is an input token
445126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner      /// chain, then an f64 value to store, then an address to store it to,
455126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner      /// then a SRCVALUE for the address.
465126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner      STFIWX,
475126984b1da4bda0e93961da07e883699f1f2d57Chris Lattner
48993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman      // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking
49993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman      // three v4f32 operands and producing a v4f32 result.
50993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman      VMADDFP, VNMSUBFP,
51993aeb2ed93f99faf1438f1b67cd922989306828Nate Begeman
52f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner      /// VPERM - The PPC VPERM Instruction.
53f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner      ///
54f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner      VPERM,
55f1d0b2bedaa065972a5ba17259055c1176cd1497Chris Lattner
56860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// Hi/Lo - These represent the high and low 16-bit parts of a global
57860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// address respectively.  These nodes have two operands, the first of
58860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// which must be a TargetGlobalAddress, and the second of which must be a
59860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// Constant.  Selected naively, these turn into 'lis G+C' and 'li G+C',
60860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// though these are usually folded into other nodes.
61860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      Hi, Lo,
62860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner
636b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller      TOC_ENTRY,
646b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller
652f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      /// OPRC, CHAIN = DYNALLOC(CHAIN, NEGSIZE, FRAME_INDEX)
662f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to
672f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      /// compute an allocation on the stack.
682f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey      DYNALLOC,
692f616bff7ef1e2e08d6d23c2a8b42ec2bfebb173Jim Laskey
70860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// GlobalBaseReg - On Darwin, this node represents the result of the mflr
71860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      /// at function entry, used for PIC code.
72860e8862c1fbd3b261da4a64a8c0096f9f373681Chris Lattner      GlobalBaseReg,
734172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner
744172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      /// These nodes represent the 32-bit PPC shifts that operate on 6-bit
754172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      /// shift amounts.  These nodes are generated by the multi-precision shift
764172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      /// code.
774172b10ca1adfc1026428e5f522aaab98bd939adChris Lattner      SRL, SRA, SHL,
78ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner
79ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      /// EXTSW_32 - This is the EXTSW instruction for use with "32-bit"
80ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      /// registers.
81ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      EXTSW_32,
829e4dd9dfc97f3930f58ca6e47bebbd8eb5cdd8a1Nate Begeman
83ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      /// STD_32 - This is the STD instruction for use with "32-bit" registers.
84ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner      STD_32,
85ecfe55e65b6a72fddd543c42f2e2df4c96c647baChris Lattner
86c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// CALL - A direct function call.
872a9ddfb903ae3baede7282348afae1f750905248Tilmann Scheller      CALL_Darwin, CALL_SVR4,
88281b55ebeccd3f0d723888c1bb9ec6e476f708f1Chris Lattner
896b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller      /// NOP - Special NOP which follows 64-bit SVR4 calls.
906b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller      NOP,
916b16eff207f99bbde3c0f7340452a5287218772cTilmann Scheller
92c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a
93c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// MTCTR instruction.
94c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      MTCTR,
95c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner
96c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a
97c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner      /// BCTRL instruction.
982a9ddfb903ae3baede7282348afae1f750905248Tilmann Scheller      BCTRL_Darwin, BCTRL_SVR4,
99c703a8fbf8653ac8302ae368391a4954c307ca2cChris Lattner
1009e4dd9dfc97f3930f58ca6e47bebbd8eb5cdd8a1Nate Begeman      /// Return with a flag operand, matched by 'blr'
1019e4dd9dfc97f3930f58ca6e47bebbd8eb5cdd8a1Nate Begeman      RET_FLAG,
1026d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner
1036d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// R32 = MFCR(CRREG, INFLAG) - Represents the MFCR/MFOCRF instructions.
1046d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// This copies the bits corresponding to the specified CRREG into the
1056d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// resultant GPR.  Bits corresponding to other CR regs are undefined.
1066d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      MFCR,
107a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner
108a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// RESVEC = VCMP(LHS, RHS, OPC) - Represents one of the altivec VCMP*
109a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// instructions.  For lack of better number, we use the opcode number
110a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// encoding for the OPC field to identify the compare.  For example, 838
111a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      /// is VCMPGTSH.
112a17b1557ad705c56c41624e6841e19093ed31f21Chris Lattner      VCMP,
1136d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner
1146d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the
1156d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// altivec VCMP*o instructions.  For lack of better number, we use the
1166d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// opcode number encoding for the OPC field to identify the compare.  For
1176d92caddc4aa5fc946b294259e00cc35536e61e8Chris Lattner      /// example, 838 is VCMPGTSH.
11890564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      VCMPo,
11990564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner
12090564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This
12190564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// corresponds to the COND_BRANCH pseudo instruction.  CRRC is the
12290564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// condition register to branch on, OPC is the branch opcode to use (e.g.
12390564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// PPC::BLE), DESTBB is the destination block to branch to, and INFLAG is
12490564f26d17701e11effa2f4e0fb9a18d8a91274Chris Lattner      /// an optional input flag argument.
125d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      COND_BRANCH,
126d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner
127d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// CHAIN = STBRX CHAIN, GPRC, Ptr, SRCVALUE, Type - This is a
128d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// byte-swapping store instruction.  It byte-swaps the low "Type" bits of
129d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// the GPRC input, then stores it through Ptr.  Type can be either i16 or
130d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// i32.
131d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      STBRX,
132d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner
133d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// GPRC, CHAIN = LBRX CHAIN, Ptr, SRCVALUE, Type - This is a
134d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// byte-swapping load instruction.  It loads "Type" bits, byte swaps it,
135d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// then puts it in the bottom bits of the GPRC.  TYPE can be either i16
136d9989384592a3bd9dd374470a723ca8303071a2dChris Lattner      /// or i32.
1376eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      LBRX,
1386eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen
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
1536eaeff29b8a6990107735f7e5f5e49da38f56223Dale Johannesen      /// 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
17330e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer      TC_RETURN
174281b55ebeccd3f0d723888c1bb9ec6e476f708f1Chris Lattner    };
1753c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  }
1763c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner
1773c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  /// Define some predicates that are used for node matching.
1783c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  namespace PPC {
179ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a
180ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// VPKUHUM instruction.
1819008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary);
182ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner
183ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a
184ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner    /// VPKUWUM instruction.
1859008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, bool isUnary);
186116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner
187116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// isVMRGLShuffleMask - Return true if this is a shuffle mask suitable for
188116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// a VRGL* instruction with the specified unit size (1,2 or 4 bytes).
1899008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVMRGLShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
1909008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman                            bool isUnary);
191116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner
192116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// isVMRGHShuffleMask - Return true if this is a shuffle mask suitable for
193116cc48e30b9c307bf3eec29c890b4ba25cd18dbChris Lattner    /// a VRGH* instruction with the specified unit size (1,2 or 4 bytes).
1949008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
1959008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman                            bool isUnary);
196ddb739e5ea6ccf6fa4f4e2a23e3da550868efaa1Chris Lattner
197d0608e191ff9c00af68985f246410c219d1bec57Chris Lattner    /// isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the shift
198d0608e191ff9c00af68985f246410c219d1bec57Chris Lattner    /// amount, otherwise return -1.
199f24380e78ecc8a2db1b2116867d878b1e7c6f6edChris Lattner    int isVSLDOIShuffleMask(SDNode *N, bool isUnary);
200d0608e191ff9c00af68985f246410c219d1bec57Chris Lattner
2013c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand
2023c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// specifies a splat of a single element that is suitable for input to
2033c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// VSPLTB/VSPLTH/VSPLTW.
2049008ca6b6b4f638cfafccb593cbc5b1d3f5ab877Nate Begeman    bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize);
2053c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner
20666ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng    /// isAllNegativeZeroVector - Returns true if all elements of build_vector
20766ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng    /// are -0.0.
20866ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng    bool isAllNegativeZeroVector(SDNode *N);
20966ffe6be0c7b50100a00cb0cc87a5d4983818572Evan Cheng
2103c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the
2113c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner    /// specified isSplatShuffleMask VECTOR_SHUFFLE mask.
2127ff7e674580adad7a5bccdbd74cf9c9f05e46d0fChris Lattner    unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize);
21364b3a08bc696b2ef8733d72ce81e49be175cbbffChris Lattner
214e87192a854ff0f2f1904dd9ea282eb36059bb5afChris Lattner    /// get_VSPLTI_elt - If this is a build_vector of constants which can be
215140a58f9dfda30dbb80edd3da1b5632c178f7efcChris Lattner    /// formed by using a vspltis[bhw] instruction of the specified element
216140a58f9dfda30dbb80edd3da1b5632c178f7efcChris Lattner    /// size, return the constant being splatted.  The ByteSize field indicates
217140a58f9dfda30dbb80edd3da1b5632c178f7efcChris Lattner    /// the number of bytes of each element [124] -> [bhw].
218475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG);
2193c0f9cc90cdcb70caf0dc517b9f9206d731aeb70Chris Lattner  }
2200bbea954331b8f08afa5b094dfb0841829c70eaaChris Lattner
22121e463b2bf864671a87ebe386cb100ef9349a540Nate Begeman  class PPCTargetLowering : public TargetLowering {
2227c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner    int VarArgsFrameIndex;            // FrameIndex for start of varargs area.
2230111999a88077f237c49d03c5e7891ec874b33a9Nicolas Geoffray    int VarArgsStackOffset;           // StackOffset for start of stack
2240111999a88077f237c49d03c5e7891ec874b33a9Nicolas Geoffray                                      // arguments.
2250111999a88077f237c49d03c5e7891ec874b33a9Nicolas Geoffray    unsigned VarArgsNumGPR;           // Index of the first unused integer
2260111999a88077f237c49d03c5e7891ec874b33a9Nicolas Geoffray                                      // register for parameter passing.
2270111999a88077f237c49d03c5e7891ec874b33a9Nicolas Geoffray    unsigned VarArgsNumFPR;           // Index of the first unused double
2280111999a88077f237c49d03c5e7891ec874b33a9Nicolas Geoffray                                      // register for parameter passing.
229331d1bc5dfe1be9090e29f9af9579888a63a9a79Chris Lattner    const PPCSubtarget &PPCSubTarget;
2307c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner  public:
23161e729e2e9517ab2d8887bab86fb377900fa1081Dan Gohman    explicit PPCTargetLowering(PPCTargetMachine &TM);
2327c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner
233da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner    /// getTargetNodeName() - This method returns the name of a target specific
234da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner    /// DAG node.
235da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner    virtual const char *getTargetNodeName(unsigned Opcode) const;
236fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
2375b8f82e35b51bf007de07a7ca9347d804084ddf8Scott Michel    /// getSetCCResultType - Return the ISD::SETCC ValueType
238825b72b0571821bf2d378749f69d6c4cfb52d2f9Owen Anderson    virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const;
2395b8f82e35b51bf007de07a7ca9347d804084ddf8Scott Michel
240fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// getPreIndexedAddressParts - returns true by value, base pointer and
241fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// offset pointer and addressing mode by reference if the node's address
242fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// can be legally represented as pre-indexed load / store address.
243475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
244475871a144eb604ddaf37503397ba0941442e5fbDan Gohman                                           SDValue &Offset,
245144d8f09e139f691cafadbc17873943ba4c465f3Evan Cheng                                           ISD::MemIndexedMode &AM,
24673e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                                           SelectionDAG &DAG) const;
247fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
248fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegReg - Given the specified addressed, check to see if it
249fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// can be represented as an indexed [r+r] operation.  Returns false if it
250fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// can be more efficiently represented with [r+imm].
251475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index,
25273e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                             SelectionDAG &DAG) const;
253fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
254fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegImm - Returns true if the address N can be represented
255fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// by a base register plus a signed 16-bit displacement [r+imm], and if it
256fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// is not better represented as reg+reg.
257475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base,
25873e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                             SelectionDAG &DAG) const;
259fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
260fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegRegOnly - Given the specified addressed, force it to be
261fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// represented as an indexed [r+r] operation.
262475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index,
26373e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                                 SelectionDAG &DAG) const;
264fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
265fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// SelectAddressRegImmShift - Returns true if the address N can be
266fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// represented by a base register plus a signed 14-bit displacement
267fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner    /// [r+imm*4].  Suitable for use by STD and friends.
268475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    bool SelectAddressRegImmShift(SDValue N, SDValue &Disp, SDValue &Base,
26973e0914848662404cf2aa18eb049ff5aae543388Dan Gohman                                  SelectionDAG &DAG) const;
270fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
271da6d20f0c15205923cb2c3ef4bf9b5d77de88881Chris Lattner
272e4bc9ea0a560d8a0ba42f5a2da617e1f1f834710Chris Lattner    /// LowerOperation - Provide custom lowering hooks for some operations.
273e4bc9ea0a560d8a0ba42f5a2da617e1f1f834710Chris Lattner    ///
274475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
2751f873003266fbdec7c2c48a965c60f4e2e35a158Chris Lattner
2761607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    /// ReplaceNodeResults - Replace the results of node with an illegal result
2771607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    /// type with new values built out of custom code.
2781607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    ///
2791607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands    virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
2801607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands                                    SelectionDAG &DAG);
2811607f05cb7d77d01ce521a30232faa389dbed4e2Duncan Sands
282475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
283fc5b1ab94959879a91c34aee8859e652a50270d0Chris Lattner
284475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual void computeMaskedBitsForTargetNode(const SDValue Op,
285977a76fbb6ea1b87dfd7fbbe2ae2afb63e982ff3Dan Gohman                                                const APInt &Mask,
286fd29e0eb060ea8b4d490860329234d2ae5f5952eDan Gohman                                                APInt &KnownZero,
287fd29e0eb060ea8b4d490860329234d2ae5f5952eDan Gohman                                                APInt &KnownOne,
288ea859be53ca13a1547c4675549946b74dc3c6f41Dan Gohman                                                const SelectionDAG &DAG,
289bbe77de450ef36b4f83cc3b57705a9758adbd925Chris Lattner                                                unsigned Depth = 0) const;
2904a95945fa5aa431110f50092f4a45d24772a553bNate Begeman
291ff9b373e8f5006c629af81e2619778b4c4f5249eEvan Cheng    virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
292fb2e752e4175920d0531f2afc93a23d0cdf4db14Evan Cheng                                                         MachineBasicBlock *MBB,
293fb2e752e4175920d0531f2afc93a23d0cdf4db14Evan Cheng                    DenseMap<MachineBasicBlock*, MachineBasicBlock*> *EM) const;
294bdab93a2ef5d9574bb4e322e020849f9bc9c90d7Dale Johannesen    MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
295bdab93a2ef5d9574bb4e322e020849f9bc9c90d7Dale Johannesen                                        MachineBasicBlock *MBB, bool is64Bit,
2961fdbc1dd4e9cb42c79a30e8dc308c322e923cc52Dan Gohman                                        unsigned BinOpcode) const;
29797efa365869d3b7b62836434585360a232836f0eDale Johannesen    MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI,
29897efa365869d3b7b62836434585360a232836f0eDale Johannesen                                                MachineBasicBlock *MBB,
2991fdbc1dd4e9cb42c79a30e8dc308c322e923cc52Dan Gohman                                            bool is8bit, unsigned Opcode) const;
300ddc787dfdc75fb2d78eb3e5793ca0f417ad74fd3Chris Lattner
3014234f57fa02b1f04a9f52a7b3c2aa22d32ac521cChris Lattner    ConstraintType getConstraintType(const std::string &Constraint) const;
302331d1bc5dfe1be9090e29f9af9579888a63a9a79Chris Lattner    std::pair<unsigned, const TargetRegisterClass*>
303331d1bc5dfe1be9090e29f9af9579888a63a9a79Chris Lattner      getRegForInlineAsmConstraint(const std::string &Constraint,
304e50ed30282bb5b4a9ed952580523f2dda16215acOwen Anderson                                   EVT VT) const;
305c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng
30628d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
30728d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    /// function arguments in the caller parameter area.  This is the actual
30828d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    /// alignment, not its logarithm.
30928d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen    unsigned getByValTypeAlignment(const Type *Ty) const;
31028d08fdb9f6572cafd5aae95c7caffa3cd136d8eDale Johannesen
31148884cd80b52be1528618f2e9b3425ac24e7b5caChris Lattner    /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
312da43bcf624acb56a3d77bb5ae9a02728af032613Evan Cheng    /// vector.  If it is invalid, don't add anything to Ops. If hasMemory is
313da43bcf624acb56a3d77bb5ae9a02728af032613Evan Cheng    /// true it means one of the asm constraint of the inline asm instruction
314da43bcf624acb56a3d77bb5ae9a02728af032613Evan Cheng    /// being processed is 'm'.
315475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    virtual void LowerAsmOperandForConstraint(SDValue Op,
31648884cd80b52be1528618f2e9b3425ac24e7b5caChris Lattner                                              char ConstraintLetter,
317da43bcf624acb56a3d77bb5ae9a02728af032613Evan Cheng                                              bool hasMemory,
318475871a144eb604ddaf37503397ba0941442e5fbDan Gohman                                              std::vector<SDValue> &Ops,
3195e764233f398b6929b67701672a5e78fec20ce2eChris Lattner                                              SelectionDAG &DAG) const;
32048884cd80b52be1528618f2e9b3425ac24e7b5caChris Lattner
321c9addb74883fef318140272768422656a694341fChris Lattner    /// isLegalAddressingMode - Return true if the addressing mode represented
322c9addb74883fef318140272768422656a694341fChris Lattner    /// by AM is legal for this target, for a load/store of the specified type.
323c9addb74883fef318140272768422656a694341fChris Lattner    virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty)const;
324c9addb74883fef318140272768422656a694341fChris Lattner
325c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng    /// isLegalAddressImmediate - Return true if the integer value can be used
326861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// as the offset of the target addressing mode for load / store of the
327861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// given type.
328861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    virtual bool isLegalAddressImmediate(int64_t V, const Type *Ty) const;
329861939152debbaa15a55a196a4321837c7bc379dEvan Cheng
330861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// isLegalAddressImmediate - Return true if the GlobalValue can be used as
331861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    /// the offset of the target addressing mode.
332861939152debbaa15a55a196a4321837c7bc379dEvan Cheng    virtual bool isLegalAddressImmediate(GlobalValue *GV) const;
33343c6e7cd9b0d9a3b0006650ddfac256848f10d51Nicolas Geoffray
33498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual bool
33598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    IsEligibleForTailCallOptimization(SDValue Callee,
33665c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                                      CallingConv::ID CalleeCC,
33798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                      bool isVarArg,
33898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                      const SmallVectorImpl<ISD::InputArg> &Ins,
33998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                      SelectionDAG& DAG) const;
34030e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer
34154aeea39a743effe88eedb43d2f7f4805e806ab5Dan Gohman    virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
342ffd0200abfd63177257f949a3674b91dcf87bf23Tilmann Scheller
343e50ed30282bb5b4a9ed952580523f2dda16215acOwen Anderson    virtual EVT getOptimalMemOpType(uint64_t Size, unsigned Align,
344ffd0200abfd63177257f949a3674b91dcf87bf23Tilmann Scheller                                    bool isSrcConst, bool isSrcStr,
345ffd0200abfd63177257f949a3674b91dcf87bf23Tilmann Scheller                                    SelectionDAG &DAG) const;
34654aeea39a743effe88eedb43d2f7f4805e806ab5Dan Gohman
347b4202b84d7e54efe5e144885c7da63e6cc465f80Bill Wendling    /// getFunctionAlignment - Return the Log2 alignment of this function.
34820c568f366be211323eeaf0e45ef053278ec9ddcBill Wendling    virtual unsigned getFunctionAlignment(const Function *F) const;
34920c568f366be211323eeaf0e45ef053278ec9ddcBill Wendling
35054fc97dcdc0ab747f49bd09c5a877bfd2a00e364Evan Cheng  private:
351475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
352475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;
35330e62c098b5841259f8026df1c5c45c7c1182a38Arnold Schwaighofer
354475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG & DAG,
35533c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         int SPDiff,
35633c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         SDValue Chain,
35733c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         SDValue &LROpOut,
35833c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         SDValue &FPOpOut,
3592a9ddfb903ae3baede7282348afae1f750905248Tilmann Scheller                                         bool isDarwinABI,
36033c960f523f2308482d5b2816af46a7ec90a6d3dDale Johannesen                                         DebugLoc dl);
361475871a144eb604ddaf37503397ba0941442e5fbDan Gohman
362475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG);
363475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG);
364475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG);
365475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG);
366475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG);
367475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG);
368475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG);
3697795932d41a84c921a5d348b7fa70f5d32e146d0Bill Wendling    SDValue LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG);
370475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
3715b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                           int VarArgsFrameIndex, int VarArgsStackOffset,
3725b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                           unsigned VarArgsNumGPR, unsigned VarArgsNumFPR,
3735b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                           const PPCSubtarget &Subtarget);
374475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG, int VarArgsFrameIndex,
3755b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                         int VarArgsStackOffset, unsigned VarArgsNumGPR,
3765b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                         unsigned VarArgsNumFPR, const PPCSubtarget &Subtarget);
377475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
3785b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                                const PPCSubtarget &Subtarget);
379475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG,
3805b3b695c2f1e11b6f5e0c89e1644211a92edab49Dale Johannesen                                      const PPCSubtarget &Subtarget);
381475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG);
3824c9369df57a52cec5e1fc735e61a979766288074Dale Johannesen    SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG, DebugLoc dl);
383475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG);
384475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG);
385475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG);
386475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG);
387475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG);
388475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG);
389475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG);
390475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG);
391475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG);
392475871a144eb604ddaf37503397ba0941442e5fbDan Gohman    SDValue LowerMUL(SDValue Op, SelectionDAG &DAG);
39398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
39498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
39565c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                            CallingConv::ID CallConv, bool isVarArg,
39698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                            const SmallVectorImpl<ISD::InputArg> &Ins,
39798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                            DebugLoc dl, SelectionDAG &DAG,
39898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                            SmallVectorImpl<SDValue> &InVals);
39965c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel    SDValue FinishCall(CallingConv::ID CallConv, DebugLoc dl, bool isTailCall,
40098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       bool isVarArg,
40198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SelectionDAG &DAG,
40298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SmallVector<std::pair<unsigned, SDValue>, 8>
40398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                         &RegsToPass,
40498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SDValue InFlag, SDValue Chain,
40598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SDValue &Callee,
40698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       int SPDiff, unsigned NumBytes,
40798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       const SmallVectorImpl<ISD::InputArg> &Ins,
40898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SmallVectorImpl<SDValue> &InVals);
40998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
41098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual SDValue
41198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerFormalArguments(SDValue Chain,
41265c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                           CallingConv::ID CallConv, bool isVarArg,
41398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                           const SmallVectorImpl<ISD::InputArg> &Ins,
41498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                           DebugLoc dl, SelectionDAG &DAG,
41598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                           SmallVectorImpl<SDValue> &InVals);
41698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
41798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual SDValue
41898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerCall(SDValue Chain, SDValue Callee,
41965c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
42098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                const SmallVectorImpl<ISD::OutputArg> &Outs,
42198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                const SmallVectorImpl<ISD::InputArg> &Ins,
42298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                DebugLoc dl, SelectionDAG &DAG,
42398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                SmallVectorImpl<SDValue> &InVals);
42498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
42598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    virtual SDValue
42698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerReturn(SDValue Chain,
42765c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                  CallingConv::ID CallConv, bool isVarArg,
42898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                  const SmallVectorImpl<ISD::OutputArg> &Outs,
42998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                  DebugLoc dl, SelectionDAG &DAG);
43098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
43198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
43298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerFormalArguments_Darwin(SDValue Chain,
43365c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                                  CallingConv::ID CallConv, bool isVarArg,
43498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                  const SmallVectorImpl<ISD::InputArg> &Ins,
43598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                  DebugLoc dl, SelectionDAG &DAG,
43698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                  SmallVectorImpl<SDValue> &InVals);
43798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
43898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerFormalArguments_SVR4(SDValue Chain,
43965c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                                CallingConv::ID CallConv, bool isVarArg,
44098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                const SmallVectorImpl<ISD::InputArg> &Ins,
44198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                DebugLoc dl, SelectionDAG &DAG,
44298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                                SmallVectorImpl<SDValue> &InVals);
44398ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman
44498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
44598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerCall_Darwin(SDValue Chain, SDValue Callee,
44665c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                       CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
44798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       const SmallVectorImpl<ISD::OutputArg> &Outs,
44898ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       const SmallVectorImpl<ISD::InputArg> &Ins,
44998ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       DebugLoc dl, SelectionDAG &DAG,
45098ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                       SmallVectorImpl<SDValue> &InVals);
45198ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman    SDValue
45298ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman      LowerCall_SVR4(SDValue Chain, SDValue Callee,
45365c3c8f323198b99b88b109654194540cf9b3fa5Sandeep Patel                     CallingConv::ID CallConv, bool isVarArg, bool isTailCall,
45498ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     const SmallVectorImpl<ISD::OutputArg> &Outs,
45598ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     const SmallVectorImpl<ISD::InputArg> &Ins,
45698ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     DebugLoc dl, SelectionDAG &DAG,
45798ca4f2a325f72374a477f9deba7d09e8999c29bDan Gohman                     SmallVectorImpl<SDValue> &InVals);
4587c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner  };
4597c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner}
4607c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner
4617c5a3d390a463fb50a6eee7ae3174817925e6d28Chris Lattner#endif   // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H
462