summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* enhance some optimization logic to handle ConstantDataSequentialChris Lattner2012-01-311-9/+26
| | | | | | as well as ConstantArray. llvm-svn: 149347
* Placate gcc's -Wreturn-typeMatt Beaumont-Gay2012-01-271-0/+1
| | | | llvm-svn: 149104
* Use function pointers, rather than references, to pass DestroyersPeter Collingbourne2012-01-261-28/+20
| | | | | | | around, in the process cleaning up the various gcc/msvc compiler workarounds. llvm-svn: 149036
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-8/+8
| | | | | | | | | | | | | | | | | | - 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
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-141-2/+2
| | | | | | | | | | | | | | | | | | | | APValue::Array and APValue::MemberPointer. All APValue values can now be emitted as constants. Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other entrypoints dealing with constant member pointers are no longer necessary and will be removed in a later change. Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to VarDecl::evaluateValue. This performs caching and deals with the nasty cases in C++11 where a non-const object's initializer can refer indirectly to previously-initialized fields within the same object. Building the intermediate APValue object incurs a measurable performance hit on pathological testcases with huge initializer lists, so we continue to build IR directly from the Expr nodes for array and record types outside of C++11. llvm-svn: 148178
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-1/+0
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Unrevert r147271, reverted in r147361.Richard Smith2011-12-301-6/+7
| | | | | | | | | | | | Also temporarily remove the assumption from IR gen that we can emit IR for every constant we can fold, since it isn't currently true in C++11, to fix PR11676. Original comment from r147271: constexpr: perform zero-initialization prior to / instead of performing a constructor call when appropriate. Thanks to Eli for spotting this. llvm-svn: 147384
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-271-1/+0
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* Switch LValue so that it exposes alignment in CharUnits. (No functional ↵Eli Friedman2011-12-031-2/+2
| | | | | | change.) llvm-svn: 145753
* Introduce a module import declaration, so that we properly represent, e.g.,Douglas Gregor2011-12-021-0/+1
| | | | | | | | __import_module__ std.vector; in the AST. llvm-svn: 145725
* Fix wrong-code bug when a const automatic variable of struct type has both aRichard Smith2011-12-021-7/+10
| | | | | | | | | | | | mutable member and a constant initializer. We'd previously promoted such variables to global constants, resulting in nasal demons if the mutable member was modified. This is only a temporary fix. The subtle interplay between isConstantInitializer and CGExprConstant is very bug-prone; there are some other issues in this area which I will be addressing in subsequent, more major reworking of this code. llvm-svn: 145654
* The cheap version of getName() is sufficient here.Benjamin Kramer2011-11-291-1/+1
| | | | llvm-svn: 145399
* CodeGen: Simplify code.Benjamin Kramer2011-11-211-6/+3
| | | | llvm-svn: 145040
* CodeGen: allow __asm renaming on static local variables.Benjamin Kramer2011-11-201-1/+9
| | | | | | Fixes PR4777. llvm-svn: 145015
* Enter the cleanups for a block outside the enclosingJohn McCall2011-11-101-2/+4
| | | | | | | | | | | | 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
* Fix the alignment on scalar parameter variables so that it matches what the ↵Eli Friedman2011-11-031-1/+4
| | | | | | AST thinks it should be. Per report on cfe-dev. llvm-svn: 143645
* de-tmpify clang.Benjamin Kramer2011-09-271-3/+3
| | | | llvm-svn: 140637
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-4/+4
| | | | llvm-svn: 140367
* OpenCL: introduce support for function scope __local variablesPeter Collingbourne2011-09-191-0/+3
| | | | llvm-svn: 140068
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-1/+1
| | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
* Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: canJulien Lerouge2011-09-091-7/+8
| | | | | | | annotate global, local variables, struct fields, or arbitrary statements (using the __builtin_annotation), rdar://8037476. llvm-svn: 139423
* Track whether an AggValueSlot is potentially aliased, and do notJohn McCall2011-08-251-1/+2
| | | | | | | | | | emit call results into potentially aliased slots. This allows us to properly mark indirect return slots as noalias, at the cost of requiring an extra memcpy when assigning an aggregate call result into a l-value. It also brings us into compliance with the x86-64 ABI. llvm-svn: 138599
* Use stronger typing for the flags on AggValueSlot and requireJohn McCall2011-08-251-1/+3
| | | | | | | creators to tell us whether something needs GC barriers. No functionality change. llvm-svn: 138581
* blocks - capturing logic of byref block variable's expression Fariborz Jahanian2011-08-251-1/+17
| | | | | | | statement initializer makes safe assumption when a substatement is encounterred (with a fix me). llvm-svn: 138528
* Make constant aggregate constant initializers private linkage.Eric Christopher2011-08-241-1/+1
| | | | | | | | | After talking with John making this the case for all of these is the right way to go. Fixes rdar://9804564 and PR10414 llvm-svn: 138418
* Whitespace and 80-col cleanup.Eric Christopher2011-08-231-3/+2
| | | | llvm-svn: 138413
* Whitespace.Eric Christopher2011-08-231-45/+45
| | | | llvm-svn: 138404
* checking for __block variable captured by givenFariborz Jahanian2011-08-231-2/+9
| | | | | | | stmt expression, recursively walk down all substatements of the stmt expression. // rdar://10001085 llvm-svn: 138334
* block IRgen - Fixes a crash when determining if given block variableFariborz Jahanian2011-08-231-0/+3
| | | | | | is captured by a given statement expression. // rdar://10001085 llvm-svn: 138314
* Implement function template specialization at class scope extension in ↵Francois Pichet2011-08-141-0/+1
| | | | | | | | | | | | | | | | | Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization. Example: template <class T> class A { public: template <class U> void f(U p) { } template <> void f(int p) { } // <== class scope specialization }; This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code. BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error. llvm-svn: 137573
* Fix a couple of problems with initialization and assignment toJohn McCall2011-07-281-1/+1
| | | | | | | | | | | __block variables where the act of initialization/assignment itself causes the __block variable to be copied to the heap because the variable is of block type and is being assigned a block literal which captures the variable. rdar://problem/9814099 llvm-svn: 136337
* Rename getInstantiationLineNumber to getExpansionLineNumber in bothChandler Carruth2011-07-251-2/+1
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135969
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-3/+3
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to useJay Foad2011-07-221-4/+2
| | | | | | ArrayRef. llvm-svn: 135761
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-7/+7
| | | | llvm-svn: 135370
* Okay, that rule about zero-length arrays applies to destroyingJohn McCall2011-07-131-37/+32
| | | | | | them, too. llvm-svn: 135038
* Generalize Cleanup::Emit's "isForEH" parameter into a setJohn McCall2011-07-121-10/+11
| | | | | | of flags. No functionality change. llvm-svn: 134997
* Switch field destruction over to use the new destroyer-based APIJohn McCall2011-07-121-12/+27
| | | | | | and kill a lot of redundant code. llvm-svn: 134988
* Fix a lot of problems with the partial destruction of arrays:John McCall2011-07-111-67/+168
| | | | | | | | | | | - an off-by-one error in emission of irregular array limits for InitListExprs - use an EH partial-destruction cleanup within the normal array-destruction cleanup - get the branch destinations right for the empty check Also some refactoring which unfortunately obscures these changes. llvm-svn: 134890
* More compiler workarounds. I have to admit that I was notJohn McCall2011-07-091-4/+14
| | | | | | | | expecting so much concentrated oddity on what seemed like a trivial feature. Thanks to François Pichet for doing the MSVC legwork here. llvm-svn: 134813
* GCC 4.2 compatibility hack.John McCall2011-07-091-3/+4
| | | | llvm-svn: 134785
* A number of array-related IR-gen cleanups.John McCall2011-07-091-56/+214
| | | | | | | | | | | | - Emit default-initialization of arrays that were partially initialized with initializer lists with a loop, rather than emitting the default initializer N times; - support destroying VLAs of non-trivial type, although this is not yet exposed to users; and - support the partial destruction of arrays initialized with initializer lists when an initializer throws an exception. llvm-svn: 134784
* Don't zero-initialize default-initialized local variables that haveDouglas Gregor2011-07-011-1/+18
| | | | | | | | trivial default constructors. This generated-code regression was caused by r131796, which had simplified the handling of default initialization in Sema. Fixes <rdar://problem/9694300>. llvm-svn: 134260
* objc-arc: fix a IRGen crash when checking forFariborz Jahanian2011-06-291-1/+2
| | | | | | | accessibility of an initializer which is a compound statement. // rdar://9694706 llvm-svn: 134091
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-251-7/+8
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Honor objc_precise_lifetime in GC mode by feeding the valueJohn McCall2011-06-241-0/+20
| | | | | | | in the variable to an inline asm which gets run when the variable goes out of scope. llvm-svn: 133840
* Change the IR-generation of VLAs so that we capture bounds,John McCall2011-06-241-15/+13
| | | | | | | not sizes; so that we use well-typed allocas; and so that we properly recurse through the full set of variably-modified types. llvm-svn: 133827
* Remove dead variables.Benjamin Kramer2011-06-181-1/+0
| | | | llvm-svn: 133346
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-171-4/+38
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Restore correct use of GC barriers.John McCall2011-06-161-37/+41
| | | | llvm-svn: 133144
OpenPOWER on IntegriCloud