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

55 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 2acc6e3fed de-constify llvm::Type, patch by David Blaikie!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 04:24:23 +00:00
Francois Pichet 6af9662662 Remove more unnecessary #include <llvm/ADT/SmallVector.h>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133418 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-20 06:11:46 +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 64cd2328ef Remove a rather egregious use of getFunctionInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127324 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 08:39:33 +00:00
John McCall 8178df3b39 Emit the structure layout of the block literal parameter to a block
invocation function into the debug info.  Rather than faking up a class,
which is tricky because of the custom layout we do, we just emit a struct
directly from the layout information we've already got.

Also, don't emit an unnecessarily parameter alloca for this "variable".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 22:38:33 +00:00
John McCall c20e20498e Don't call objc_read_weak as part of emitting a block literal.
Nobody ever gave me a clear reason for why we were doing this, and
now it's apparently causing serious problems, so if *not* having this
causes problems, we get to solve them the right way this time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125627 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 00:49:34 +00:00
John McCall d16c2cf1ca Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class.  Minor other refactorings.

Fixed a few address-space bugs while I was there.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 08:22:06 +00:00
John McCall 6b5a61b6dc A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125005 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 10:33:21 +00:00
Fariborz Jahanian 830937bc11 IR Gen. part of API support for __block cxx
objects imported into blocks. //rdar://8594790.
Will have a test case coming (as well as one
sent to llvm test suite).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120713 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 17:02:11 +00:00
Fariborz Jahanian 2715b207a6 Some cleanup of block API code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119174 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 19:19:38 +00:00
Fariborz Jahanian 34999876e2 Block API patch to do copy ctor of copied-in cxx objects in
copy helper function and dtor of copied cxx objects
in dispose helper functions. __block variables
TBD next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 21:53:34 +00:00
Fariborz Jahanian e27e9d6733 Adding couple of Block API, a bug fix and
a test change, all for blocks. wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11 00:11:38 +00:00
Daniel Dunbar 673431a298 IRgen: Move blocks runtime interfaces to CodeGenModule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108481 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 00:00:15 +00:00
John McCall f1549f66a8 Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host.  Hopefully these results hold up on different platforms.  

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions.  Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former.  Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work.  Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however.  The HH is an unfortunate requirement of LLVM's EH IR.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 01:34:17 +00:00
Chris Lattner 77b89b87c3 finally get around to doing a significant cleanup to irgen:
have CGF create and make accessible standard int32,int64 and 
intptr types.  This fixes a ton of 80 column violations 
introduced by LLVMContextification and cleans up stuff a lot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106977 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-27 07:15:29 +00:00
Fariborz Jahanian 19739ae839 Fixed a block regression caused by trying to use
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105549 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 19:39:39 +00:00
Fariborz Jahanian df8b8ea349 For C++ copied in objects, use copy constructors in
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 16:10:00 +00:00
John McCall ee5042903d Allocate space in a block record for implicit references to the Objective C
'self' variable arising from uses of the 'super' keyword.  Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.

