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