Commit Graph

157 Commits

Author SHA1 Message Date
Fariborz Jahanian 45da0c9013 Test modification.
Patch by Jean-Daniel Dupas

llvm-svn: 73343
2009-06-14 16:45:35 +00:00
Daniel Dunbar 2f554fadcd Don't include system headers when overriding triple.
llvm-svn: 73301
2009-06-13 20:02:26 +00:00
Daniel Dunbar c0467f36f2 Force Obj-C runtime version for this test
llvm-svn: 73300
2009-06-13 19:40:25 +00:00
Daniel Dunbar 76d864c7e7 Support complex properties, ivars and message expressions.
llvm-svn: 73158
2009-06-10 04:38:50 +00:00
Mike Stump cbc2bcaf17 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.

llvm-svn: 72974
2009-06-05 23:26:36 +00:00
Fariborz Jahanian b68215c4de Place the GC attribute on the same relative pointer
position to make it consistant and to match gcc's behavior,
by placing it at the inner-most pointer.

llvm-svn: 72784
2009-06-03 17:15:17 +00:00
Fariborz Jahanian c6d9800564 A corner case of objc2 gc's write-barrier generation
for the Next runtime.

llvm-svn: 72703
2009-06-01 21:29:32 +00:00
Fariborz Jahanian bc60ee2215 Fixed a test case which I am to blame for making it
not runaable.

llvm-svn: 72695
2009-06-01 17:40:54 +00:00
Fariborz Jahanian 7c1baf46d6 No write-barrier for initializations.
llvm-svn: 72492
2009-05-27 19:54:11 +00:00
Fariborz Jahanian ba74e5daa5 Test for David Chisnall's -fobjc-sender-dependent-dispatch patch.
llvm-svn: 72330
2009-05-23 17:03:50 +00:00
Daniel Dunbar 223db1c9e5 Initialize Obj-C GC attributes when emitting BlockDeclRefExprs.
- Otherwise we may incorrectly miss generation of some write barriers.

llvm-svn: 72313
2009-05-23 02:49:02 +00:00
Daniel Dunbar c61d0bd8f1 Debug info: Initialize runtime language field correctly for Objective-C
interface types.

llvm-svn: 72036
2009-05-18 20:51:58 +00:00
Daniel Dunbar f811647c27 Improve test case a wee bit
llvm-svn: 72014
2009-05-18 16:49:49 +00:00
Daniel Dunbar 9a017d7fcf Classes with "+load" methods need to go in the non-lazy class list (or
else the method will not be found by the runtime at class load time).

llvm-svn: 71904
2009-05-15 22:33:15 +00:00
Daniel Dunbar 0a2171ccd5 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.

llvm-svn: 71774
2009-05-14 16:42:16 +00:00
Daniel Dunbar 7911002bf9 We need to specify the "linkage name" to the subprogram now that we
emit the correct "display name". I suspect we need more work here, see
FIXME for example.

llvm-svn: 71761
2009-05-14 01:45:24 +00:00
Daniel Dunbar 0beb7894c4 Make sure not to include the LLVM asm prefix in function names for
debug info.

llvm-svn: 71736
2009-05-13 23:08:57 +00:00
Fariborz Jahanian 0f44d81a4c Patch to implement ivar synthesis of properties declared in protocols
only and used in class imllementations (objc2 Nonfragile ABI specific).

llvm-svn: 71571
2009-05-12 18:14:29 +00:00
Fariborz Jahanian 5d5ed2d800 Patch to allow Nonfragile ABI to use 32-bit style legacy
message dispage API for all but a few messages. This is 
a runtime performance improvement and there is not meant
to be a functional change.

llvm-svn: 71467
2009-05-11 19:25:47 +00:00
Daniel Dunbar 81ded69511 Remove -fobjc-tight-layout, seems to work!
llvm-svn: 71184
2009-05-07 21:58:26 +00:00
Fariborz Jahanian a16904bc41 Fixes a bug for objc2's gc in the presense of type-casts.
llvm-svn: 71041
2009-05-05 23:28:21 +00:00
Fariborz Jahanian 32ff7aeefa Provide basic support for generation of objc2's
objc_assign_global API when assigning to global
objective-c object pointer.

