summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprScalar.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | 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
* [ubsan] Add flag to enable recovery from checks when possible.Will Dietz2012-12-021-2/+4
| | | | llvm-svn: 169114
* Add -fsanitize=integer for reporting suspicious integer behaviors.Will Dietz2012-11-271-22/+52
| | | | | | Introduces new sanitizer "unsigned-integer-overflow". llvm-svn: 168701
* Make -ffp-contract a codegen option, rather than a laguage option. This makesLang Hames2012-11-151-1/+1
| | | | | | | 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
* Classify the INT_MIN/-1 check as -fsanitize=signed-integer-overflow, not as ↵Richard Smith2012-11-061-9/+17
| | | | | | -fsanitize=divide-by-zero. llvm-svn: 167433
* Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith2012-11-051-12/+14
| | | | | | | 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-14/+14
| | | | llvm-svn: 167261
* Clean up misapplication of diff.Richard Smith2012-11-011-1/+0
| | | | llvm-svn: 167260
* Split emission of -ftrapv checks and -fcatch-undefined-behavior checks intoRichard Smith2012-11-011-0/+6
| | | | | | separate functions, since they share essentially no code. llvm-svn: 167259
* Remove divison-by-zero checks from -ftrapv. These checks were incompatible withRichard Smith2012-11-011-6/+2
| | | | | | | g++'s -ftrapv, failed to call the -ftrapv overflow handler, and are still available under -fcatch-undefined-behavior. llvm-svn: 167258
* Switch CodeGenOptions over to a .def file, like we do with LangOptions.Douglas Gregor2012-10-231-1/+2
| | | | llvm-svn: 166497
* -fcatch-undefined-behavior: Trap undefined behavior due to conversions to orRichard Smith2012-10-121-0/+118
| | | | | | | from a floating-point type where the source value is not in the range of representable values of the destination type. llvm-svn: 165843
* -fcatch-undefined-behavior: emit calls to the runtime library whenever one ↵Richard Smith2012-10-091-7/+59
| | | | | | of the checks fails. llvm-svn: 165536
* Move TargetData to DataLayout.Micah Villmow2012-10-081-1/+1
| | | | llvm-svn: 165395
* Fail early with a clear assert if an operation with multiple uses somehow endsLang Hames2012-10-041-0/+4
| | | | | | up being contracted during codegen. llvm-svn: 165197
* Always initialize FPContractable.Benjamin Kramer2012-10-031-0/+3
| | | | | | | false is used as a baseline here, we may want to allow contraction in some of the cases. Found by valgrind. llvm-svn: 165156
* Teach getCXXRecordDeclForPointerType about references.Jordan Rose2012-10-031-8/+7
| | | | | | | | | Then, rename it getPointeeCXXRecordDecl and give it a nice doc comment, and actually use it. No intended functionality change. llvm-svn: 165077
* Add FP_CONTRACT support for clang.Lang Hames2012-10-021-2/+84
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* -fcatch-undefined-behavior: Factor emission of the creation of, and branch to,Richard Smith2012-09-081-66/+29
| | | | | | | | | 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/+3
| | | | | | | | | (__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
* Fix PR13704Michael Liao2012-08-281-1/+1
| | | | | | | - The increment needs to be signed value to preserve the original value when its data type is larger than 64-bit integer. llvm-svn: 162766
* Remove spurious string literal for bool argument.Richard Smith2012-08-251-1/+1
| | | | llvm-svn: 162642
* -fcatch-undefined-behavior: add the -ftrapv checks to the set of things caughtRichard Smith2012-08-251-18/+49
| | | | | | | | | | | | | | | | by this mode, and also check for signed left shift overflow. The rules for the latter are a little subtle: * neither C89 nor C++98 specify the behavior of a signed left shift at all * in C99 and C11, shifting a 1 bit into the sign bit has undefined behavior * in C++11, with core issue 1457, shifting a 1 bit *out* of the sign bit has undefined behavior As of this change, we use the C99 rules for all C language variants, and the C++11 rules for all C++ language variants. Once we have individual -fcatch-undefined-behavior= flags, this should be revisited. llvm-svn: 162634
* New -fcatch-undefined-behavior features:Richard Smith2012-08-241-5/+7
| | | | | | | | * 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
* Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used ↵Benjamin Kramer2012-07-041-3/+2
| | | | | | | | instead. No functionality change. llvm-svn: 159719
* Fix Sema and IRGen for atomic compound assignment so it has the right ↵Eli Friedman2012-06-161-5/+5
| | | | | | | | semantics when promotions are involved. (As far as I can tell, this only affects some edge cases.) llvm-svn: 158591
* reverse r158117.Fariborz Jahanian2012-06-061-3/+0
| | | | llvm-svn: 158119
* When doing arithmatic on vla pointer, make sureFariborz Jahanian2012-06-061-0/+3
| | | | | | | to emit vla size to prevent an irgen crash. // rdar://11485774 llvm-svn: 158117
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-1/+1
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* OpenCL: Fix vector conditional operator CodeGen for the case wherePeter Collingbourne2012-05-291-1/+1
| | | | | | the operands are vectors of doubles. llvm-svn: 157596
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-2/+2
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Use enum to set debug info size generated by ClangAlexey Samsonov2012-04-271-3/+4
| | | | llvm-svn: 155697
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-2/+2
| | | | llvm-svn: 155082
* Express the number of ULPs in fpaccuracy metadata as a real rather than a Duncan Sands2012-04-101-1/+1
| | | | | | rational number, eg as 2.5 rather than 5, 2. OK'd by Peter Collingbourne. llvm-svn: 154388
* Make the variant of __builtin_shufflevector that takes the shuffle indexes ↵Eli Friedman2012-04-051-3/+3
| | | | | | as a vector actually usable. Patch by David Neto. PR12465. llvm-svn: 154128
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-16/+16
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-11/+4
| | | | | | | | 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-101-46/+15
| | | | | | | | 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
* [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
* 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-061-0/+12
| | | | | | | | | | | | | 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
* Reinstate r151879, r151880, reverted in r151922, along with a bugfix forRichard Smith2012-03-021-9/+15
| | | | | | | | | 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
* 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
* Implement IRGen for the retain-autorelease in the lambda ↵Eli Friedman2012-02-281-2/+1
| | | | | | conversion-to-block-pointer outside of ARC. Testcases coming up soon. llvm-svn: 151603
* Generate an AST for the conversion from a lambda closure type to aDouglas Gregor2012-02-221-0/+4
| | | | | | | | | | | | | | | block pointer that returns a block literal which captures (by copy) the lambda closure itself. Some aspects of the block literal are left unspecified, namely the capture variable (which doesn't actually exist) and the body (which will be filled in by IRgen because it can't be written as an AST). Because we're switching to this model, this patch also eliminates tracking the copy-initialization expression for the block capture of the conversion function, since that information is now embedded in the synthesized block literal. -1 side tables FTW. llvm-svn: 151131
* Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,Richard Smith2012-02-181-1/+4
| | | | | | rather than an lvalue referring to the scalar. llvm-svn: 150889
* Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall2012-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | | is general goodness because representations of member pointers are not always equivalent across member pointer types on all ABIs (even though this isn't really standard-endorsed). Take advantage of the new information to teach IR-generation how to do these reinterprets in constant initializers. Make sure this works when intermingled with hierarchy conversions (although this is not part of our motivating use case). Doing this in the constant-evaluator would probably have been better, but that would require a *lot* of extra structure in the representation of constant member pointers: you'd really have to track an arbitrary chain of hierarchy conversions and reinterpretations in order to get this right. Ultimately, this seems less complex. I also wasn't quite sure how to extend the constant evaluator to handle foldings that we don't actually want to treat as extended constant expressions. llvm-svn: 150551
* Use a simpler (and more efficient) pattern to pad vectors.Benjamin Kramer2012-02-141-11/+6
| | | | llvm-svn: 150475
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-5/+4
| | | | | | CodeGenModule. llvm-svn: 149943
OpenPOWER on IntegriCloud