summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-2/+1
| | | | | | CodeGenModule. llvm-svn: 149943
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Simplify code by using the new getAggregateElement method that got addedChris Lattner2012-01-301-10/+4
| | | | | | | recently. This also conveniently gets clang ready for a change about to land in mainline. llvm-svn: 149225
* Use function pointers, rather than references, to pass DestroyersPeter Collingbourne2012-01-261-7/+3
| | | | | | | around, in the process cleaning up the various gcc/msvc compiler workarounds. llvm-svn: 149036
* Fixup r148926, for -Asserts.NAKAMURA Takumi2012-01-251-1/+1
| | | | llvm-svn: 148943
* reapply r148902:Chris Lattner2012-01-251-19/+11
| | | | | | | | | | "use the new ConstantVector::getSplat method where it makes sense." Also simplify a bunch of code to use the Builder->getInt32 instead of doing it the hard and ugly way. Much more progress could be made here, but I don't plan to do it. llvm-svn: 148926
* Fix a crash for an edge case of the GNU ?: extension.Eli Friedman2012-01-251-2/+2
| | | | llvm-svn: 148923
* Revert 148902 which was part of 148901 which was reverted in r148906.Argyrios Kyrtzidis2012-01-251-11/+19
| | | | | | | Original log: use the new ConstantVector::getSplat method where it makes sense. llvm-svn: 148907
* use the new ConstantVector::getSplat method where it makes sense.Chris Lattner2012-01-251-19/+11
| | | | llvm-svn: 148902
* Add an assertion that our use-marking actually covers all uses of a ↵Eli Friedman2012-01-211-0/+7
| | | | | | variable. The assertion doesn't cover quite as much as it should, but it's a good start, at least. llvm-svn: 148625
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-4/+0
| | | | llvm-svn: 148577
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-6/+31
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* implement rdar://10639962 by keeping track of increased alignment Chris Lattner2012-01-041-1/+5
| | | | | | information even in subscripting operations. llvm-svn: 147557
* Fix PR5279 - don't sliently drop alignment information on stores of types ↵Chris Lattner2011-12-191-1/+1
| | | | | | that have alignment less than the natural alignment of the type when it comes from a typedef. llvm-svn: 146908
* Switch LValue so that it exposes alignment in CharUnits. (No functional ↵Eli Friedman2011-12-031-18/+17
| | | | | | change.) llvm-svn: 145753
* Switch the Alignment argument on AggValueSlot over to CharUnits, per John's ↵Eli Friedman2011-12-031-4/+2
| | | | | | review comment. llvm-svn: 145741
* Track alignment in AggValueSlot. No functional change in this patch, but ↵Eli Friedman2011-12-031-6/+11
| | | | | | I'll be introducing uses of the specified alignment soon. llvm-svn: 145736
* Don't use a varargs convention for calls unprototyped functions where one of ↵Eli Friedman2011-12-011-1/+1
| | | | | | the arguments is an AVX vector. llvm-svn: 145574
* When destroying temporaries, instead of a custom cleanup use thePeter Collingbourne2011-11-271-1/+1
| | | | | | | | | | | generic pushDestroy function. This would reduce the number of useful declarations in CGTemporaries.cpp to one. Since CodeGenFunction::EmitCXXTemporary does not deserve its own file, move it to CGCleanup.cpp and delete CGTemporaries.cpp. llvm-svn: 145202
* Reference initialization with initializer lists.Sebastian Redl2011-11-271-1/+12
| | | | | | This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists. llvm-svn: 145186
* Use static storage duration for file-scope compound literals, even when theyRichard Smith2011-11-221-0/+5
| | | | | | appear in non-constant initializers in C++. llvm-svn: 145087
* Fix a bunch of really nasty bugs in how we compute alignment for reference ↵Eli Friedman2011-11-161-14/+28
| | | | | | lvalues. PR11376. llvm-svn: 144745
* Enter the cleanups for a block outside the enclosingJohn McCall2011-11-101-4/+11
| | | | | | | | | | | | full-expression. Naturally they're inactive before we enter the block literal expression. This restores the intended behavior that blocks belong to their enclosing scope. There's a useful -O0 / compile-time optimization that we're missing here with activating cleanups following straight-line code from their inactive beginnings. llvm-svn: 144268
* Bind function "r-values" as l-values when emitting them asJohn McCall2011-11-081-1/+1
| | | | | | opaque values. Silly C type system. llvm-svn: 144144
* Rip out CK_GetObjCProperty.John McCall2011-11-071-2/+0
| | | | llvm-svn: 143910
* Rip the ObjCPropertyRef l-value kind out of IR-generation.John McCall2011-11-071-35/+8
| | | | llvm-svn: 143908
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* back out changes in r143399 and r143475.Fariborz Jahanian2011-11-021-3/+1
| | | | | | | rvale-references are captured by reference in blocks. // rdar://9971124. llvm-svn: 143583
* Adds IRGen support for captured rvalue references in blocks.Fariborz Jahanian2011-10-311-1/+3
| | | | | | | In this case, temporary value is copied into block descriptor as their own copy to work on. // rdar://9971124 llvm-svn: 143399
* Annotate imprecise FP division with fpaccuracy metadataPeter Collingbourne2011-10-271-0/+16
| | | | | | | | | The OpenCL single precision division operation is only required to be accurate to 2.5ulp. Annotate the fdiv instruction with metadata which signals to the backend that an imprecise divide instruction may be used. llvm-svn: 143136
* Misc fixes for atomics. Biggest fix is doing alignment correctly for ↵Eli Friedman2011-10-141-8/+6
| | | | | | _Atomic types. llvm-svn: 142002
* Recommit:Eric Christopher2011-10-131-4/+2
| | | | | | | | | | | | | | | Start handling debug line and scope information better: Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 after fixing a few bugs that were exposed in gdb testsuite testing. llvm-svn: 141893
* Revert file/scope handling patches. gdb testing revealed a couple of bugs.Eric Christopher2011-10-121-2/+4
| | | | llvm-svn: 141796
* Start handling debug line and scope information better:Eric Christopher2011-10-111-4/+2
| | | | | | | | | | | Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 llvm-svn: 141732
* Silence some -Wuninitialized false positives with gcc.Eli Friedman2011-10-111-1/+2
| | | | llvm-svn: 141701
* Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman2011-10-111-0/+277
| | | | llvm-svn: 141632
* CUDA: IR generation support for kernel call expressionsPeter Collingbourne2011-10-061-0/+3
| | | | llvm-svn: 141300
OpenPOWER on IntegriCloud