summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Some code simplification. ir gen for gc'able arrayFariborz Jahanian2009-02-191-9/+11
| | | | | | of objects in objc. llvm-svn: 64992
* Address Chris's comments regarding C++ name mangling.Douglas Gregor2009-02-181-1/+1
| | | | llvm-svn: 64984
* Some refactoring and simplificaiotn of objc's gcFariborz Jahanian2009-02-181-17/+10
| | | | | | ir gen. llvm-svn: 64954
* Start generating gc'able code using the newFariborz Jahanian2009-02-181-25/+16
| | | | | | objc gc type attributes. llvm-svn: 64935
* Cleanup objc's gc attributes code no longer needed.Fariborz Jahanian2009-02-181-2/+10
| | | | | | | | This make warn-weak-field.m to fail (subject of a followup patch). attr-objc-gc.m no passes. llvm-svn: 64925
* 80-cols.Daniel Dunbar2009-02-171-9/+11
| | | | llvm-svn: 64779
* Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.Daniel Dunbar2009-02-161-1/+1
| | | | | | | | | | | | | | | | - Define pow[lf]?, sqrt[lf]? as builtins. - Add -fmath-errno option which binds to LangOptions.MathErrno - Add new builtin flag Builtin::Context::isConstWithoutErrno for functions which can be marked as const if errno isn't respected for math functions. Sema automatically marks these functions as const when they are defined, if MathErrno=0. - IRgen uses const attribute on sqrt and pow library functions to decide if it can use the llvm intrinsic. llvm-svn: 64689
* fix volatile handling with ExtVectorElementExpr, so that weChris Lattner2009-02-161-8/+7
| | | | | | | | | | | emit two volatile loads for: typedef __attribute__(( ext_vector_type(4) )) float float4; float test(volatile float4 *P) { return P->x+P->y; } llvm-svn: 64683
* introduce and use a new ExtVectorElementExpr::isArrow method, at Eli's ↵Chris Lattner2009-02-161-4/+5
| | | | | | suggestion llvm-svn: 64681
* enhance ExtVectorElementExpr to allow V->xxyy to work like (*V).xxyyChris Lattner2009-02-161-8/+12
| | | | llvm-svn: 64667
* Add hook to add attributes to function declarations that we knowDouglas Gregor2009-02-141-1/+1
| | | | | | | | | | | | | | | | 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
* Implicitly declare certain C library functions (malloc, strcpy, memmove,Douglas Gregor2009-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add basic support for C++ name mangling according to the Itanium C++Douglas Gregor2009-02-131-1/+1
| | | | | | | | | | | | | | | | 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
* Add support for generating block call expressions.Anders Carlsson2009-02-121-1/+1
| | | | llvm-svn: 64346
* Support IRgen of va_arg of structure as l-value.Daniel Dunbar2009-02-111-1/+9
| | | | llvm-svn: 64325
* Some refactoring of Ivar offset code gen.Fariborz Jahanian2009-02-101-11/+1
| | | | | | in preparation for nonfragile ivar offset work. llvm-svn: 64225
* Add util Emit{LoadOf,StoreTo}Scalar methods to encapsulate conversionDaniel Dunbar2009-02-101-23/+38
| | | | | | | from LLVM memory type to/from LLVM temporary type. - No intended functionality change. llvm-svn: 64191
* Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.Daniel Dunbar2009-02-051-10/+14
| | | | llvm-svn: 63845
* ir-gen for nonfragile ivar bitfield access (objc2 nonfragile abi).Fariborz Jahanian2009-02-031-16/+8
| | | | llvm-svn: 63644
* objc2's ir-gen for nonfragile ivar access.Fariborz Jahanian2009-02-031-4/+9
| | | | llvm-svn: 63578
* Thread CGFunctionInfo construction through CodeGenTypes.Daniel Dunbar2009-02-021-1/+2
| | | | | | - Inefficient & leaks memory currently, will be cleaned up subsequently. llvm-svn: 63567
* More ABI API cleanup.Daniel Dunbar2009-02-021-1/+1
| | | | | | | - Lift CGFunctionInfo creation above ReturnTypeUsesSret and EmitFunction{Epi,Pro}log. llvm-svn: 63553
* ABI handling API changes.Daniel Dunbar2009-02-021-1/+1
| | | | | | | | | | | - Lift CGFunctionInfo creation up to callers of EmitCall. - Move isVariadic bit out of CGFunctionInfo, take as argument to GetFunctionType instead. No functionality change. llvm-svn: 63550
* Refactored code gen for ivar access in preparation forFariborz Jahanian2009-02-021-1/+2
| | | | | | objc2 nonfragile ivar access code gen. llvm-svn: 63541
* Vector codegen improvementsNate Begeman2009-01-181-40/+59
| | | | llvm-svn: 62458
* Patch to implement code gen for aggrgate-valued property usedFariborz Jahanian2009-01-121-0/+8
| | | | | | to access a field of its type. llvm-svn: 62123
* Implement EmitUnsupportedRValue to generate an appropriately typed RValue.Daniel Dunbar2009-01-091-3/+13
| | | | llvm-svn: 62004
* Give "unsupported" error on calls through block pointers instead ofDaniel Dunbar2009-01-091-6/+22
| | | | | | crashes. llvm-svn: 61992
* Add QualifiedDeclRefExpr, which retains additional source-locationDouglas Gregor2009-01-061-1/+3
| | | | | | | | | | | | | | | | | | | information for declarations that were referenced via a qualified-id, e.g., N::C::value. We keep track of the location of the start of the nested-name-specifier. Note that the difference between QualifiedDeclRefExpr and DeclRefExpr does have an effect on the semantics of function calls in two ways: 1) The use of a qualified-id instead of an unqualified-id suppresses argument-dependent lookup 2) If the name refers to a virtual function, the qualified-id version will call the function determined statically while the unqualified-id version will call the function determined dynamically (by looking up the appropriate function in the vtable). Neither of these features is implemented yet, but we do print out qualified names for QualifiedDeclRefExprs as part of the AST printing. llvm-svn: 61789
* Add ASTContext::getBaseElementType and use it in ↵Anders Carlsson2008-12-211-6/+1
| | | | | | CodeGenFunction::EmitArraySubscriptExpr. llvm-svn: 61303
* Handle VLA indexingAnders Carlsson2008-12-211-2/+19
| | | | llvm-svn: 61295
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-1/+3
| | | | | | | | | | which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
* Removed a slot in ObjCMemRegExpr used inFariborz Jahanian2008-12-181-2/+2
| | | | | | code gen which did not belong there. llvm-svn: 61203
* Code gen. for ivar references; including bitfieldFariborz Jahanian2008-12-151-29/+37
| | | | | | ivars. llvm-svn: 61043
* Fix rdar://6095061 - gcc allows __builtin_choose_expr as an lvalueChris Lattner2008-12-121-0/+6
| | | | llvm-svn: 60924
* Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner2008-11-241-1/+1
| | | | | | | | | | | uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
* Implemented ir-gen for 'implicit' properties using the new AST nodes.Fariborz Jahanian2008-11-221-0/+26
| | | | llvm-svn: 59886
* Fields of ivars of struct types are considered ivarsFariborz Jahanian2008-11-211-2/+7
| | | | | | themselves for gc API generation purposes. llvm-svn: 59828
* Support generation of objc_assign_ivar for ivarFariborz Jahanian2008-11-201-3/+9
| | | | | | write-barriers. llvm-svn: 59748
* Added a test case for __weak field decls. Change SetVarDeclObjCAttributeFariborz Jahanian2008-11-201-8/+9
| | | | | | to static function. Added comments. llvm-svn: 59738
* More objc gc stuff. Read/Write barriers for local static/extern,Fariborz Jahanian2008-11-201-17/+45
| | | | | | | diagnostics on use of __weak attribute on fields, Early support for read/write barriers for objc fields. llvm-svn: 59682
* More of objective-c's gc code-gen. Treat objective-cFariborz Jahanian2008-11-191-0/+6
| | | | | | objects as __strong when attribute unspecified. llvm-svn: 59654
* Few more changes due to Daniel's feedback.Fariborz Jahanian2008-11-191-17/+17
| | | | llvm-svn: 59645
* Fix redundant load of bit-fields on assignment (to get the updatedDaniel Dunbar2008-11-191-3/+23
| | | | | | | | | value). - Use extra argument to EmitStoreThroughLValue to provide place to write update bit-field value if caller requires it. - This fixes several FIXMEs. llvm-svn: 59615
* Generate strong write barriers for __strong objects.Fariborz Jahanian2008-11-191-6/+13
| | | | | | Also, took care of Daniel's commments. llvm-svn: 59575
* Patch for generation of weak write barriers for objcFariborz Jahanian2008-11-181-1/+9
| | | | | | __weak objects. llvm-svn: 59560
* Generate objc_read_weak for __weak objc loads.Fariborz Jahanian2008-11-181-0/+8
| | | | llvm-svn: 59553
* Some basic support toward objective-c's GC code gen.Fariborz Jahanian2008-11-181-2/+8
| | | | llvm-svn: 59543
* Add a new expression node, CXXOperatorCallExpr, which expresses aDouglas Gregor2008-11-141-1/+3
| | | | | | | | | | | | | | | | | | | function call created in response to the use of operator syntax that resolves to an overloaded operator in C++, e.g., "str1 + str2" that resolves to std::operator+(str1, str2)". We now build a CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But only for binary operators, where we actually implement overloading) I decided *not* to refactor the current CallExpr to make it abstract (with FunctionCallExpr and CXXOperatorCallExpr as derived classes). Doing so would allow us to make CXXOperatorCallExpr a little bit smaller, at the cost of making the argument and callee accessors virtual. We won't know if this is going to be a win until we can parse lots of C++ code to determine how much memory we'll save by making this change vs. the performance penalty due to the extra virtual calls. llvm-svn: 59306
* Easy IRgen improvement for bitfields, don't emit x >> 0.Daniel Dunbar2008-11-131-2/+3
| | | | | | | - Logic such as this quite possibly should be optional builder behavior. llvm-svn: 59213
OpenPOWER on IntegriCloud