Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: include/clang/Basic/TargetCXXABI.h

Issue 1022123003: clang: add support for asmjs arch and Emscripten OS (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-clang.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/AST/ASTContext.cpp » ('j') | lib/Basic/Targets.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
82 /// 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
83 /// compatible compilers). 89 /// compatible compilers).
84 /// 90 ///
85 /// FIXME: should this be split into Win32 and Win64 variants? 91 /// FIXME: should this be split into Win32 and Win64 variants?
86 /// 92 ///
87 /// Only scattered and incomplete official documentation exists. 93 /// Only scattered and incomplete official documentation exists.
88 Microsoft 94 Microsoft
89 }; 95 };
90 96
91 private: 97 private:
(...skipping 13 matching lines...) Expand all
105 } 111 }
106 112
107 Kind getKind() const { return TheKind; } 113 Kind getKind() const { return TheKind; }
108 114
109 /// \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?
110 bool isItaniumFamily() const { 116 bool isItaniumFamily() const {
111 switch (getKind()) { 117 switch (getKind()) {
112 case GenericAArch64: 118 case GenericAArch64:
113 case GenericItanium: 119 case GenericItanium:
114 case GenericARM: 120 case GenericARM:
121 case Emscripten: // @LOCALMOD Emscripten
115 case iOS: 122 case iOS:
116 case iOS64: 123 case iOS64:
117 return true; 124 return true;
118 125
119 case Microsoft: 126 case Microsoft:
120 return false; 127 return false;
121 } 128 }
122 llvm_unreachable("bad ABI kind"); 129 llvm_unreachable("bad ABI kind");
123 } 130 }
124 131
125 /// \brief Is this ABI an MSVC-compatible ABI? 132 /// \brief Is this ABI an MSVC-compatible ABI?
126 bool isMicrosoft() const { 133 bool isMicrosoft() const {
127 switch (getKind()) { 134 switch (getKind()) {
128 case GenericAArch64: 135 case GenericAArch64:
129 case GenericItanium: 136 case GenericItanium:
130 case GenericARM: 137 case GenericARM:
138 case Emscripten: // @LOCALMOD Emscripten
131 case iOS: 139 case iOS:
132 case iOS64: 140 case iOS64:
133 return false; 141 return false;
134 142
135 case Microsoft: 143 case Microsoft:
136 return true; 144 return true;
137 } 145 }
138 llvm_unreachable("bad ABI kind"); 146 llvm_unreachable("bad ABI kind");
139 } 147 }
140 148
149 // @LOCALMOD-START Emscripten
150 /// \brief Are pointers to member functions differently aligned?
151 bool arePointersToMemberFunctionsAligned() const {
152 switch (getKind()) {
153 case Emscripten:
154 // Emscripten uses table indices for function pointers and therefore
155 // doesn't require alignment.
156 return false;
157 case GenericARM:
158 case GenericAArch64:
159 // ARM-style pointers to member functions put the discriminator in the
160 // this adjustment, so they don't require functions to have any special
161 // alignment.
162 return false;
163 case GenericItanium:
jvoung (off chromium) 2015/03/20 17:07:07 Hmm, so LE32 uses GenericItanium directly and does
JF 2015/03/20 18:49:38 As discussed on IRC I left ARM as it was, with a T
164 case iOS:
165 case iOS64:
166 case Microsoft:
167 return true;
168 }
169 llvm_unreachable("bad ABI kind");
170 }
171 // @LOCALMOD-END Emscripten
172
141 /// \brief Is the default C++ member function calling convention 173 /// \brief Is the default C++ member function calling convention
142 /// the same as the default calling convention? 174 /// the same as the default calling convention?
143 bool isMemberFunctionCCDefault() const { 175 bool isMemberFunctionCCDefault() const {
144 // Right now, this is always false for Microsoft. 176 // Right now, this is always false for Microsoft.
145 return !isMicrosoft(); 177 return !isMicrosoft();
146 } 178 }
147 179
148 /// Are arguments to a call destroyed left to right in the callee? 180 /// Are arguments to a call destroyed left to right in the callee?
149 /// This is a fundamental language change, since it implies that objects 181 /// This is a fundamental language change, since it implies that objects
150 /// passed by value do *not* live to the end of the full expression. 182 /// 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
203 /// exploiting this observation requires an ABI break and cannot be 235 /// exploiting this observation requires an ABI break and cannot be
204 /// done on a generic Itanium platform. 236 /// done on a generic Itanium platform.
205 bool canKeyFunctionBeInline() const { 237 bool canKeyFunctionBeInline() const {
206 switch (getKind()) { 238 switch (getKind()) {
207 case GenericARM: 239 case GenericARM:
208 case iOS64: 240 case iOS64:
209 return false; 241 return false;
210 242
211 case GenericAArch64: 243 case GenericAArch64:
212 case GenericItanium: 244 case GenericItanium:
245 case Emscripten: // @LOCALMOD Emscripten
213 case iOS: // old iOS compilers did not follow this rule 246 case iOS: // old iOS compilers did not follow this rule
214 case Microsoft: 247 case Microsoft:
215 return true; 248 return true;
216 } 249 }
217 llvm_unreachable("bad ABI kind"); 250 llvm_unreachable("bad ABI kind");
218 } 251 }
219 252
220 /// When is record layout allowed to allocate objects in the tail 253 /// When is record layout allowed to allocate objects in the tail
221 /// padding of a base class? 254 /// padding of a base class?
222 /// 255 ///
(...skipping 26 matching lines...) Expand all
249 UseTailPaddingUnlessPOD11 282 UseTailPaddingUnlessPOD11
250 }; 283 };
251 TailPaddingUseRules getTailPaddingUseRules() const { 284 TailPaddingUseRules getTailPaddingUseRules() const {
252 switch (getKind()) { 285 switch (getKind()) {
253 // To preserve binary compatibility, the generic Itanium ABI has 286 // To preserve binary compatibility, the generic Itanium ABI has
254 // permanently locked the definition of POD to the rules of C++ TR1, 287 // permanently locked the definition of POD to the rules of C++ TR1,
255 // and that trickles down to all the derived ABIs. 288 // and that trickles down to all the derived ABIs.
256 case GenericItanium: 289 case GenericItanium:
257 case GenericAArch64: 290 case GenericAArch64:
258 case GenericARM: 291 case GenericARM:
292 case Emscripten: // @LOCALMOD Emscripten
259 case iOS: 293 case iOS:
260 return UseTailPaddingUnlessPOD03; 294 return UseTailPaddingUnlessPOD03;
261 295
262 // iOS on ARM64 uses the C++11 POD rules. It does not honor the 296 // iOS on ARM64 uses the C++11 POD rules. It does not honor the
263 // Itanium exception about classes with over-large bitfields. 297 // Itanium exception about classes with over-large bitfields.
264 case iOS64: 298 case iOS64:
265 return UseTailPaddingUnlessPOD11; 299 return UseTailPaddingUnlessPOD11;
266 300
267 // MSVC always allocates fields in the tail-padding of a base class 301 // MSVC always allocates fields in the tail-padding of a base class
268 // subobject, even if they're POD. 302 // subobject, even if they're POD.
(...skipping 11 matching lines...) Expand all
280 } 314 }
281 315
282 friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) { 316 friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) {
283 return !(left == right); 317 return !(left == right);
284 } 318 }
285 }; 319 };
286 320
287 } // end namespace clang 321 } // end namespace clang
288 322
289 #endif 323 #endif
OLDNEW
« no previous file with comments | « no previous file | lib/AST/ASTContext.cpp » ('j') | lib/Basic/Targets.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698