summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* assert/ErrorUnsupported in unimplemented stub functions instead ofDaniel Dunbar2009-02-161-16/+25
| | | | | | miscompiling. llvm-svn: 64647
* Obj-C non-fragile ABI: Fix types of a few globals; these were notDaniel Dunbar2009-02-151-20/+26
| | | | | | creating valid LLVM structures (although they work fined). llvm-svn: 64580
* Use getNameAsCString instead of getNameAsString and reflow the type.Mike Stump2009-02-143-7/+7
| | | | | | Thanks Anders. llvm-svn: 64571
* Generate the helper function for blocks. Now basic codegen isMike Stump2009-02-145-15/+25
| | | | | | starting to work for blocks. llvm-svn: 64570
* Fixed a bad ir-gen bug which caused a dejagnu test to fail.Fariborz Jahanian2009-02-141-1/+1
| | | | | | | Now we are pretty close to be in sync with objc's classic abi when it comes to passing dejagnu objc executable tests. llvm-svn: 64569
* Fixed a problem caused by foreward @class useFariborz Jahanian2009-02-141-2/+2
| | | | | | | | which consequently caused a Seg fault. during meta-data generation. It also addresses an issue related to late binding of newly synthesize ivars (when we support it). llvm-svn: 64563
* Add hook to add attributes to function declarations that we knowDouglas Gregor2009-02-142-2/+3
| | | | | | | | | | | | | | | | about, whether they are builtins or not. Use this to add the appropriate "format" attribute to NSLog, NSLogv, asprintf, and vasprintf, and to translate builtin attributes (from Builtins.def) into actual attributes on the function declaration. Use the "printf" format attribute on function declarations to determine whether we should do format string checking, rather than looking at an ad hoc list of builtins and "known" function names. Be a bit more careful about when we consider a function a "builtin" in C++. llvm-svn: 64561
* x86_64 ABI: Need to use canonical types when comparing againstDaniel Dunbar2009-02-141-2/+6
| | | | | | ASTContext types. llvm-svn: 64533
* x86_64 ABI: Pass simple types directly when possible. This isDaniel Dunbar2009-02-141-2/+32
| | | | | | | important for both keeping the generated LLVM simple and for ensuring that integer types are passed/promoted correctly. llvm-svn: 64529
* Make it possible for builtins to expression FILE* arguments, so thatDouglas Gregor2009-02-141-1/+4
| | | | | | | | we can define builtins such as fprintf, vfprintf, and __builtin___fprintf_chk. Give a nice error message when we need to implicitly declare a function like fprintf. llvm-svn: 64526
* fix rdar://6586493, a bug in codegen of the GNU Chris Lattner2009-02-131-9/+19
| | | | | | missing-?:-true-value extension. llvm-svn: 64505
* Implicitly declare certain C library functions (malloc, strcpy, memmove,Douglas Gregor2009-02-133-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | etc.) when we perform name lookup on them. This ensures that we produce the correct signature for these functions, which has two practical impacts: 1) When we're supporting the "implicit function declaration" feature of C99, these functions will be implicitly declared with the right signature rather than as a function returning "int" with no prototype. See PR3541 for the reason why this is important (hint: GCC always predeclares these functions). 2) If users attempt to redeclare one of these library functions with an incompatible signature, we produce a hard error. This patch does a little bit of work to give reasonable error messages. For example, when we hit case #1 we complain that we're implicitly declaring this function with a specific signature, and then we give a note that asks the user to include the appropriate header (e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In case #2, we show the type of the implicit builtin that was incorrectly declared, so the user can see the problem. We could do better here: for example, when displaying this latter error message we say something like: 'strcpy' was implicitly declared here with type 'char *(char *, char const *)' but we should really print out a fake code line showing the declaration, like this: 'strcpy' was implicitly declared here as: char *strcpy(char *, char const *) This would also be good for printing built-in candidates with C++ operator overloading. The set of C library functions supported by this patch includes all functions from the C99 specification's <stdlib.h> and <string.h> that (a) are predefined by GCC and (b) have signatures that could cause codegen issues if they are treated as functions with no prototype returning and int. Future work could extend this set of functions to other C library functions that we know about. llvm-svn: 64504
* Set constant bit on static block vars as well. Patch by Anders Johnson!qDaniel Dunbar2009-02-131-1/+1
| | | | llvm-svn: 64502
* Simplify predicate.Daniel Dunbar2009-02-131-3/+1
| | | | llvm-svn: 64500
* IRgen support for attribute used.Daniel Dunbar2009-02-133-8/+29
| | | | | | - PR3566 llvm-svn: 64492
* Pull MayDeferGeneration out of EmitGlobal.Daniel Dunbar2009-02-132-16/+39
| | | | | | | | - Fix emission of static functions with constructor attribute while I was here. <rdar://problem/6140899> [codegen] "static" and attribute-constructor interact poorly llvm-svn: 64488
* Rename EmitStatics (etc) to EmitDeferred; provide basic infrastructureDaniel Dunbar2009-02-132-20/+61
| | | | | | | for attribute used support. - No functionality change. llvm-svn: 64487
* Let the backend unique these.Mike Stump2009-02-133-6/+2
| | | | llvm-svn: 64486
* Fix spelling.Mike Stump2009-02-131-2/+2
| | | | llvm-svn: 64482
* Move DescriptorUniqueCount into CGM.Mike Stump2009-02-133-4/+5
| | | | llvm-svn: 64481
* Move NSConcreteStackBlock into CGM.Mike Stump2009-02-132-10/+26
| | | | llvm-svn: 64479
* Eliminate an unused variableDouglas Gregor2009-02-131-3/+0
| | | | llvm-svn: 64476
* Reflow to 80col.Mike Stump2009-02-131-91/+84
| | | | llvm-svn: 64475
* Move GlobalUniqueCount up into CGM.Mike Stump2009-02-133-5/+8
| | | | llvm-svn: 64473
* Fixed a 64bit code gen bug of a cateogoryFariborz Jahanian2009-02-131-11/+17
| | | | | | implementation with no category declaration! llvm-svn: 64470
* x86_64 ABI: Support va_arg passed in mixed registers.Daniel Dunbar2009-02-131-1/+22
| | | | | | - Now at 1274 passes on gcc compat suite vs 1262. llvm-svn: 64469
* Condense NSConcreteGlobalBlock handling.Mike Stump2009-02-132-19/+22
| | | | llvm-svn: 64461
* Calculate size correctly.Mike Stump2009-02-131-2/+3
| | | | llvm-svn: 64459
* Size should be unsigned.Mike Stump2009-02-131-7/+6
| | | | llvm-svn: 64458
* Condense all the blocks code into CGBlocks.cpp.Mike Stump2009-02-133-135/+134
| | | | llvm-svn: 64457
* Fixup types, the runtime uses int, not int32.Mike Stump2009-02-131-4/+9
| | | | llvm-svn: 64456
* Fix cmake builds.Mike Stump2009-02-131-0/+1
| | | | llvm-svn: 64455
* Fixup spacing a tad.Mike Stump2009-02-131-69/+67
| | | | llvm-svn: 64454
* Move GenericBlockLiteralType into CGM.Mike Stump2009-02-133-27/+31
| | | | llvm-svn: 64452
* Move BlockDescriptorType into CGM.Mike Stump2009-02-133-21/+26
| | | | llvm-svn: 64451
* Add CodeGen support for the nodebug attribute.Anders Carlsson2009-02-134-9/+17
| | | | llvm-svn: 64445
* Initial implementation of arbitrary fixed-width integer types. Eli Friedman2009-02-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently only used for 128-bit integers. Note that we can't use the fixed-width integer types for other integer modes without other changes because glibc headers redefines (u)int*_t and friends using the mode attribute. For example, this means that uint64_t has to be compatible with unsigned __attribute((mode(DI))), and uint64_t is currently defined to long long. And I have a feeling we'll run into issues if we try to define uint64_t as something which isn't either long or long long. This doesn't get the alignment right in most cases, including the 128-bit integer case; I'll file a PR shortly. The gist of the issue is that the targets don't really expose the information necessary to figure out the alignment outside of the target description, so there's a non-trivial amount of work involved in getting it working right. That said, the alignment used is conservative, so the only issue with the current implementation is ABI compatibility. This makes it trivial to add some sort of "bitwidth" attribute to make arbitrary-width integers; I'll do that in a followup. We could also use this for stuff like the following for compatibility with gcc, but I have a feeling it would be a better idea for clang to be consistent between C and C++ modes rather than follow gcc's example for C mode. struct {unsigned long long x : 33;} x; unsigned long long a(void) {return x.x+1;} llvm-svn: 64434
* Add mangling for variadic functions and conversion functionsDouglas Gregor2009-02-131-2/+8
| | | | llvm-svn: 64425
* Add basic support for C++ name mangling according to the Itanium C++Douglas Gregor2009-02-138-18/+597
| | | | | | | | | | | | | | | | ABI to the CodeGen library. Since C++ code-generation is so incomplete, we can't exercise much of this mangling code. However, a few smoke tests show that it's doing the same thing as GCC. When C++ codegen matures, we'll extend the ABI tester to verify name-mangling as well, and complete the implementation here. At this point, the major client of name mangling is in the uses of the new "overloadable" attribute in C, which allows overloading. Any "overloadable" function in C (or in an extern "C" block in C++) will be mangled the same way that the corresponding C++ function would be mangled. llvm-svn: 64413
* Honor attribute section on static block var decls.Daniel Dunbar2009-02-121-0/+4
| | | | llvm-svn: 64411
* Fix a bug whereby, an ivar used to synthesize a property belongsFariborz Jahanian2009-02-121-4/+25
| | | | | | to a base class (nonfragile abi ir gen bug). llvm-svn: 64391
* Initial codegen for block literals. This is a work in progress. I'veMike Stump2009-02-121-6/+142
| | | | | | | | tried to put FIXMEs on the most important things to fix up. Lots left to do including more codegen, more documentation and cleaning code and style cleanups. llvm-svn: 64390
* Add a very basic implemenation of global blocks. This needs to be cleaned up.Anders Carlsson2009-02-125-13/+153
| | | | llvm-svn: 64387
* Several cleanups:Steve Naroff2009-02-121-1/+1
| | | | | | | | - rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect. - add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time. - move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types). llvm-svn: 64385
* Support __attribute__(section(<name>))Daniel Dunbar2009-02-121-0/+6
| | | | llvm-svn: 64380
* x86_64: Initial varargs support.Daniel Dunbar2009-02-121-1/+153
| | | | | | | | | | | | | | | | | | | | | | | | | - Doesn't yet handle case where values are passed in mixed (general purpose & floating point) registers; otherwise largely functional. Code still needs some cleaning. Fixes: MultiSource/Applications/lua/lua MultiSource/Applications/siod/siod MultiSource/Applications/sqlite3/sqlite3 SingleSource/Regression/C/PR640 SingleSource/UnitTests/2003-07-09-SignedArgs SingleSource/UnitTests/2007-03-02-VaCopy gcc compat test suite results (Darwin x86-32 & -64): -- # of expected passes 1262 # of unexpected failures 56 # of unresolved testcases 34 # of unsupported tests 2 Compare to: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090209/012050.html llvm-svn: 64370
* Add support for generating block call expressions.Anders Carlsson2009-02-123-1/+140
| | | | llvm-svn: 64346
* Use EmitVAListRef instead of EmitLValue directly to handle array decayDaniel Dunbar2009-02-114-4/+3
| | | | | | case on x86_64. llvm-svn: 64333
* Support IRgen of va_arg of structure as l-value.Daniel Dunbar2009-02-112-2/+12
| | | | llvm-svn: 64325
* ir-gen for objc's @selector expression in nonfragile abi mode.Fariborz Jahanian2009-02-111-1/+26
| | | | llvm-svn: 64323
OpenPOWER on IntegriCloud