Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 1 | //===- ARMISelLowering.h - ARM DAG Lowering Interface -----------*- C++ -*-===// |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the interfaces that ARM uses to lower LLVM code into a |
| 11 | // selection DAG. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_ARM_ARMISELLOWERING_H |
| 16 | #define LLVM_LIB_TARGET_ARM_ARMISELLOWERING_H |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 17 | |
Craig Topper | a925326 | 2014-03-22 23:51:00 +0000 | [diff] [blame] | 18 | #include "MCTargetDesc/ARMBaseInfo.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/SmallVector.h" |
| 20 | #include "llvm/ADT/StringRef.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/CallingConvLower.h" |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/ISDOpcodes.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 23 | #include "llvm/CodeGen/MachineFunction.h" |
| 24 | #include "llvm/CodeGen/MachineValueType.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 25 | #include "llvm/CodeGen/SelectionDAGNodes.h" |
David Blaikie | b3bde2e | 2017-11-17 01:07:10 +0000 | [diff] [blame] | 26 | #include "llvm/CodeGen/TargetLowering.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 27 | #include "llvm/CodeGen/ValueTypes.h" |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 28 | #include "llvm/IR/Attributes.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 29 | #include "llvm/IR/CallingConv.h" |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 30 | #include "llvm/IR/Function.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 31 | #include "llvm/IR/IRBuilder.h" |
| 32 | #include "llvm/IR/InlineAsm.h" |
| 33 | #include "llvm/Support/CodeGen.h" |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 34 | #include <utility> |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 35 | |
| 36 | namespace llvm { |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 37 | |
| 38 | class ARMSubtarget; |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 39 | class DataLayout; |
| 40 | class FastISel; |
| 41 | class FunctionLoweringInfo; |
| 42 | class GlobalValue; |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 43 | class InstrItineraryData; |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 44 | class Instruction; |
| 45 | class MachineBasicBlock; |
| 46 | class MachineInstr; |
| 47 | class SelectionDAG; |
| 48 | class TargetLibraryInfo; |
| 49 | class TargetMachine; |
| 50 | class TargetRegisterInfo; |
| 51 | class VectorType; |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 52 | |
| 53 | namespace ARMISD { |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 54 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 55 | // ARM Specific DAG Nodes |
Matthias Braun | d04893f | 2015-05-07 21:33:59 +0000 | [diff] [blame] | 56 | enum NodeType : unsigned { |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 57 | // Start the numbering where the builtin ops and target ops leave off. |
Dan Gohman | ed1cf1a | 2008-09-23 18:42:32 +0000 | [diff] [blame] | 58 | FIRST_NUMBER = ISD::BUILTIN_OP_END, |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 59 | |
| 60 | Wrapper, // Wrapper - A wrapper node for TargetConstantPool, |
| 61 | // TargetExternalSymbol, and TargetGlobalAddress. |
Evan Cheng | dfce83c | 2011-01-17 08:03:18 +0000 | [diff] [blame] | 62 | WrapperPIC, // WrapperPIC - A wrapper node for TargetGlobalAddress in |
| 63 | // PIC mode. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 64 | WrapperJT, // WrapperJT - A wrapper node for TargetJumpTable |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 65 | |
Manman Ren | 9f91116 | 2012-06-01 02:44:42 +0000 | [diff] [blame] | 66 | // Add pseudo op to model memcpy for struct byval. |
| 67 | COPY_STRUCT_BYVAL, |
| 68 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 69 | CALL, // Function call. |
Evan Cheng | c3c949b4 | 2007-06-19 21:05:09 +0000 | [diff] [blame] | 70 | CALL_PRED, // Function call that's predicable. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 71 | CALL_NOLINK, // Function call with branch not branch-and-link. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 72 | BRCOND, // Conditional branch. |
| 73 | BR_JT, // Jumptable branch. |
Evan Cheng | c6d70ae | 2009-07-29 02:18:14 +0000 | [diff] [blame] | 74 | BR2_JT, // Jumptable branch (2 level - jumptable entry is a jump). |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 75 | RET_FLAG, // Return with a flag operand. |
Tim Northover | d840745 | 2013-10-01 14:33:28 +0000 | [diff] [blame] | 76 | INTRET_FLAG, // Interrupt return with an LR-offset and a flag operand. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 77 | |
| 78 | PIC_ADD, // Add with a PC operand and a PIC label. |
| 79 | |
| 80 | CMP, // ARM compare instructions. |
Bill Wendling | 4b79647 | 2012-06-11 08:07:26 +0000 | [diff] [blame] | 81 | CMN, // ARM CMN instructions. |
David Goodwin | dbf11ba | 2009-06-29 15:33:01 +0000 | [diff] [blame] | 82 | CMPZ, // ARM compare that sets only Z flag. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 83 | CMPFP, // ARM VFP compare instruction, sets FPSCR. |
| 84 | CMPFPw0, // ARM VFP compare against zero instruction, sets FPSCR. |
| 85 | FMSTAT, // ARM fmstat instruction. |
Evan Cheng | e87681c | 2012-02-23 01:19:06 +0000 | [diff] [blame] | 86 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 87 | CMOV, // ARM conditional move instructions. |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 88 | |
Pablo Barrio | 7a64346 | 2016-06-23 16:53:49 +0000 | [diff] [blame] | 89 | SSAT, // Signed saturation |
Florian Hahn | c3aa6d8 | 2017-12-20 11:13:57 +0000 | [diff] [blame] | 90 | USAT, // Unsigned saturation |
Pablo Barrio | 7a64346 | 2016-06-23 16:53:49 +0000 | [diff] [blame] | 91 | |
Evan Cheng | 0cc4ad9 | 2010-07-13 19:27:42 +0000 | [diff] [blame] | 92 | BCC_i64, |
| 93 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 94 | SRL_FLAG, // V,Flag = srl_flag X -> srl X, 1 + save carry out. |
| 95 | SRA_FLAG, // V,Flag = sra_flag X -> sra X, 1 + save carry out. |
| 96 | RRX, // V = RRX X, Flag -> srl X, 1 + shift in carry flag. |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 97 | |
Evan Cheng | e891654 | 2011-08-30 01:34:54 +0000 | [diff] [blame] | 98 | ADDC, // Add with carry |
| 99 | ADDE, // Add using carry |
| 100 | SUBC, // Sub with carry |
| 101 | SUBE, // Sub using carry |
| 102 | |
Jim Grosbach | d7cf55c | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 103 | VMOVRRD, // double to two gprs. |
| 104 | VMOVDRR, // Two gprs to double. |
Lauro Ramos Venancio | c39c12a | 2007-04-27 13:54:47 +0000 | [diff] [blame] | 105 | |
Jim Grosbach | bbdc5d2 | 2010-10-19 23:27:08 +0000 | [diff] [blame] | 106 | EH_SJLJ_SETJMP, // SjLj exception handling setjmp. |
| 107 | EH_SJLJ_LONGJMP, // SjLj exception handling longjmp. |
Matthias Braun | 3cd00c1 | 2015-07-16 22:34:16 +0000 | [diff] [blame] | 108 | EH_SJLJ_SETUP_DISPATCH, // SjLj exception handling setup_dispatch. |
Jim Grosbach | aeca45d | 2009-05-12 23:59:14 +0000 | [diff] [blame] | 109 | |
Dale Johannesen | d679ff7 | 2010-06-03 21:09:53 +0000 | [diff] [blame] | 110 | TC_RETURN, // Tail call return pseudo. |
| 111 | |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 112 | THREAD_POINTER, |
| 113 | |
Evan Cheng | b972e56 | 2009-08-07 00:34:42 +0000 | [diff] [blame] | 114 | DYN_ALLOC, // Dynamic allocation on the stack. |
| 115 | |
Bob Wilson | 7ed5971 | 2010-10-30 00:54:37 +0000 | [diff] [blame] | 116 | MEMBARRIER_MCR, // Memory barrier (MCR) |
Evan Cheng | 8740ee3 | 2010-11-03 06:34:55 +0000 | [diff] [blame] | 117 | |
| 118 | PRELOAD, // Preload |
Andrew Trick | 1a1f8d4 | 2011-04-23 03:24:11 +0000 | [diff] [blame] | 119 | |
Saleem Abdulrasool | abac6e9 | 2014-06-09 20:18:42 +0000 | [diff] [blame] | 120 | WIN__CHKSTK, // Windows' __chkstk call to do stack probing. |
Saleem Abdulrasool | fe83b50 | 2015-09-25 05:15:46 +0000 | [diff] [blame] | 121 | WIN__DBZCHK, // Windows' divide by zero check |
Saleem Abdulrasool | abac6e9 | 2014-06-09 20:18:42 +0000 | [diff] [blame] | 122 | |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 123 | VCEQ, // Vector compare equal. |
Owen Anderson | c7baee3 | 2010-11-08 23:21:22 +0000 | [diff] [blame] | 124 | VCEQZ, // Vector compare equal to zero. |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 125 | VCGE, // Vector compare greater than or equal. |
Owen Anderson | c7baee3 | 2010-11-08 23:21:22 +0000 | [diff] [blame] | 126 | VCGEZ, // Vector compare greater than or equal to zero. |
| 127 | VCLEZ, // Vector compare less than or equal to zero. |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 128 | VCGEU, // Vector compare unsigned greater than or equal. |
| 129 | VCGT, // Vector compare greater than. |
Owen Anderson | c7baee3 | 2010-11-08 23:21:22 +0000 | [diff] [blame] | 130 | VCGTZ, // Vector compare greater than zero. |
| 131 | VCLTZ, // Vector compare less than zero. |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 132 | VCGTU, // Vector compare unsigned greater than. |
| 133 | VTST, // Vector test bits. |
| 134 | |
| 135 | // Vector shift by immediate: |
| 136 | VSHL, // ...left |
| 137 | VSHRs, // ...right (signed) |
| 138 | VSHRu, // ...right (unsigned) |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 139 | |
| 140 | // Vector rounding shift by immediate: |
| 141 | VRSHRs, // ...right (signed) |
| 142 | VRSHRu, // ...right (unsigned) |
| 143 | VRSHRN, // ...right narrow |
| 144 | |
| 145 | // Vector saturating shift by immediate: |
| 146 | VQSHLs, // ...left (signed) |
| 147 | VQSHLu, // ...left (unsigned) |
| 148 | VQSHLsu, // ...left (signed to unsigned) |
| 149 | VQSHRNs, // ...right narrow (signed) |
| 150 | VQSHRNu, // ...right narrow (unsigned) |
| 151 | VQSHRNsu, // ...right narrow (signed to unsigned) |
| 152 | |
| 153 | // Vector saturating rounding shift by immediate: |
| 154 | VQRSHRNs, // ...right narrow (signed) |
| 155 | VQRSHRNu, // ...right narrow (unsigned) |
| 156 | VQRSHRNsu, // ...right narrow (signed to unsigned) |
| 157 | |
| 158 | // Vector shift and insert: |
| 159 | VSLI, // ...left |
| 160 | VSRI, // ...right |
| 161 | |
| 162 | // Vector get lane (VMOV scalar to ARM core register) |
| 163 | // (These are used for 8- and 16-bit element types only.) |
| 164 | VGETLANEu, // zero-extend vector extract element |
| 165 | VGETLANEs, // sign-extend vector extract element |
| 166 | |
Bob Wilson | bad47f6 | 2010-07-14 06:31:50 +0000 | [diff] [blame] | 167 | // Vector move immediate and move negated immediate: |
Bob Wilson | a3f1901 | 2010-07-13 21:16:48 +0000 | [diff] [blame] | 168 | VMOVIMM, |
Bob Wilson | bad47f6 | 2010-07-14 06:31:50 +0000 | [diff] [blame] | 169 | VMVNIMM, |
| 170 | |
Evan Cheng | 7ca4b6e | 2011-11-15 02:12:34 +0000 | [diff] [blame] | 171 | // Vector move f32 immediate: |
| 172 | VMOVFPIMM, |
| 173 | |
Bob Wilson | bad47f6 | 2010-07-14 06:31:50 +0000 | [diff] [blame] | 174 | // Vector duplicate: |
Bob Wilson | eb54d51 | 2009-08-14 05:13:08 +0000 | [diff] [blame] | 175 | VDUP, |
Bob Wilson | cce31f6 | 2009-08-14 05:08:32 +0000 | [diff] [blame] | 176 | VDUPLANE, |
Bob Wilson | f45dee3 | 2009-08-04 00:36:16 +0000 | [diff] [blame] | 177 | |
Bob Wilson | ea3a402 | 2009-08-12 22:31:50 +0000 | [diff] [blame] | 178 | // Vector shuffles: |
Bob Wilson | 32cd855 | 2009-08-19 17:03:43 +0000 | [diff] [blame] | 179 | VEXT, // extract |
Bob Wilson | ea3a402 | 2009-08-12 22:31:50 +0000 | [diff] [blame] | 180 | VREV64, // reverse elements within 64-bit doublewords |
| 181 | VREV32, // reverse elements within 32-bit words |
Anton Korobeynikov | 9a232f4 | 2009-08-21 12:41:24 +0000 | [diff] [blame] | 182 | VREV16, // reverse elements within 16-bit halfwords |
Bob Wilson | a706231 | 2009-08-21 20:54:19 +0000 | [diff] [blame] | 183 | VZIP, // zip (interleave) |
| 184 | VUZP, // unzip (deinterleave) |
Bob Wilson | c6c13a3 | 2010-02-18 06:05:53 +0000 | [diff] [blame] | 185 | VTRN, // transpose |
Bill Wendling | e1fd78f | 2011-03-14 23:02:38 +0000 | [diff] [blame] | 186 | VTBL1, // 1-register shuffle with mask |
| 187 | VTBL2, // 2-register shuffle with mask |
Bob Wilson | c6c13a3 | 2010-02-18 06:05:53 +0000 | [diff] [blame] | 188 | |
Bob Wilson | 38ab35a | 2010-09-01 23:50:19 +0000 | [diff] [blame] | 189 | // Vector multiply long: |
| 190 | VMULLs, // ...signed |
| 191 | VMULLu, // ...unsigned |
| 192 | |
Sam Parker | 916b1ba | 2017-03-14 09:13:22 +0000 | [diff] [blame] | 193 | SMULWB, // Signed multiply word by half word, bottom |
| 194 | SMULWT, // Signed multiply word by half word, top |
Arnold Schwaighofer | f00fb1c | 2012-09-04 14:37:49 +0000 | [diff] [blame] | 195 | UMLAL, // 64bit Unsigned Accumulate Multiply |
| 196 | SMLAL, // 64bit Signed Accumulate Multiply |
Sam Parker | d616cf0 | 2016-06-20 16:47:09 +0000 | [diff] [blame] | 197 | UMAAL, // 64-bit Unsigned Accumulate Accumulate Multiply |
Sam Parker | 654cb82 | 2017-03-15 08:27:11 +0000 | [diff] [blame] | 198 | SMLALBB, // 64-bit signed accumulate multiply bottom, bottom 16 |
| 199 | SMLALBT, // 64-bit signed accumulate multiply bottom, top 16 |
| 200 | SMLALTB, // 64-bit signed accumulate multiply top, bottom 16 |
| 201 | SMLALTT, // 64-bit signed accumulate multiply top, top 16 |
Sam Parker | df33770 | 2017-05-04 07:31:28 +0000 | [diff] [blame] | 202 | SMLALD, // Signed multiply accumulate long dual |
| 203 | SMLALDX, // Signed multiply accumulate long dual exchange |
| 204 | SMLSLD, // Signed multiply subtract long dual |
| 205 | SMLSLDX, // Signed multiply subtract long dual exchange |
Arnold Schwaighofer | f00fb1c | 2012-09-04 14:37:49 +0000 | [diff] [blame] | 206 | |
Bob Wilson | d8a9a04 | 2010-06-04 00:04:02 +0000 | [diff] [blame] | 207 | // Operands of the standard BUILD_VECTOR node are not legalized, which |
| 208 | // is fine if BUILD_VECTORs are always lowered to shuffles or other |
| 209 | // operations, but for ARM some BUILD_VECTORs are legal as-is and their |
| 210 | // operands need to be legalized. Define an ARM-specific version of |
| 211 | // BUILD_VECTOR for this purpose. |
| 212 | BUILD_VECTOR, |
| 213 | |
Jim Grosbach | 11013ed | 2010-07-16 23:05:05 +0000 | [diff] [blame] | 214 | // Bit-field insert |
Owen Anderson | 0747307 | 2010-11-03 22:44:51 +0000 | [diff] [blame] | 215 | BFI, |
Andrew Trick | 1a1f8d4 | 2011-04-23 03:24:11 +0000 | [diff] [blame] | 216 | |
Owen Anderson | 0747307 | 2010-11-03 22:44:51 +0000 | [diff] [blame] | 217 | // Vector OR with immediate |
Owen Anderson | 30c4892 | 2010-11-05 19:27:46 +0000 | [diff] [blame] | 218 | VORRIMM, |
| 219 | // Vector AND with NOT of immediate |
Bob Wilson | 2d790df | 2010-11-28 06:51:26 +0000 | [diff] [blame] | 220 | VBICIMM, |
| 221 | |
Cameron Zwarich | 53dd03d | 2011-03-30 23:01:21 +0000 | [diff] [blame] | 222 | // Vector bitwise select |
| 223 | VBSL, |
| 224 | |
Scott Douglass | 953f908 | 2015-10-05 14:49:54 +0000 | [diff] [blame] | 225 | // Pseudo-instruction representing a memory copy using ldm/stm |
| 226 | // instructions. |
| 227 | MEMCPY, |
| 228 | |
Bob Wilson | 2d790df | 2010-11-28 06:51:26 +0000 | [diff] [blame] | 229 | // Vector load N-element structure to all lanes: |
Eli Friedman | f624ec2 | 2016-12-16 18:44:08 +0000 | [diff] [blame] | 230 | VLD1DUP = ISD::FIRST_TARGET_MEMORY_OPCODE, |
| 231 | VLD2DUP, |
Bob Wilson | 2d790df | 2010-11-28 06:51:26 +0000 | [diff] [blame] | 232 | VLD3DUP, |
Bob Wilson | 06fce87 | 2011-02-07 17:43:21 +0000 | [diff] [blame] | 233 | VLD4DUP, |
| 234 | |
| 235 | // NEON loads with post-increment base updates: |
| 236 | VLD1_UPD, |
| 237 | VLD2_UPD, |
| 238 | VLD3_UPD, |
| 239 | VLD4_UPD, |
| 240 | VLD2LN_UPD, |
| 241 | VLD3LN_UPD, |
| 242 | VLD4LN_UPD, |
Eli Friedman | f624ec2 | 2016-12-16 18:44:08 +0000 | [diff] [blame] | 243 | VLD1DUP_UPD, |
Bob Wilson | 06fce87 | 2011-02-07 17:43:21 +0000 | [diff] [blame] | 244 | VLD2DUP_UPD, |
| 245 | VLD3DUP_UPD, |
| 246 | VLD4DUP_UPD, |
| 247 | |
| 248 | // NEON stores with post-increment base updates: |
| 249 | VST1_UPD, |
| 250 | VST2_UPD, |
| 251 | VST3_UPD, |
| 252 | VST4_UPD, |
| 253 | VST2LN_UPD, |
| 254 | VST3LN_UPD, |
Amara Emerson | b4ad2f3 | 2013-09-26 12:22:36 +0000 | [diff] [blame] | 255 | VST4LN_UPD |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 256 | }; |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 257 | |
| 258 | } // end namespace ARMISD |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 259 | |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 260 | /// Define some predicates that are used for node matching. |
| 261 | namespace ARM { |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 262 | |
Jim Grosbach | 11013ed | 2010-07-16 23:05:05 +0000 | [diff] [blame] | 263 | bool isBitFieldInvertedMask(unsigned v); |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 264 | |
| 265 | } // end namespace ARM |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 266 | |
Bob Wilson | dd0e236 | 2009-05-20 16:30:25 +0000 | [diff] [blame] | 267 | //===--------------------------------------------------------------------===// |
Dale Johannesen | 8447d34 | 2007-03-20 00:30:56 +0000 | [diff] [blame] | 268 | // ARMTargetLowering - ARM Implementation of the TargetLowering interface |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 269 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 270 | class ARMTargetLowering : public TargetLowering { |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 271 | public: |
Eric Christopher | 1889fdc | 2015-01-29 00:19:39 +0000 | [diff] [blame] | 272 | explicit ARMTargetLowering(const TargetMachine &TM, |
| 273 | const ARMSubtarget &STI); |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 274 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 275 | unsigned getJumpTableEncoding() const override; |
Eric Christopher | 824f42f | 2015-05-12 01:26:05 +0000 | [diff] [blame] | 276 | bool useSoftFloat() const override; |
Jim Grosbach | 8d3ba73 | 2010-07-19 17:20:38 +0000 | [diff] [blame] | 277 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 278 | SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; |
Duncan Sands | 6ed4014 | 2008-12-01 11:39:25 +0000 | [diff] [blame] | 279 | |
| 280 | /// ReplaceNodeResults - Replace the results of node with an illegal result |
| 281 | /// type with new values built out of custom code. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 282 | void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, |
| 283 | SelectionDAG &DAG) const override; |
Duncan Sands | 6ed4014 | 2008-12-01 11:39:25 +0000 | [diff] [blame] | 284 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 285 | const char *getTargetNodeName(unsigned Opcode) const override; |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 286 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 287 | bool isSelectSupported(SelectSupportKind Kind) const override { |
Nadav Rotem | 9d83202 | 2012-09-02 12:10:19 +0000 | [diff] [blame] | 288 | // ARM does not support scalar condition selects on vectors. |
| 289 | return (Kind != ScalarCondVectorVal); |
| 290 | } |
| 291 | |
Diana Picus | 1d101d7 | 2017-09-01 10:44:48 +0000 | [diff] [blame] | 292 | bool isReadOnly(const GlobalValue *GV) const; |
| 293 | |
Duncan Sands | f2641e1 | 2011-09-06 19:07:46 +0000 | [diff] [blame] | 294 | /// getSetCCResultType - Return the value type to use for ISD::SETCC. |
Mehdi Amini | 44ede33 | 2015-07-09 02:09:04 +0000 | [diff] [blame] | 295 | EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, |
| 296 | EVT VT) const override; |
Duncan Sands | f2641e1 | 2011-09-06 19:07:46 +0000 | [diff] [blame] | 297 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 298 | MachineBasicBlock * |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 299 | EmitInstrWithCustomInserter(MachineInstr &MI, |
| 300 | MachineBasicBlock *MBB) const override; |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 301 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 302 | void AdjustInstrPostInstrSelection(MachineInstr &MI, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 303 | SDNode *Node) const override; |
Evan Cheng | e6fba77 | 2011-08-30 19:09:48 +0000 | [diff] [blame] | 304 | |
Evan Cheng | f863e3f | 2011-07-13 00:42:17 +0000 | [diff] [blame] | 305 | SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const; |
Peter Collingbourne | 86b9fbe | 2016-03-21 18:00:02 +0000 | [diff] [blame] | 306 | SDValue PerformBRCONDCombine(SDNode *N, SelectionDAG &DAG) const; |
James Molloy | 9d55f19 | 2015-11-10 14:22:05 +0000 | [diff] [blame] | 307 | SDValue PerformCMOVToBFICombine(SDNode *N, SelectionDAG &DAG) const; |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 308 | SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; |
Evan Cheng | d42641c | 2011-02-02 01:06:55 +0000 | [diff] [blame] | 309 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 310 | bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const override; |
Evan Cheng | d42641c | 2011-02-02 01:06:55 +0000 | [diff] [blame] | 311 | |
Matt Arsenault | 6f2a526 | 2014-07-27 17:46:40 +0000 | [diff] [blame] | 312 | /// allowsMisalignedMemoryAccesses - Returns true if the target allows |
Evan Cheng | 79e2ca9 | 2012-12-10 23:21:26 +0000 | [diff] [blame] | 313 | /// unaligned memory accesses of the specified type. Returns whether it |
| 314 | /// is "fast" by reference in the second argument. |
Matt Arsenault | 6f2a526 | 2014-07-27 17:46:40 +0000 | [diff] [blame] | 315 | bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, |
| 316 | unsigned Align, |
| 317 | bool *Fast) const override; |
Bill Wendling | bae6b2c | 2009-08-15 21:21:19 +0000 | [diff] [blame] | 318 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 319 | EVT getOptimalMemOpType(uint64_t Size, |
| 320 | unsigned DstAlign, unsigned SrcAlign, |
| 321 | bool IsMemset, bool ZeroMemset, |
| 322 | bool MemcpyStrSrc, |
| 323 | MachineFunction &MF) const override; |
Lang Hames | 9929c42 | 2011-11-02 22:52:45 +0000 | [diff] [blame] | 324 | |
Sam Parker | 71efbe4 | 2017-09-18 14:28:51 +0000 | [diff] [blame] | 325 | bool isTruncateFree(Type *SrcTy, Type *DstTy) const override; |
| 326 | bool isTruncateFree(EVT SrcVT, EVT DstVT) const override; |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 327 | bool isZExtFree(SDValue Val, EVT VT2) const override; |
Evan Cheng | 9ec512d | 2012-12-06 19:13:27 +0000 | [diff] [blame] | 328 | |
Ahmed Bougacha | 4200cc9 | 2015-03-05 19:37:53 +0000 | [diff] [blame] | 329 | bool isVectorLoadExtDesirable(SDValue ExtVal) const override; |
| 330 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 331 | bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override; |
Tim Northover | cc2e903 | 2013-08-06 13:58:03 +0000 | [diff] [blame] | 332 | |
| 333 | |
Chris Lattner | 1eb94d9 | 2007-03-30 23:15:24 +0000 | [diff] [blame] | 334 | /// isLegalAddressingMode - Return true if the addressing mode represented |
| 335 | /// by AM is legal for this target, for a load/store of the specified type. |
Mehdi Amini | 0cdec1e | 2015-07-09 02:09:40 +0000 | [diff] [blame] | 336 | bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, |
Jonas Paulsson | 024e319 | 2017-07-21 11:59:37 +0000 | [diff] [blame] | 337 | Type *Ty, unsigned AS, |
| 338 | Instruction *I = nullptr) const override; |
Javed Absar | 85874a9 | 2016-10-13 14:57:43 +0000 | [diff] [blame] | 339 | |
| 340 | /// getScalingFactorCost - Return the cost of the scaling used in |
| 341 | /// addressing mode represented by AM. |
| 342 | /// If the AM is supported, the return value must be >= 0. |
| 343 | /// If the AM is not supported, the return value must be negative. |
| 344 | int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, |
| 345 | unsigned AS) const override; |
| 346 | |
Evan Cheng | dc49a8d | 2009-08-14 20:09:37 +0000 | [diff] [blame] | 347 | bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const; |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 348 | |
Evgeny Astigeevich | 540a39a | 2017-08-24 10:00:25 +0000 | [diff] [blame] | 349 | /// \brief Returns true if the addresing mode representing by AM is legal |
| 350 | /// for the Thumb1 target, for a load/store of the specified type. |
| 351 | bool isLegalT1ScaledAddressingMode(const AddrMode &AM, EVT VT) const; |
| 352 | |
Evan Cheng | 3d3c24a | 2009-11-11 19:05:52 +0000 | [diff] [blame] | 353 | /// isLegalICmpImmediate - Return true if the specified immediate is legal |
Jim Grosbach | 84511e1 | 2010-06-02 21:53:11 +0000 | [diff] [blame] | 354 | /// icmp immediate, that is the target has icmp instructions which can |
| 355 | /// compare a register against the immediate without having to materialize |
| 356 | /// the immediate into a register. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 357 | bool isLegalICmpImmediate(int64_t Imm) const override; |
Evan Cheng | 3d3c24a | 2009-11-11 19:05:52 +0000 | [diff] [blame] | 358 | |
Dan Gohman | 6136e94 | 2011-05-03 00:46:49 +0000 | [diff] [blame] | 359 | /// isLegalAddImmediate - Return true if the specified immediate is legal |
| 360 | /// add immediate, that is the target has add instructions which can |
| 361 | /// add a register and the immediate without having to materialize |
| 362 | /// the immediate into a register. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 363 | bool isLegalAddImmediate(int64_t Imm) const override; |
Dan Gohman | 6136e94 | 2011-05-03 00:46:49 +0000 | [diff] [blame] | 364 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 365 | /// getPreIndexedAddressParts - returns true by value, base pointer and |
| 366 | /// offset pointer and addressing mode by reference if the node's address |
| 367 | /// can be legally represented as pre-indexed load / store address. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 368 | bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset, |
| 369 | ISD::MemIndexedMode &AM, |
| 370 | SelectionDAG &DAG) const override; |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 371 | |
| 372 | /// getPostIndexedAddressParts - returns true by value, base pointer and |
| 373 | /// offset pointer and addressing mode by reference if this node can be |
| 374 | /// combined with a load / store to form a post-indexed load / store. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 375 | bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base, |
| 376 | SDValue &Offset, ISD::MemIndexedMode &AM, |
| 377 | SelectionDAG &DAG) const override; |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 378 | |
Craig Topper | d0af7e8 | 2017-04-28 05:31:46 +0000 | [diff] [blame] | 379 | void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, |
Simon Pilgrim | 37b536e | 2017-03-31 11:24:16 +0000 | [diff] [blame] | 380 | const APInt &DemandedElts, |
Jay Foad | a0653a3 | 2014-05-14 21:14:37 +0000 | [diff] [blame] | 381 | const SelectionDAG &DAG, |
| 382 | unsigned Depth) const override; |
Bill Wendling | bae6b2c | 2009-08-15 21:21:19 +0000 | [diff] [blame] | 383 | |
| 384 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 385 | bool ExpandInlineAsm(CallInst *CI) const override; |
Evan Cheng | 078b0b0 | 2011-01-08 01:24:27 +0000 | [diff] [blame] | 386 | |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 387 | ConstraintType getConstraintType(StringRef Constraint) const override; |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 388 | |
| 389 | /// Examine constraint string and operand type and determine a weight value. |
| 390 | /// The operand object must already have been set up with the operand type. |
| 391 | ConstraintWeight getSingleConstraintMatchWeight( |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 392 | AsmOperandInfo &info, const char *constraint) const override; |
John Thompson | e8360b7 | 2010-10-29 17:29:13 +0000 | [diff] [blame] | 393 | |
Eric Christopher | 11e4df7 | 2015-02-26 22:38:43 +0000 | [diff] [blame] | 394 | std::pair<unsigned, const TargetRegisterClass *> |
| 395 | getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 396 | StringRef Constraint, MVT VT) const override; |
Rafael Espindola | fa0df55 | 2007-11-05 23:12:20 +0000 | [diff] [blame] | 397 | |
Silviu Baranga | 82d0426 | 2016-04-25 14:29:18 +0000 | [diff] [blame] | 398 | const char *LowerXConstraint(EVT ConstraintVT) const override; |
| 399 | |
Bob Wilson | cf1ec2c | 2009-04-01 17:58:54 +0000 | [diff] [blame] | 400 | /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops |
| 401 | /// vector. If it is invalid, don't add anything to Ops. If hasMemory is |
| 402 | /// true it means one of the asm constraint of the inline asm instruction |
| 403 | /// being processed is 'm'. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 404 | void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, |
| 405 | std::vector<SDValue> &Ops, |
| 406 | SelectionDAG &DAG) const override; |
Jim Grosbach | 91fa781 | 2009-05-13 22:32:43 +0000 | [diff] [blame] | 407 | |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 408 | unsigned |
| 409 | getInlineAsmMemConstraint(StringRef ConstraintCode) const override { |
Daniel Sanders | 1f58ef7 | 2015-06-03 12:33:56 +0000 | [diff] [blame] | 410 | if (ConstraintCode == "Q") |
| 411 | return InlineAsm::Constraint_Q; |
James Molloy | 72222f5 | 2015-10-26 10:04:52 +0000 | [diff] [blame] | 412 | else if (ConstraintCode == "o") |
| 413 | return InlineAsm::Constraint_o; |
Daniel Sanders | 1f58ef7 | 2015-06-03 12:33:56 +0000 | [diff] [blame] | 414 | else if (ConstraintCode.size() == 2) { |
| 415 | if (ConstraintCode[0] == 'U') { |
| 416 | switch(ConstraintCode[1]) { |
| 417 | default: |
| 418 | break; |
| 419 | case 'm': |
| 420 | return InlineAsm::Constraint_Um; |
| 421 | case 'n': |
| 422 | return InlineAsm::Constraint_Un; |
| 423 | case 'q': |
| 424 | return InlineAsm::Constraint_Uq; |
| 425 | case 's': |
| 426 | return InlineAsm::Constraint_Us; |
| 427 | case 't': |
| 428 | return InlineAsm::Constraint_Ut; |
| 429 | case 'v': |
| 430 | return InlineAsm::Constraint_Uv; |
| 431 | case 'y': |
| 432 | return InlineAsm::Constraint_Uy; |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); |
Daniel Sanders | bf5b80f | 2015-03-16 13:13:41 +0000 | [diff] [blame] | 437 | } |
| 438 | |
Dan Gohman | 4df9d9c | 2010-05-11 16:21:03 +0000 | [diff] [blame] | 439 | const ARMSubtarget* getSubtarget() const { |
Dan Gohman | 544ab2c | 2008-04-12 04:36:06 +0000 | [diff] [blame] | 440 | return Subtarget; |
Rafael Espindola | fa0df55 | 2007-11-05 23:12:20 +0000 | [diff] [blame] | 441 | } |
| 442 | |
Evan Cheng | 4cad68e | 2010-05-15 02:18:07 +0000 | [diff] [blame] | 443 | /// getRegClassFor - Return the register class that should be used for the |
| 444 | /// specified value type. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 445 | const TargetRegisterClass *getRegClassFor(MVT VT) const override; |
Evan Cheng | 4cad68e | 2010-05-15 02:18:07 +0000 | [diff] [blame] | 446 | |
James Molloy | 8a25992 | 2013-12-03 11:23:11 +0000 | [diff] [blame] | 447 | /// Returns true if a cast between SrcAS and DestAS is a noop. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 448 | bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { |
James Molloy | 8a25992 | 2013-12-03 11:23:11 +0000 | [diff] [blame] | 449 | // Addrspacecasts are always noops. |
| 450 | return true; |
| 451 | } |
| 452 | |
John Brawn | 0dbcd65 | 2015-03-18 12:01:59 +0000 | [diff] [blame] | 453 | bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize, |
| 454 | unsigned &PrefAlign) const override; |
| 455 | |
Eric Christopher | 84bdfd8 | 2010-07-21 22:26:11 +0000 | [diff] [blame] | 456 | /// createFastISel - This method returns a target specific FastISel object, |
| 457 | /// or null if the target does not support "fast" ISel. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 458 | FastISel *createFastISel(FunctionLoweringInfo &funcInfo, |
| 459 | const TargetLibraryInfo *libInfo) const override; |
Eric Christopher | 84bdfd8 | 2010-07-21 22:26:11 +0000 | [diff] [blame] | 460 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 461 | Sched::Preference getSchedulingPreference(SDNode *N) const override; |
Evan Cheng | 4401f88 | 2010-05-20 23:26:43 +0000 | [diff] [blame] | 462 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 463 | bool |
Zvi Rackover | 1b73682 | 2017-07-26 08:06:58 +0000 | [diff] [blame] | 464 | isShuffleMaskLegal(ArrayRef<int> M, EVT VT) const override; |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 465 | bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; |
Evan Cheng | 4a609f3c | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 466 | |
| 467 | /// isFPImmLegal - Returns true if the target can instruction select the |
| 468 | /// specified FP immediate natively. If false, the legalizer will |
| 469 | /// materialize the FP immediate as a load from a constant pool. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 470 | bool isFPImmLegal(const APFloat &Imm, EVT VT) const override; |
Evan Cheng | 4a609f3c | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 471 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 472 | bool getTgtMemIntrinsic(IntrinsicInfo &Info, |
| 473 | const CallInst &I, |
Matt Arsenault | 7d7adf4 | 2017-12-14 22:34:10 +0000 | [diff] [blame] | 474 | MachineFunction &MF, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 475 | unsigned Intrinsic) const override; |
Juergen Ributzka | 659ce00 | 2014-01-28 01:20:14 +0000 | [diff] [blame] | 476 | |
| 477 | /// \brief Returns true if it is beneficial to convert a load of a constant |
| 478 | /// to just the constant itself. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 479 | bool shouldConvertConstantLoadToIntImm(const APInt &Imm, |
| 480 | Type *Ty) const override; |
Juergen Ributzka | 659ce00 | 2014-01-28 01:20:14 +0000 | [diff] [blame] | 481 | |
Eli Friedman | d03df81 | 2016-12-20 20:05:07 +0000 | [diff] [blame] | 482 | /// Return true if EXTRACT_SUBVECTOR is cheap for this result type |
| 483 | /// with this index. |
Craig Topper | 2251ef9 | 2017-08-13 17:29:07 +0000 | [diff] [blame] | 484 | bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, |
| 485 | unsigned Index) const override; |
Eli Friedman | d03df81 | 2016-12-20 20:05:07 +0000 | [diff] [blame] | 486 | |
Oliver Stannard | c24f217 | 2014-05-09 14:01:47 +0000 | [diff] [blame] | 487 | /// \brief Returns true if an argument of type Ty needs to be passed in a |
| 488 | /// contiguous block of registers in calling convention CallConv. |
| 489 | bool functionArgumentNeedsConsecutiveRegisters( |
| 490 | Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override; |
| 491 | |
Joseph Tremoulet | f748c89 | 2015-11-07 01:11:31 +0000 | [diff] [blame] | 492 | /// If a physical register, this returns the register that receives the |
| 493 | /// exception address on entry to an EH pad. |
| 494 | unsigned |
| 495 | getExceptionPointerRegister(const Constant *PersonalityFn) const override; |
| 496 | |
| 497 | /// If a physical register, this returns the register that receives the |
| 498 | /// exception typeid on entry to a landing pad. |
| 499 | unsigned |
| 500 | getExceptionSelectorRegister(const Constant *PersonalityFn) const override; |
| 501 | |
Robin Morisset | 5349e8e | 2014-09-18 18:56:04 +0000 | [diff] [blame] | 502 | Instruction *makeDMB(IRBuilder<> &Builder, ARM_MB::MemBOpt Domain) const; |
Tim Northover | 037f26f2 | 2014-04-17 18:22:47 +0000 | [diff] [blame] | 503 | Value *emitLoadLinked(IRBuilder<> &Builder, Value *Addr, |
| 504 | AtomicOrdering Ord) const override; |
| 505 | Value *emitStoreConditional(IRBuilder<> &Builder, Value *Val, |
| 506 | Value *Addr, AtomicOrdering Ord) const override; |
| 507 | |
Ahmed Bougacha | 81616a7 | 2015-09-22 17:22:58 +0000 | [diff] [blame] | 508 | void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override; |
| 509 | |
Tim Shen | 04de70d | 2017-05-09 15:27:17 +0000 | [diff] [blame] | 510 | Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst, |
| 511 | AtomicOrdering Ord) const override; |
| 512 | Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst, |
| 513 | AtomicOrdering Ord) const override; |
Robin Morisset | a47cb41 | 2014-09-03 21:01:03 +0000 | [diff] [blame] | 514 | |
Hao Liu | 2cd34bb | 2015-06-26 02:45:36 +0000 | [diff] [blame] | 515 | unsigned getMaxSupportedInterleaveFactor() const override { return 4; } |
| 516 | |
| 517 | bool lowerInterleavedLoad(LoadInst *LI, |
| 518 | ArrayRef<ShuffleVectorInst *> Shuffles, |
| 519 | ArrayRef<unsigned> Indices, |
| 520 | unsigned Factor) const override; |
| 521 | bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI, |
| 522 | unsigned Factor) const override; |
| 523 | |
James Y Knight | f44fc52 | 2016-03-16 22:12:04 +0000 | [diff] [blame] | 524 | bool shouldInsertFencesForAtomic(const Instruction *I) const override; |
Ahmed Bougacha | 5246867 | 2015-09-11 17:08:28 +0000 | [diff] [blame] | 525 | TargetLoweringBase::AtomicExpansionKind |
| 526 | shouldExpandAtomicLoadInIR(LoadInst *LI) const override; |
Robin Morisset | ed3d48f | 2014-09-03 21:29:59 +0000 | [diff] [blame] | 527 | bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override; |
Ahmed Bougacha | 9d67713 | 2015-09-11 17:08:17 +0000 | [diff] [blame] | 528 | TargetLoweringBase::AtomicExpansionKind |
JF Bastien | f14889e | 2015-03-04 15:47:57 +0000 | [diff] [blame] | 529 | shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override; |
Ahmed Bougacha | 5246867 | 2015-09-11 17:08:28 +0000 | [diff] [blame] | 530 | bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override; |
Tim Northover | 037f26f2 | 2014-04-17 18:22:47 +0000 | [diff] [blame] | 531 | |
Akira Hatanaka | e5b6e0d | 2014-07-25 19:31:34 +0000 | [diff] [blame] | 532 | bool useLoadStackGuardNode() const override; |
| 533 | |
Quentin Colombet | c32615d | 2014-10-31 17:52:53 +0000 | [diff] [blame] | 534 | bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx, |
| 535 | unsigned &Cost) const override; |
| 536 | |
Nirav Dave | 4dcad5d | 2017-07-10 20:25:54 +0000 | [diff] [blame] | 537 | bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT, |
| 538 | const SelectionDAG &DAG) const override { |
Nirav Dave | 54e22f3 | 2017-03-14 00:34:14 +0000 | [diff] [blame] | 539 | // Do not merge to larger than i32. |
| 540 | return (MemVT.getSizeInBits() <= 32); |
| 541 | } |
| 542 | |
Sanjay Patel | af1b48b | 2015-11-10 19:24:31 +0000 | [diff] [blame] | 543 | bool isCheapToSpeculateCttz() const override; |
| 544 | bool isCheapToSpeculateCtlz() const override; |
| 545 | |
Sanjay Patel | b2f1621 | 2017-04-05 14:09:39 +0000 | [diff] [blame] | 546 | bool convertSetCCLogicToBitwiseLogic(EVT VT) const override { |
| 547 | return VT.isScalarInteger(); |
| 548 | } |
| 549 | |
Manman Ren | 5751814 | 2016-04-11 21:08:06 +0000 | [diff] [blame] | 550 | bool supportSwiftError() const override { |
| 551 | return true; |
| 552 | } |
| 553 | |
Diana Picus | 774d157 | 2016-07-18 06:48:25 +0000 | [diff] [blame] | 554 | bool hasStandaloneRem(EVT VT) const override { |
| 555 | return HasStandaloneRem; |
| 556 | } |
| 557 | |
Diana Picus | 2af9c38 | 2016-12-16 10:35:20 +0000 | [diff] [blame] | 558 | CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool isVarArg) const; |
| 559 | CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC, bool isVarArg) const; |
| 560 | |
Matthew Simpson | 1468d3e | 2017-04-10 18:34:37 +0000 | [diff] [blame] | 561 | /// Returns true if \p VecTy is a legal interleaved access type. This |
| 562 | /// function checks the vector element type and the overall width of the |
| 563 | /// vector. |
| 564 | bool isLegalInterleavedAccessType(VectorType *VecTy, |
| 565 | const DataLayout &DL) const; |
| 566 | |
| 567 | /// Returns the number of interleaved accesses that will be generated when |
| 568 | /// lowering accesses of the given type. |
| 569 | unsigned getNumInterleavedAccesses(VectorType *VecTy, |
| 570 | const DataLayout &DL) const; |
| 571 | |
Matthias Braun | 4682ac6 | 2017-05-05 22:04:05 +0000 | [diff] [blame] | 572 | void finalizeLowering(MachineFunction &MF) const override; |
| 573 | |
Evan Cheng | 10f99a3 | 2010-07-19 22:15:08 +0000 | [diff] [blame] | 574 | protected: |
Eric Christopher | 23a3a7c | 2015-02-26 00:00:24 +0000 | [diff] [blame] | 575 | std::pair<const TargetRegisterClass *, uint8_t> |
| 576 | findRepresentativeClass(const TargetRegisterInfo *TRI, |
| 577 | MVT VT) const override; |
Evan Cheng | 10f99a3 | 2010-07-19 22:15:08 +0000 | [diff] [blame] | 578 | |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 579 | private: |
| 580 | /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can |
| 581 | /// make the right decision when generating code for different targets. |
| 582 | const ARMSubtarget *Subtarget; |
| 583 | |
Evan Cheng | df907f4 | 2010-07-23 22:39:59 +0000 | [diff] [blame] | 584 | const TargetRegisterInfo *RegInfo; |
| 585 | |
Evan Cheng | bf40707 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 586 | const InstrItineraryData *Itins; |
| 587 | |
Bob Wilson | 844d6c8 | 2009-07-13 18:11:36 +0000 | [diff] [blame] | 588 | /// ARMPCLabelIndex - Keep track of the number of ARM PC labels created. |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 589 | unsigned ARMPCLabelIndex; |
| 590 | |
James Y Knight | f44fc52 | 2016-03-16 22:12:04 +0000 | [diff] [blame] | 591 | // TODO: remove this, and have shouldInsertFencesForAtomic do the proper |
| 592 | // check. |
| 593 | bool InsertFencesForAtomic; |
| 594 | |
Diana Picus | 774d157 | 2016-07-18 06:48:25 +0000 | [diff] [blame] | 595 | bool HasStandaloneRem = true; |
| 596 | |
Craig Topper | 4fa625f | 2012-08-12 03:16:37 +0000 | [diff] [blame] | 597 | void addTypeForNEON(MVT VT, MVT PromotedLdStVT, MVT PromotedBitwiseVT); |
| 598 | void addDRTypeForNEON(MVT VT); |
| 599 | void addQRTypeForNEON(MVT VT); |
Louis Gerbarg | 3342bf1 | 2014-05-09 17:02:49 +0000 | [diff] [blame] | 600 | std::pair<SDValue, SDValue> getARMXALUOOp(SDValue Op, SelectionDAG &DAG, SDValue &ARMcc) const; |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 601 | |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame] | 602 | using RegsToPassVector = SmallVector<std::pair<unsigned, SDValue>, 8>; |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 603 | |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 604 | void PassF64ArgInRegs(const SDLoc &dl, SelectionDAG &DAG, SDValue Chain, |
| 605 | SDValue &Arg, RegsToPassVector &RegsToPass, |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 606 | CCValAssign &VA, CCValAssign &NextVA, |
| 607 | SDValue &StackPtr, |
Craig Topper | b94011f | 2013-07-14 04:42:23 +0000 | [diff] [blame] | 608 | SmallVectorImpl<SDValue> &MemOpChains, |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 609 | ISD::ArgFlagsTy Flags) const; |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 610 | SDValue GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA, |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 611 | SDValue &Root, SelectionDAG &DAG, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 612 | const SDLoc &dl) const; |
Bob Wilson | 2e076c4 | 2009-06-22 23:27:02 +0000 | [diff] [blame] | 613 | |
Oliver Stannard | c24f217 | 2014-05-09 14:01:47 +0000 | [diff] [blame] | 614 | CallingConv::ID getEffectiveCallingConv(CallingConv::ID CC, |
| 615 | bool isVarArg) const; |
Jim Grosbach | 84511e1 | 2010-06-02 21:53:11 +0000 | [diff] [blame] | 616 | CCAssignFn *CCAssignFnForNode(CallingConv::ID CC, bool Return, |
| 617 | bool isVarArg) const; |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 618 | SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 619 | const SDLoc &dl, SelectionDAG &DAG, |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 620 | const CCValAssign &VA, |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 621 | ISD::ArgFlagsTy Flags) const; |
Jim Grosbach | c98892f | 2010-05-26 20:22:18 +0000 | [diff] [blame] | 622 | SDValue LowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const; |
Jim Grosbach | bd9485d | 2010-05-22 01:06:18 +0000 | [diff] [blame] | 623 | SDValue LowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const; |
Matthias Braun | 3cd00c1 | 2015-07-16 22:34:16 +0000 | [diff] [blame] | 624 | SDValue LowerEH_SJLJ_SETUP_DISPATCH(SDValue Op, SelectionDAG &DAG) const; |
Jim Grosbach | a570d05 | 2010-02-08 23:22:00 +0000 | [diff] [blame] | 625 | SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG, |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 626 | const ARMSubtarget *Subtarget) const; |
| 627 | SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; |
Alexandros Lamprineas | 2b2b420 | 2017-06-20 07:20:52 +0000 | [diff] [blame] | 628 | SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const; |
| 629 | SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 630 | SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG) const; |
| 631 | SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG) const; |
Saleem Abdulrasool | 40bca0a | 2014-05-09 00:58:32 +0000 | [diff] [blame] | 632 | SDValue LowerGlobalAddressWindows(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 633 | SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 2ce6f2a | 2008-07-27 21:46:04 +0000 | [diff] [blame] | 634 | SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA, |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 635 | SelectionDAG &DAG) const; |
Dan Gohman | 2ce6f2a | 2008-07-27 21:46:04 +0000 | [diff] [blame] | 636 | SDValue LowerToTLSExecModels(GlobalAddressSDNode *GA, |
Hans Wennborg | aea4120 | 2012-05-04 09:40:39 +0000 | [diff] [blame] | 637 | SelectionDAG &DAG, |
| 638 | TLSModel::Model model) const; |
Tim Northover | bd41cf8 | 2016-01-07 09:03:03 +0000 | [diff] [blame] | 639 | SDValue LowerGlobalTLSAddressDarwin(SDValue Op, SelectionDAG &DAG) const; |
Saleem Abdulrasool | f36005a | 2016-02-03 18:21:59 +0000 | [diff] [blame] | 640 | SDValue LowerGlobalTLSAddressWindows(SDValue Op, SelectionDAG &DAG) const; |
Tim Northover | bd41cf8 | 2016-01-07 09:03:03 +0000 | [diff] [blame] | 641 | SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 642 | SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const; |
Roger Ferrer Ibanez | 5ea0f25 | 2017-12-11 12:13:45 +0000 | [diff] [blame] | 643 | SDValue LowerSignedALUO(SDValue Op, SelectionDAG &DAG) const; |
| 644 | SDValue LowerUnsignedALUO(SDValue Op, SelectionDAG &DAG) const; |
Bill Wendling | 6a98131 | 2010-08-11 08:43:16 +0000 | [diff] [blame] | 645 | SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 646 | SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; |
Joel Galenson | 6f4e827 | 2017-12-20 22:25:39 +0000 | [diff] [blame] | 647 | SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 648 | SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const; |
Evan Cheng | 25f9364 | 2010-07-08 02:08:50 +0000 | [diff] [blame] | 649 | SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const; |
Evan Cheng | 168ced9 | 2010-05-22 01:47:14 +0000 | [diff] [blame] | 650 | SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 651 | SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; |
Dan Gohman | 21cea8a | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 652 | SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG) const; |
| 653 | SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const; |
Nate Begeman | b69b182 | 2010-08-03 21:31:55 +0000 | [diff] [blame] | 654 | SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const; |
Lang Hames | c35ee8b | 2012-03-15 18:49:02 +0000 | [diff] [blame] | 655 | SDValue LowerConstantFP(SDValue Op, SelectionDAG &DAG, |
| 656 | const ARMSubtarget *ST) const; |
Andrew Trick | 1a1f8d4 | 2011-04-23 03:24:11 +0000 | [diff] [blame] | 657 | SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG, |
Bob Wilson | 6f2b896 | 2011-01-07 21:37:30 +0000 | [diff] [blame] | 658 | const ARMSubtarget *ST) const; |
Bob Wilson | e7dde0c | 2013-11-03 06:14:38 +0000 | [diff] [blame] | 659 | SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const; |
Renato Golin | 8761069 | 2013-07-16 09:32:17 +0000 | [diff] [blame] | 660 | SDValue LowerDivRem(SDValue Op, SelectionDAG &DAG) const; |
Martell Malone | d122924 | 2015-11-26 15:34:03 +0000 | [diff] [blame] | 661 | SDValue LowerDIV_Windows(SDValue Op, SelectionDAG &DAG, bool Signed) const; |
| 662 | void ExpandDIV_Windows(SDValue Op, SelectionDAG &DAG, bool Signed, |
Saleem Abdulrasool | fe83b50 | 2015-09-25 05:15:46 +0000 | [diff] [blame] | 663 | SmallVectorImpl<SDValue> &Results) const; |
Martell Malone | d122924 | 2015-11-26 15:34:03 +0000 | [diff] [blame] | 664 | SDValue LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG, bool Signed, |
Saleem Abdulrasool | fe83b50 | 2015-09-25 05:15:46 +0000 | [diff] [blame] | 665 | SDValue &Chain) const; |
Scott Douglass | bdef604 | 2015-08-24 09:17:18 +0000 | [diff] [blame] | 666 | SDValue LowerREM(SDNode *N, SelectionDAG &DAG) const; |
Saleem Abdulrasool | abac6e9 | 2014-06-09 20:18:42 +0000 | [diff] [blame] | 667 | SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const; |
Oliver Stannard | 51b1d46 | 2014-08-21 12:50:31 +0000 | [diff] [blame] | 668 | SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const; |
| 669 | SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const; |
| 670 | SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const; |
| 671 | SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const; |
Bob Wilson | 6f2b896 | 2011-01-07 21:37:30 +0000 | [diff] [blame] | 672 | |
Pat Gavlin | a717f25 | 2015-07-09 17:40:29 +0000 | [diff] [blame] | 673 | unsigned getRegisterByName(const char* RegName, EVT VT, |
| 674 | SelectionDAG &DAG) const override; |
Renato Golin | c7aea40 | 2014-05-06 16:51:25 +0000 | [diff] [blame] | 675 | |
Stephen Lin | dd50202 | 2013-07-10 01:54:24 +0000 | [diff] [blame] | 676 | /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster |
| 677 | /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be |
| 678 | /// expanded to FMAs when this method returns true, otherwise fmuladd is |
| 679 | /// expanded to fmul + fadd. |
| 680 | /// |
| 681 | /// ARM supports both fused and unfused multiply-add operations; we already |
Stephen Lin | 2a64473 | 2013-07-10 01:57:39 +0000 | [diff] [blame] | 682 | /// lower a pair of fmul and fadd to the latter so it's not clear that there |
Stephen Lin | dd50202 | 2013-07-10 01:54:24 +0000 | [diff] [blame] | 683 | /// would be a gain or that the gain would be worthwhile enough to risk |
| 684 | /// correctness bugs. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 685 | bool isFMAFasterThanFMulAndFAdd(EVT VT) const override { return false; } |
Stephen Lin | dd50202 | 2013-07-10 01:54:24 +0000 | [diff] [blame] | 686 | |
Bob Wilson | 6f2b896 | 2011-01-07 21:37:30 +0000 | [diff] [blame] | 687 | SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const; |
Rafael Espindola | 18a831d | 2007-10-19 14:35:17 +0000 | [diff] [blame] | 688 | |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 689 | SDValue LowerCallResult(SDValue Chain, SDValue InFlag, |
Sandeep Patel | 68c5f47 | 2009-09-02 08:44:58 +0000 | [diff] [blame] | 690 | CallingConv::ID CallConv, bool isVarArg, |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 691 | const SmallVectorImpl<ISD::InputArg> &Ins, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 692 | const SDLoc &dl, SelectionDAG &DAG, |
| 693 | SmallVectorImpl<SDValue> &InVals, bool isThisReturn, |
| 694 | SDValue ThisVal) const; |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 695 | |
Manman Ren | 5e9e65e | 2016-01-12 00:47:18 +0000 | [diff] [blame] | 696 | bool supportSplitCSR(MachineFunction *MF) const override { |
Matthias Braun | f1caa28 | 2017-12-15 22:22:58 +0000 | [diff] [blame] | 697 | return MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS && |
| 698 | MF->getFunction().hasFnAttribute(Attribute::NoUnwind); |
Manman Ren | 5e9e65e | 2016-01-12 00:47:18 +0000 | [diff] [blame] | 699 | } |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 700 | |
Manman Ren | 5e9e65e | 2016-01-12 00:47:18 +0000 | [diff] [blame] | 701 | void initializeSplitCSR(MachineBasicBlock *Entry) const override; |
| 702 | void insertCopiesSplitCSR( |
| 703 | MachineBasicBlock *Entry, |
| 704 | const SmallVectorImpl<MachineBasicBlock *> &Exits) const override; |
| 705 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 706 | SDValue |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 707 | LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, |
| 708 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 709 | const SDLoc &dl, SelectionDAG &DAG, |
| 710 | SmallVectorImpl<SDValue> &InVals) const override; |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 711 | |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 712 | int StoreByValRegs(CCState &CCInfo, SelectionDAG &DAG, const SDLoc &dl, |
| 713 | SDValue &Chain, const Value *OrigArg, |
| 714 | unsigned InRegsParamRecordIdx, int ArgOffset, |
Tim Northover | 8cda34f | 2015-03-11 18:54:22 +0000 | [diff] [blame] | 715 | unsigned ArgSize) const; |
Stepan Dyatkovskiy | f5aa83d | 2013-04-30 07:19:58 +0000 | [diff] [blame] | 716 | |
Stuart Hastings | 45fe3c3 | 2011-04-20 16:47:52 +0000 | [diff] [blame] | 717 | void VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 718 | const SDLoc &dl, SDValue &Chain, |
| 719 | unsigned ArgOffset, unsigned TotalArgRegsSaveSize, |
Stepan Dyatkovskiy | f5aa83d | 2013-04-30 07:19:58 +0000 | [diff] [blame] | 720 | bool ForceMutable = false) const; |
Stuart Hastings | 45fe3c3 | 2011-04-20 16:47:52 +0000 | [diff] [blame] | 721 | |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 722 | SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, |
| 723 | SmallVectorImpl<SDValue> &InVals) const override; |
Dan Gohman | f9bbcd1 | 2009-08-05 01:29:28 +0000 | [diff] [blame] | 724 | |
Stuart Hastings | 67c5c3e | 2011-02-28 17:17:53 +0000 | [diff] [blame] | 725 | /// HandleByVal - Target-specific cleanup for ByVal support. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 726 | void HandleByVal(CCState *, unsigned &, unsigned) const override; |
Stuart Hastings | 67c5c3e | 2011-02-28 17:17:53 +0000 | [diff] [blame] | 727 | |
Dale Johannesen | d679ff7 | 2010-06-03 21:09:53 +0000 | [diff] [blame] | 728 | /// IsEligibleForTailCallOptimization - Check whether the call is eligible |
| 729 | /// for tail call optimization. Targets which want to do tail call |
| 730 | /// optimization should implement this function. |
| 731 | bool IsEligibleForTailCallOptimization(SDValue Callee, |
| 732 | CallingConv::ID CalleeCC, |
| 733 | bool isVarArg, |
| 734 | bool isCalleeStructRet, |
| 735 | bool isCallerStructRet, |
| 736 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
Dan Gohman | fe7532a | 2010-07-07 15:54:55 +0000 | [diff] [blame] | 737 | const SmallVectorImpl<SDValue> &OutVals, |
Dale Johannesen | d679ff7 | 2010-06-03 21:09:53 +0000 | [diff] [blame] | 738 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 739 | SelectionDAG& DAG) const; |
Benjamin Kramer | b1996da | 2012-11-28 20:55:10 +0000 | [diff] [blame] | 740 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 741 | bool CanLowerReturn(CallingConv::ID CallConv, |
| 742 | MachineFunction &MF, bool isVarArg, |
| 743 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 744 | LLVMContext &Context) const override; |
Benjamin Kramer | b1996da | 2012-11-28 20:55:10 +0000 | [diff] [blame] | 745 | |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 746 | SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, |
| 747 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 748 | const SmallVectorImpl<SDValue> &OutVals, |
| 749 | const SDLoc &dl, SelectionDAG &DAG) const override; |
Evan Cheng | 15b80e4 | 2009-11-12 07:13:11 +0000 | [diff] [blame] | 750 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 751 | bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override; |
Evan Cheng | d4b0873 | 2010-11-30 23:55:39 +0000 | [diff] [blame] | 752 | |
Matt Arsenault | 3138075 | 2017-04-18 21:16:46 +0000 | [diff] [blame] | 753 | bool mayBeEmittedAsTailCall(const CallInst *CI) const override; |
Evan Cheng | 0663f23 | 2011-03-21 01:19:09 +0000 | [diff] [blame] | 754 | |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 755 | SDValue getCMOV(const SDLoc &dl, EVT VT, SDValue FalseVal, SDValue TrueVal, |
Oliver Stannard | 51b1d46 | 2014-08-21 12:50:31 +0000 | [diff] [blame] | 756 | SDValue ARMcc, SDValue CCR, SDValue Cmp, |
| 757 | SelectionDAG &DAG) const; |
Evan Cheng | 15b80e4 | 2009-11-12 07:13:11 +0000 | [diff] [blame] | 758 | SDValue getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 759 | SDValue &ARMcc, SelectionDAG &DAG, const SDLoc &dl) const; |
| 760 | SDValue getVFPCmp(SDValue LHS, SDValue RHS, SelectionDAG &DAG, |
James Molloy | d508789 | 2017-02-13 12:32:47 +0000 | [diff] [blame] | 761 | const SDLoc &dl, bool InvalidOnQNaN) const; |
Bob Wilson | 45acbd0 | 2011-03-08 01:17:20 +0000 | [diff] [blame] | 762 | SDValue duplicateCmp(SDValue Cmp, SelectionDAG &DAG) const; |
Evan Cheng | 0cc4ad9 | 2010-07-13 19:27:42 +0000 | [diff] [blame] | 763 | |
| 764 | SDValue OptimizeVFPBrcond(SDValue Op, SelectionDAG &DAG) const; |
Jim Grosbach | 5c4e99f | 2009-12-11 01:42:04 +0000 | [diff] [blame] | 765 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 766 | void SetupEntryBlockForSjLj(MachineInstr &MI, MachineBasicBlock *MBB, |
Bill Wendling | 030b58e | 2011-10-06 22:18:16 +0000 | [diff] [blame] | 767 | MachineBasicBlock *DispatchBB, int FI) const; |
| 768 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 769 | void EmitSjLjDispatchBlock(MachineInstr &MI, MachineBasicBlock *MBB) const; |
Bill Wendling | 374ee19 | 2011-10-03 21:25:38 +0000 | [diff] [blame] | 770 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 771 | bool RemapAddSubWithFlags(MachineInstr &MI, MachineBasicBlock *BB) const; |
Manman Ren | e873552 | 2012-06-01 19:33:18 +0000 | [diff] [blame] | 772 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 773 | MachineBasicBlock *EmitStructByval(MachineInstr &MI, |
Manman Ren | e873552 | 2012-06-01 19:33:18 +0000 | [diff] [blame] | 774 | MachineBasicBlock *MBB) const; |
Saleem Abdulrasool | abac6e9 | 2014-06-09 20:18:42 +0000 | [diff] [blame] | 775 | |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 776 | MachineBasicBlock *EmitLowered__chkstk(MachineInstr &MI, |
Saleem Abdulrasool | abac6e9 | 2014-06-09 20:18:42 +0000 | [diff] [blame] | 777 | MachineBasicBlock *MBB) const; |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 778 | MachineBasicBlock *EmitLowered__dbzchk(MachineInstr &MI, |
Saleem Abdulrasool | fe83b50 | 2015-09-25 05:15:46 +0000 | [diff] [blame] | 779 | MachineBasicBlock *MBB) const; |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 780 | }; |
Andrew Trick | 1a1f8d4 | 2011-04-23 03:24:11 +0000 | [diff] [blame] | 781 | |
Owen Anderson | a407692 | 2010-11-05 21:57:54 +0000 | [diff] [blame] | 782 | enum NEONModImmType { |
| 783 | VMOVModImm, |
| 784 | VMVNModImm, |
| 785 | OtherModImm |
| 786 | }; |
Andrew Trick | 1a1f8d4 | 2011-04-23 03:24:11 +0000 | [diff] [blame] | 787 | |
Eric Christopher | 84bdfd8 | 2010-07-21 22:26:11 +0000 | [diff] [blame] | 788 | namespace ARM { |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 789 | |
Bob Wilson | 3e6fa46 | 2012-08-03 04:06:28 +0000 | [diff] [blame] | 790 | FastISel *createFastISel(FunctionLoweringInfo &funcInfo, |
| 791 | const TargetLibraryInfo *libInfo); |
Evan Cheng | 10043e2 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 792 | |
Eugene Zelenko | c4ad1ce | 2017-01-11 01:45:03 +0000 | [diff] [blame] | 793 | } // end namespace ARM |
| 794 | |
| 795 | } // end namespace llvm |
| 796 | |
| 797 | #endif // LLVM_LIB_TARGET_ARM_ARMISELLOWERING_H |