| OLD | NEW |
| 1 //===--- TargetCXXABI.h - C++ ABI Target Configuration ----------*- C++ -*-===// | 1 //===--- TargetCXXABI.h - C++ ABI Target Configuration ----------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 iOS64, | 72 iOS64, |
| 73 | 73 |
| 74 /// The generic AArch64 ABI is also a modified version of the Itanium ABI, | 74 /// The generic AArch64 ABI is also a modified version of the Itanium ABI, |
| 75 /// but it has fewer divergences than the 32-bit ARM ABI. | 75 /// but it has fewer divergences than the 32-bit ARM ABI. |
| 76 /// | 76 /// |
| 77 /// The relevant changes from the generic ABI in this case are: | 77 /// The relevant changes from the generic ABI in this case are: |
| 78 /// - representation of member function pointers adjusted as in ARM. | 78 /// - representation of member function pointers adjusted as in ARM. |
| 79 /// - guard variables are smaller. | 79 /// - guard variables are smaller. |
| 80 GenericAArch64, | 80 GenericAArch64, |
| 81 | 81 |
| 82 // @LOCALMOD-START Emscripten | |
| 83 /// Emscripten uses the Itanium C++, with the exception that it uses | |
| 84 /// ARM-style pointers to member functions. | |
| 85 Emscripten, | |
| 86 // @LOCALMOD-END Emscripten | |
| 87 /// The generic Mips ABI is a modified version of the Itanium ABI. | 82 /// The generic Mips ABI is a modified version of the Itanium ABI. |
| 88 /// | 83 /// |
| 89 /// At the moment, only change from the generic ABI in this case is: | 84 /// At the moment, only change from the generic ABI in this case is: |
| 90 /// - representation of member function pointers adjusted as in ARM. | 85 /// - representation of member function pointers adjusted as in ARM. |
| 91 GenericMIPS, | 86 GenericMIPS, |
| 92 | 87 |
| 93 /// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and | 88 /// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and |
| 94 /// compatible compilers). | 89 /// compatible compilers). |
| 95 /// | 90 /// |
| 96 /// FIXME: should this be split into Win32 and Win64 variants? | 91 /// FIXME: should this be split into Win32 and Win64 variants? |
| (...skipping 19 matching lines...) Expand all Loading... |
| 116 } | 111 } |
| 117 | 112 |
| 118 Kind getKind() const { return TheKind; } | 113 Kind getKind() const { return TheKind; } |
| 119 | 114 |
| 120 /// \brief Does this ABI generally fall into the Itanium family of ABIs? | 115 /// \brief Does this ABI generally fall into the Itanium family of ABIs? |
| 121 bool isItaniumFamily() const { | 116 bool isItaniumFamily() const { |
| 122 switch (getKind()) { | 117 switch (getKind()) { |
| 123 case GenericAArch64: | 118 case GenericAArch64: |
| 124 case GenericItanium: | 119 case GenericItanium: |
| 125 case GenericARM: | 120 case GenericARM: |
| 126 case Emscripten: // @LOCALMOD Emscripten | |
| 127 case iOS: | 121 case iOS: |
| 128 case iOS64: | 122 case iOS64: |
| 129 case GenericMIPS: | 123 case GenericMIPS: |
| 130 return true; | 124 return true; |
| 131 | 125 |
| 132 case Microsoft: | 126 case Microsoft: |
| 133 return false; | 127 return false; |
| 134 } | 128 } |
| 135 llvm_unreachable("bad ABI kind"); | 129 llvm_unreachable("bad ABI kind"); |
| 136 } | 130 } |
| 137 | 131 |
| 138 /// \brief Is this ABI an MSVC-compatible ABI? | 132 /// \brief Is this ABI an MSVC-compatible ABI? |
| 139 bool isMicrosoft() const { | 133 bool isMicrosoft() const { |
| 140 switch (getKind()) { | 134 switch (getKind()) { |
| 141 case GenericAArch64: | 135 case GenericAArch64: |
| 142 case GenericItanium: | 136 case GenericItanium: |
| 143 case GenericARM: | 137 case GenericARM: |
| 144 case Emscripten: // @LOCALMOD Emscripten | |
| 145 case iOS: | 138 case iOS: |
| 146 case iOS64: | 139 case iOS64: |
| 147 case GenericMIPS: | 140 case GenericMIPS: |
| 148 return false; | 141 return false; |
| 149 | 142 |
| 150 case Microsoft: | 143 case Microsoft: |
| 151 return true; | 144 return true; |
| 152 } | 145 } |
| 153 llvm_unreachable("bad ABI kind"); | 146 llvm_unreachable("bad ABI kind"); |
| 154 } | 147 } |
| 155 | 148 |
| 156 // @LOCALMOD-START Emscripten | |
| 157 /// \brief Are pointers to member functions differently aligned? | |
| 158 bool arePointersToMemberFunctionsAligned() const { | |
| 159 switch (getKind()) { | |
| 160 case Emscripten: | |
| 161 // Emscripten uses table indices for function pointers and therefore | |
| 162 // doesn't require alignment. | |
| 163 return false; | |
| 164 case GenericARM: | |
| 165 case GenericAArch64: | |
| 166 // TODO: ARM-style pointers to member functions put the discriminator in | |
| 167 // the this adjustment, so they don't require functions to have any | |
| 168 // special alignment and could therefore also return false. | |
| 169 case GenericItanium: | |
| 170 case GenericMIPS: | |
| 171 case iOS: | |
| 172 case iOS64: | |
| 173 case Microsoft: | |
| 174 return true; | |
| 175 } | |
| 176 llvm_unreachable("bad ABI kind"); | |
| 177 } | |
| 178 // @LOCALMOD-END Emscripten | |
| 179 | |
| 180 /// \brief Is the default C++ member function calling convention | 149 /// \brief Is the default C++ member function calling convention |
| 181 /// the same as the default calling convention? | 150 /// the same as the default calling convention? |
| 182 bool isMemberFunctionCCDefault() const { | 151 bool isMemberFunctionCCDefault() const { |
| 183 // Right now, this is always false for Microsoft. | 152 // Right now, this is always false for Microsoft. |
| 184 return !isMicrosoft(); | 153 return !isMicrosoft(); |
| 185 } | 154 } |
| 186 | 155 |
| 187 /// Are arguments to a call destroyed left to right in the callee? | 156 /// Are arguments to a call destroyed left to right in the callee? |
| 188 /// This is a fundamental language change, since it implies that objects | 157 /// This is a fundamental language change, since it implies that objects |
| 189 /// passed by value do *not* live to the end of the full expression. | 158 /// passed by value do *not* live to the end of the full expression. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 /// exploiting this observation requires an ABI break and cannot be | 211 /// exploiting this observation requires an ABI break and cannot be |
| 243 /// done on a generic Itanium platform. | 212 /// done on a generic Itanium platform. |
| 244 bool canKeyFunctionBeInline() const { | 213 bool canKeyFunctionBeInline() const { |
| 245 switch (getKind()) { | 214 switch (getKind()) { |
| 246 case GenericARM: | 215 case GenericARM: |
| 247 case iOS64: | 216 case iOS64: |
| 248 return false; | 217 return false; |
| 249 | 218 |
| 250 case GenericAArch64: | 219 case GenericAArch64: |
| 251 case GenericItanium: | 220 case GenericItanium: |
| 252 case Emscripten: // @LOCALMOD Emscripten | |
| 253 case iOS: // old iOS compilers did not follow this rule | 221 case iOS: // old iOS compilers did not follow this rule |
| 254 case Microsoft: | 222 case Microsoft: |
| 255 case GenericMIPS: | 223 case GenericMIPS: |
| 256 return true; | 224 return true; |
| 257 } | 225 } |
| 258 llvm_unreachable("bad ABI kind"); | 226 llvm_unreachable("bad ABI kind"); |
| 259 } | 227 } |
| 260 | 228 |
| 261 /// When is record layout allowed to allocate objects in the tail | 229 /// When is record layout allowed to allocate objects in the tail |
| 262 /// padding of a base class? | 230 /// padding of a base class? |
| (...skipping 27 matching lines...) Expand all Loading... |
| 290 UseTailPaddingUnlessPOD11 | 258 UseTailPaddingUnlessPOD11 |
| 291 }; | 259 }; |
| 292 TailPaddingUseRules getTailPaddingUseRules() const { | 260 TailPaddingUseRules getTailPaddingUseRules() const { |
| 293 switch (getKind()) { | 261 switch (getKind()) { |
| 294 // To preserve binary compatibility, the generic Itanium ABI has | 262 // To preserve binary compatibility, the generic Itanium ABI has |
| 295 // permanently locked the definition of POD to the rules of C++ TR1, | 263 // permanently locked the definition of POD to the rules of C++ TR1, |
| 296 // and that trickles down to all the derived ABIs. | 264 // and that trickles down to all the derived ABIs. |
| 297 case GenericItanium: | 265 case GenericItanium: |
| 298 case GenericAArch64: | 266 case GenericAArch64: |
| 299 case GenericARM: | 267 case GenericARM: |
| 300 case Emscripten: // @LOCALMOD Emscripten | |
| 301 case iOS: | 268 case iOS: |
| 302 case GenericMIPS: | 269 case GenericMIPS: |
| 303 return UseTailPaddingUnlessPOD03; | 270 return UseTailPaddingUnlessPOD03; |
| 304 | 271 |
| 305 // iOS on ARM64 uses the C++11 POD rules. It does not honor the | 272 // iOS on ARM64 uses the C++11 POD rules. It does not honor the |
| 306 // Itanium exception about classes with over-large bitfields. | 273 // Itanium exception about classes with over-large bitfields. |
| 307 case iOS64: | 274 case iOS64: |
| 308 return UseTailPaddingUnlessPOD11; | 275 return UseTailPaddingUnlessPOD11; |
| 309 | 276 |
| 310 // MSVC always allocates fields in the tail-padding of a base class | 277 // MSVC always allocates fields in the tail-padding of a base class |
| (...skipping 12 matching lines...) Expand all Loading... |
| 323 } | 290 } |
| 324 | 291 |
| 325 friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) { | 292 friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) { |
| 326 return !(left == right); | 293 return !(left == right); |
| 327 } | 294 } |
| 328 }; | 295 }; |
| 329 | 296 |
| 330 } // end namespace clang | 297 } // end namespace clang |
| 331 | 298 |
| 332 #endif | 299 #endif |
| OLD | NEW |