summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix the required args count for variadic blocks.John McCall2012-12-071-1/+1
| | | | | | | | | | | | | | | | | We were emitting calls to blocks as if all arguments were required --- i.e. with signature (A,B,C,D,...) rather than (A,B,...). This patch fixes that and accounts for the implicit block-context argument as a required argument. In addition, this patch changes the function type under which we call unprototyped functions on platforms like x86-64 that guarantee compatibility of variadic functions with unprototyped function types; previously we would always call such functions under the LLVM type T (...)*, but now we will call them under the type T (A,B,C,D,...)*. This last change should have no material effect except for making the type conventions more explicit; it was a side-effect of the most convenient implementation. llvm-svn: 169588
* Rework the bitfield access IR generation to address PR13619 andChandler Carruth2012-12-061-154/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | generally support the C++11 memory model requirements for bitfield accesses by relying more heavily on LLVM's memory model. The primary change this introduces is to move from a manually aligned and strided access pattern across the bits of the bitfield to a much simpler lump access of all bits in the bitfield followed by math to extract the bits relevant for the particular field. This simplifies the code significantly, but relies on LLVM to intelligently lowering these integers. I have tested LLVM's lowering both synthetically and in benchmarks. The lowering appears to be functional, and there are no really significant performance regressions. Different code patterns accessing bitfields will vary in how this impacts them. The only real regressions I'm seeing are a few patterns where the LLVM code generation for loads that feed directly into a mask operation don't take advantage of the x86 ability to do a smaller load and a cheap zero-extension. This doesn't regress any benchmark in the nightly test suite on my box past the noise threshold, but my box is quite noisy. I'll be watching the LNT numbers, and will look into further improvements to the LLVM lowering as needed. llvm-svn: 169489
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-5/+5
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fix test failure when building Clang with g++4.7 -- don't use a Twine temporaryRichard Smith2012-12-031-5/+5
| | | | | | after its lifetime has ended! llvm-svn: 169170
* [ubsan] Add flag to enable recovery from checks when possible.Will Dietz2012-12-021-7/+17
| | | | llvm-svn: 169114
* Fixing a precedence issue with my previous commit.Aaron Ballman2012-11-301-1/+1
| | | | llvm-svn: 169041
* Fixing an MSVC warning about an unsafe mixture of Boolean and unsigned types ↵Aaron Ballman2012-11-301-1/+1
| | | | | | in a logical operator. llvm-svn: 169037
* objective-C arc: load of a __weak object happens via call toFariborz Jahanian2012-11-271-2/+5
| | | | | | | | | | | objc_loadWeak. This retains and autorelease the weakly-refereced object. This hidden autorelease sometimes makes __weak variable alive even after the weak reference is erased, because the object is still referenced by an autorelease pool. This patch overcomes this behavior by loading a weak object via call to objc_loadWeakRetained(), followng it by objc_release at appropriate place, thereby removing the hidden autorelease. // rdar://10849570 llvm-svn: 168740
* Enable inlining of 4 byte atomic ops on ppc32, 8 byte atomic ops on ppc64.Benjamin Kramer2012-11-171-5/+4
| | | | | | Also fixes a bit/byte mismatch when checking if a target supports atomic ops of a certain size. llvm-svn: 168260
* Fix IR generation for bool on PPC (and any other target where bool is not 8 ↵Eli Friedman2012-11-131-5/+7
| | | | | | | | bits in memory). PR11777. llvm-svn: 167802
* Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith2012-11-051-23/+27
| | | | | | | checks to enable. Remove frontend support for -fcatch-undefined-behavior, -faddress-sanitizer and -fthread-sanitizer now that they don't do anything. llvm-svn: 167413
* Simplify: replace getContext().getLangOpts() with just getLangOpts().Richard Smith2012-11-011-8/+8
| | | | llvm-svn: 167261
* Split emission of -ftrapv checks and -fcatch-undefined-behavior checks intoRichard Smith2012-11-011-23/+21
| | | | | | separate functions, since they share essentially no code. llvm-svn: 167259
* -fcatch-undefined-behavior: Start checking loads and stores for null pointers.Richard Smith2012-11-011-11/+11
| | | | | | | | We want the diagnostic, and if the load is optimized away, we still want to trap it. Stop checking non-default address spaces; that doesn't work in general. llvm-svn: 167219
* Don't crash on bad atomic operations. PR14176.Eli Friedman2012-10-301-7/+13
| | | | llvm-svn: 166992
* Move two helper functions to AST so that sema can use them.Rafael Espindola2012-10-271-113/+2
| | | | llvm-svn: 166853
* Refactor some code into a new findMaterializedTemporary function.Rafael Espindola2012-10-271-25/+32
| | | | llvm-svn: 166849
* Refactor some code into a new skipRValueSubobjectAdjustments function.Rafael Espindola2012-10-271-45/+51
| | | | llvm-svn: 166848
* Delay codegen to after collecting all SubobjectAdjustment so that the collectionRafael Espindola2012-10-271-6/+6
| | | | | | can be refactored and used in Sema. llvm-svn: 166847
* -fcatch-undefined-behavior checking for appropriate vptr value: Clang ↵Richard Smith2012-10-251-7/+83
| | | | | | CodeGen side. llvm-svn: 166661
* DR1472: A reference isn't odr-used if it has preceding initialization,Richard Smith2012-10-201-3/+17
| | | | | | | | | initialized by a reference constant expression. Our odr-use modeling still needs work here: we don't yet implement the 'set of potential results of an expression' DR. llvm-svn: 166361
* Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling2012-10-151-1/+1
| | | | | | own class named AttrBuilder. No functionality change. llvm-svn: 165961
* Attributes RewriteBill Wendling2012-10-151-1/+2
| | | | | | | | Convert the uses of the Attributes class over to the new format. The Attributes::get method call now takes an LLVM context so that the attributes object can be uniquified and stored. llvm-svn: 165918
* Add codegen support for __uuidof().Nico Weber2012-10-111-1/+11
| | | | llvm-svn: 165710
* Remove the final bits of Attributes being declared in the AttributeBill Wendling2012-10-101-3/+5
| | | | | | | namespace. Use the attribute's enum value instead. No functionality change intended. llvm-svn: 165611
* -fcatch-undefined-behavior: store the type name directly at the end of a ↵Richard Smith2012-10-091-5/+5
| | | | | | type descriptor. 5% binary size reduction due to fewer relocations. llvm-svn: 165572
* -fcatch-undefined-behavior: emit calls to the runtime library whenever one ↵Richard Smith2012-10-091-26/+164
| | | | | | of the checks fails. llvm-svn: 165536
* Move TargetData to DataLayout.Micah Villmow2012-10-081-3/+3
| | | | llvm-svn: 165395
* When a bad UTF-8 encoding or bogus escape sequence is encountered in aRichard Smith2012-09-081-2/+3
| | | | | | | string literal, produce a diagnostic pointing at the erroneous character range, not at the start of the literal. llvm-svn: 163459
* -fcatch-undefined-behavior: Factor emission of the creation of, and branch to,Richard Smith2012-09-081-31/+28
| | | | | | | | | the trap BB out of the individual checks and into a common function, to prepare for making this code call into a runtime library. Rename the existing EmitCheck to EmitTypeCheck to clarify it and to move it out of the way of the new EmitCheck. llvm-svn: 163451
* Change the representation of builtin functions in the ASTEli Friedman2012-08-311-1/+4
| | | | | | | | | (__builtin_* etc.) so that it isn't possible to take their address. Specifically, introduce a new type to represent a reference to a builtin function, and a new cast kind to convert it to a function pointer in the operand of a call. Fixes PR13195. llvm-svn: 162962
* New -fcatch-undefined-behavior features:Richard Smith2012-08-241-21/+62
| | | | | | | | * when checking that a pointer or reference refers to appropriate storage for a type, also check the alignment and perform a null check * check that references are bound to appropriate storage * check that 'this' has appropriate storage in member accesses and member function calls llvm-svn: 162523
* Convert loads and stores of vec3 to vec4 to achieve better code generation. ↵Tanya Lattner2012-08-161-0/+80
| | | | | | Add test case. llvm-svn: 162002
* Fix an assertion failure with a C++ constructor initializing aEli Friedman2012-08-081-22/+0
| | | | | | member of reference type in an anonymous struct. PR13154. llvm-svn: 161473
* Update Clang to reflect the move of MDBuilder in r160237.Chandler Carruth2012-07-151-1/+1
| | | | llvm-svn: 160238
* Distinguish more carefully between free functions and C++ instance methodsJohn McCall2012-07-071-2/+2
| | | | | | | | in the ABI arrangement, and leave a hook behind so that we can easily tweak CCs on platforms that use different CCs by default for C++ instance methods. llvm-svn: 159894
* Silence warning in -Asserts buildMatt Beaumont-Gay2012-07-031-0/+1
| | | | llvm-svn: 159635
* Share ConvertUTF8toWide() between Lex and CodeGen.Nico Weber2012-07-031-37/+2
| | | | llvm-svn: 159634
* Significantly simplify CGExprAgg's logic about ignored results:John McCall2012-07-021-6/+9
| | | | | | | | | | | | if we want to ignore a result, the Dest will be null. Otherwise, we must copy into it. This means we need to ensure a slot when loading from a volatile l-value. With all that in place, fix a bug with chained assignments into __block variables of aggregate type where we were losing insight into the actual source of the value during the second assignment. llvm-svn: 159630
* Propagate lvalue alignment into bitfields. Per report on cfe-dev.Eli Friedman2012-06-271-19/+18
| | | | llvm-svn: 159295
* Support L__FUNCTION__ in microsoft mode, PR11789Nico Weber2012-06-231-6/+95
| | | | | | | | | | Heavily based on a patch from Aaron Wishnick <aaron.s.wishnick@gmail.com>. I'll clean up the duplicated function in CodeGen as a follow-up, later today or tomorrow. llvm-svn: 159060
* Make the ".*" operator work correctly when the base is a prvalue and the ↵Eli Friedman2012-06-151-1/+30
| | | | | | field has a non-trivial copy constructor. PR13097. llvm-svn: 158578
* User better API for vla in compund literals.Fariborz Jahanian2012-06-071-4/+3
| | | | | | // rdar://11485774 llvm-svn: 158157
* When emitting compund literal of vla pointer elements, make Fariborz Jahanian2012-06-071-1/+5
| | | | | | | sure to emit vla size to prevent an irgen crash. // rdar://11485774 llvm-svn: 158153
* wire -fbounds-checking to the new LLVM bounds checking passNuno Lopes2012-05-221-1/+1
| | | | llvm-svn: 157262
* revert the usage of the objectsize intrinsic with 3 parameters (to match ↵Nuno Lopes2012-05-221-2/+1
| | | | | | LLVM r157255) llvm-svn: 157256
* Implement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and theRichard Smith2012-05-141-7/+14
| | | | | | expression is treated as an lvalue. llvm-svn: 156781
* update calls to objectsize intrinsic to match LLVM r156473Nuno Lopes2012-05-091-2/+3
| | | | | | add a test for -fbounds-checking code generation llvm-svn: 156474
* add -fbounds-checking option.Nuno Lopes2012-05-081-1/+1
| | | | | | | | When enabled, clang generates bounds checks for array and pointers dereferences. Work to follow in LLVM's backend. OK'ed by Chad; thanks for the review. llvm-svn: 156431
* remove code to add bound checks for simple array accesses, since those are ↵Nuno Lopes2012-05-071-25/+0
| | | | | | | | already covered by the check with the objectsize builtin remove the comparison of objectsize with -1. since it's an unsigned comparison, it will always succeed if objectsize returns -1, which is enough to have the check removed llvm-svn: 156311
OpenPOWER on IntegriCloud