summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExpr.cpp
AgeCommit message (Collapse)Author
2011-11-06Change the AST representation of operations on Objective-CJohn McCall
property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
2011-11-02back out changes in r143399 and r143475.Fariborz Jahanian
rvale-references are captured by reference in blocks. // rdar://9971124. llvm-svn: 143583
2011-10-31Adds IRGen support for captured rvalue references in blocks.Fariborz Jahanian
In this case, temporary value is copied into block descriptor as their own copy to work on. // rdar://9971124 llvm-svn: 143399
2011-10-27Annotate imprecise FP division with fpaccuracy metadataPeter Collingbourne
The OpenCL single precision division operation is only required to be accurate to 2.5ulp. Annotate the fdiv instruction with metadata which signals to the backend that an imprecise divide instruction may be used. llvm-svn: 143136
2011-10-14Misc fixes for atomics. Biggest fix is doing alignment correctly for ↵Eli Friedman
_Atomic types. llvm-svn: 142002
2011-10-13Recommit:Eric Christopher
Start handling debug line and scope information better: Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 after fixing a few bugs that were exposed in gdb testsuite testing. llvm-svn: 141893
2011-10-12Revert file/scope handling patches. gdb testing revealed a couple of bugs.Eric Christopher
llvm-svn: 141796
2011-10-11Start handling debug line and scope information better:Eric Christopher
Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 llvm-svn: 141732
2011-10-11Silence some -Wuninitialized false positives with gcc.Eli Friedman
llvm-svn: 141701
2011-10-11Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman
llvm-svn: 141632
2011-10-06CUDA: IR generation support for kernel call expressionsPeter Collingbourne
llvm-svn: 141300
2011-09-30objc gc: assigning to an objc object struct member through an ivar Fariborz Jahanian
pointer to this struct must go through the none ivar writer barrier. llvm-svn: 140867
2011-09-29Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don'tEric Christopher
exist anymore. llvm-svn: 140739
2011-09-29Call UpdateLineDirectiveRegion every time we want to emit a stopEric Christopher
point in the code. Ensures that we don't miss any places and the check is reasonably cheap. llvm-svn: 140737
2011-09-27de-tmpify clang.Benjamin Kramer
llvm-svn: 140637
2011-09-23Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie
llvm-svn: 140407
2011-09-23Switch assert(0/false) llvm_unreachable.David Blaikie
llvm-svn: 140367
2011-09-21ANSI C requires that a call to an unprototyped function type succeedJohn McCall
if the definition has a non-variadic prototype with compatible parameters. Therefore, the default rule for such calls must be to use a non-variadic convention. Achieve this by casting the callee to the function type with which it is required to be compatible, unless the target specifically opts out and insists that unprototyped calls should use the variadic rules. The only case of that I'm aware of is the x86-64 convention, which passes arguments the same way in both cases but also sets a small amount of extra information; here we seek to maintain compatibility with GCC, which does set this when calling an unprototyped function. Addresses PR10810 and PR10713. llvm-svn: 140241
2011-09-13Switch LangOptions over to a .def file that describes header of theDouglas Gregor
language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
2011-09-10Rename the ARC cast kinds to start with "ARC".John McCall
llvm-svn: 139466
2011-09-10When converting a block pointer to an Objective-C pointer type, extendJohn McCall
the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
2011-09-09Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: canJulien Lerouge
annotate global, local variables, struct fields, or arbitrary statements (using the __builtin_annotation), rdar://8037476. llvm-svn: 139423
2011-09-09Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall
than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
2011-09-08Formatting.Eric Christopher
llvm-svn: 139296
2011-09-06When extracting the callee declaration from a call expression, be sureDouglas Gregor
to look through SubstNonTypeTemplateParmExprs. Then, update the IR generation of CallExprs to actually use CallExpr::getCalleeDecl() rather than attempting to mimick its behavior (badly). Fixes <rdar://problem/10063539>. llvm-svn: 139185
2011-08-26Slight optimization enabled by the previous assert: John McCall
emit all gl-value arguments as reference bindings. llvm-svn: 138655
2011-08-26What say we document some of these AggValueSlot flags a bitJohn McCall
better. llvm-svn: 138628
2011-08-26An initialization does not alias.John McCall
llvm-svn: 138624
2011-08-25Track whether an AggValueSlot is potentially aliased, and do notJohn McCall
emit call results into potentially aliased slots. This allows us to properly mark indirect return slots as noalias, at the cost of requiring an extra memcpy when assigning an aggregate call result into a l-value. It also brings us into compliance with the x86-64 ABI. llvm-svn: 138599
2011-08-25Use stronger typing for the flags on AggValueSlot and requireJohn McCall
creators to tell us whether something needs GC barriers. No functionality change. llvm-svn: 138581
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-07-22Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to useJay Foad
ArrayRef. llvm-svn: 135761
2011-07-20as eli points out, we're not doing memory stuff here. While ConvertType Chris Lattner
and ConvertTypeForMem are the same for pointers, it is best to just use ConvertType. Thanks Eli! llvm-svn: 135567
2011-07-18de-constify llvm::Type, patch by David Blaikie!Chris Lattner
llvm-svn: 135370
2011-07-15Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall
to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
2011-07-14Change intrinsic getter to take an ArrayRef, now that the underlying ↵Benjamin Kramer
function in LLVM does. llvm-svn: 135155
2011-07-12Add more compiler workarounds. Should fix the build with old GCCs and MSVC.Benjamin Kramer
llvm-svn: 134995
2011-07-12Switch field destruction over to use the new destroyer-based APIJohn McCall
and kill a lot of redundant code. llvm-svn: 134988
2011-07-12Work around a problem with a static helper's formulation in releaseChandler Carruth
builds introduced in r134972: lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType' lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument This fixes the issue by passing CodeGenFunction on down, and using its builder directly rather than passing just the builder down. This may not be the best / cleanest fix, Chris please review. It at least fixes builds. llvm-svn: 134977
2011-07-12Fix a problem Eli ran into where we now reject incomplete arrays of Chris Lattner
uncompleted struct types. We now do what llvm-gcc does and compile them into [i8 x 0]. If the type is later completed, we make sure that it is appropriately cast. We compile the terrible example to something like this now: %struct.A = type { i32, i32, i32 } @g = external global [0 x i8] define void @_Z1fv() nounwind { entry: call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*)) ret void } declare void @_Z3fooP1A(%struct.A*) define %struct.A* @_Z2f2v() nounwind { entry: ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1) } llvm-svn: 134972
2011-07-10enhance EmitLValueForFieldInitialization to do the proper pointer ↵Chris Lattner
adjustment, allowing us to revert the other half of r134860. Now things are back to a relatively tidy state. llvm-svn: 134865
2011-07-10revert part of r134860, which is empirically unnecessary after the proper fixChris Lattner
llvm-svn: 134864
2011-07-10change EmitLValueForField to cast the returned lvalue to the rightChris Lattner
type, even when in the struct case. This was one root issue that was causing type mismatches throughout the compiler. llvm-svn: 134862
2011-07-10when emitting pointer load from an lvalue or storing to an lvalue,Chris Lattner
do an explicit bitcast to whatever ConvertType produces. This will go with the next patch. llvm-svn: 134860
2011-07-09clang side to match the LLVM IR type system rewrite patch.Chris Lattner
llvm-svn: 134831
2011-07-07In ARC, reclaim all return values of retainable type, not just thoseJohn McCall
where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
2011-07-07Sort #includes.Nick Lewycky
llvm-svn: 134589
2011-06-27Fix PR10204 in a better way.John McCall
llvm-svn: 133943
2011-06-27Revert parts of r133860 to fix a crash. Add a test.Nico Weber
llvm-svn: 133931
2011-06-25LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall
by removing the redundant type parameter. llvm-svn: 133860