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

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: Address comments. 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') | no next file with comments »
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 // TODO: ARM-style pointers to member functions put the discriminator in
160 // the this adjustment, so they don't require functions to have any
161 // special alignment and could therefore also return false.
162 case GenericItanium:
163 case iOS:
164 case iOS64:
165 case Microsoft:
166 return true;
167 }
168 llvm_unreachable("bad ABI kind");
169 }
170 // @LOCALMOD-END Emscripten
171
141 /// \brief Is the default C++ member function calling convention 172 /// \brief Is the default C++ member function calling convention
142 /// the same as the default calling convention? 173 /// the same as the default calling convention?
143 bool isMemberFunctionCCDefault() const { 174 bool isMemberFunctionCCDefault() const {
144 // Right now, this is always false for Microsoft. 175 // Right now, this is always false for Microsoft.
145 return !isMicrosoft(); 176 return !isMicrosoft();
146 } 177 }
147 178
148 /// Are arguments to a call destroyed left to right in the callee? 179 /// Are arguments to a call destroyed left to right in the callee?
149 /// This is a fundamental language change, since it implies that objects 180 /// 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. 181 /// 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 234 /// exploiting this observation requires an ABI break and cannot be
204 /// done on a generic Itanium platform. 235 /// done on a generic Itanium platform.
205 bool canKeyFunctionBeInline() const { 236 bool canKeyFunctionBeInline() const {
206 switch (getKind()) { 237 switch (getKind()) {
207 case GenericARM: 238 case GenericARM:
208 case iOS64: 239 case iOS64:
209 return false; 240 return false;
210 241
211 case GenericAArch64: 242 case GenericAArch64:
212 case GenericItanium: 243 case GenericItanium:
244 case Emscripten: // @LOCALMOD Emscripten
213 case iOS: // old iOS compilers did not follow this rule 245 case iOS: // old iOS compilers did not follow this rule
214 case Microsoft: 246 case Microsoft:
215 return true; 247 return true;
216 } 248 }
217 llvm_unreachable("bad ABI kind"); 249 llvm_unreachable("bad ABI kind");
218 } 250 }
219 251
220 /// When is record layout allowed to allocate objects in the tail 252 /// When is record layout allowed to allocate objects in the tail
221 /// padding of a base class? 253 /// padding of a base class?
222 /// 254 ///
(...skipping 26 matching lines...) Expand all
249 UseTailPaddingUnlessPOD11 281 UseTailPaddingUnlessPOD11
250 }; 282 };
251 TailPaddingUseRules getTailPaddingUseRules() const { 283 TailPaddingUseRules getTailPaddingUseRules() const {
252 switch (getKind()) { 284 switch (getKind()) {
253 // To preserve binary compatibility, the generic Itanium ABI has 285 // To preserve binary compatibility, the generic Itanium ABI has
254 // permanently locked the definition of POD to the rules of C++ TR1, 286 // permanently locked the definition of POD to the rules of C++ TR1,
255 // and that trickles down to all the derived ABIs. 287 // and that trickles down to all the derived ABIs.
256 case GenericItanium: 288 case GenericItanium:
257 case GenericAArch64: 289 case GenericAArch64:
258 case GenericARM: 290 case GenericARM:
291 case Emscripten: // @LOCALMOD Emscripten
259 case iOS: 292 case iOS:
260 return UseTailPaddingUnlessPOD03; 293 return UseTailPaddingUnlessPOD03;
261 294
262 // iOS on ARM64 uses the C++11 POD rules. It does not honor the 295 // iOS on ARM64 uses the C++11 POD rules. It does not honor the
263 // Itanium exception about classes with over-large bitfields. 296 // Itanium exception about classes with over-large bitfields.
264 case iOS64: 297 case iOS64:
265 return UseTailPaddingUnlessPOD11; 298 return UseTailPaddingUnlessPOD11;
266 299
267 // MSVC always allocates fields in the tail-padding of a base class 300 // MSVC always allocates fields in the tail-padding of a base class
268 // subobject, even if they're POD. 301 // subobject, even if they're POD.
(...skipping 11 matching lines...) Expand all
280 } 313 }
281 314
282 friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) { 315 friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) {
283 return !(left == right); 316 return !(left == right);
284 } 317 }
285 }; 318 };
286 319
287 } // end namespace clang 320 } // end namespace clang
288 321
289 #endif 322 #endif
OLDNEW
« no previous file with comments | « no previous file | lib/AST/ASTContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698