summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
Commit message (Collapse)AuthorAgeFilesLines
* implement __sync_synchronize and __sync_lock_release,Chris Lattner2009-05-131-3/+15
| | | | | | rdar://6880573 llvm-svn: 71637
* add support for __sync_nand_and_fetch and __sync_fetch_and_nand,Chris Lattner2009-05-131-2/+20
| | | | | | rdar://6880573 llvm-svn: 71636
* reimplement __sync_* builtins to be variadic and to follow the sameChris Lattner2009-05-081-18/+94
| | | | | | | | | semantic rules that gcc and icc use. This implements the variadic and concrete versions as builtins and has sema do the disambiguation. There are probably a bunch of details to finish up but this seems like a large monotonic step forward :) llvm-svn: 71212
* PR4134: Implement __builtin_extract_return_addr.Eli Friedman2009-05-031-1/+4
| | | | llvm-svn: 70794
* Remove getIntegerConstantExprValue in favor of using EvaluateAsInt.Eli Friedman2009-04-261-2/+1
| | | | llvm-svn: 70145
* fix incorrect lowering of __builtin_ia32_shufpd, rdar://6803924Chris Lattner2009-04-181-1/+2
| | | | llvm-svn: 69428
* Update to use hasAttr() instead of getAttr().Daniel Dunbar2009-04-131-2/+2
| | | | | | - No functionality change. llvm-svn: 68987
* Add a destination type argument to EmitConstantExpr. This will be used for ↵Anders Carlsson2009-04-081-1/+1
| | | | | | when the destination has a reference type. (No functionality change yet) llvm-svn: 68593
* Implement __sync_{add,sub,and,or,xor}_and_fetch andDaniel Dunbar2009-04-071-9/+59
| | | | | | | | __sync_bool_compare_and_swap. - <rdar://problem/6762223> [sema/irgen] support __sync_bool_compare_and_swap and __sync_add_and_fetch llvm-svn: 68482
* Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.Daniel Dunbar2009-02-161-1/+30
| | | | | | | | | | | | | | | | - 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 IRgen of __builtin_memset.Daniel Dunbar2009-02-161-1/+2
| | | | | | - Fix test case to not only have negative tests. llvm-svn: 64674
* Implicitly declare certain C library functions (malloc, strcpy, memmove,Douglas Gregor2009-02-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use EmitVAListRef instead of EmitLValue directly to handle array decayDaniel Dunbar2009-02-111-1/+1
| | | | | | case on x86_64. llvm-svn: 64333
* Reapply Daniel's patch to match up with llvm 63765.Dale Johannesen2009-02-051-6/+3
| | | | | | Untested, Daniel or Nate please review. llvm-svn: 63814
* Chase LLVM TOT in circles (i.e., revert r63773 to match revert ofDaniel Dunbar2009-02-041-3/+6
| | | | | | r63765). llvm-svn: 63795
* (llvm up) Update for intrinsic lookup changes.Daniel Dunbar2009-02-041-6/+3
| | | | llvm-svn: 63773
* Make the constant folder aware of Eli Friedman2009-01-251-2/+2
| | | | | | | __builtin___CFStringMakeConstantString. (We get into trouble in GenerateStaticBlockVarDecl if the constant folder isn't accurate.) llvm-svn: 62949
* Slight cleanup, and fix for va_arg on architectures where va_list is a Eli Friedman2009-01-201-14/+3
| | | | | | struct. llvm-svn: 62585
* Do codegen correctly for va_start/end/copy on architectures where Eli Friedman2009-01-201-4/+14
| | | | | | | | | va_list is a struct, like x86-64. If anyone has a better idea for how to do the check in the if statements, suggestions are welcome. llvm-svn: 62582
* Fix for PR3350: add special-casing for "references" to va_lists in Eli Friedman2009-01-201-5/+1
| | | | | | | | builtins. Also, a minor tweak to va_copy for consistency. llvm-svn: 62574
* Vector codegen improvementsNate Begeman2009-01-181-0/+2
| | | | llvm-svn: 62458
* Generate code for __builtin_ia32_pshufwAnders Carlsson2008-12-221-0/+7
| | | | llvm-svn: 61324
* Use the new Expr::EvaluateAnders Carlsson2008-12-011-5/+5
| | | | llvm-svn: 60321
* rename Expr::tryEvaluate to Expr::Evaluate.Chris Lattner2008-11-161-1/+1
| | | | llvm-svn: 59426
* Fix bug in va_copyAnders Carlsson2008-11-041-1/+1
| | | | llvm-svn: 58680
* Fix for PR2966: va_start/va_end use the *address* of the Eli Friedman2008-10-291-1/+1
| | | | | | | | | | | va_list, not the value. Patch fixes an assert on x86-64 and a wrong-code bug on x86. I'm not completely sure, but I think it's a regression from r58306. Does anyone run regression tests regularly on x86-64? The crash should have been picked up there. llvm-svn: 58366
* Added pinsrd, pinsrq, and some other vector intrinsicsMon P Wang2008-10-151-0/+4
| | | | llvm-svn: 57563
* Lift EmitTargetBuiltinExpr out of EmitBuiltinExpr.Daniel Dunbar2008-10-101-8/+11
| | | | llvm-svn: 57335
* Make sema and codegen allow __builtin___CFStringMakeConstantString as a validChris Lattner2008-10-061-17/+2
| | | | | | | constant lvalue. Implement this in codegen by moving the code out of CGBuiltin into EmitConstantExpr. llvm-svn: 57163
* always try to fold a builtin before emitting it. In the futureChris Lattner2008-10-061-18/+5
| | | | | | | it is possible that a builtin could sometimes be folded (e.g. __builtin_clz) if it's operand is a constant. llvm-svn: 57161
* Move handling of __builtin_nan("") out of CGBuiltin.cpp into ExprConstant.cppChris Lattner2008-10-061-18/+5
| | | | llvm-svn: 57157
* remove some code where CGBuiltin folds constants, and use tryEvaluate toChris Lattner2008-10-061-22/+19
| | | | | | | do it instead. We should still handle __builtin_nan etc, but don't yet. This fixes incorrect evaluation of __builtin_constant_p, a FIXME. llvm-svn: 57156
* Added support for sse intrinsics loadlpd, loadhpd, muldq128, and mulld128Mon P Wang2008-09-301-0/+7
| | | | llvm-svn: 56830
* Add __builtin_object_size support.Daniel Dunbar2008-09-031-0/+10
| | | | | | | - Currently CodeGen always returns a conservative value for this (-1 or 0 depending on the context). llvm-svn: 55735
* Simplify some calls to Builder.CreateCallAnders Carlsson2008-08-301-5/+4
| | | | llvm-svn: 55567
* Change WarnUnsupported to ErrorUnsupported (in name and in practice).Daniel Dunbar2008-08-161-1/+1
| | | | | | | - We are beyond the point where this shows up often and when it does generating miscompiled files is bad. llvm-svn: 54836
* More #include cleaningDaniel Dunbar2008-08-111-4/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | | - Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h - Moved Sema::getCurMethodDecl() out of line (dependent on ObjCMethodDecl via dyn_cast). llvm-svn: 54629
* Updated to match new atomic names (to enable overloading for pointers toMon P Wang2008-07-311-4/+8
| | | | | | different address spaces) for llvm r54195. llvm-svn: 54241
* X86 builtin fixesNate Begeman2008-07-251-32/+10
| | | | llvm-svn: 54049
* don't depend on the result of CreateNeg to be a binopChris Lattner2008-07-231-3/+3
| | | | llvm-svn: 53948
* Implement bzero, memset, memmove builtins.Daniel Dunbar2008-07-221-10/+31
| | | | | | | This subsumes Nico Weber's patch and implements bzero in terms of llvm.memset to match llvm-gcc. llvm-svn: 53888
* Implement nans, prefetch, and trap builtins. Daniel Dunbar2008-07-211-1/+15
| | | | | | | This closes <rdar://problem/6080720>, support for __builtin_constant_p has been filed separately. llvm-svn: 53885
* Kill an unused variable warningDaniel Dunbar2008-07-211-3/+0
| | | | llvm-svn: 53878
* Add __builtin_powi[fl] supportDaniel Dunbar2008-07-211-0/+14
| | | | llvm-svn: 53866
* Implement ffs, parity, and popcount builtins.Daniel Dunbar2008-07-211-2/+55
| | | | | | + test case llvm-svn: 53851
* Add support shufpdMon P Wang2008-07-181-0/+4
| | | | llvm-svn: 53747
* Codegen support for __builtin_stdarg_startChris Lattner2008-07-091-2/+3
| | | | llvm-svn: 53329
* Make a few related changes:Chris Lattner2008-06-301-76/+91
| | | | | | | | | | | | | | 1) add a new ASTContext::getFloatTypeSemantics method. 2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places. 3) Change the TargetInfo.h get*Format methods to return their fltSemantics byref instead of by pointer. 4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which sometimes expand specially and othertimes fall back to libm. 5) Add support for __builtin_nan("") to codegen, cases that don't pass in an empty string are currently lowered to libm calls. 6) Fix codegen of __builtin_infl. llvm-svn: 52914
* Updated atomic intrinsic name from llvm r52706. Fixed dropped bit in shufps.Mon P Wang2008-06-251-4/+4
| | | | llvm-svn: 52707
OpenPOWER on IntegriCloud