summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Fix thinko in yesterday's fix.Devang Patel2010-05-141-1/+1
| | | | | | Providing linkage name for function static variable confuses gdb, so don't do that. llvm-svn: 103779
* Make sure that value-initialized pointers to data members are initialized ↵Anders Carlsson2010-05-141-1/+1
| | | | | | correctly. llvm-svn: 103771
* C++/Darwin/x86: Teach IRgen it can pass reference types in registers.Daniel Dunbar2010-05-141-2/+2
| | | | llvm-svn: 103761
* Fix context in class static variable's debugging information entry.Devang Patel2010-05-131-4/+13
| | | | | | This fixes bunch of failures in gdb testsuite. llvm-svn: 103745
* Disable the available_externally optimization for inline virtualDouglas Gregor2010-05-131-11/+0
| | | | | | | | | | | | methods for which the key function is guaranteed to be in another translation unit. Unfortunately, this guarantee isn't the case when dealing with shared libraries that fail to export these virtual method definitions. I'm reopening PR6747 so we can consider this again at a later point in time. llvm-svn: 103741
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-135-56/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* If given location is invalid then use current location.Devang Patel2010-05-122-107/+58
| | | | | | | | | This fixes recent regressions reported by gdb testsuite. Tighter verification of debug info generated by FE found these regressions. Refactor code to extract line number and column number from SourceLocation. llvm-svn: 103678
* Use end location of DeclStmt to mark stop point. Devang Patel2010-05-121-1/+4
| | | | | | This is meaningful for blocks. This patch fixes bunch of test failures in gdb testsuite. llvm-svn: 103533
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-112-8/+4
| | | | llvm-svn: 103517
* IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.Daniel Dunbar2010-05-111-0/+24
| | | | | | - Fixes PR7098. llvm-svn: 103514
* It's bad form to create VarDecl's without DeclContextsDouglas Gregor2010-05-111-1/+3
| | | | llvm-svn: 103484
* Minor refactoring of my last patch.Fariborz Jahanian2010-05-111-4/+5
| | | | llvm-svn: 103475
* Initialize Column.Devang Patel2010-05-101-6/+12
| | | | llvm-svn: 103448
* Objective-C++ Code gen. Handle code gen. for propertyFariborz Jahanian2010-05-102-2/+20
| | | | | | | reference dot-syntax notation in a varierty of cases. Fixes radar 7964490. llvm-svn: 103440
* If variable location is invalid then use current location.Devang Patel2010-05-101-1/+3
| | | | | | This fixes radar 7959934. llvm-svn: 103408
* Tweaked selector mangling again (GNU runtime).David Chisnall2010-05-091-6/+17
| | | | llvm-svn: 103368
* Fixed linkage problem from last commit (GNU runtime).David Chisnall2010-05-081-2/+2
| | | | llvm-svn: 103355
* Tweaked selector generation (GNU runtime). Removed the use of GlobalAliases ↵David Chisnall2010-05-081-9/+15
| | | | | | in the generated bitcode. llvm-svn: 103353
* If there is not any debug info for type then do not emit debug info for this ↵Devang Patel2010-05-071-0/+5
| | | | | | | | | variable. A recent change to tightly verify debug info prepared by FE caught this. This fixes unittest build. llvm-svn: 103320
* Minor mod. to my last patch.Fariborz Jahanian2010-05-071-1/+2
| | | | llvm-svn: 103280
* Fixes a Code gen crash trying to use a dot-syntax forFariborz Jahanian2010-05-071-2/+8
| | | | | | a property of a c++ class object (radar 7957369). llvm-svn: 103279
* Avoid use of DIDescriptor::getNode(). Use overloaded operators instead.Devang Patel2010-05-071-25/+30
| | | | llvm-svn: 103273
* Do not give implicitly-defined virtual members functionsDouglas Gregor2010-05-061-2/+2
| | | | | | | | | | | | | available_externally linkage, since they may not have been given a strong definition in another translation unit. Without this patch, the following test case fails to link with a GCC-compiled libstdc++: #include <sstream> int main() { std::basic_stringbuf<char> bs; } Fixes the last problem with the Boost.IO library. llvm-svn: 103208
* Fix typo in comment; 80 col violationDouglas Gregor2010-05-061-3/+3
| | | | llvm-svn: 103204
* The global variable for the VTT might not have external linkage; allowDouglas Gregor2010-05-061-1/+1
| | | | | | | us to find local variables, too. Fixes the last remaining Boost.Rational failure. llvm-svn: 103203
* Code Gen support for Getter/Setter synthesis of Fariborz Jahanian2010-05-061-3/+23
| | | | | | C++ object properties. (still radar 7468090). llvm-svn: 103182
* simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,Chris Lattner2010-05-061-3/+2
| | | | | | fixing PR7063. llvm-svn: 103171
* add todos for isinf_sign and isnormal, which I don't intend to implementChris Lattner2010-05-061-1/+8
| | | | | | in the near future. llvm-svn: 103169
* implement codegen support for __builtin_isfinite, part of PR6083Chris Lattner2010-05-061-0/+13
| | | | llvm-svn: 103168
* implement part of PR6083: codegen support for isinf. Like isnan,Chris Lattner2010-05-061-1/+35
| | | | | | | this is generating correct but suboptimal (extra extend to double) code for the float case. Will investigate next. llvm-svn: 103166
* Clean up the {} and else placement. This fixes an ambiguous else as well asChandler Carruth2010-05-061-6/+6
| | | | | | picking a more consistent pattern. llvm-svn: 103142
* Pass the globaldecl into GetOrCreateLLVMFunction so that llvmChris Lattner2010-05-051-1/+1
| | | | | | | | | function attributes like byval get applied to the function definition. This fixes PR7058 and makes i386 llvm/clang bootstrap pass all the same tests as x86-64 bootstrap for me (the llvmc tests still fail in both). llvm-svn: 103131
* This patch deals with Sema Part of Setter/Getter synthesisFariborz Jahanian2010-05-051-6/+0
| | | | | | | of properties which are of C++ objects. Code Gen to follow (Radar 7468090). llvm-svn: 103123
* When we emit a non-constant initializer for a global variable ofDouglas Gregor2010-05-051-2/+4
| | | | | | | | reference type, make sure that the initializer we build is the of the appropriate type for the *reference*, not for the thing that it refers to. Fixes PR7050. llvm-svn: 103115
* For thread-safe static initialization of local statics withDouglas Gregor2010-05-051-33/+48
| | | | | | | | destructors, place the __cxa_atexit call after the __cxa_guard_release call, mimicking GCC/LLVM-GCC behavior. Noticed while debugging something related. llvm-svn: 103088
* Reapplying patch to change StmtNodes.def to StmtNodes.td, this timeAlexis Hunt2010-05-051-1/+1
| | | | | | | with no whitespace. This will allow statements to be referred to in attribute TableGen files. llvm-svn: 103087
* Revert r103072; I accidentally ended up deleting a bunch of trailingAlexis Hunt2010-05-051-24/+24
| | | | | | | whitespace which makes this patch unreadable. Will recommit without the whitespace. llvm-svn: 103086
* Reimplement code generation for copying fields in theDouglas Gregor2010-05-052-226/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicitly-generated copy constructor. Previously, Sema would perform some checking and instantiation to determine which copy constructors, etc., would be called, then CodeGen would attempt to figure out which copy constructor to call... but would get it wrong, or poke at an uninstantiated default argument, or fail in other ways. The new scheme is similar to what we now do for the implicit copy-assignment operator, where Sema performs all of the semantic analysis and builds specific ASTs that look similar to the ASTs we'd get from explicitly writing the copy constructor, so that CodeGen need only do a direct translation. However, it's not quite that simple because one cannot explicit write elementwise copy-construction of an array. So, I've extended CXXBaseOrMemberInitializer to contain a list of indexing variables used to copy-construct the elements. For example, if we have: struct A { A(const A&); }; struct B { A array[2][3]; }; then we generate an implicit copy assignment operator for B that looks something like this: B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { } CodeGen will loop over the invented variables i0 and i1 to visit all elements in the array, so that each element in the destination array will be copy-constructed from the corresponding element in the source array. Of course, if we're dealing with arrays of scalars or class types with trivial copy-assignment operators, we just generate a memcpy rather than a loop. Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes all of its regression tests. Conspicuously missing from this patch is handling for the exceptional case, where we need to destruct those objects that we have constructed. I'll address that case separately. llvm-svn: 103079
* Use a more appropriate LLVM type for the vtable pointer.Anders Carlsson2010-05-051-3/+5
| | | | llvm-svn: 103078
* Unbreak CMake build.Douglas Gregor2010-05-051-0/+2
| | | | llvm-svn: 103077
* Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributesAlexis Hunt2010-05-051-24/+24
| | | | llvm-svn: 103072
* Emit the globals, metadata, etc. associated with static variables even whenJohn McCall2010-05-042-5/+5
| | | | | | | | they're unreachable. This matters because (if they're POD, or if this is C) the scope containing the variable might be reachable even if the variable isn't. Fixes PR7044. llvm-svn: 103052
* Fixes a code gen. crash when ivar object has trivial constructor.Fariborz Jahanian2010-05-041-12/+14
| | | | llvm-svn: 103028
* When instantiating a function that was declared via a typedef, e.g.,Douglas Gregor2010-05-041-1/+4
| | | | | | | | | | | | | typedef int functype(int, int); functype func; also instantiate the synthesized function parameters for the resulting function declaration. With this change, Boost.Wave builds and passes all of its regression tests. llvm-svn: 103025
* Fixes a code gen crash when block is a reference type, etc.Fariborz Jahanian2010-05-041-0/+2
| | | | | | (radar 7495203). llvm-svn: 103022
* When inheriting a default argument expression, inherit the full expression,John McCall2010-05-041-1/+3
| | | | | | | | | not just the inner expression. This is important if the expression has any temporaries. Fixes PR 7028. Basically a symptom of really tragic method names. llvm-svn: 102998
* Fixes a Code Gen. Crash when calling destructor on a __blockFariborz Jahanian2010-05-041-4/+9
| | | | | | | variabe. Blocks and their construction/destruction is wip though. llvm-svn: 102985
* Just bail out immediately when emitting an unreachable function-local staticJohn McCall2010-05-031-0/+3
| | | | | | variable. Surprisingly, this does seem to be the right way to solve this. llvm-svn: 102961
* If we're generating code to create a pointer-to-member functionDouglas Gregor2010-05-031-0/+6
| | | | | | | aggregate and the result of the aggregate is unused, bail out early. Fixes PR7027. llvm-svn: 102942
* When computing the address of a virtual member function pointer, use the ↵Anders Carlsson2010-05-032-2/+12
| | | | | | pointer width instead of hardcoding for 64-bit. llvm-svn: 102921
OpenPOWER on IntegriCloud