Граф коммитов

71 Коммитов

Автор SHA1 Сообщение Дата
Chad Rosier 649b4a1a9b Revert r153613 as it's causing large compile-time regressions on the nightly testers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-29 17:37:10 +00:00
John McCall 57cd1b89cd When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value.  Fixes PR12204.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-28 23:30:44 +00:00
Eli Friedman e5a8aeb4ad Make sure we correctly set the alignment for vector loads and stores associated with vector element lvalues. Patch by Kevin Schoedel (with some minor modifications by me).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153285 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-22 22:36:39 +00:00
Benjamin Kramer 9f32a920c6 Reuse forAddr to create ignored AggValueSlots.
Silences valgrind warnings about uninitalized alignment values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146342 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-11 16:34:24 +00:00
Eli Friedman 6da2c71601 Switch LValue so that it exposes alignment in CharUnits. (No functional change.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 04:14:32 +00:00
Eli Friedman 51f5120905 Add a utility to get a RValue for a given LValue for an aggregate; switch a few places over to it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145747 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 03:08:40 +00:00
Eli Friedman d7722d9d76 Switch the Alignment argument on AggValueSlot over to CharUnits, per John's review comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145741 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 02:13:40 +00:00
Eli Friedman f394078fde Track alignment in AggValueSlot. No functional change in this patch, but I'll be introducing uses of the specified alignment soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145736 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 00:54:26 +00:00
John McCall db45806b99 Rip the ObjCPropertyRef l-value kind out of IR-generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143908 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-07 03:59:57 +00:00
John McCall 4b9c2d235f Change the AST representation of operations on Objective-C
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-06 09:01:30 +00:00
John McCall fd71fb81c5 What say we document some of these AggValueSlot flags a bit
better.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138628 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-26 08:02:37 +00:00
John McCall 4418439220 Since the 'is aliased' bit is critical for correctness in C++, it
really shouldn't be optional.  Fix the remaining place where a
temporary was being passed as potentially-aliased memory.

Fixes PR10756.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138627 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-26 07:31:35 +00:00
John McCall 410ffb2bc5 Track whether an AggValueSlot is potentially aliased, and do not
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138599 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-25 23:04:34 +00:00
John McCall 7c2349be2d Use stronger typing for the flags on AggValueSlot and require
creators to tell us whether something needs GC barriers.
No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-25 20:40:09 +00:00
John McCall a07398ed98 Restore correct use of GC barriers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133144 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-16 04:16:24 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
John McCall 5808ce43f8 More capturing of 'this': implicit member expressions. Getting that
right for anonymous struct/union members led to me discovering some
seemingly broken code in that area of Sema, which I fixed, partly by  
changing the representation of member pointer constants so that    
IndirectFieldDecls aren't expanded.  This led to assorted cleanups with   
member pointers in CodeGen, and while I was doing that I saw some random
other things to clean up.                   



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124785 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 08:15:49 +00:00
John McCall 119a1c6c40 Kill the KVC l-value kind and calculate the base expression when emitting
the l-value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 02:32:38 +00:00
Chris Lattner 1b726771d0 Improve codegen for initializer lists to use memset more aggressively
when an initializer is variable (I handled the constant case in a previous
patch).  This has three pieces:

1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that
   the memory being stored into has previously been memset to zero.
2. Teach CGExprAgg to not emit stores of zero to isZeroed memory.
3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine
   whether they are profitable to emit a memset + inividual stores vs
   stores for everything.

The heuristic used is that a global has to be more than 16 bytes and
has to be 3/4 zero to be candidate for this xform.  The two testcases
are illustrative of the scenarios this catches.  We now codegen test9 into:

 call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false)
 %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0
 %tmp = load i32* %X.addr, align 4
 store i32 %tmp, i32* %.array

and test10 into:

  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false)
  %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0
  %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0
  %tmp2 = load i32* %X.addr, align 4
  store i32 %tmp2, i32* %tmp1, align 4
  %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3
  %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4
  %tmp11 = load i32* %X.addr, align 4
  store i32 %tmp11, i32* %tmp10, align 4

