1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===-- ARMISelLowering.h - ARM DAG Lowering Interface ----------*- C++ -*-===//
2894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//                     The LLVM Compiler Infrastructure
4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file is distributed under the University of Illinois Open Source
6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// License. See LICENSE.TXT for details.
7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file defines the interfaces that ARM uses to lower LLVM code into a
11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// selection DAG.
12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
15894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#ifndef ARMISELLOWERING_H
16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#define ARMISELLOWERING_H
17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "ARMSubtarget.h"
19894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/Target/TargetLowering.h"
20894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/Target/TargetRegisterInfo.h"
21894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/CodeGen/FastISel.h"
22894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/CodeGen/SelectionDAG.h"
23894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/CodeGen/CallingConvLower.h"
24894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include <vector>
25894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
26894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumannamespace llvm {
27894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class ARMConstantPoolValue;
28894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  namespace ARMISD {
30894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    // ARM Specific DAG Nodes
31894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    enum NodeType {
32894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Start the numbering where the builtin ops and target ops leave off.
33894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FIRST_NUMBER = ISD::BUILTIN_OP_END,
34894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
35894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      Wrapper,      // Wrapper - A wrapper node for TargetConstantPool,
36894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                    // TargetExternalSymbol, and TargetGlobalAddress.
3719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      WrapperDYN,   // WrapperDYN - A wrapper node for TargetGlobalAddress in
3819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                    // DYN mode.
3919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      WrapperPIC,   // WrapperPIC - A wrapper node for TargetGlobalAddress in
4019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                    // PIC mode.
41894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      WrapperJT,    // WrapperJT - A wrapper node for TargetJumpTable
42894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
43894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CALL,         // Function call.
44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CALL_PRED,    // Function call that's predicable.
45894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CALL_NOLINK,  // Function call with branch not branch-and-link.
46894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      tCALL,        // Thumb function call.
47894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BRCOND,       // Conditional branch.
48894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BR_JT,        // Jumptable branch.
49894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BR2_JT,       // Jumptable branch (2 level - jumptable entry is a jump).
50894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      RET_FLAG,     // Return with a flag operand.
51894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
52894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      PIC_ADD,      // Add with a PC operand and a PIC label.
53894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
54894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CMP,          // ARM compare instructions.
55894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CMPZ,         // ARM compare that sets only Z flag.
56894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CMPFP,        // ARM VFP compare instruction, sets FPSCR.
57894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CMPFPw0,      // ARM VFP compare against zero instruction, sets FPSCR.
58894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FMSTAT,       // ARM fmstat instruction.
59894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      CMOV,         // ARM conditional move instructions.
60894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
61894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BCC_i64,
62894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
63894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      RBIT,         // ARM bitreverse instruction
64894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
65894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FTOSI,        // FP to sint within a FP register.
66894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FTOUI,        // FP to uint within a FP register.
67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      SITOF,        // sint to FP within a FP register.
68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      UITOF,        // uint to FP within a FP register.
69894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
70894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      SRL_FLAG,     // V,Flag = srl_flag X -> srl X, 1 + save carry out.
71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      SRA_FLAG,     // V,Flag = sra_flag X -> sra X, 1 + save carry out.
72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      RRX,          // V = RRX X, Flag     -> srl X, 1 + shift in carry flag.
73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
7419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ADDC,         // Add with carry
7519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ADDE,         // Add using carry
7619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      SUBC,         // Sub with carry
7719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      SUBE,         // Sub using carry
7819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
79894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VMOVRRD,      // double to two gprs.
80894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VMOVDRR,      // Two gprs to double.
81894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
8219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      EH_SJLJ_SETJMP,         // SjLj exception handling setjmp.
8319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      EH_SJLJ_LONGJMP,        // SjLj exception handling longjmp.
8419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      EH_SJLJ_DISPATCHSETUP,  // SjLj exception handling dispatch setup.
85894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
86894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      TC_RETURN,    // Tail call return pseudo.
87894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
88894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      THREAD_POINTER,
89894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
90894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      DYN_ALLOC,    // Dynamic allocation on the stack.
91894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
9219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      MEMBARRIER,   // Memory barrier (DMB)
9319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      MEMBARRIER_MCR, // Memory barrier (MCR)
9419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
9519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      PRELOAD,      // Preload
9619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
97894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCEQ,         // Vector compare equal.
9819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VCEQZ,        // Vector compare equal to zero.
99894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCGE,         // Vector compare greater than or equal.
10019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VCGEZ,        // Vector compare greater than or equal to zero.
10119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VCLEZ,        // Vector compare less than or equal to zero.
102894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCGEU,        // Vector compare unsigned greater than or equal.
103894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCGT,         // Vector compare greater than.
10419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VCGTZ,        // Vector compare greater than zero.
10519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VCLTZ,        // Vector compare less than zero.
106894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VCGTU,        // Vector compare unsigned greater than.
107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VTST,         // Vector test bits.
108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector shift by immediate:
110894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHL,         // ...left
111894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHRs,        // ...right (signed)
112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHRu,        // ...right (unsigned)
113894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHLLs,       // ...left long (signed)
114894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHLLu,       // ...left long (unsigned)
115894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHLLi,       // ...left long (with maximum shift count)
116894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSHRN,        // ...right narrow
117894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
118894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector rounding shift by immediate:
119894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VRSHRs,       // ...right (signed)
120894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VRSHRu,       // ...right (unsigned)
121894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VRSHRN,       // ...right narrow
122894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
123894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector saturating shift by immediate:
124894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQSHLs,       // ...left (signed)
125894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQSHLu,       // ...left (unsigned)
126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQSHLsu,      // ...left (signed to unsigned)
127894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQSHRNs,      // ...right narrow (signed)
128894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQSHRNu,      // ...right narrow (unsigned)
129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQSHRNsu,     // ...right narrow (signed to unsigned)
130894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
131894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector saturating rounding shift by immediate:
132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQRSHRNs,     // ...right narrow (signed)
133894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQRSHRNu,     // ...right narrow (unsigned)
134894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VQRSHRNsu,    // ...right narrow (signed to unsigned)
135894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
136894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector shift and insert:
137894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSLI,         // ...left
138894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VSRI,         // ...right
139894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
140894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector get lane (VMOV scalar to ARM core register)
141894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // (These are used for 8- and 16-bit element types only.)
142894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VGETLANEu,    // zero-extend vector extract element
143894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VGETLANEs,    // sign-extend vector extract element
144894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
145894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector move immediate and move negated immediate:
146894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VMOVIMM,
147894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VMVNIMM,
148894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
149894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector duplicate:
150894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VDUP,
151894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VDUPLANE,
152894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
153894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Vector shuffles:
154894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VEXT,         // extract
155894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VREV64,       // reverse elements within 64-bit doublewords
156894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VREV32,       // reverse elements within 32-bit words
157894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VREV16,       // reverse elements within 16-bit halfwords
158894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VZIP,         // zip (interleave)
159894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VUZP,         // unzip (deinterleave)
160894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      VTRN,         // transpose
16119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VTBL1,        // 1-register shuffle with mask
16219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VTBL2,        // 2-register shuffle with mask
16319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
16419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // Vector multiply long:
16519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VMULLs,       // ...signed
16619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VMULLu,       // ...unsigned
167894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
168894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Operands of the standard BUILD_VECTOR node are not legalized, which
169894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // is fine if BUILD_VECTORs are always lowered to shuffles or other
170894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // operations, but for ARM some BUILD_VECTORs are legal as-is and their
171894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // operands need to be legalized.  Define an ARM-specific version of
172894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // BUILD_VECTOR for this purpose.
173894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BUILD_VECTOR,
174894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
175894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Floating-point max and min:
176894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FMAX,
177894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FMIN,
178894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
179894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      // Bit-field insert
18019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      BFI,
18119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
18219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // Vector OR with immediate
18319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VORRIMM,
18419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // Vector AND with NOT of immediate
18519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VBICIMM,
18619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
18719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // Vector bitwise select
18819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VBSL,
18919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
19019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // Vector load N-element structure to all lanes:
19119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD2DUP = ISD::FIRST_TARGET_MEMORY_OPCODE,
19219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD3DUP,
19319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD4DUP,
19419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
19519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // NEON loads with post-increment base updates:
19619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD1_UPD,
19719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD2_UPD,
19819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD3_UPD,
19919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD4_UPD,
20019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD2LN_UPD,
20119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD3LN_UPD,
20219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD4LN_UPD,
20319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD2DUP_UPD,
20419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD3DUP_UPD,
20519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VLD4DUP_UPD,
20619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
20719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // NEON stores with post-increment base updates:
20819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST1_UPD,
20919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST2_UPD,
21019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST3_UPD,
21119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST4_UPD,
21219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST2LN_UPD,
21319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST3LN_UPD,
21419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      VST4LN_UPD,
21519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
21619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      // 64-bit atomic ops (value split into two registers)
21719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMADD64_DAG,
21819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMSUB64_DAG,
21919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMOR64_DAG,
22019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMXOR64_DAG,
22119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMAND64_DAG,
22219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMNAND64_DAG,
22319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMSWAP64_DAG,
22419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      ATOMCMPXCHG64_DAG
225894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    };
226894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
227894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
228894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  /// Define some predicates that are used for node matching.
229894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  namespace ARM {
230894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isBitFieldInvertedMask(unsigned v);
231894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
232894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
233894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  //===--------------------------------------------------------------------===//
234894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  //  ARMTargetLowering - ARM Implementation of the TargetLowering interface
235894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
236894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  class ARMTargetLowering : public TargetLowering {
237894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  public:
238894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    explicit ARMTargetLowering(TargetMachine &TM);
239894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
240894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual unsigned getJumpTableEncoding(void) const;
241894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
242894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
243894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
244894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ReplaceNodeResults - Replace the results of node with an illegal result
245894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// type with new values built out of custom code.
246894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
247894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
248894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    SelectionDAG &DAG) const;
249894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
250894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual const char *getTargetNodeName(unsigned Opcode) const;
251894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
25219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// getSetCCResultType - Return the value type to use for ISD::SETCC.
25319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual EVT getSetCCResultType(EVT VT) const;
25419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
255894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual MachineBasicBlock *
256894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      EmitInstrWithCustomInserter(MachineInstr *MI,
257894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  MachineBasicBlock *MBB) const;
258894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
25919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual void
26019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    AdjustInstrPostInstrSelection(MachineInstr *MI, SDNode *Node) const;
26119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
26219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const;
26319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
26419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
26519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const;
26619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
267894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// allowsUnalignedMemoryAccesses - Returns true if the target allows
268894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// unaligned memory accesses. of the specified type.
269894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// FIXME: Add getOptimalMemOpType to implement memcpy with NEON?
270894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool allowsUnalignedMemoryAccesses(EVT VT) const;
271894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
272894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalAddressingMode - Return true if the addressing mode represented
273894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// by AM is legal for this target, for a load/store of the specified type.
27419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty)const;
275894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const;
276894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
277894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isLegalICmpImmediate - Return true if the specified immediate is legal
278894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// icmp immediate, that is the target has icmp instructions which can
279894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// compare a register against the immediate without having to materialize
280894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// the immediate into a register.
281894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isLegalICmpImmediate(int64_t Imm) const;
282894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
28319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// isLegalAddImmediate - Return true if the specified immediate is legal
28419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// add immediate, that is the target has add instructions which can
28519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// add a register and the immediate without having to materialize
28619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// the immediate into a register.
28719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool isLegalAddImmediate(int64_t Imm) const;
28819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
289894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getPreIndexedAddressParts - returns true by value, base pointer and
290894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// offset pointer and addressing mode by reference if the node's address
291894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// can be legally represented as pre-indexed load / store address.
292894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
293894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SDValue &Offset,
294894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           ISD::MemIndexedMode &AM,
295894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SelectionDAG &DAG) const;
296894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
297894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getPostIndexedAddressParts - returns true by value, base pointer and
298894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// offset pointer and addressing mode by reference if this node can be
299894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// combined with a load / store to form a post-indexed load / store.
300894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op,
301894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                            SDValue &Base, SDValue &Offset,
302894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                            ISD::MemIndexedMode &AM,
303894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                            SelectionDAG &DAG) const;
304894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
305894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void computeMaskedBitsForTargetNode(const SDValue Op,
306894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                const APInt &Mask,
307894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                APInt &KnownZero,
308894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                APInt &KnownOne,
309894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                const SelectionDAG &DAG,
310894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                unsigned Depth) const;
311894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
312894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
31319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool ExpandInlineAsm(CallInst *CI) const;
31419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
315894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ConstraintType getConstraintType(const std::string &Constraint) const;
31619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
31719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// Examine constraint string and operand type and determine a weight value.
31819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// The operand object must already have been set up with the operand type.
31919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    ConstraintWeight getSingleConstraintMatchWeight(
32019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      AsmOperandInfo &info, const char *constraint) const;
32119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
322894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    std::pair<unsigned, const TargetRegisterClass*>
323894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      getRegForInlineAsmConstraint(const std::string &Constraint,
324894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                   EVT VT) const;
325894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
326894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
327894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// vector.  If it is invalid, don't add anything to Ops. If hasMemory is
328894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// true it means one of the asm constraint of the inline asm instruction
329894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// being processed is 'm'.
330894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual void LowerAsmOperandForConstraint(SDValue Op,
33119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                              std::string &Constraint,
332894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              std::vector<SDValue> &Ops,
333894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                              SelectionDAG &DAG) const;
334894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
335894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const ARMSubtarget* getSubtarget() const {
336894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return Subtarget;
337894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
338894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
339894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getRegClassFor - Return the register class that should be used for the
340894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// specified value type.
341894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual TargetRegisterClass *getRegClassFor(EVT VT) const;
342894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
343894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// getMaximalGlobalOffset - Returns the maximal possible offset which can
344894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// be used for loads / stores from the global.
345894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual unsigned getMaximalGlobalOffset() const;
346894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
347894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// createFastISel - This method returns a target specific FastISel object,
348894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// or null if the target does not support "fast" ISel.
349894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual FastISel *createFastISel(FunctionLoweringInfo &funcInfo) const;
350894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
351894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    Sched::Preference getSchedulingPreference(SDNode *N) const;
352894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
353894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isShuffleMaskLegal(const SmallVectorImpl<int> &M, EVT VT) const;
354894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
355894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
356894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// isFPImmLegal - Returns true if the target can instruction select the
357894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// specified FP immediate natively. If false, the legalizer will
358894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// materialize the FP immediate as a load from a constant pool.
359894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
360894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
36119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool getTgtMemIntrinsic(IntrinsicInfo &Info,
36219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                    const CallInst &I,
36319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                    unsigned Intrinsic) const;
364894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  protected:
365894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    std::pair<const TargetRegisterClass*, uint8_t>
366894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    findRepresentativeClass(EVT VT) const;
367894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
368894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  private:
369894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
370894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// make the right decision when generating code for different targets.
371894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const ARMSubtarget *Subtarget;
372894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
373894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    const TargetRegisterInfo *RegInfo;
374894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
37519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    const InstrItineraryData *Itins;
37619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
377894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// ARMPCLabelIndex - Keep track of the number of ARM PC labels created.
378894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    ///
379894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    unsigned ARMPCLabelIndex;
380894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
381894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    void addTypeForNEON(EVT VT, EVT PromotedLdStVT, EVT PromotedBitwiseVT);
382894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    void addDRTypeForNEON(EVT VT);
383894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    void addQRTypeForNEON(EVT VT);
384894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
385894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    typedef SmallVector<std::pair<unsigned, SDValue>, 8> RegsToPassVector;
386894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    void PassF64ArgInRegs(DebugLoc dl, SelectionDAG &DAG,
387894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                          SDValue Chain, SDValue &Arg,
388894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                          RegsToPassVector &RegsToPass,
389894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                          CCValAssign &VA, CCValAssign &NextVA,
390894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                          SDValue &StackPtr,
391894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                          SmallVector<SDValue, 8> &MemOpChains,
392894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                          ISD::ArgFlagsTy Flags) const;
393894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA,
394894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 SDValue &Root, SelectionDAG &DAG,
395894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                 DebugLoc dl) const;
396894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
397894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    CCAssignFn *CCAssignFnForNode(CallingConv::ID CC, bool Return,
398894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                  bool isVarArg) const;
399894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg,
400894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             DebugLoc dl, SelectionDAG &DAG,
401894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             const CCValAssign &VA,
402894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                             ISD::ArgFlagsTy Flags) const;
403894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const;
404894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const;
40519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue LowerEH_SJLJ_DISPATCHSETUP(SDValue Op, SelectionDAG &DAG) const;
406894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG,
407894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    const ARMSubtarget *Subtarget) const;
408894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
409894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG) const;
410894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG) const;
411894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
412894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
413894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                            SelectionDAG &DAG) const;
414894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerToTLSExecModels(GlobalAddressSDNode *GA,
415894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                   SelectionDAG &DAG) const;
416894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG) const;
417894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
41819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
419894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
420894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
421894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
422894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
423894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
424894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG) const;
425894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const;
426894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
42719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
42819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                              const ARMSubtarget *ST) const;
42919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
43019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const;
431894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
432894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
433894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            CallingConv::ID CallConv, bool isVarArg,
434894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            const SmallVectorImpl<ISD::InputArg> &Ins,
435894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            DebugLoc dl, SelectionDAG &DAG,
436894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                            SmallVectorImpl<SDValue> &InVals) const;
437894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
438894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
439894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerFormalArguments(SDValue Chain,
440894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           CallingConv::ID CallConv, bool isVarArg,
441894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           const SmallVectorImpl<ISD::InputArg> &Ins,
442894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           DebugLoc dl, SelectionDAG &DAG,
443894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                           SmallVectorImpl<SDValue> &InVals) const;
444894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
44519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    void VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG,
44619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                              DebugLoc dl, SDValue &Chain, unsigned ArgOffset)
44719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman      const;
44819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
44919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    void computeRegArea(CCState &CCInfo, MachineFunction &MF,
45019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                        unsigned &VARegSize, unsigned &VARegSaveSize) const;
45119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
452894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
453894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerCall(SDValue Chain, SDValue Callee,
454894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                CallingConv::ID CallConv, bool isVarArg,
455894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                bool &isTailCall,
456894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<ISD::OutputArg> &Outs,
457894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<SDValue> &OutVals,
458894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const SmallVectorImpl<ISD::InputArg> &Ins,
459894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                DebugLoc dl, SelectionDAG &DAG,
460894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                SmallVectorImpl<SDValue> &InVals) const;
461894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
46219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    /// HandleByVal - Target-specific cleanup for ByVal support.
46319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual void HandleByVal(CCState *, unsigned &) const;
46419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
465894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// IsEligibleForTailCallOptimization - Check whether the call is eligible
466894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// for tail call optimization. Targets which want to do tail call
467894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    /// optimization should implement this function.
468894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    bool IsEligibleForTailCallOptimization(SDValue Callee,
469894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           CallingConv::ID CalleeCC,
470894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           bool isVarArg,
471894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           bool isCalleeStructRet,
472894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           bool isCallerStructRet,
473894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    const SmallVectorImpl<ISD::OutputArg> &Outs,
474894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    const SmallVectorImpl<SDValue> &OutVals,
475894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    const SmallVectorImpl<ISD::InputArg> &Ins,
476894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                           SelectionDAG& DAG) const;
477894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    virtual SDValue
478894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      LowerReturn(SDValue Chain,
479894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  CallingConv::ID CallConv, bool isVarArg,
480894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  const SmallVectorImpl<ISD::OutputArg> &Outs,
481894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  const SmallVectorImpl<SDValue> &OutVals,
482894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                  DebugLoc dl, SelectionDAG &DAG) const;
483894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
48419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool isUsedByReturnOnly(SDNode *N) const;
48519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
48619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    virtual bool mayBeEmittedAsTailCall(CallInst *CI) const;
48719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
488894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
489894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                      SDValue &ARMcc, SelectionDAG &DAG, DebugLoc dl) const;
490894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue getVFPCmp(SDValue LHS, SDValue RHS,
491894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                      SelectionDAG &DAG, DebugLoc dl) const;
49219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    SDValue duplicateCmp(SDValue Cmp, SelectionDAG &DAG) const;
493894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
494894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    SDValue OptimizeVFPBrcond(SDValue Op, SelectionDAG &DAG) const;
495894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
496894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MachineBasicBlock *EmitAtomicCmpSwap(MachineInstr *MI,
497894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         MachineBasicBlock *BB,
498894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                         unsigned Size) const;
499894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
500894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        MachineBasicBlock *BB,
501894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        unsigned Size,
502894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        unsigned BinOpcode) const;
50319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MachineBasicBlock *EmitAtomicBinary64(MachineInstr *MI,
50419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                          MachineBasicBlock *BB,
50519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                          unsigned Op1,
50619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                          unsigned Op2,
50719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                          bool NeedsCarry = false,
50819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                          bool IsCmpxchg = false) const;
50919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MachineBasicBlock * EmitAtomicBinaryMinMax(MachineInstr *MI,
51019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                               MachineBasicBlock *BB,
51119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                               unsigned Size,
51219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                               bool signExtend,
51319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                               ARMCC::CondCodes Cond) const;
51419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
51519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    void EmitBasePointerRecalculation(MachineInstr *MI, MachineBasicBlock *MBB,
51619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                      MachineBasicBlock *DispatchBB) const;
51719bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
51819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    void SetupEntryBlockForSjLj(MachineInstr *MI,
51919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                MachineBasicBlock *MBB,
52019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                MachineBasicBlock *DispatchBB, int FI) const;
52119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
52219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    MachineBasicBlock *EmitSjLjDispatchBlock(MachineInstr *MI,
52319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman                                             MachineBasicBlock *MBB) const;
52419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
52519bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    bool RemapAddSubWithFlags(MachineInstr *MI, MachineBasicBlock *BB) const;
52619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  };
527894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
52819bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  enum NEONModImmType {
52919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    VMOVModImm,
53019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    VMVNModImm,
53119bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    OtherModImm
532894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  };
53319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
53419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
535894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  namespace ARM {
536894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    FastISel *createFastISel(FunctionLoweringInfo &funcInfo);
537894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
538894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
539894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
540894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#endif  // ARMISELLOWERING_H
541