aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
AgeCommit message (Collapse)Author
2010-06-23polish the -finstrument-functions implementation, patch by Nelson Elhage!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22implement support for -finstrument-functions, patch by NelsonChris Lattner
Elhage! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-08Rename __tcf_ to __cxx_global_array_dtor. Remove the ↵Anders Carlsson
UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105648 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25Improve name mangling for blocks and support mangling of static localDouglas Gregor
variables within blocks. We loosely follow GCC's mangling, but since these are always internal symbols the names don't really matter. I intend to revisit block mangling later, because GCC's mangling is rather verbose. <rdar://problem/8015719>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104610 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22Re-land the fix for PR7139.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21Unbreak self-host.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle ↵Anders Carlsson
setting null data member pointers correctly. Fixes PR7139. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03Don't copy or initialize empty classes. Fixes PR7012.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102891 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01Complete reimplementation of the synthesis for implicitly-defined copyDouglas Gregor
assignment operators. Previously, Sema provided type-checking and template instantiation for copy assignment operators, then CodeGen would synthesize the actual body of the copy constructor. Unfortunately, the two were not in sync, and CodeGen might pick a copy-assignment operator that is different from what Sema chose, leading to strange failures, e.g., link-time failures when CodeGen called a copy-assignment operator that was not instantiation, run-time failures when copy-assignment operators were overloaded for const/non-const references and the wrong one was picked, and run-time failures when by-value copy-assignment operators did not have their arguments properly copy-initialized. This implementation synthesizes the implicitly-defined copy assignment operator bodies in Sema, so that the resulting ASTs encode exactly what CodeGen needs to do; there is no longer any special code in CodeGen to synthesize copy-assignment operators. The synthesis of the body is relatively simple, and we generate one of three different kinds of copy statements for each base or member: - For a class subobject, call the appropriate copy-assignment operator, after overload resolution has determined what that is. - For an array of scalar types or an array of class types that have trivial copy assignment operators, construct a call to __builtin_memcpy. - For an array of class types with non-trivial copy assignment operators, synthesize a (possibly nested!) for loop whose inner statement calls the copy constructor. - For a scalar type, use built-in assignment. This patch fixes at least a few tests cases in Boost.Spirit that were failing because CodeGen picked the wrong copy-assignment operator (leading to link-time failures), and I suspect a number of undiagnosed problems will also go away with this change. Some of the diagnostics we had previously have gotten worse with this change, since we're going through generic code for our type-checking. I will improve this in a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13Fix debug info for cleanup block.Devang Patel
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang
field to memcpy, memmove, and memset. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100305 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02Revert r100193 since it causes failures in objc in clangMon P Wang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02Reapply patch for adding support for address spaces and added a isVolatile ↵Mon P Wang
field to memcpy, memmove, and memset. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.Bob Wilson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30Added support for address spaces and added a isVolatile field to memcpy, ↵Mon P Wang
memmove, and memset git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30the big refactoring bits of PR3782.Rafael Espindola
This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23Rename CGVtableInfo to CodeGenVTables in preparation of adding another ↵Anders Carlsson
VTableInfo class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21Eliminate the default arguments to ASTContext::getFunctionType(),Douglas Gregor
fixing up a few callers that thought they were propagating NoReturn information but were in fact saying something about exception specifications. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19More refactoring around constructor/destructor code generation.John McCall
Fix some bugs with function-try-blocks and simplify normal try-block code generation. This implementation excludes a deleting destructor's call to operator delete() from the function-try-block, which I believe is correct but which I can't find straightforward support for at a moment's glance. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96670 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18Make deleting and complete dtor variants defer to other dtor variants byJohn McCall
calling them as subroutines. This triggers whenever the alias optimization doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases or it's the deleting dtor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18Extract out function-body code generation into its own method. No functionalityJohn McCall
change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16IRgen optimization: cache the value of 'this' and 'vtt' instead ofJohn McCall
repeatedly reloading from an alloca. We still need to create the alloca for debug info purposes (although we currently create it in all cases because of some abstraction boundaries that're hard to break down). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96403 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16IRgen: Switch 'retval' to use CreateIRTemp.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09Pass inline keyword to optimizer as the new InlineHint function attribute.Jakob Stoklund Olesen
At the moment the inlinehint attribute is ignored by the Inliner unless you pass a -respect-inlinehint option. This will soon be the default. The inlinehint attribute is set if the inline keyword is explicitly specified on any declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95623 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-07Make sure to set vtable pointers in the destructors as well.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05Standardize the parsing of function type attributes in a way thatJohn McCall
follows (as conservatively as possible) gcc's current behavior: attributes written on return types that don't apply there are applied to the function instead, etc. Only parse CC attributes as type attributes, not as decl attributes; don't accepet noreturn as a decl attribute on ValueDecls, either (it still needs to apply to other decls, like blocks). Consistently consume CC/noreturn information throughout codegen; enforce this by removing their default values in CodeGenTypes::getFunctionInfo(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04Rename StartConditionalBranch/FinishConditionalBranch to ↵Anders Carlsson
BeginConditionalBranch/EndConditionalBranch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95308 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24Fix a nasty bug where temporaries weren't marked as being conditional in ↵Anders Carlsson
some cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94341 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14Emit human readable names for c/c++ functions. Avoid emitting linkage name ↵Devang Patel
if it matches regular name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11Roll out ASTContext::getTypeSizeInChars(), replacing instances ofKen Dyck
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits ones as appropriate. Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, fromQuantity(), and getQuantity() for clarity. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-02Correctly pass VTT parameters to constructors and destructors. The VTTs ↵Anders Carlsson
aren't yet used in the ctors/dtors, but that will follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, ↵Douglas Gregor
since the context is available in the Decl git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15Switch codegen for -fcatch-undefined-bahavior over to __builtin_trapMike Stump
instead of abort to improve codesize and codegen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-14Add support for detecting undefined shift behavior. WIP.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12Implement runtime checks for undefined behavior. WIP.Mike Stump
This implements a new flag -fcatch-undefined-behavior. The flag turns on additional runtime checks for: T a[I]; a[i] abort when i < 0 or i >= I. Future stuff includes shifts by >= bitwidth amounts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10Get rid of static variable.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10Ensure we only generate one terminate handler.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09Add cleanups for exceptional edges. WIP.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08Use StringRef in CGDebugInfo::EmitFunctionStart.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07Add codegen support for exception specifications. WIP.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04Add support for function try blocks.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90622 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04Make functions returning a struct indirectly evaluate the returned structEli Friedman
directly into the sret pointer. This is an optimization in C, but is required for correctness in C++ for classes with a non-trivial copy constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02More exception handling improvements... WIP.Mike Stump
Highlights include: Add a helper to generate __cxa_free_exception and _ZSt9terminatev. Add a region to handle EH object deallocation for ctor failures for throw. Add a terminate handler for __cxa_end_catch. A framework for adding cleanup actions for the exceptional edges only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add VTT parameter to base ctors/dtors with virtual bases. (They aren't used ↵Anders Carlsson
yet). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20Fix lifetime of conditional temporaries. Patch by Victor Zverovich!Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06indirectbr seems to work! Rip out the old code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06If a member variable of reference type is bound to a temporary in its member ↵Anders Carlsson
initializer it needs to be destroyed at the end of the constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06Cleanup ctor/dtor emission.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04This patch extends CleanupScope to support destructionFariborz Jahanian
of array objects on block exit. Patch is by Anders Calrsson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28Implement clang support for indirect branch and address of labelChris Lattner
using the new LLVM support for this. This is temporarily hiding behind horrible and ugly #ifdefs until the time when the optimizer is stable (hopefully a week or so). Until then, lets make it "opt in" :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85446 91177308-0d34-0410-b5e6-96231b3b80d8