summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
* adjust to mainline llvm API change.Chris Lattner2012-05-281-4/+2
| | | | llvm-svn: 157557
* CUDA: add CodeGen support for global variable address spaces.Peter Collingbourne2012-05-201-3/+21
| | | | | | | | | Because in CUDA types do not have associated address spaces, globals are declared in their "native" address space, and accessed by bitcasting the pointer to address space 0. This relies on address space 0 being a unified address space. llvm-svn: 157167
* Add support for __attribute__((hot)) and __attribute__((cold)).Benjamin Kramer2012-05-121-0/+4
| | | | | | | | Currently cold functions are marked with the "optsize" attribute in CodeGen so they are always optimized for size. The hot attribute is just ignored, LLVM doesn't have a way to express hotness at the moment. llvm-svn: 156723
* This patch adds a new Clang compiler flag "-gline-tables-only".Alexey Samsonov2012-05-041-1/+2
| | | | | | | | | | | | | | It reduces the amount of emitted debug information: 1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram, DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only. 2) .debug_str contains only function names. 3) No debug data for types/namespaces/variables is emitted. 4) The data in .debug_line is enough to produce valid stack traces with function names and line numbers. Reviewed by Eric Christopher. llvm-svn: 156160
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-1/+1
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Use enum to set debug info size generated by ClangAlexey Samsonov2012-04-271-1/+2
| | | | llvm-svn: 155697
* enable TBAA when -fthread-sanitizer is given, even with -O0 or ↵Kostya Serebryany2012-04-241-3/+4
| | | | | | -relaxed-aliasing llvm-svn: 155430
* Typo.Eric Christopher2012-04-161-1/+1
| | | | llvm-svn: 154880
* Enable debug info for objective c implementations that may not haveEric Christopher2012-04-111-0/+5
| | | | | | | | an explicit instance variable. rdar://10590352 llvm-svn: 154481
* Revert r153723, and its follow-ups r153728 and r153733.Chandler Carruth2012-03-301-3/+2
| | | | | | | | | | | | | | | | These patches cause us to miscompile and/or reject code with static function-local variables in an extern-C context. Previously, we were papering over this as long as the variables are within the same translation unit, and had not seen any failures in the wild. We still need a proper fix, which involves mangling static locals inside of an extern-C block (as GCC already does), but this patch causes pretty widespread regressions. Firefox, and many other applications no longer build. Lots of test cases have been posted to the list in response to this commit, so there should be no problem reproducing the issues. llvm-svn: 153768
* Do the static-locals thing properly in the face of unions andJohn McCall2012-03-301-2/+3
| | | | | | other things which might mess with the variable's type. llvm-svn: 153733
* The UTF16 string referenced by a CFString should go into the __TEXT,__ustringBill Wendling2012-03-301-26/+24
| | | | | | | | | | | | | section. A 'normal' string will go into the __TEXT,__const section, but this isn't good for UTF16 strings. The __ustring section allows for coalescing, among other niceties (such as allowing the linker to easily split up strings). Instead of outputting the UTF16 string as a series of bytes, output it as a series of shorts. The back-end will then nicely place the UTF16 string into the correct section, because it's a mensch. <rdar://problem/10655949> llvm-svn: 153710
* Fix whitespace.Bill Wendling2012-03-291-6/+5
| | | | llvm-svn: 153698
* add tbaa metadata to vtable pointer loads/storesKostya Serebryany2012-03-261-0/+6
| | | | llvm-svn: 153447
* Simplify some users of DenseMap::erase.Benjamin Kramer2012-03-241-4/+1
| | | | llvm-svn: 153389
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-40/+40
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Replace MarkVarRequired with a more genericRafael Espindola2012-03-081-2/+6
| | | | | | HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
* Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola2012-03-051-0/+3
| | | | | | | | | | | | In the included testcase, soma thinks that we already have a definition after we see the out of line decl. Codegen puts it in a deferred list, to be output if a use is seen. This would break when we saw an explicit template instantiation definition, since codegen would not be notified. This patch adds a method to the consumer interface so that soma can notify codegen that this decl is now required. llvm-svn: 152024
* Reinstate r151879, r151880, reverted in r151922, along with a bugfix forRichard Smith2012-03-021-1/+2
| | | | | | | | | scalar emission of DeclRefExprs to const bools: emit scalar bools as i1, not as i8. In addition to the extra unit testing, this has successfully bootstrapped. llvm-svn: 151955
* Hack in a loud error for PR12086. Better than a silent miscompile.Sebastian Redl2012-02-271-1/+12
| | | | llvm-svn: 151586
* CodeGen support for global variables of type std::initializer_list<X>.Sebastian Redl2012-02-251-2/+117
| | | | | | | | | | | | | This emits a backing array with internal linkage and fills it with data, then has the initializer_list point at the array. Dynamic initialization and global destructors are correctly supported. What doesn't work is nested initializer_lists. I have no idea how to get them to work, either. However, these should be very rare, and so I'll just call it a known bug and declare generalized initializers DONE! llvm-svn: 151457
* Remove UpdateCompletedType from the debug info emission. We nowEric Christopher2012-02-181-2/+0
| | | | | | | emit less than complete types on purpose on occasion and so our caches aren't useful for this kind of lazy emitting. llvm-svn: 150856
* Bug fix: do not emit static const local variables with mutable membersRichard Smith2012-02-171-15/+18
| | | | | | | | | as constants. Refactor and simplify all the separate checks for whether a type can be emitted as a constant. llvm-svn: 150793
* When performing IRGen on a global, emit it as a constant if:Richard Smith2012-02-171-1/+0
| | | | | | | | | | | 1) It has a const-qualified type, and 2) It has no mutable members, and 3) It has no dynamic initialization, and 4) It has trivial destruction. Remove the unnecessary requirement that the type be POD. This allows us to mark all constexpr objects with no mutable members as 'constant'. llvm-svn: 150792
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-7/+4
| | | | | | | | | | | | | | | | | | | | | 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
* Teach clang to add metadata tags to calls and invokes in ObjC withDan Gohman2012-02-161-1/+2
| | | | | | | | | -fno-objc-arc-exceptions. This will allow the optimizer to perform optimizations which are only safe under that flag. This is a part of rdar://10803830. llvm-svn: 150644
* Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith2012-02-131-7/+11
| | | | | | | | | | | constructor, and that constructor is used to initialize an object of static storage duration such that all members and bases are initialized by constant expressions, constant initialization is performed. In this case, the object can still have a non-trivial destructor, and if it does, we must emit a dynamic initializer which performs no initialization and instead simply registers that destructor. llvm-svn: 150419
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-18/+20
| | | | | | CodeGenModule. llvm-svn: 149943
* build wide strings with ConstantDataArray, just because we can.Chris Lattner2012-02-061-12/+18
| | | | llvm-svn: 149928
* improve the code that handles IR generation of byte-sized string literals to ↵Chris Lattner2012-02-061-35/+19
| | | | | | | | avoid allocating an std::string. llvm-svn: 149924
* use cheaper llvm APIs for various bits of IR generation.Chris Lattner2012-02-061-17/+14
| | | | llvm-svn: 149916
* reapply the patches reverted in r149477, which enable ConstantDataArray.Chris Lattner2012-02-051-25/+26
| | | | llvm-svn: 149801
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-2/+2
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move the code that sets the AddressSafetyAlexander Potapenko2012-02-021-8/+7
| | | | | | | | | | attribute into CodeGenModule::SetLLVMFunctionAttributesForDefinition(). Previously it resided in CodeGenModule::GetOrCreateLLVMFunction, which for some reason wasn't called for ObjC class methods, see http://code.google.com/p/address-sanitizer/issues/detail?id=33 llvm-svn: 149605
* Revert r149363 which was part a series of commits that were reverted in llvmArgyrios Kyrtzidis2012-02-011-26/+25
| | | | | | | | | | | | | | | | | commit 149470. This fixes test/CodeGen/PR3589-freestanding-libcalls.c. Original log: ConstantArray::get() (for strings) is going away, use ConstantDataArray::getString instead. Many instances of ConstantArray::get() could be moved to use more efficient ConstantDataArray methods that avoid a ton of intermediate Constant*'s for each element (e.g. GetConstantArrayFromStringLiteral). I don't plan on doing this in the short-term though. llvm-svn: 149477
* Support @compatibility_alias at run time (GNUstep Runtime)David Chisnall2012-01-311-1/+1
| | | | | | Patch by Niels Grewe! llvm-svn: 149401
* ConstantArray::get() (for strings) is going away, useChris Lattner2012-01-311-25/+26
| | | | | | | | | | | | ConstantDataArray::getString instead. Many instances of ConstantArray::get() could be moved to use more efficient ConstantDataArray methods that avoid a ton of intermediate Constant*'s for each element (e.g. GetConstantArrayFromStringLiteral). I don't plan on doing this in the short-term though. llvm-svn: 149363
* The following patch adds __attribute__((no_address_safety_analysis)) which ↵Kostya Serebryany2012-01-241-0/+8
| | | | | | | | | | | | | | | will allow to disable address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function. When building with AddressSanitizer, add AddressSafety function attribute to every generated function except for those that have __attribute__((no_address_safety_analysis)). With this patch we will be able to 1. disable AddressSanitizer for a particular function 2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on. llvm-svn: 148842
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-4/+2
| | | | llvm-svn: 148577
* test svn commit accessSeth Cantrell2012-01-181-0/+1
| | | | llvm-svn: 148388
* Fix a string over-run detected by ASAN.Nick Lewycky2012-01-181-2/+3
| | | | llvm-svn: 148375
* Fix special king of typo.Nick Lewycky2012-01-181-1/+1
| | | | llvm-svn: 148368
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-1/+1
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-141-3/+4
| | | | | | | | | | | | | | | | | | | | 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
* The `-fwritable-strings' flag doesn't make the backing store strings of allBill Wendling2012-01-101-10/+6
| | | | | | | | | | | CFStrings writable. The strings (both Unicode and ASCII) should reside in a read-only section. E.g., __TEXT,__cstring instead of __DATA,__data. This is done by making the global variable created for the strings constant despite the value of that flag. <rdar://problem/10657500> llvm-svn: 147845
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-4/+6
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* 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
* Extend the fix for PR9614 to handle inline asm in the outer decl andRafael Espindola2011-12-191-15/+32
| | | | | | | the inner decl being a builtin. This is needed to support the glibc headers in fedora 16 (2.14). llvm-svn: 146867
* 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 the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman2011-11-011-24/+51
| | | | | | | | | | native representation of integers for the elements. This fixes a bunch of nastiness involving treating wide strings as a series of bytes. Patch by Seth Cantrell. llvm-svn: 143417
OpenPOWER on IntegriCloud