llvm-svn: 70939
2009-05-04 23:27:20 +00:00
Daniel Dunbar 9b042e06ee Fix the field count in interface record layout (it was incorrectly
compensating for super classes). This was making the reported class
sizes for empty classes very, very wrong.
 - Also, we now report the size info for an empty class like gcc (as
   the offset of the start, not as 0, 0).

 - Add a few more test cases we were mishandling before (padding bit
   field at end of struct, for example).

llvm-svn: 70938
2009-05-04 23:23:09 +00:00
Fariborz Jahanian c46fff0f5f Adding more test to ivar-layout-64.m.
llvm-svn: 70918
2009-05-04 21:46:27 +00:00
Daniel Dunbar 9252ee1779 Compute interface instanceStart and instanceSize using the record
layout.
 - This is much simpler / more efficient.

 - This also properly computes the size in the presence of bit-fields.

llvm-svn: 70916
2009-05-04 21:26:30 +00:00
Daniel Dunbar 98ba964e5c Don't allow clients to traverse into superclass synthesized properties
via CollectObjCIvars.
 - In places where we need them, we should have the implementation and
   access the properties through it.

This is a fairly substantial functionality change: 
 1. @encode no longer encodes synthesized ivars, ever.

 2. The ivar layout bitmap no longer encodes information for
    synthesized ivars in superclasses. Well, actually I had already
    broken that, but it is intentional now.

We are now differing substantially from llvm-gcc and gcc
here. However, in my opinion this fundamentally *must* work if
non-fragile classes are to work. Without this change, the result of
@encode and the ivar layout depend on the order that the
implementation is seen in a file (if it is in the same file with its
superclass). Since both scenarios should work the same, our behavior
is now consistent with gcc behavior as if an implementation is never
seen following an implementation of its superclass.

Note that #2 is only a functionality change when (A) an
implementation appears in the same translation unit with the
implementation of its superclass, and (B) the superclass has
synthesized ivars. My belief is that this situation does not occur in
practice.

I am not yet sure of the role/semantics of @encode when synthesized
ivars are present... it's use is fairly unsound in a non-fragile world.

llvm-svn: 70822
2009-05-04 04:10:48 +00:00
Daniel Dunbar 36e2a1eea3 Use the implementation decl for looking up offset while building the
ivar layout.
 - The layout needs access to synthesized ivars.

llvm-svn: 70798
2009-05-03 21:05:10 +00:00
Daniel Dunbar e4eeb07acd Rename test case
llvm-svn: 70797
2009-05-03 20:37:42 +00:00
Fariborz Jahanian 18c435a17d API for message dispatch of methods returning floats
to match gcc's closely.

llvm-svn: 70493
2009-04-30 16:31:11 +00:00
Chris Lattner 7d4f5c47ce only support int128_t on 64-bit and larger targets. 32-bit targets don't
have support for __divti3 and friends.

llvm-svn: 70480
2009-04-30 06:18:40 +00:00
Chris Lattner f122cef4df initial support for __[u]int128_t, which should be basically
compatible with VC++ and GCC.  The codegen/mangling angle hasn't
been fully ironed out yet.  Note that we accept int128_t even in
32-bit mode, unlike gcc.

llvm-svn: 70464
2009-04-30 02:43:43 +00:00
Fariborz Jahanian e55f8660be Export lazy references of .objc_class_name of class names
referenced in a category implementation meta-data
(Next objc 32bit abi).

llvm-svn: 70407
2009-04-29 20:40:05 +00:00
Chris Lattner 669e32f8c0 rdar://6827200 - [sema] reject statically allocated arrays of interface types
Upgrade "array of interface" warning to an error.  In addition to being a
terrible idea, this crashes codegen.

llvm-svn: 70178
2009-04-27 01:55:56 +00:00
Daniel Dunbar ef2ffbc390 Fix pointer addressing and array subscripting of Objective-C interface
types.
 - I broke this in the switch to representing interfaces with opaque
   types.

 - <rdar://problem/6822660> clang crashes on subscript of interface in
   32-bit mode

llvm-svn: 70009
2009-04-25 05:08:32 +00:00
Daniel Dunbar 449354c761 Add a test case for a somewhat obscure scenario.
llvm-svn: 69947
2009-04-24 02:38:10 +00:00
Daniel Dunbar 4645707034 Add implicit definition of objc_msgSend.
- As with malloc and friends, this is important where the return type
   on a 64-bit platform would otherwise end up discarding the upper
   32-bits.

