summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Add support to mangle templated member function names with templateEric Christopher2012-03-141-1/+14
| | | | | | | | args. Fixes rdar://11042577 llvm-svn: 152691
* When adding member functions to a class add any specializations ofEric Christopher2012-03-131-9/+22
| | | | | | | | | | | function templates as well. A future commit will mangle the added name with the template args like classes are mangled. Fixes rdar://10986010 llvm-svn: 152683
* [Sema] Prefer to use ObjCInterfaceDecl's protocol_begin()/protocol_end() ↵Argyrios Kyrtzidis2012-03-131-3/+3
| | | | | | | | | iterators instead of ObjCInterfaceDecl::getReferencedProtocols(), because the iterators are safe to use even if the caller did not check that the interface is a definition. llvm-svn: 152597
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-1128-207/+207
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* llvm::SwitchInstStepan Dyatkovskiy2012-03-111-1/+1
| | | | | | | Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default. Added some notes relative to case iterators. llvm-svn: 152533
* Simplify code. No functionality change.Benjamin Kramer2012-03-101-14/+5
| | | | llvm-svn: 152503
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-108-108/+70
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Unify the BlockDeclRefExpr and DeclRefExpr paths so thatJohn McCall2012-03-105-52/+201
| | | | | | | | we correctly emit loads of BlockDeclRefExprs even when they don't qualify as ODR-uses. I think I'm adequately convinced that BlockDeclRefExpr can die. llvm-svn: 152479
* IRgen/ABI/x86_64: Avoid passing small structs using byval sometimes.Daniel Dunbar2012-03-101-9/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - We do this when it is easy to determine that the backend will pass them on the stack properly by itself. Currently LLVM codegen is really bad in some cases with byval, for example, on the test case here (which is derived from Sema code, which likes to pass SourceLocations around):: struct s47 { unsigned a; }; void f47(int,int,int,int,int,int,struct s47); void test47(int a, struct s47 b) { f47(a, a, a, a, a, a, b); } we used to emit code like this:: ... movl %esi, -8(%rbp) movl -8(%rbp), %ecx movl %ecx, (%rsp) ... to handle moving the struct onto the stack, which is just appalling. Now we generate:: movl %esi, (%rsp) which seems better, no? llvm-svn: 152462
* Make sure we update the static local decl address map when we are forced to ↵Eli Friedman2012-03-092-6/+8
| | | | | | rebuild a global because of the initializer. <rdar://problem/10957867>. llvm-svn: 152372
* Make sure constant emission handles initializer lists with strings ↵Eli Friedman2012-03-091-1/+3
| | | | | | correctly. Part of <rdar://problem/10957867>. llvm-svn: 152370
* [AST] Reduce Decl::getASTContext() calls.Daniel Dunbar2012-03-091-1/+1
| | | | | | | - This function is not at all free; pass it around along some hot paths instead of recomputing it deep inside various VarDecl methods. llvm-svn: 152363
* Replace MarkVarRequired with a more genericRafael Espindola2012-03-084-10/+13
| | | | | | HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
* Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:Stepan Dyatkovskiy2012-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*". ConstCaseIt is just a read-only iterator. CaseIt is read-write iterator; it allows to change case successor and case value. Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters. Main way of iterator usage looks like this: SwitchInst *SI = ... // intialize it somehow for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) { BasicBlock *BB = i.getCaseSuccessor(); ConstantInt *V = i.getCaseValue(); // Do something. } If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method. If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method. There are also related changes in llvm-clients: klee and clang. llvm-svn: 152298
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* Don't even try to directly emit the value of a DeclRefExpr if that declarationRichard Smith2012-03-071-2/+11
| | | | | | is not usable in a constant expression. ~2.5% speedup on 403.gcc / combine.c. llvm-svn: 152193
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-066-20/+279
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola2012-03-054-0/+16
| | | | | | | | | | | | 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
* Silence a GCC warning about a set-but-not-used variable in release builds.Chandler Carruth2012-03-041-0/+1
| | | | llvm-svn: 152005
* add a testcase for PR12094 and fix a crash on pointer to incomplete type,Chris Lattner2012-03-041-3/+7
| | | | | | reported by Richard Smith. llvm-svn: 151993
* Reinstate r151879, r151880, reverted in r151922, along with a bugfix forRichard Smith2012-03-024-30/+49
| | | | | | | | | 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
* PR12094: Set the alignment of memory intrinsic instructions based on theJay Foad2012-03-022-29/+57
| | | | | | types of the pointer arguments. llvm-svn: 151927
* Revert r151879, r151880, "PR12145: Avoid emitting loads of constexpr ↵Daniel Dunbar2012-03-021-15/+9
| | | | | | | | variables in contexts where there" and "Fix buildbot: make this test less dependent on the value names in the produced IR." They broke bootstrap. llvm-svn: 151922
* PR12145: Avoid emitting loads of constexpr variables in contexts where thereRichard Smith2012-03-021-9/+15
| | | | | | | is no odr-use of the variable. Go slightly beyond what the standard requires for variables of reference type. llvm-svn: 151879
* Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name ↵Eli Friedman2012-03-011-4/+4
| | | | | | says. llvm-svn: 151853
* Add a flag -fthread-sanitizer.Kostya Serebryany2012-03-011-1/+13
| | | | | | | | | | This flag enables ThreadSanitizer instrumentation committed to llvm as r150423. The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer. This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet committed and it's structure in compiler-rt is not 100% clear. The users manual wil be changed in a separate commit. llvm-svn: 151846
* Reapply r151702 with a small fix for a failure to cut and pasteEric Christopher2012-03-011-30/+61
| | | | | | | | correctly. Still rdar://10900684 llvm-svn: 151838
* Implement "optimization" for lambda-to-block conversion which inlines the ↵Eli Friedman2012-03-014-11/+19
| | | | | | | | generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap. Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed. llvm-svn: 151797
* Allocate TargetLibraryInfo for the CodeGen passes. Otherwise, it's instantiatedChad Rosier2012-02-291-0/+6
| | | | | | | | | by the BAA pass, which uses the default TargetLibraryInfo constructor. Unfortunately, the default TargetLibraryInfo constructor assumes all library calls are available and thus ignores -fno-builtin. rdar://10947759 llvm-svn: 151745
* Revert r151702, "Add support for handling captured variables in lambda debugDaniel Dunbar2012-02-291-61/+30
| | | | | | info.", which broke some -O0 -g tests. llvm-svn: 151730
* Add support for handling captured variables in lambda debug info.Eric Christopher2012-02-291-30/+61
| | | | | | | | | | | | This currently doesn't handle capturing the 'this' pointer for any enclosing class. Steal the lambda-expressions.cpp testcase and debugify it and try to use more variables to proof it against random changes. Part of rdar://10900684 llvm-svn: 151702
* Formatting.Eric Christopher2012-02-291-1/+1
| | | | llvm-svn: 151700
* Make sure list-initialization of arrays works correctly in explicit type ↵Eli Friedman2012-02-291-1/+1
| | | | | | conversions. PR12121. llvm-svn: 151674
* Prefer bitcast+GEP over ptrtoint+sub+inttoptr: it's semantically equivalent ↵Eli Friedman2012-02-281-3/+3
| | | | | | here, and generally nicer to the optimizer. llvm-svn: 151659
* Remove stray semi-colons.Daniel Dunbar2012-02-281-2/+2
| | | | llvm-svn: 151631
* Implement IRGen for the retain-autorelease in the lambda ↵Eli Friedman2012-02-283-2/+27
| | | | | | conversion-to-block-pointer outside of ARC. Testcases coming up soon. llvm-svn: 151603
* Hack in a loud error for PR12086. Better than a silent miscompile.Sebastian Redl2012-02-271-1/+12
| | | | llvm-svn: 151586
* Add missing code for compound literals of complex type. ↵Eli Friedman2012-02-271-0/+4
| | | | | | <rdar://problem/10938628> llvm-svn: 151549
* ObjcInterfaceTypes are also complete types for the type cache.Eric Christopher2012-02-271-3/+3
| | | | | | Fixes rdar://10934887 llvm-svn: 151519
* Ensure that we delete destructors in the right cases. Specifically:Richard Smith2012-02-261-0/+4
| | | | | | | | | | | | | | - variant members with nontrivial destructors make the containing class's destructor deleted - check for a virtual destructor after checking for overridden methods in the base class(es) - check for an inaccessible operator delete for a class with a virtual destructor. Do not try to call an anonymous union field's destructor from the destructor of the containing class. llvm-svn: 151483
* CodeGen support for global variables of type std::initializer_list<X>.Sebastian Redl2012-02-253-3/+121
| | | | | | | | | | | | | 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
* Fix crashers on unexpected std::initializer_list layouts. Found by inspection.Sebastian Redl2012-02-251-0/+4
| | | | llvm-svn: 151456
* Prevent llvm.lifetime intrinsics from being emitted at -O0.Chad Rosier2012-02-251-1/+5
| | | | | | rdar://10921594 llvm-svn: 151430
* Work-in-progress for lambda conversion-to-block operator. Still need to ↵Eli Friedman2012-02-254-27/+85
| | | | | | implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure). llvm-svn: 151428
* Trying to increase my Ohloh ranking with trivial tweaksDouglas Gregor2012-02-251-6/+2
| | | | llvm-svn: 151414
* Simplify check per Eli's commentDouglas Gregor2012-02-251-4/+1
| | | | llvm-svn: 151412
* Fix a stupid mistake in r151133. Reported to me by Joerg Sonnenberger.Eli Friedman2012-02-241-3/+5
| | | | llvm-svn: 151407
* For the purposes of building LLVM types, a forward-declaredDouglas Gregor2012-02-241-1/+6
| | | | | | | enumeration type with a fixed underlying type is complete. Fixes <rdar://problem/10916155>. llvm-svn: 151403
* Reapply r151172 - Unwind path cleanup for array new list initializers - with aChad Rosier2012-02-241-7/+32
| | | | | | test case that only runs on debug builds. llvm-svn: 151311
* Replace a use of hasTrivialDefaultConstructor() with the appropriateDouglas Gregor2012-02-231-1/+1
| | | | | | isTrivial() call. llvm-svn: 151259
OpenPOWER on IntegriCloud