Previously we produced 99 stores of zero for test9 and also tons for test10.
This xforms should substantially speed up -O0 builds when it kicks in as well
as reducing code size and optimizer heartburn on insane cases.  This resolves
PR279.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 07:07:26 +00:00
John McCall 12f78a6741 Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:19:52 +00:00
John McCall 74fb0edb44 Reset the lifetime-managed flag between emission of the agg conditional
branches.  Fixes PR8623.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 00:07:33 +00:00
Fariborz Jahanian 8a97005f97 After discussion with Doug and John, I am reverting
the patch. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117159 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 22:05:03 +00:00
Fariborz Jahanian 07ed93f378 Patch fixes miscompile with non-trivial copy constructors and
statement expressions, //rdar: //8540501


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 21:01:02 +00:00
Dan Gohman 3d5aff5d30 Experimental TBAA support.
This enables metadata generation by default, however the TBAA pass
in the optimizer is still disabled for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 23:06:10 +00:00
Fariborz Jahanian da53134472 Removes unused setter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 16:14:34 +00:00
John McCall 6fa291673f Further beautification: this pointer can now be typed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 03:16:41 +00:00
John McCall d1a5f13140 Initialize AggValueSlot's flags along all paths, plus minor beautification.
Prospective fix for broken commit in r114045.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 03:13:23 +00:00
Fariborz Jahanian 474e2fe495 Patch to move RequiresGCollection bit to
AggValueSlot slot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 00:20:07 +00:00
John McCall 558d2abc7f one piece of code is responsible for the lifetime of every aggregate
slot.  The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.

I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision.  The main obstacle here is that
IR-generation must be much more careful about making sure that exactly



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 10:14:12 +00:00
Daniel Dunbar 77c059060f CGValue: Increase width of allowed alignment. We could switch to log2, but we
don't currently need the bits anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112173 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 06:02:12 +00:00
Daniel Dunbar f1fbda380b IRgen/CGValue: Give MakeAddrLValue() an alignment argument, and eliminate old form of MakeAddr().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111723 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 03:58:45 +00:00
Daniel Dunbar 3491b3d38b IRgen: Move remaining LValue::Set... methods to LValue::set... (non-static) methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 03:51:29 +00:00
Daniel Dunbar 99ad7df957 IRgen/CGValue: Add getQuals(), so qualifiers can be modified on an LValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111719 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 03:29:54 +00:00
Daniel Dunbar ea61917735 IRgen/LValue: Add LValue::setNonGC instead of SetObjCNonGC, for consistency with isNonGC().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111718 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 03:22:38 +00:00
Daniel Dunbar 5cf8bfec71 IRgen: Add an LValue::MakeAddr variant which takes a type and uses that to build
the qualifiers.

Also, add CodeGenFunction::MakeAddrLValue() helper function which passes in the
ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111714 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 02:53:44 +00:00
Daniel Dunbar 9f4f7cfe40 IRgen/CGValue: Add alignment to LValue, and use that alignment when generating lvalue load/stores.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 02:39:23 +00:00
Daniel Dunbar de988818f4 IRgen/LValue: Rename SetQualifiers() to Initialize().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 02:31:58 +00:00
Fariborz Jahanian 021a7a6398 Adopt objc_assign_threadlocal() for __thread variables of GC types.
Implements radar 8203301.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 20:30:03 +00:00
Benjamin Kramer 81bf3b3566 CodeGen: Shrink RValue. 4 words -> 2 words.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102863 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 14:59:10 +00:00
Daniel Dunbar 7f2896406c IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 02:59:45 +00:00
Daniel Dunbar efbf487da8 IRgen: Move BitFieldIsSigned bit into CGBitFieldInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 01:07:44 +00:00
Daniel Dunbar f0fe5bc0e4 IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
- Unfortunately, this requires some horrible code in CGObjCMac which always
   allocats a CGBitFieldInfo because we don't currently build a proper layout
   for Objective-C classes. It needs to be cleaned up, but I don't want the
   bit-field cleanups to be blocked on that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 21:36:35 +00:00
Mike Stump 519202d315 Fix documentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 16:11:57 +00:00
Fariborz Jahanian 6c7a1f3647 Patch fixes a code gen. bug in generation of objc_assign_ivar
(objc GC's API).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 22:25:38 +00:00
John McCall 0953e767ff Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 19:53:00 +00:00
Fariborz Jahanian fd02ed702e Miscellanous fixes in generatation of objc gc's write-barriers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 18:54:29 +00:00
Fariborz Jahanian 1c1afc4ed3 Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 00:04:00 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Fariborz Jahanian 09105f52b1 Using "ObjCImplicitSetterGetterRefExpr" instead of "ObjCImplctSetterGetterRefExpr".
A field rename and more comments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 17:02:02 +00:00
Fariborz Jahanian 154440e6a8 Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.
Removed an unnecessary loop to get to setters incoming
argument. Added DoxyGen comments. Still more work
to do in this area (WIP).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-18 20:50:23 +00:00