llvm-svn: 69874
2009-04-23 07:00:09 +00:00
Daniel Dunbar e4f25b706b Reapply r69771, with updates & fixes:
Rework the shadow struct that is layed out for Objective-C classes.

 - Superclasses are now always laid out in their shadow structure at
   the first field.

 - Prior to this, the entire class heirarchy was flattened into a
   single structure which meant that alignment, padding, and bitfields
   were incorrect (the ASTRecordLayout was correct however, which
   meant our debug info didn't coincide with ivar offsets, for
   example).

 - This is still very suboptimal (for example, ivar are looked up
   recursively, but I believe the ivar layout itself is now at least
   close to correct.

 - <rdar://problem/6773388> error: objc[29823]: layout bitmap sliding
   backwards

llvm-svn: 69811
2009-04-22 17:43:55 +00:00
Daniel Dunbar 6067720a41 Make sure this test runs on all 3 Objective-C implementations.
llvm-svn: 69786
2009-04-22 07:28:06 +00:00
Daniel Dunbar 658ba85820 Revert r69771, I missed some (obvious) details. :/
llvm-svn: 69773
2009-04-22 04:39:47 +00:00
Daniel Dunbar 25b81ef847 Rework the shadow struct that is layed out for Objective-C classes.
- Superclasses are now always laid out their shadow structure at the
   first field.

 - Prior to this, the entire class heirarchy was flattened into a
   single structure which meant that alignment, padding, and bitfields
   weren't packed correctly (the ASTRecordLayout was correct however,
   which meant our debug info didn't coincide with ivar offsets, for
   example).

 - This is still very suboptimal, but I believe the ivar layout itself
   is now at least close to correct.

 - <rdar://problem/6773388> error: objc[29823]: layout bitmap sliding
   backwards

llvm-svn: 69771
2009-04-22 03:45:12 +00:00
Daniel Dunbar 50b5c4ccaa Revert 69646, that was the precise inverse of what I wanted to commit.
llvm-svn: 69647
2009-04-21 01:19:10 +00:00
Daniel Dunbar 9df980b876 Kill ASTContext::[gs]etFieldForDecl, instead we just lookup things
when we need them -- which is exactly what some code was already
doing!
 - No intended functionality change.

llvm-svn: 69646
2009-04-21 01:18:01 +00:00
Mike Stump 3214d12325 Fixup codegen for write barriers for block variables. Radar 6786715
llvm-svn: 69642
2009-04-21 00:51:43 +00:00
Daniel Dunbar 75e909f5e0 Set a bit in IMAGE_INFO to indicate that we don't contain any
@synthesized ivars for superclasses.
 - <rdar://problem/6806371> [clang] Mark code without miscompiled
   @synthesized properties

llvm-svn: 69581
2009-04-20 07:11:47 +00:00
Daniel Dunbar caec0238bc Don't emit ivar offsets for unnamed bit fields.
Also, added assertion that the field matches what would be looked up.

llvm-svn: 69572
2009-04-20 05:53:40 +00:00
Chris Lattner b433b279f3 Fix rdar://6804402 - crash on objc implementations declared with
@class but no implementation.  This was broken in all 3 runtime
impls.

llvm-svn: 69512
2009-04-19 06:02:28 +00:00
Daniel Dunbar 9a7a78b0ae Fix bug in computation of ivar offsets for (adjacent) bitfields.
- The confusing IRgen bitfield interface is partly to blame here;
   fixing the functional error for now, cleanups to the interface to
   follow.

llvm-svn: 69503
2009-04-19 02:03:42 +00:00
Daniel Dunbar f45dbd8c7b Test case would allow clang to fail.
llvm-svn: 69470
2009-04-18 20:23:29 +00:00
Douglas Gregor f21701b70c Fix test to output LLVM to a temporary file, which we grep as part of the test
llvm-svn: 69448
2009-04-18 15:48:37 +00:00
Daniel Dunbar 41595d43d5 Use getAsPointerType instead of using getCanonicalType directly.
- <rdar://problem/6803995>

llvm-svn: 69435
2009-04-18 08:54:40 +00:00