summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Fix the required args count for variadic blocks.John McCall2012-12-076-19/+61
| | | | | | | | | | | | | | | | | 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-065-518/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use the 'count' attribute to calculate the upper bound of an array.Bill Wendling2012-12-041-26/+9
| | | | | | | | | The count attribute is more accurate with regards to the size of an array. It also obviates the upper bound attribute in the subrange. We can also better handle an unbound array by setting the count to -1 instead of the lower bound to 1 and upper bound to 0. llvm-svn: 169311
* Adapt to LLVM commit 169291 which streamlines the usage of NaCl/NativeClientEli Bendersky2012-12-041-4/+4
| | | | | | in the triple. llvm-svn: 169292
* objective-c blocks: Consider padding due to alignmentFariborz Jahanian2012-12-043-6/+25
| | | | | | | after the fixed size block header when generating captured block variable info. // rdar://12773256 llvm-svn: 169285
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-0442-151/+139
| | | | | | | | | | | | | 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
* Add a 'count' field to the DWARF subrange.Bill Wendling2012-12-041-5/+18
| | | | | | | | | The count field is necessary because there isn't a difference between the 'lo' and 'hi' attributes for a one-element array and a zero-element array. When the count is '0', we know that this is a zero-element array. When it's >=1, then it's a normal constant sized array. When it's -1, then the array is unbounded. llvm-svn: 169219
* Have clang use LLVM IR's fast-math flags when in FastMath or FiniteMathOnly ↵Michael Ilseman2012-12-041-0/+10
| | | | | | modes. Test cases included. llvm-svn: 169191
* remove trailing whitespaceMichael Ilseman2012-12-041-32/+32
| | | | llvm-svn: 169187
* 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
* Add Clang flags -fsanitize-blacklist and -fno-sanitize-blacklist. Make this ↵Alexey Samsonov2012-12-031-5/+11
| | | | | | flag usable for ASan. Blacklisting can be used to disable sanitizer checks for particular file/function/object. llvm-svn: 169144
* Fix PR14474: don't emit debug info for interface types in -gline-tables-only ↵Alexey Samsonov2012-12-031-3/+3
| | | | | | mode. llvm-svn: 169138
* Add -fsanitize=memory.Evgeniy Stepanov2012-12-031-0/+12
| | | | llvm-svn: 169124
* [ubsan] Add flag to enable recovery from checks when possible.Will Dietz2012-12-025-13/+36
| | | | llvm-svn: 169114
* Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer2012-12-011-2/+3
| | | | | | | | | pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
* 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
* Fix a small calling-convention bug for x86-32. PR14453.Eli Friedman2012-11-291-2/+8
| | | | llvm-svn: 168959
* This patch exposes to Clang users three more sanitizers are experimental ↵Alexey Samsonov2012-11-291-8/+24
| | | | | | | | | | | | | | features of ASan: 1) init-order sanitizer: initialization-order checker. Status: usable, but may produce false positives w/o proper blacklisting. 2) use-after-return sanitizer Status: implemented, but heavily understed. Should be optional, as it significanlty slows program down. 3) use-after-scope sanitizer Status: in progress. llvm-svn: 168950
* Merge function types in C.Rafael Espindola2012-11-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other differences, GCC accepts typedef int IA[]; typedef int A10[10]; static A10 *f(void); static IA *f(void); void g(void) { (void)sizeof(*f()); } but clang used to reject it with: invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []') The intention of c99's 6.2.7 seems to be that we should use the composite type and accept as gcc does. Doing the type merging required some extra fixes: * Use the type from the function type in initializations, even if an parameter is available. * Fix the merging of the noreturn attribute in function types. * Make CodeGen handle the fact that an parameter type can be different from the corresponding type in the function type. llvm-svn: 168895
* objective-C blocks: Make sure that identical logic is usedFariborz Jahanian2012-11-283-6/+5
| | | | | | | | | | in deciding a copy/dispose field is needed in a byref structure and when generating the copy/dispose helpers. In certain cases, these fields were being added but no copy/dispose was being generated. This was uncovered in ARC, but not in MRR. // rdar://12759433 llvm-svn: 168825
* ABI: comments from Eli on r168820.Manman Ren2012-11-281-0/+2
| | | | | | rdar://12723368 llvm-svn: 168821
* ABI: modify CreateCoercedLoad and CreateCoercedStore to not use load or store ofManman Ren2012-11-281-12/+12
| | | | | | | | | | | | | | | the original parameter or return type. Since we do not accurately represent the data fields of a union, we should not directly load or store a union type. As an exmple, if we have i8,i8, i32, i32 as one field type and i32,i32 as another field type, the first field type will be chosen to represent the union. If we load with the union's type, the 3rd byte and the 4th byte will be skipped. rdar://12723368 llvm-svn: 168820
* [asan] Split AddressSanitizer into two passes (FunctionPass, ModulePass), ↵Kostya Serebryany2012-11-281-1/+2
| | | | | | Clang part. llvm-svn: 168782
* objective-C arc: load of a __weak object happens via call toFariborz Jahanian2012-11-272-6/+17
| | | | | | | | | | | 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
* Add -fsanitize=integer for reporting suspicious integer behaviors.Will Dietz2012-11-271-22/+52
| | | | | | Introduces new sanitizer "unsigned-integer-overflow". llvm-svn: 168701
* This patch addresses an incompatibility relative to the 64-bit PowerPCBill Schmidt2012-11-271-0/+3
| | | | | | | | | | | | | | | ELF ABI. Complex values are to be passed in registers as though the real and imaginary parts were passed as separate parameters. Prior to this patch, complex values were passed as byval aggregates. It turns out that specifying getDirect() for all complex types when classifying the argument type results in the desired behavior. The new Clang test case verifies that the correct LLVM IR is generated for caller and callee for each of the underlying types for _Complex. llvm-svn: 168673
* MSPGCC renamed ISR vectors from vector_<address> to __isr_<number>. This ↵Anton Korobeynikov2012-11-261-2/+2
| | | | | | | | patch makes Clang reflect this scheme. Patch by Job Noorman! llvm-svn: 168598
* PR14306: Move -fbounds-checking to -fsanitize=bounds.Joey Gouly2012-11-231-4/+2
| | | | llvm-svn: 168510
* Update method calls to the new interface re r168354.Bill Wendling2012-11-202-3/+4
| | | | llvm-svn: 168355
* 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
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-164-5/+5
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* Make sure CodeGenTypes correctly reconverts function types. Fixes PR14355, ↵Eli Friedman2012-11-151-1/+11
| | | | | | a crash in IR generation. llvm-svn: 168112
* Simplify code. No functionality change.Benjamin Kramer2012-11-151-18/+12
| | | | llvm-svn: 168047
* Use empty parens for empty function parameter list instead of '(void)'.Dmitri Gribenko2012-11-154-6/+6
| | | | llvm-svn: 168041
* Make -ffp-contract a codegen option, rather than a laguage option. This makesLang Hames2012-11-152-5/+5
| | | | | | | more sense anyway - it determines how expressions are codegen'd. It also ensures that -ffp-contract=fast has the intended effect when compiling LLVM IR. llvm-svn: 168027
* When evaluating variably modified types for function parameters, dig out theEli Friedman2012-11-141-1/+10
| | | | | | | | | | type as written from the ParmVarDecl; it's unclear whether the standard (C99 6.9.1p10) requires this, but we're following the precedent set by gcc, and hopefully nobody will ever ask about this again. PR9559 / <rdar://problem/12621983>. llvm-svn: 167985
* The ObjC++-to-C++ personality trick is only necessary on NeXT runtimes,John McCall2012-11-141-4/+5
| | | | | | | which is not coincidentally the only place it works, either (because of how it tests for EH_TYPE symbols). llvm-svn: 167935
* fixes a buildbot failure.Fariborz Jahanian2012-11-141-0/+1
| | | | llvm-svn: 167934
* Fix 80-column violation.Fariborz Jahanian2012-11-141-3/+5
| | | | llvm-svn: 167932
* objective-C blocks: Provide layout map for byrefFariborz Jahanian2012-11-146-78/+203
| | | | | | variables captured in a block. // rdar://12184410 llvm-svn: 167931
* Move some GNUStep-specific code out of CGObjCGNU.John McCall2012-11-141-22/+25
| | | | | | Patch by Jonathan Schleifer. llvm-svn: 167925
* Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."Eric Christopher2012-11-131-12/+9
| | | | | | | | temporarily since it breaks the gdb bots. This reverts commit r167807/30305bec25cac981c6d4a3b8be004401310a82a7. llvm-svn: 167887
* Use the 'count' attribute instead of the 'upper_bound' attribute.Bill Wendling2012-11-131-9/+12
| | | | | | | | | If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the same for both of them because we use the 'upper_bound' attribute. Instead use the 'count' attrbute, which gives the correct number of elements in the array. <rdar://problem/12566646> llvm-svn: 167807
* 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
* objective-C blocks: Change BLOCK_HAS_EXTENDED_LAYOUT to be 1<<31.Fariborz Jahanian2012-11-101-2/+2
| | | | | | lower 24bit is currently being used. llvm-svn: 167678
* Turn FrontendInputFile into an immutable class and have it also acceptArgyrios Kyrtzidis2012-11-091-1/+1
| | | | | | a memory buffer instead of only a filename. llvm-svn: 167627
* Implement -mstrict-align using '-backend-option -arm-strict-align' as this savesChad Rosier2012-11-091-1/+0
| | | | | | us from having to make any backend changes. llvm-svn: 167623
* [driver] Add a -mstrict-align compiler option for ARM targets.Chad Rosier2012-11-091-0/+1
| | | | | | rdar://12340498 llvm-svn: 167619
* When deciding whether to convert an array construction loop into a memcpy, lookRichard Smith2012-11-071-11/+4
| | | | | | | | at whether the *selected* constructor would be trivial rather than considering whether the array's element type has *any* non-trivial constructors of the relevant kind. llvm-svn: 167562
OpenPOWER on IntegriCloud