Fixes rdar://problem/8010633.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104312 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 04:11:14 +00:00
John McCall ea1471e0e9 Support implicitly closing on 'this' in a block. Fixed PR7165.
(the codegen works here, too, but that's annoying to test without execution)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 01:18:31 +00:00
John McCall 3d3ec1c099 Miscellaneous codegen cleanups. Mostly, don't create new basic blocks
just to save the current insertion state!  This change significantly
simplifies the IR CFG in exceptions code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 10:05:39 +00:00
Benjamin Kramer 6876fe615e Minor include pruning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100007 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 15:04:05 +00:00
Blaine Garst a36e22399c add support for a 1<<29 bit in the block flags field to mark blocks using alternate struct return ABI
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-05 01:29:59 +00:00
Blaine Garst 2a7eb28397 Unconditionally support block introspection data in a new field at the end
of the block descriptor field.  This field is the ObjC style @encode
signature of the implementation function, and was to this point
conditionally provided in the block literal data structure.  That
provisional support is removed.

Additionally, eliminate unused enumerations for the block literal flags field.
The first shipping ABI unconditionally set (1<<29) but this bit is unused
by the runtime, so the second ABI will unconditionally have (1<<30) set so
that the runtime can in fact distinguish whether the additional data is
present or not.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 21:51:17 +00:00
Blaine Garst c0ea8855ad remove unused function & enumerations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96635 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 00:24:37 +00:00
Ken Dyck 30a8a272f0 Use CharUnits for alignments in character units.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94571 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 19:13:33 +00:00
Ken Dyck 199c3d6cd1 Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate. 

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, 
fromQuantity(), and getQuantity() for clarity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 17:06:35 +00:00
David Chisnall 5e530af5d5 Added block type introspection support.
As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 19:33:30 +00:00
Mike Stump bf5fd788b0 Refactor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84769 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 18:23:01 +00:00
Mike Stump ea26cb522e Prep work to always preallocate BlockDeclRefExprs so that we can
generate the debug information for the first parameter to the block
invoke functions.  WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 03:49:08 +00:00
Benjamin Kramer 3c0ef8cc0d Simplify pointer creation with the new Type::getInt*Ptr methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 10:07:13 +00:00
Mike Stump 39605b4eab Improve debug info generation for __block variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:12:52 +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
Owen Anderson 0032b2781b Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 21:57:51 +00:00
Benjamin Kramer f21efe9088 LLVMContext is a class now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78691 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:46:57 +00:00
Owen Anderson 47a434ff3d Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 23:18:46 +00:00
Steve Naroff f495456020 Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 15:41:00 +00:00
Owen Anderson a1cf15f468 Update for LLVM API change, and contextify a bunch of related stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:10:40 +00:00
Mike Stump 3899a7fb9c As an optimization, we maintain a cache of generated
___Block_byref_id_object_dispose and ___Block_byref_id_object_copy
functions so that we can simply reuse instead of creating a new one.
Additionally, add an assert to ensure no one yet tries to align a
__block variable beyond the alignment of a pointer as the codegen is
incomplete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 23:26:36 +00:00
Daniel Dunbar 49f59ec45b Skip the asm prefix when storing the name in block info.
- Otherwise we emit internal names with embedded '\01' characters,
   which confuses some tools.

 - Ideally all the code which wants to get a "display name" for the
   given function should follow one code path, but this should be a
   monotonic improvement for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71774 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-14 16:42:16 +00:00
Mike Stump c0c0ef061f Fixup copy/dispose helpers for Objective-C. Radar 6756504
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68837 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 23:09:55 +00:00
Mike Stump b7477cf6cf Fixup codegen for nested blocks that use copy/dispose in the inner
blocks, so that the outer blocks use it as well.  Radar 6762279


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 18:52:28 +00:00
Mike Stump 0892099dbc Codegen support for copy helpers for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66319 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 02:35:30 +00:00
Mike Stump cf62d39bc2 Pass the type of the block literal around to make required temporal ordering of code clearer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 18:42:23 +00:00
Mike Stump ee09422b01 Complete __Block_byref_id_object_copy cogegen for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:12:24 +00:00
Mike Stump 1851b68aaa Finish off __Block_byref_id_object_dispose codegen for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 04:53:30 +00:00
Mike Stump 416d92ef0b Remove extra arg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:45:21 +00:00
Mike Stump 45031c08c6 More codegen support for the copy/dispose helpers for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:29:21 +00:00
Mike Stump a4f668f3b7 Framework for codegen for copy/dispose helpers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:33:24 +00:00
Mike Stump 00470a1c4c prep work for copy/destroy helpers for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 08:32:30 +00:00
Mike Stump 797b632757 Add codegen support for __block variables to call _Block_object_dispose as necessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 01:23:13 +00:00