summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* IRgen: Add CreateMemTemp, for creating an temporary memory object for a ↵Daniel Dunbar2010-02-098-49/+51
| | | | | | | | | | particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing. - This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome! PR6240. llvm-svn: 95648
* Pass inline keyword to optimizer as the new InlineHint function attribute.Jakob Stoklund Olesen2010-02-091-0/+10
| | | | | | | | | | 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. llvm-svn: 95623
* Reapply r95393, without the change to CGExpr. I was wrong in assuming that theDaniel Dunbar2010-02-083-19/+14
| | | | | | element type always matched the converted LLVM type for ExprType. llvm-svn: 95596
* Emit global references with constant initializers as constants. Fixes PR5585.John McCall2010-02-081-1/+1
| | | | | | | The standard actually says that such references should have internal linkage, but gcc doesn't do that, so we probably can't get away with it. llvm-svn: 95577
* Make sure to set vtable pointers in the destructors as well.Anders Carlsson2010-02-073-1/+4
| | | | llvm-svn: 95525
* Use the right type when taking the address of a non-virtual member function ↵Anders Carlsson2010-02-072-3/+11
| | | | | | pointer. Fixes PR6258. llvm-svn: 95524
* Use the right linkage for static variables inside C++ inline functions.Anders Carlsson2010-02-072-7/+21
| | | | llvm-svn: 95512
* Improved handling of the visibility attribute. Declarations now inherit ↵Anders Carlsson2010-02-071-0/+4
| | | | | | | | their parent's visibility. (This is kind of a risky change, but I did a self-host build and everything appears to work fine!) llvm-svn: 95511
* Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are ↵Anders Carlsson2010-02-061-0/+6
| | | | | | disabled. llvm-svn: 95509
* Add support for threadsafe statics, and make them the default (matching gcc).Anders Carlsson2010-02-061-22/+85
| | | | | | Daniel, I'd appreciate a review of the driver/cc1 parts. llvm-svn: 95508
* Call destructors for constructed bases as well.Anders Carlsson2010-02-061-0/+13
| | | | llvm-svn: 95502
* If a constructor throws an exception we need to execute the destructors for ↵Anders Carlsson2010-02-061-0/+19
| | | | | | all fully constructed members. Fixes ctor_dtor_count.cpp in the test suite. llvm-svn: 95501
* Switch CodeGen's "is this variable declaration a definition?" logicDouglas Gregor2010-02-061-14/+1
| | | | | | | | | over to VarDecl::isThisDeclarationADefinition(), which handles variables declared with linkage specifications better (among other things). CMake 2.9 (from CVS) now builds with clang++ and is somewhat functional. llvm-svn: 95486
* Only append 'L' for internal variable declarations, not all declarations. ↵Anders Carlsson2010-02-061-3/+4
| | | | | | (Found by the mangle checker, yay) llvm-svn: 95485
* Remove unused variable.Ted Kremenek2010-02-061-1/+0
| | | | llvm-svn: 95476
* Use the correct function info for constructors when applying function ↵Anders Carlsson2010-02-065-6/+26
| | | | | | attributes. Fixes PR6245. llvm-svn: 95474
* Assert when we try to mangle a dependent template name, rather thanDouglas Gregor2010-02-061-1/+3
| | | | | | crashing unceremoniously. llvm-svn: 95464
* Rearrange some checks to avoid call to isCopyConstructor() and clarify pathJohn McCall2010-02-061-12/+14
| | | | | | taken for non-trivial constructors. llvm-svn: 95457
* Standardize the parsing of function type attributes in a way thatJohn McCall2010-02-0513-94/+140
| | | | | | | | | | | | 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(). llvm-svn: 95436
* Revert r95393, which broke Clang's self-host.Douglas Gregor2010-02-053-14/+22
| | | | llvm-svn: 95430
* Implement name mangling for template template parametersDouglas Gregor2010-02-051-2/+15
| | | | llvm-svn: 95427
* IRgen: A few more ConvertType cleanups.Daniel Dunbar2010-02-051-11/+6
| | | | llvm-svn: 95423
* IRgen: Factor out EmitAggExprToLValue.Daniel Dunbar2010-02-053-14/+20
| | | | llvm-svn: 95416
* Fix a code gen bug accessing 'isa' field via a message callFariborz Jahanian2010-02-051-5/+14
| | | | | | (Fixes radar 7609722). llvm-svn: 95406
* IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that isDaniel Dunbar2010-02-054-6/+9
| | | | | | conceptually correct. Review appreciated (Chris, Eli, Anders). llvm-svn: 95401
* Fix the bug that was breaking self-host, and re-land the static ctor fixes.Anders Carlsson2010-02-051-1/+12
| | | | llvm-svn: 95400
* Now that we store calling conventions in the types, use them instead ofCharles Davis2010-02-051-6/+10
| | | | | | | getting the calling convention from the target function, which may or may not exist. Fixes PR5280. llvm-svn: 95399
* IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases thatDaniel Dunbar2010-02-053-22/+14
| | | | | | | | need to deal with aggregates specially; this is consistent with the rest of IRgen. Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString. llvm-svn: 95393
* Revert r95363 and r95375, which broke self-host.Douglas Gregor2010-02-051-11/+1
| | | | llvm-svn: 95389
* Check in a mangle checker that's turned off by default.Anders Carlsson2010-02-051-0/+18
| | | | llvm-svn: 95377
* Fix array initialization test.Anders Carlsson2010-02-051-1/+2
| | | | llvm-svn: 95375
* If a global initializer has a non-trivial destructor it can't be emitted as ↵Anders Carlsson2010-02-051-1/+10
| | | | | | a constant (even if it has a trivial constructor). llvm-svn: 95363
* Always start tag definitions before completing them. Assert same.John McCall2010-02-051-2/+2
| | | | | | Fixes latent and not-so-latent objc++ and blocks++ bugs. llvm-svn: 95340
* Extract a common structure for holding information about the definitionJohn McCall2010-02-042-14/+17
| | | | | | | | of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
* When binding an lvalue to a reference, we always need to pop temporaries.Anders Carlsson2010-02-041-1/+9
| | | | | | | | | | | | | With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives: Expected Passes : 6933 Expected Failures : 46 Unsupported Tests : 40 Unexpected Failures: 27 which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers. llvm-svn: 95313
* Fix a bug where we would not mark temporaries as conditional when emitting a ↵Anders Carlsson2010-02-041-1/+7
| | | | | | conditional operator as an lvalue. llvm-svn: 95311
* Rename StartConditionalBranch/FinishConditionalBranch to ↵Anders Carlsson2010-02-044-20/+20
| | | | | | BeginConditionalBranch/EndConditionalBranch. llvm-svn: 95308
* Fix another pointer-to-member function miscompile, this time when trying to ↵Anders Carlsson2010-02-041-11/+11
| | | | | | call a virtual member function. llvm-svn: 95307
* Calculate offset correctly when taking the address of a virtual member function.Anders Carlsson2010-02-042-3/+10
| | | | llvm-svn: 95305
* Mangle member expressions. Also invented.John McCall2010-02-041-1/+57
| | | | llvm-svn: 95284
* Add a cautionary note about the mangling I just invented.John McCall2010-02-041-0/+3
| | | | llvm-svn: 95275
* Add mangling support for calls, sizeof/alignof, constructor calls,John McCall2010-02-041-29/+151
| | | | | | float literals, and unresolved lookups (which required hand-wavey extensions). llvm-svn: 95273
* Revert "Numerous changes to selector handling:", this breaks a whole bunch ofDaniel Dunbar2010-02-035-63/+26
| | | | | | working code, for no apparent reason. llvm-svn: 95244
* Handle reference binding in aggregate initializers. Fixes another 47 tests.Anders Carlsson2010-02-031-5/+5
| | | | llvm-svn: 95235
* Add a band-aid fix for clang self-hosting. A better fix will follow shortly.Anders Carlsson2010-02-031-0/+3
| | | | llvm-svn: 95232
* More cleanup.Anders Carlsson2010-02-031-10/+14
| | | | llvm-svn: 95226
* Revert the new reference binding code; I came up with a way simpler solution ↵Anders Carlsson2010-02-036-41/+6
| | | | | | for the reference binding bug that is preventing self-hosting. llvm-svn: 95223
* First pass at adding GC support for GNU runtime. GC ivar maps not yet ↵David Chisnall2010-02-031-6/+97
| | | | | | | | constructed, GC flag not set. Please don't try using this yet - the runtime support is still very immature and your code will almost certainly crash if you do. llvm-svn: 95222
* When a function or variable somehow depends on a type or declarationDouglas Gregor2010-02-032-34/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that is in an anonymous namespace, give that function or variable internal linkage. This change models an oddity of the C++ standard, where names declared in an anonymous namespace have external linkage but, because anonymous namespace are really "uniquely-named" namespaces, the names cannot be referenced from other translation units. That means that they have external linkage for semantic analysis, but the only sensible implementation for code generation is to give them internal linkage. We now model this notion via the UniqueExternalLinkage linkage type. There are several changes here: - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage when the declaration is in an anonymous namespace. - Added Type::getLinkage() to determine the linkage of a type, which is defined as the minimum linkage of the types (when we're dealing with a compound type that is not a struct/class/union). - Extended NamedDecl::getLinkage() to consider the linkage of the template arguments and template parameters of function template specializations and class template specializations. - Taught code generation to rely on NamedDecl::getLinkage() when determining the linkage of variables and functions, also considering the linkage of the types of those variables and functions (C++ only). Map UniqueExternalLinkage to internal linkage, taking out the explicit checks for isInAnonymousNamespace(). This fixes much of PR5792, which, as discovered by Anders Carlsson, is actually the reason behind the pass-manager assertion that causes the majority of clang-on-clang regression test failures. With this fix, Clang-built-Clang+LLVM passes 88% of its regression tests (up from 67%). The specific numbers are: LLVM: Expected Passes : 4006 Expected Failures : 32 Unsupported Tests : 40 Unexpected Failures: 736 Clang: Expected Passes : 1903 Expected Failures : 14 Unexpected Failures: 75 Overall: Expected Passes : 5909 Expected Failures : 46 Unsupported Tests : 40 Unexpected Failures: 811 Still to do: - Improve testing - Check whether we should allow the presence of types with InternalLinkage (in addition to UniqueExternalLinkage) given variables/functions internal linkage in C++, as mentioned in PR5792. - Determine how expensive the getLinkage() calls are in practice; consider caching the result in NamedDecl. - Assess the feasibility of Chris's idea in comment #1 of PR5792. llvm-svn: 95216
* remove a big chunk of #if 0 code.Chris Lattner2010-02-031-58/+0
| | | | llvm-svn: 95201
OpenPOWER on IntegriCloud