summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update Clang to reflect the move of MDBuilder in r160237.Chandler Carruth2012-07-151-1/+1
| | | | llvm-svn: 160238
* Distinguish more carefully between free functions and C++ instance methodsJohn McCall2012-07-071-2/+2
| | | | | | | | in the ABI arrangement, and leave a hook behind so that we can easily tweak CCs on platforms that use different CCs by default for C++ instance methods. llvm-svn: 159894
* Silence warning in -Asserts buildMatt Beaumont-Gay2012-07-031-0/+1
| | | | llvm-svn: 159635
* Share ConvertUTF8toWide() between Lex and CodeGen.Nico Weber2012-07-031-37/+2
| | | | llvm-svn: 159634
* Significantly simplify CGExprAgg's logic about ignored results:John McCall2012-07-021-6/+9
| | | | | | | | | | | | if we want to ignore a result, the Dest will be null. Otherwise, we must copy into it. This means we need to ensure a slot when loading from a volatile l-value. With all that in place, fix a bug with chained assignments into __block variables of aggregate type where we were losing insight into the actual source of the value during the second assignment. llvm-svn: 159630
* Propagate lvalue alignment into bitfields. Per report on cfe-dev.Eli Friedman2012-06-271-19/+18
| | | | llvm-svn: 159295
* Support L__FUNCTION__ in microsoft mode, PR11789Nico Weber2012-06-231-6/+95
| | | | | | | | | | Heavily based on a patch from Aaron Wishnick <aaron.s.wishnick@gmail.com>. I'll clean up the duplicated function in CodeGen as a follow-up, later today or tomorrow. llvm-svn: 159060
* Make the ".*" operator work correctly when the base is a prvalue and the ↵Eli Friedman2012-06-151-1/+30
| | | | | | field has a non-trivial copy constructor. PR13097. llvm-svn: 158578
* User better API for vla in compund literals.Fariborz Jahanian2012-06-071-4/+3
| | | | | | // rdar://11485774 llvm-svn: 158157
* When emitting compund literal of vla pointer elements, make Fariborz Jahanian2012-06-071-1/+5
| | | | | | | sure to emit vla size to prevent an irgen crash. // rdar://11485774 llvm-svn: 158153
* wire -fbounds-checking to the new LLVM bounds checking passNuno Lopes2012-05-221-1/+1
| | | | llvm-svn: 157262
* revert the usage of the objectsize intrinsic with 3 parameters (to match ↵Nuno Lopes2012-05-221-2/+1
| | | | | | LLVM r157255) llvm-svn: 157256
* Implement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and theRichard Smith2012-05-141-7/+14
| | | | | | expression is treated as an lvalue. llvm-svn: 156781
* update calls to objectsize intrinsic to match LLVM r156473Nuno Lopes2012-05-091-2/+3
| | | | | | add a test for -fbounds-checking code generation llvm-svn: 156474
* add -fbounds-checking option.Nuno Lopes2012-05-081-1/+1
| | | | | | | | When enabled, clang generates bounds checks for array and pointers dereferences. Work to follow in LLVM's backend. OK'ed by Chad; thanks for the review. llvm-svn: 156431
* remove code to add bound checks for simple array accesses, since those are ↵Nuno Lopes2012-05-071-25/+0
| | | | | | | | already covered by the check with the objectsize builtin remove the comparison of objectsize with -1. since it's an unsigned comparison, it will always succeed if objectsize returns -1, which is enough to have the check removed llvm-svn: 156311
* Push variable declaration into nested scope (the only place where it is ↵Ted Kremenek2012-05-011-3/+1
| | | | | | used). Found by static analyzer. llvm-svn: 155922
* Abstract the emission of global destructors into ABI-specific codeJohn McCall2012-05-011-1/+1
| | | | | | | | | | | | | and only consider using __cxa_atexit in the Itanium logic. The default logic is to use atexit(). Emit "guarded" initializers in Microsoft mode unconditionally. This is definitely not correct, but it's closer to correct than just not emitting the initializer. Based on a patch by Timur Iskhodzhanov! llvm-svn: 155894
* Adjust for LLVM name tweaks requested by Chandler.Duncan Sands2012-04-161-3/+3
| | | | llvm-svn: 154824
* Propagate alignment on lvalues through EmitLValueForField. PR12395.Eli Friedman2012-04-161-47/+49
| | | | llvm-svn: 154789
* Use MDBuilder to help with metadata creation.Duncan Sands2012-04-151-10/+3
| | | | llvm-svn: 154767
* Rename "fpaccuracy" metadata to the more generic "fpmath". That's because I'mDuncan Sands2012-04-141-2/+1
| | | | | | | | | thinking of generalizing it to be able to specify other freedoms beyond accuracy (such as that NaN's don't have to be respected). I'd like the 3.1 release (the first one with this metadata) to have the more generic name already rather than having to auto-upgrade it in 3.2. llvm-svn: 154745
* Step forward with supporting of ARM homogenous aggregates:Anton Korobeynikov2012-04-131-0/+13
| | | | | | | - Handle unions - Handle C++ classes llvm-svn: 154664
* Implement __atomic_fetch_nand and __atomic_nand_fetch to complete our set ofRichard Smith2012-04-131-1/+11
| | | | | | GNU __atomic builtins. llvm-svn: 154659
* Implement the missing pieces needed to support libstdc++4.7's <atomic>:Richard Smith2012-04-131-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | __atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_* predefined macros. Implement library fallback for __atomic_is_lock_free and __c11_atomic_is_lock_free, and implement __atomic_always_lock_free. Contrary to their documentation, GCC's __atomic_fetch_add family don't multiply the operand by sizeof(T) when operating on a pointer type. libstdc++ relies on this quirk. Remove this handling for all but the __c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins. Contrary to their documentation, __atomic_test_and_set and __atomic_clear take a first argument of type 'volatile void *', not 'void *' or 'bool *', and __atomic_is_lock_free and __atomic_always_lock_free have an argument of type 'const volatile void *', not 'void *'. With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite, except for a couple of libstdc++ bugs and some cases where libc++'s test suite tests for properties which implementations have latitude to vary. llvm-svn: 154640
* Fix some i1/i8 confusion within _Atomic(bool) in IR generation, bothDouglas Gregor2012-04-121-5/+9
| | | | | | | | | | | | | | in general (such an atomic has boolean representation) and specifically for IR generation of __c11_atomic_init. The latter also means actually using initialization semantics for this initialization, rather than just creating a store. On a related note, make sure we actually put in non-atomic-to-atomic conversions when performing an implicit conversion sequence. IR generation is far too kind here, but we still want the ASTs to make sense. llvm-svn: 154612
* Implement support for 18 of the GNU-compatible __atomic builtins.Richard Smith2012-04-121-50/+175
| | | | | | | | | | | | This is not quite sufficient for libstdc++'s <atomic>: we still need __atomic_test_and_set and __atomic_clear, and may need a more complete __atomic_is_lock_free implementation. We are also missing an implementation of __atomic_always_lock_free, __atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed for libstdc++. llvm-svn: 154579
* Make __atomic_init() (soon to be __c11_atomic_init()) work with non-scalar ↵David Chisnall2012-04-111-4/+15
| | | | | | types. llvm-svn: 154507
* Express the number of ULPs in fpaccuracy metadata as a real rather than a Duncan Sands2012-04-101-7/+4
| | | | | | rational number, eg as 2.5 rather than 5, 2. OK'd by Peter Collingbourne. llvm-svn: 154388
* Call out to GCC-compatible runtime functions for atomic ops that we can't useDavid Chisnall2012-03-291-34/+61
| | | | | | | | | | | | | | LLVM intrinsics for. I have an implementation of these functions, which wants to go in a libgcc_s equivalent in compiler-rt. It's currently here: http://people.freebsd.org/~theraven/atomic.c It will be committed to compiler-rt as soon as I work out where would be a sensible place to put it... llvm-svn: 153666
* Revert r153613 as it's causing large compile-time regressions on the nightly ↵Chad Rosier2012-03-291-9/+10
| | | | | | testers. llvm-svn: 153660
* When we can't prove that the target of an aggregate copy isJohn McCall2012-03-281-10/+9
| | | | | | | a complete object, the memcpy needs to use the data size of the structure instead of its sizeof() value. Fixes PR12204. llvm-svn: 153613
* Move the emission of strict enum range metadata behind a flag (the sameChandler Carruth2012-03-271-2/+3
| | | | | | | | | | | | | | | | | | | | | flag as GCC uses: -fstrict-enums). There is a *lot* of code making unwarranted assumptions about the underlying type of enums, and it doesn't seem entirely reasonable to eagerly break all of it. Much more importantly, the current state of affairs is *very* good at optimizing based upon this information, which causes failures that are very distant from the actual enum. Before we push for enabling this by default, I think we need to implement -fcatch-undefined-behavior support for instrumenting and trapping whenever we store or load a value outside of the range. That way we can track down the misbehaving code very quickly. I discussed this with Rafael, and currently the only important cases he is aware of are the bool range-based optimizations which are staying hard enabled. We've not seen any issue with those either, and they are much more important for performance. llvm-svn: 153550
* Add back r153360 with a fix for enums that cover all the 32 bit values.Rafael Espindola2012-03-241-8/+62
| | | | | | Thanks to NAKAMURA Takumi for finding it! llvm-svn: 153383
* Revert r153360 (and r153380), "Second part of PR12251. Produce the range ↵NAKAMURA Takumi2012-03-241-61/+8
| | | | | | | | | | metadata in clang for booleans and". For i686 targets (eg. cygwin), I saw "Range must not be empty!" in verifier. It produces (i32)[0x80000000:0x80000000) from (uint64_t)[0xFFFFFFFF80000000ULL:0x0000000080000000ULL), for signed i32 on MDNode::Range. llvm-svn: 153382
* Second part of PR12251. Produce the range metadata in clang for booleans andRafael Espindola2012-03-241-8/+61
| | | | | | c++ enums. llvm-svn: 153360
* Make sure we correctly set the alignment for vector loads and stores ↵Eli Friedman2012-03-221-14/+27
| | | | | | associated with vector element lvalues. Patch by Kevin Schoedel (with some minor modifications by me). llvm-svn: 153285
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-10/+10
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-23/+18
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Unify the BlockDeclRefExpr and DeclRefExpr paths so thatJohn McCall2012-03-101-0/+116
| | | | | | | | we correctly emit loads of BlockDeclRefExprs even when they don't qualify as ODR-uses. I think I'm adequately convinced that BlockDeclRefExpr can die. llvm-svn: 152479
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* Generate an AST for the conversion from a lambda closure type to aDouglas Gregor2012-02-221-1/+2
| | | | | | | | | | | | | | | block pointer that returns a block literal which captures (by copy) the lambda closure itself. Some aspects of the block literal are left unspecified, namely the capture variable (which doesn't actually exist) and the body (which will be filled in by IRgen because it can't be written as an AST). Because we're switching to this model, this patch also eliminates tracking the copy-initialization expression for the block capture of the conversion function, since that information is now embedded in the synthesized block literal. -1 side tables FTW. llvm-svn: 151131
* Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,Richard Smith2012-02-181-3/+4
| | | | | | rather than an lvalue referring to the scalar. llvm-svn: 150889
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-7/+6
| | | | | | | | | | | | | | | | | | | | | optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
* Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall2012-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | | is general goodness because representations of member pointers are not always equivalent across member pointer types on all ABIs (even though this isn't really standard-endorsed). Take advantage of the new information to teach IR-generation how to do these reinterprets in constant initializers. Make sure this works when intermingled with hierarchy conversions (although this is not part of our motivating use case). Doing this in the constant-evaluator would probably have been better, but that would require a *lot* of extra structure in the representation of constant member pointers: you'd really have to track an arbitrary chain of hierarchy conversions and reinterpretations in order to get this right. Ultimately, this seems less complex. I also wasn't quite sure how to extend the constant evaluator to handle foldings that we don't actually want to treat as extended constant expressions. llvm-svn: 150551
* Use a simpler (and more efficient) pattern to pad vectors.Benjamin Kramer2012-02-141-4/+2
| | | | llvm-svn: 150475
* Basic support for referring to captured variables from lambdas. Some simple ↵Eli Friedman2012-02-111-0/+6
| | | | | | examples seem to work. Tests coming up soon. llvm-svn: 150293
* Refactor lambda IRGen so AggExprEmitter::VisitLambdaExpr does the right thing.Eli Friedman2012-02-091-46/+1
| | | | llvm-svn: 150146
* Basic IRGen for LambdaExprs with captures.Eli Friedman2012-02-091-3/+46
| | | | llvm-svn: 150141
* A little bit of lambda IRGen.Eli Friedman2012-02-081-0/+11
| | | | llvm-svn: 150058
OpenPOWER on IntegriCloud