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
62b1070fa2
Inline GetFieldBaseOffset into sole callsite.
...
llvm-svn: 70813
2009-05-03 23:35:23 +00:00
Daniel Dunbar
5b743915c3
Avoid recomputing field offsets.
...
llvm-svn: 70812
2009-05-03 23:31:46 +00:00
Daniel Dunbar
d22aa4a5e5
Normalize formatting
...
llvm-svn: 70810
2009-05-03 23:21:22 +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
3434d492b3
It turns out BuildAggrIvarLayout wasn't even using the shadow struct,
...
just computing it!
llvm-svn: 70779
2009-05-03 14:22:14 +00:00
Daniel Dunbar
94f46dc056
Lift common subexpression, remove dead "base" variable.
...
llvm-svn: 70778
2009-05-03 14:17:18 +00:00
Daniel Dunbar
15bd88860c
Factor out BuildAggrIvarRecordLayout routine.
...
llvm-svn: 70777
2009-05-03 14:10:34 +00:00
Daniel Dunbar
7abf83cc86
Lift out GetGCAttrTypeForType routine.
...
llvm-svn: 70776
2009-05-03 13:55:09 +00:00
Daniel Dunbar
7b89ace186
Add constructors for GC_IVAR and SKIP_SCAN, tighten up uses.
...
Lift up a size calculation and note some asymmetries.
llvm-svn: 70775
2009-05-03 13:44:42 +00:00
Daniel Dunbar
22007d345f
Normalize style, remove a dead assert.
...
llvm-svn: 70771
2009-05-03 13:32:01 +00:00
Daniel Dunbar
80b4eef686
Use ASTRecordLayout for computing ivar offsets instead of shadow
...
struct.
- We still need to do more lookup than necessary because ivars don't
live in a reasonable DeclContext.
- The only remaining client of the interface shadow struct is the
ivar layout bitmap.
llvm-svn: 70756
2009-05-03 13:15:50 +00:00
Daniel Dunbar
961202372f
Add a ComputeIvarBaseOffset overload taking an implementation
...
decl. Only this routine will be suitable for computing the offset of a
synthesized ivar.
- No functionality change.
llvm-svn: 70696
2009-05-03 12:57:56 +00:00
Daniel Dunbar
12119b959b
Compute Objective-C metadata size information from the record layout,
...
not the shadow structure.
llvm-svn: 70691
2009-05-03 10:46:44 +00:00
Daniel Dunbar
ccf6183687
Remove unused argument.
...
llvm-svn: 70684
2009-05-03 08:56:52 +00:00
Daniel Dunbar
0cec95f86a
Coalesce the ivar offset calculation further.
...
llvm-svn: 70683
2009-05-03 08:55:17 +00:00
Daniel Dunbar
d09551a376
Use type from ivar instead of from shadow struct field.
...
- No functionality change.
llvm-svn: 70674
2009-05-03 07:52:00 +00:00
Fariborz Jahanian
e29b4f0785
Remove a warning when this file is compiled optimized.
...
llvm-svn: 70518
2009-04-30 23:08:58 +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
Fariborz Jahanian
4b4ef86369
Undid setting of the flag for msg_Send for 32bit code gen.
...
It seems to effect code gen. Add a FIXME instead.
llvm-svn: 70423
2009-04-29 22:47:27 +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
Fariborz Jahanian
e27b929809
Type of msgSend message dispatch API is a vararg.
...
llvm-svn: 70404
2009-04-29 19:14:43 +00:00
Eli Friedman
1c4a175aef
Remove getIntegerConstantExprValue in favor of using EvaluateAsInt.
...
llvm-svn: 70145
2009-04-26 19:19:15 +00:00
Chris Lattner
f0b64d73a8
split ObjC and C++ Statements out into their own headers.
...
llvm-svn: 70105
2009-04-26 01:32:48 +00:00
Fariborz Jahanian
969bc68195
Minor refactoring. No intended change in behavior.
...
llvm-svn: 69988
2009-04-24 21:07:43 +00:00
Fariborz Jahanian
ce567657fd
Minor refactoring. No change in functionality.
...
llvm-svn: 69979
2009-04-24 17:15:27 +00:00
Fariborz Jahanian
a123b64218
Some code clean up of objc2's bitmap layout.
...
llvm-svn: 69970
2009-04-24 16:17:09 +00:00
Fariborz Jahanian
80672fce8f
Removed bunch of FIXMEs no longer needed.
...
llvm-svn: 69896
2009-04-23 16:27:20 +00:00
Daniel Dunbar
f0a8344bac
Mark IMAGE_INFO as constant on x86_64-darwin.
...
- This shouldn't change anything, we never actually access it, but
this is consistent with llvm-gcc (and 32-bit)
llvm-svn: 69880
2009-04-23 08:03:21 +00:00
Daniel Dunbar
22b0ada8cf
Use std::sort instead of qsort.
...
- Notably, there was a memory error here, SkipIvars does not have to
be the same size as IvarsInfo.
- Fariborz, please check.
llvm-svn: 69850
2009-04-23 01:29:05 +00:00
Douglas Gregor
29bd76fd04
Eliminate the three SmallVectors in ObjCImplDecl (for instance
...
methods, class methods, and property implementations) and instead
place all of these entities into the DeclContext.
This eliminates more linear walks when looking for class or instance
methods and should make PCH (de-)serialization of ObjCDecls trivial
(and lazy).
llvm-svn: 69849
2009-04-23 01:02:12 +00:00
Fariborz Jahanian
6df69867c3
ivar layout bitmap is alive!
...
llvm-svn: 69838
2009-04-22 23:00:43 +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
202f3dc5b3
Remove lookupFieldDeclFromIvar from ObjCIvarDecl interface.
...
- This is only used by CGObjCRuntime now.
llvm-svn: 69800
2009-04-22 12:00:04 +00:00
Daniel Dunbar
7d4e1c5e4a
Don't convert interface types (to structs) as part of CodeGenTypes.
...
- This has pros and cons, but for now the pros seem to significantly
outway the con.
The con is that we will always need to cast in the runtime
implementation to a struct type, if we wish to access an interface
directly.
The pros are:
- Avoid the cost of generating types which are used. Most
manipulation of Objective-C objects is done through messages, and
only the implementation of a class will directly access
memory. Previously, we would convert the type even if it only
appear as a function parameter, for example.
- We don't need to worry about incomplete types, and
UpdateCompletedType for interfaces is gone.
- It becomes easier to narrow the interface to the shadow struct for
Objective-C interfaces (so it can be eliminated).
Currently the runtimes still use the CodeGenTypes machinery to
generate the LLVM structure they need via ConvertTagDecl, but this can
eventually be replaced.
llvm-svn: 69797
2009-04-22 10:28:39 +00:00
Daniel Dunbar
7b4dfc8b78
Add CGObjCRuntime::GetConcreteClassStruct to encapsulate access to the
...
underlying llvm::StructType for an interface.
llvm-svn: 69796
2009-04-22 09:39:34 +00:00
Daniel Dunbar
725dc2c5bb
Emit meta data using the Ivar, not a looked up FieldDecl.
...
llvm-svn: 69790
2009-04-22 08:22:17 +00:00
Daniel Dunbar
9fd114d577
Merge ivar access amongst the three runtimes.
...
- For now, this means we are always doing the address computations by
hand instead of constructing a proper GEP. Right now, however, this
is less important than having fewer entry points to dealing with
Objective-C interface layout.
llvm-svn: 69787
2009-04-22 07:32:20 +00:00
Daniel Dunbar
722f424178
Make ObjCInterfaceDecl's const in some more places.
...
llvm-svn: 69775
2009-04-22 05:08:15 +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
Chris Lattner
2dfdb3ea94
move 64-bit abi functions to lazy model, everything is lazy now, yay.
...
llvm-svn: 69767
2009-04-22 02:53:24 +00:00
Chris Lattner
ce8754edac
remove the last of the non-lazy objc runtime functions for the 32-bit ABI,
...
7 left for 64-bit ABI.
llvm-svn: 69766
2009-04-22 02:44:54 +00:00
Chris Lattner
0a696a42fe
number of non-lazy runtime functions from 9 -> 4.
...
llvm-svn: 69765
2009-04-22 02:38:11 +00:00
Chris Lattner
095ac38f1c
make message send functions lazy, we're down from 14 non-lazy functions to 9.
...
llvm-svn: 69764
2009-04-22 02:32:31 +00:00
Chris Lattner
c6406dbf7f
move more EH stuff to being lazily created. An empty .m file now
...
produces just 14 dead "declares" in llvm ir instead of 19.
llvm-svn: 69763
2009-04-22 02:26:14 +00:00
Chris Lattner
a7c00b4c4c
make try/catch objc runtime functions be lazily generated.
...
rdar://6809612
llvm-svn: 69762
2009-04-22 02:15:23 +00:00
Daniel Dunbar
d1148a7f72
Make sure to mark the interface as completed when we see an
...
@implementation that closes a @class delcaration.
- I don't know how to make a test case for this, but this strengthens
the invariants that hold internally. The functionality change here
is the edit to SemaDeclObjC.cpp.
llvm-svn: 69728
2009-04-21 21:41:56 +00:00
Fariborz Jahanian
f5fec02d0c
More objc2's ivar layout bitmap. No change in functionality.
...
llvm-svn: 69695
2009-04-21 18:33:06 +00:00
Daniel Dunbar
9ebf9516af
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: 69648
2009-04-21 01:19:28 +00:00
Daniel Dunbar
e03f005d30
Assert on a few conditions that (I believe) should hold
...
w.r.t. ASTContext::[gs]etFieldDecl, and the Field argument to
EmitObjCValueForIvar).
llvm-svn: 69639
2009-04-21 00:41:40 +00:00
Fariborz Jahanian
80c9ce2c4a
ObjC2's Ivar bitmap layout work. No change in functionality.
...
llvm-svn: 69629
2009-04-20 22:03:45 +00:00
Daniel Dunbar
e3f5cfc0b8
Move countInheritedIvars to within striking distance of
...
GetClassSizeInfo
Reduce nesting in GetInterfaceDeclStructLayout.
Tweak some comments.
No functionality change.
llvm-svn: 69621
2009-04-20 20:18:54 +00:00
Daniel Dunbar
be1f26df5d
Inline GetFirstIvarInRecord into sole caller.
...
- No functionality change.
llvm-svn: 69582
2009-04-20 07:18:49 +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
f5c18461e3
Lift out GetNamedIvarList.
...
Drop uses of GetFirstInvarInRecord, instead we lookup the ivars we
know are in the record.
- This is somewhat less efficient, but I need to detangle this code
first...
llvm-svn: 69579
2009-04-20 06:54:31 +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
Daniel Dunbar
5d5dbb1754
Remove non-const form of lookupFieldDeclForIvar.
...
llvm-svn: 69563
2009-04-20 00:37:55 +00:00
Daniel Dunbar
ae03226bc6
Comment fixes.
...
llvm-svn: 69562
2009-04-20 00:33:43 +00:00
Daniel Dunbar
554fd79b38
Lift GetClassSizeInfo out of GenerateClass, add a FIXME.
...
- No functionality change.
llvm-svn: 69561
2009-04-19 23:41:48 +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
bf90b33665
Reuse ObjcIvarOffsetVariable instead of duplicating code.
...
- No functionality change (but added a FIXME).
llvm-svn: 69496
2009-04-19 00:44:02 +00:00
Daniel Dunbar
a106052090
Remove some unnecessary complexity.
...
- No functionality change.
llvm-svn: 69495
2009-04-19 00:31:15 +00:00
Daniel Dunbar
508a7dda4a
Fix a bug found by inspection, class/meta references could be emitted
...
into the wrong section (they shared the same lookup table).
llvm-svn: 69433
2009-04-18 08:51:00 +00:00
Chris Lattner
6fdd57cba8
fix a crash compiling code with its own definition of objc_assign_weak.
...
rdar://6800430
llvm-svn: 69392
2009-04-17 22:12:36 +00:00
Daniel Dunbar
66b13dac0a
Don't put msgrefs in used globals (in particular, we don't want
...
no-dead-strip set on them).
llvm-svn: 69388
2009-04-17 21:10:58 +00:00
Chris Lattner
10dae30049
Fix rdar://6800926 - crash compiling non-fragile _Bool bitfield ivar,
...
the functional change here is changing ConvertType -> ConvertTypeForMem
so that we handle i1 fields properly as memory.
llvm-svn: 69361
2009-04-17 17:46:19 +00:00
Fariborz Jahanian
68c4c61be8
Removed a no longer needed FIXME comment.
...
llvm-svn: 69315
2009-04-16 21:49:16 +00:00
Fariborz Jahanian
bcf548760e
Category method synbols must be qualified by gategory name to
...
match gcc's.
llvm-svn: 69305
2009-04-16 18:34:20 +00:00
Daniel Dunbar
4b68d26a93
Don't use \01 in symbol name if unnecessary.
...
- This was particularly bad since I fixed one instance of this name
and not another, meaning we got an LLVM module with the same
effective name in two different globals!
llvm-svn: 69205
2009-04-15 19:52:32 +00:00
Daniel Dunbar
24645c9ff4
Fix alignment on obj_msgrefs to match llvm-gcc.
...
llvm-svn: 69199
2009-04-15 19:04:46 +00:00
Daniel Dunbar
e60aa05d34
Add test case for superrefs section (and make spacing consistent).
...
llvm-svn: 69198
2009-04-15 19:03:14 +00:00
Fariborz Jahanian
f5e8ddd550
__objc_superrefs belongs to __DATA segment.
...
llvm-svn: 69170
2009-04-15 16:31:36 +00:00
Daniel Dunbar
b25452a98e
Tweaks to Objective-C metadata (32 & 64-bit) to match llvm-gcc.
...
- Set alignment on property lists.
- 32-bit:
o Set section on property lists.
o Fix section name for category class methods.
o Fix symbol name for property lists.
o Fix section name for class method.
o Set alignment and section on class extension structure.
o Set alignment on a number of things: instance variables, methods,
method descriptions, the symbols structure.
- 64-bit:
o Fix section flags for protocol list.
I doubt most of these were problems in practice, but it is nice to
match llvm-gcc.
llvm-svn: 69132
2009-04-15 02:56:18 +00:00
Daniel Dunbar
3241fae46c
Set alignment on __cstring metadata variables to 1 (matching
...
llvm-gcc).
llvm-svn: 69097
2009-04-14 23:14:47 +00:00
Daniel Dunbar
729df96bf5
Avoid use of magic \01 prefix when unneeded.
...
llvm-svn: 69093
2009-04-14 22:44:26 +00:00
Fariborz Jahanian
899e7eb6c7
Do not dead code strip global meta-data objects.
...
This will match gcc's behavior in the arena.
llvm-svn: 69061
2009-04-14 18:41:56 +00:00
Daniel Dunbar
4527d30c3d
Fix comment.
...
llvm-svn: 69053
2009-04-14 17:42:51 +00:00
Daniel Dunbar
f5f359fb73
Clean up handling of visibility.
...
llvm-svn: 69027
2009-04-14 06:00:08 +00:00
Daniel Dunbar
4184ac847f
Update to use hasAttr() instead of getAttr().
...
- No functionality change.
llvm-svn: 68987
2009-04-13 21:08:27 +00:00
Fariborz Jahanian
464423dce4
Patch to generate meta-data for prtocol used
...
in @protocol expression.
llvm-svn: 68806
2009-04-10 18:47:34 +00:00
Douglas Gregor
bcced4ec31
Propagate the ASTContext to various AST traversal and lookup functions.
...
No functionality change (really).
llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Daniel Dunbar
8f28d01126
Implementation definition of interfaces with __objc_exception attribute.
...
- Complete <rdar://problem/6635883> Support __objc_exception__
attribute
llvm-svn: 68591
2009-04-08 04:21:03 +00:00
Fariborz Jahanian
57eb2e021e
Propagte -fvisibility to objc2's class symbols.
...
llvm-svn: 68543
2009-04-07 20:26:30 +00:00
Daniel Dunbar
d7beeea228
Handle use side of __objc_exception__ attribute; when using an
...
exception with this attribute we don't need to emit a weak definition
for the exception type information.
llvm-svn: 68513
2009-04-07 06:43:45 +00:00
Daniel Dunbar
15894b791b
Various fixes to symbols used for Obj-C x86_64 metadata.
...
- Changed method names to match gcc (categories names still aren't
mangled in).
- Expose correct name for class and metadata symbols (although
-fvisibility=hidden isn't yet correct).
- Remove several things from llvm.used that didn't need to be there
(I suspect this can still be trimmed).
- Don't use asm-prefix extension for _objc_empty_{cache,vtable} (not
needed).
- Hide EH type class info with -fvisibility=hidden
- Change setGlobal[Option]Visibility to not change the visibility of
functions with internal linkage.
llvm-svn: 68510
2009-04-07 05:48:37 +00:00
Fariborz Jahanian
bc3c77b881
Fixed visibility issues related to objc2's synthesized
...
ivars.
llvm-svn: 68453
2009-04-06 18:30:00 +00:00
Chris Lattner
dcceee734c
Fix a couple of cases where Constant* pointers can dangle in
...
ObjCNonFragileABITypesHelper by converting them to dynamic
getters. This fixes a crash on rdar://6757213. The others
should be converted over as well.
llvm-svn: 68445
2009-04-06 16:53:45 +00:00
Fariborz Jahanian
38a5c9650e
Fix up lookup rules for properties declared in
...
objc's continuation class.
llvm-svn: 68339
2009-04-02 18:44:20 +00:00
Fariborz Jahanian
78be1651e2
Nonfragile ivar synthesis with property is in a continuation
...
class.
llvm-svn: 68234
2009-04-01 19:37:34 +00:00
Steve Naroff
e14b368fa9
More "prep" work for handling UTF16 CFString.
...
Patch by Jean-Daniel Dupas. Thanks!
llvm-svn: 68203
2009-04-01 13:55:36 +00:00
Chris Lattner
3088a31e96
remove ASTContext::buildObjCInterfaceType, which breaks canonical
...
types. It is no longer needed now that the code generator
re-lays-out interfaces if they are defines after being laid out
from a forward decl.
llvm-svn: 68194
2009-04-01 06:23:52 +00:00
Fariborz Jahanian
63a224ad59
ir-gen support for nonfragile abi's synthesized ivars.
...
llvm-svn: 68122
2009-03-31 18:11:23 +00:00
Fariborz Jahanian
3254a6f94c
More toward nonfragile abi's synthesized ivars.
...
llvm-svn: 68115
2009-03-31 17:00:52 +00:00
Steve Naroff
66afeb5968
Some "prep" work for handling ObjC @-string constants that contain UTF-8. No functionality change.
...
Changed GenerateConstantString() to take an ObjCStringLiteral (instead of a std::string). While this isn't strictly necessary, it seems cleaner and allows us to cache to "containsNonAscii" if necessary (to avoid checking in both Sema and CodeGen).
llvm-svn: 68114
2009-03-31 16:53:37 +00:00
Chris Lattner
5b36ddb1ad
fill in temporary smallvectors instead of vectors for performance.
...
Fix BuildAggrIvarLayout to not access vectors out of range.
llvm-svn: 68101
2009-03-31 08:48:01 +00:00
Chris Lattner
06ae0e2c3b
small cleanups.
...
llvm-svn: 68095
2009-03-31 08:33:16 +00:00
Fariborz Jahanian
dac14a7159
- Minor change to dump of ivar layout map.
...
- Temporarily undef'ed __OBJC2__ in nonfragile objc abi mode
as it was forcing ivar synthesis in a certain project which clang
does not yet support.
llvm-svn: 67766
2009-03-26 19:10:36 +00:00
Fariborz Jahanian
f909f92799
More for for objc2's ivar layout map (currently
...
is not in use).
llvm-svn: 67713
2009-03-25 22:36:49 +00:00
Fariborz Jahanian
aedcfa49b9
Must allow for strong cast of floats as well (objc2 gc).
...
llvm-svn: 67551
2009-03-23 19:10:40 +00:00
Chris Lattner
d480892445
pull "runtime globals" into the same framework as other functions/global variables.
...
No intended functionality change.
llvm-svn: 67478
2009-03-22 21:03:39 +00:00
Fariborz Jahanian
07038f9785
Fix a crash during meta-data generation of objc2's nonfragile abi.
...
llvm-svn: 67402
2009-03-20 20:48:19 +00:00
Daniel Dunbar
64895a0703
Remove a FIXME.
...
llvm-svn: 67022
2009-03-15 06:05:20 +00:00
Fariborz Jahanian
1b074a3eb7
Fixed an ir-gen bug related to strong-cast generation of
...
source being a non-pointer.
llvm-svn: 66854
2009-03-13 00:42:52 +00:00
Fariborz Jahanian
1bf7288529
More objc2's ivar layout bitmap.
...
bitmap generation for basic ivars seem to
work now. This is work in progress.
llvm-svn: 66836
2009-03-12 22:50:49 +00:00
Fariborz Jahanian
99bee42be2
Code refactoring. No change in functionality.
...
llvm-svn: 66710
2009-03-11 21:42:00 +00:00
Fariborz Jahanian
cbaf73cd26
More of objc2's ivar layout bitmap (Next: specific).
...
Work in progress.
llvm-svn: 66707
2009-03-11 20:59:05 +00:00
Fariborz Jahanian
3b0f886c3f
More Next objc2's gc ivar layout bitmap work.
...
Work in progress.
llvm-svn: 66615
2009-03-11 00:07:04 +00:00
Fariborz Jahanian
524bb20b4b
More objc2's gc meta-data work related to ivar layout bitmap.
...
Work in progress.
llvm-svn: 66546
2009-03-10 16:22:08 +00:00
Daniel Dunbar
ae3338429f
NeXT: Set alignment on a number of ObjC metadata variables (matching llvm-gcc).
...
llvm-svn: 66481
2009-03-09 22:18:41 +00:00
Daniel Dunbar
c2d4b62046
NeXT: Move some routines over to CreateMetadataVar.
...
- No intended functionality change.
llvm-svn: 66473
2009-03-09 21:49:58 +00:00
Daniel Dunbar
463cc8ade5
Tweak CreateMetadataVar, take the exact alignment instead of relying
...
on LLVM TargetData.
llvm-svn: 66455
2009-03-09 20:50:13 +00:00
Fariborz Jahanian
de2f33373b
More fix for bitfield ivar meta-data and code gen accessing it.
...
Now, we can actually execute dejagnu test with bitfield ivars
in non-fragile abi mode.
llvm-svn: 66448
2009-03-09 20:44:22 +00:00
Daniel Dunbar
91b000f771
Fix typo in pref commit.
...
llvm-svn: 66433
2009-03-09 20:16:39 +00:00
Daniel Dunbar
30c653655d
NeXT: Add CreateMetadataVar utility method to encapsulate creation of
...
Obj-C metadata variables (which generally should be handled the same,
although they aren't currently).
- No functionality change.
llvm-svn: 66432
2009-03-09 20:09:19 +00:00
Fariborz Jahanian
6772621acf
Code refactoring. No functional change.
...
llvm-svn: 66391
2009-03-08 20:18:37 +00:00
Fariborz Jahanian
03676f557c
correct bitfield ivar offset in ivar meta-data.
...
(objc abi specific).
llvm-svn: 66345
2009-03-07 19:43:20 +00:00
Mike Stump
a6ca334389
Fixup our uses of various linkages to match how llvm now works. I think they are all
...
correct, but an extra set of ObjC eyes would be good.
llvm-svn: 66342
2009-03-07 16:33:28 +00:00
Eli Friedman
a374b68b5a
Back out the patch in r66302, and re-fix it properly. We assume for
...
performance that the type of the returned llvm::Value for an expression
matches the converted type of the clang::Expr; mismatches will cause all
sorts of errors and silent miscompilations.
llvm-svn: 66321
2009-03-07 03:57:15 +00:00
Daniel Dunbar
9676015e86
Cleanup EH a bit given changes to ObjCCatchStmt.
...
- No functionality change.
llvm-svn: 66218
2009-03-06 00:01:21 +00:00
Fariborz Jahanian
c559f3f175
More function stop for objc2's ivar layout bit map.
...
llvm-svn: 66209
2009-03-05 22:39:55 +00:00
Fariborz Jahanian
01dff426c8
Adds a template for a function for objc2's gc's ivar layout
...
bitmap.
llvm-svn: 66175
2009-03-05 19:17:31 +00:00
Devang Patel
4b6e4bb25d
Refactor code.
...
llvm-svn: 66043
2009-03-04 18:21:39 +00:00
Steve Naroff
371b8fb4c3
Fix <rdar://problem/6640991> Exception handling executes wrong clause (Daniel, please verify).
...
Also necessary to fix:
<rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements
<rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements
llvm-svn: 65964
2009-03-03 19:52:17 +00:00
Daniel Dunbar
76b7acc49f
First cut at zero-cost EH support.
...
- Still manually generates the EH code; the parts related to cleanup
need to be integrated into the cleanup stack (for proper
interaction with VLAs, etc.).
- Some differences vs gcc in corner cases; I believe our behavior is
correct but need to verify/file bugs vs gcc.
llvm-svn: 65809
2009-03-02 06:08:11 +00:00
Daniel Dunbar
7a38ce4f88
Make sure to invoke (not call) to objc_exception_throw if necessary.
...
llvm-svn: 65808
2009-03-02 05:20:36 +00:00
Daniel Dunbar
a646834214
Fix completely broken thinko in GetClassGlobal.
...
llvm-svn: 65807
2009-03-02 05:18:14 +00:00
Daniel Dunbar
88367f2768
Obj-C non fragile ABI: Use GetClassGlobal in one more instance I missed.
...
llvm-svn: 65762
2009-03-01 04:51:18 +00:00
Daniel Dunbar
b1559a4499
Obj-C non fragile ABI: Add GetInterfaceEHType for getting the Obj-C
...
exception typeinfo metadata, and a few other EH related types/functions.
- No functionality change.
llvm-svn: 65761
2009-03-01 04:46:24 +00:00
Daniel Dunbar
c6928bbe29
NeXT: Unify code for creating a class global.
...
- No functionality change.
llvm-svn: 65760
2009-03-01 04:40:10 +00:00
Daniel Dunbar
947bca2cc9
ObjCAtCatchStmt's ParamStmt is always a DeclStmt.
...
llvm-svn: 65759
2009-03-01 04:28:32 +00:00
Fariborz Jahanian
bac73acc24
Obscure code gen bug related to sending
...
message to 'super' in a class method declared in
cateogy (darwin specific).
llvm-svn: 65709
2009-02-28 20:07:56 +00:00
Fariborz Jahanian
cd073cc2e9
Alignment of pointers in __objc_classlist must be on their
...
natural alignment. Otherwise, the excess hole confuses the
objc2 runtime (this is darwin specific).
llvm-svn: 65666
2009-02-28 00:54:00 +00:00
Fariborz Jahanian
ec3385733a
Couple of meta-data segments were wrong. This patch fixes them.
...
llvm-svn: 65578
2009-02-26 22:30:39 +00:00
Fariborz Jahanian
03b300b734
Fix an inconsistance in objc2's meta-data related to
...
the symbol for the root meta-data.
llvm-svn: 65548
2009-02-26 18:23:47 +00:00
Fariborz Jahanian
240f2b7851
patch for two things.
...
make sure objc2's nonfragile abi is enacted for Leopard too.
add -fobjc-gc-only flag to the image_info symbol.
llvm-svn: 65413
2009-02-24 23:34:44 +00:00
Fariborz Jahanian
6fe4306195
Set flag for -fobjc-gc in IMAGE_INFO variable.
...
llvm-svn: 65387
2009-02-24 21:08:09 +00:00
Daniel Dunbar
0b0dcd987d
Some initial Obj-C zero cost EH support.
...
- Only handles cases with @try with no @catch blocks, and there are a
number of problems with the implementation. Nevertheless, this is
good enough to handled @synchronized correctly, and some other
basic uses.
llvm-svn: 65378
2009-02-24 07:47:38 +00:00
Daniel Dunbar
94ceb61574
Fix two @synchronized bugs found by inspection: the expression to sychronize on should only be evaluated once, and it is evaluated outside the cleanup scope.
...
Also, lift SyncEnter and SyncExit up in nervous anticipation of x86-64
zero cost EH.
llvm-svn: 65362
2009-02-24 01:43:46 +00:00
Fariborz Jahanian
0f466c746f
More objc's gc ir-gen stuff.
...
llvm-svn: 65077
2009-02-19 23:36:06 +00:00
Anders Carlsson
9ab53d120e
Add support for throwing exceptions to the nonfragile ABI
...
llvm-svn: 64692
2009-02-16 22:59:18 +00:00
Fariborz Jahanian
06292955d0
Added implementation of objc2's gc API calls for
...
nonfragile abi.
llvm-svn: 64690
2009-02-16 22:52:32 +00:00
Daniel Dunbar
d73ea816af
assert/ErrorUnsupported in unimplemented stub functions instead of
...
miscompiling.
llvm-svn: 64647
2009-02-16 18:48:45 +00:00
Daniel Dunbar
8de90f0a92
Obj-C non-fragile ABI: Fix types of a few globals; these were not
...
creating valid LLVM structures (although they work fined).
llvm-svn: 64580
2009-02-15 07:36:20 +00:00
Fariborz Jahanian
35afdfc36e
Fixed a bad ir-gen bug which caused a dejagnu test to fail.
...
Now we are pretty close to be in sync with objc's classic
abi when it comes to passing dejagnu objc executable tests.
llvm-svn: 64569
2009-02-14 21:25:36 +00:00
Fariborz Jahanian
99bed6fd21
Fixed a problem caused by foreward @class use
...
which consequently caused a Seg fault. during meta-data
generation. It also addresses an issue related to
late binding of newly synthesize ivars (when we support it).
llvm-svn: 64563
2009-02-14 20:13:28 +00:00
Fariborz Jahanian
d8fc1053ab
Fixed a 64bit code gen bug of a cateogory
...
implementation with no category declaration!
llvm-svn: 64470
2009-02-13 17:52:22 +00:00
Fariborz Jahanian
c335c40a4b
Fix a bug whereby, an ivar used to synthesize a property belongs
...
to a base class (nonfragile abi ir gen bug).
llvm-svn: 64391
2009-02-12 18:51:23 +00:00
Steve Naroff
b76051534c
Several cleanups:
...
- rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect.
- add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time.
- move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types).
llvm-svn: 64385
2009-02-12 17:52:19 +00:00
Fariborz Jahanian
74b7722c2c
ir-gen for objc's @selector expression in nonfragile abi mode.
...
llvm-svn: 64323
2009-02-11 20:51:17 +00:00
Fariborz Jahanian
d7264430e6
This patch is all it takes to pass all objc2's fast-enumeration
...
tests in the dejagnu test suite in the nonfragile abi mode.
llvm-svn: 64251
2009-02-10 22:46:12 +00:00
Fariborz Jahanian
4e7ae06b00
Generate ir for ivar offset. This will pass
...
type-nsobject-attribute.m in the dejagnu test suite
in the nonfragile abi mode.
llvm-svn: 64233
2009-02-10 20:21:06 +00:00
Fariborz Jahanian
21fc74c15a
Some refactoring of Ivar offset code gen.
...
in preparation for nonfragile ivar offset work.
llvm-svn: 64225
2009-02-10 19:02:04 +00:00
Anders Carlsson
33c1b6528f
Remove the last remnants of the Obj-C EH stack code.
...
llvm-svn: 64205
2009-02-10 06:07:49 +00:00
Anders Carlsson
bfee7e921b
Use the new cleanup infrastructure for @try/@finally
...
llvm-svn: 64160
2009-02-09 20:38:58 +00:00
Anders Carlsson
dcb149cbef
Add a simplified EmitJumpThroughFinally and use it in CGObjC in preparation of making it use the cleanup stack.
...
llvm-svn: 64098
2009-02-08 22:25:30 +00:00
Anders Carlsson
bf8a1be33c
Split the exception object out into its own stack.
...
llvm-svn: 64032
2009-02-07 21:37:21 +00:00
Anders Carlsson
da0e4560a1
Simplify the Objective-C exception handling.
...
llvm-svn: 64031
2009-02-07 21:26:04 +00:00
Fariborz Jahanian
c76e741622
Fixed an objc2 nonfragile-abi code gen bug.
...
Now we can say 'hello world' objective-c style
in the nonfragile abi.
llvm-svn: 63981
2009-02-06 23:46:26 +00:00
Fariborz Jahanian
6b7cd6e5f4
objc2's nonfragile abi API for messages sent to 'super'.
...
llvm-svn: 63959
2009-02-06 20:09:23 +00:00
Fariborz Jahanian
33f66e640a
objc2's nonfragile-abi - API selection for when receiver is a class
...
llvm-svn: 63881
2009-02-05 20:41:40 +00:00
Fariborz Jahanian
4f9d349e07
More objc2's API chanes.
...
llvm-svn: 63878
2009-02-05 19:35:43 +00:00
Fariborz Jahanian
9065541262
#ifdef'out out objc2 API selection which is not done in gcc (unlike
...
the documentation to the contrary).
llvm-svn: 63871
2009-02-05 18:00:27 +00:00
Fariborz Jahanian
4e87c834d3
This patch generates messaging code for objc2's non-fragile abi.
...
llvm-svn: 63810
2009-02-05 01:13:09 +00:00
Fariborz Jahanian
e4dc35deb9
Some early code for objc2's nonfragile abi messaging.
...
llvm-svn: 63770
2009-02-04 20:42:28 +00:00
Daniel Dunbar
4d22e4975a
Change construction of common ObjC functions to use CGCall
...
infrastructure to construct function type.
- For consistencty, we should probably always use this to construct
function types, but these are absolutely necessary to ensure that
we can emit calls to these functions.
llvm-svn: 63695
2009-02-04 00:44:42 +00:00
Fariborz Jahanian
3d9296e6f5
Some function stub added for new abi messaging.
...
llvm-svn: 63691
2009-02-04 00:22:57 +00:00
Fariborz Jahanian
82c72e1ee4
Several new declarations for objc2 nonfragile
...
abi messaging.
llvm-svn: 63684
2009-02-03 23:49:23 +00:00
Fariborz Jahanian
712bfa6478
ir-gen for nonfragile ivar bitfield access (objc2 nonfragile abi).
...
llvm-svn: 63644
2009-02-03 19:03:09 +00:00
Fariborz Jahanian
ebc4c9d2a3
Minor objc2 bug fix.
...
llvm-svn: 63635
2009-02-03 17:34:34 +00:00
Fariborz Jahanian
c88a70d885
objc2's ir-gen for nonfragile ivar access.
...
llvm-svn: 63578
2009-02-03 00:09:52 +00:00
Daniel Dunbar
bf8c24ad89
Thread CGFunctionInfo construction through CodeGenTypes.
...
- Inefficient & leaks memory currently, will be cleaned up subsequently.
llvm-svn: 63567
2009-02-02 23:23:47 +00:00
Daniel Dunbar
d931a87f90
More ABI API cleanup.
...
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
EmitFunction{Epi,Pro}log.
llvm-svn: 63553
2009-02-02 22:03:45 +00:00
Daniel Dunbar
7633cbf005
ABI handling API changes.
...
- Lift CGFunctionInfo creation up to callers of EmitCall.
- Move isVariadic bit out of CGFunctionInfo, take as argument to
GetFunctionType instead.
No functionality change.
llvm-svn: 63550
2009-02-02 21:43:58 +00:00
Fariborz Jahanian
9f84b78ac1
Refactored code gen for ivar access in preparation for
...
objc2 nonfragile ivar access code gen.
llvm-svn: 63541
2009-02-02 20:02:29 +00:00
Fariborz Jahanian
c22f236e81
Use target alignment API to set objc2's meta-data
...
alignment.
llvm-svn: 63470
2009-01-31 02:43:27 +00:00
Daniel Dunbar
3cd20632ff
Kill off CGCallInfo, always use CGFunctionInfo for encapsulating
...
function/call info.
llvm-svn: 63466
2009-01-31 02:19:00 +00:00
Fariborz Jahanian
0408723269
class meta-data belong to __objc_data section (in objc2
...
nonfragile abi).
llvm-svn: 63461
2009-01-31 01:07:39 +00:00
Fariborz Jahanian
822082517f
Recognize class's visibility attribute and set its linkage
...
to private extern (in objc2 nonfragile abi).
llvm-svn: 63460
2009-01-31 00:59:10 +00:00
Fariborz Jahanian
75e0351adb
Missed another mis-alignment of an objc2 meta-data.
...
llvm-svn: 63453
2009-01-30 23:51:52 +00:00
Fariborz Jahanian
e46e284efd
Setting correct alignent for objc2 meta-data.
...
llvm-svn: 63445
2009-01-30 23:15:42 +00:00
Fariborz Jahanian
fa57e8e7ab
add imag_info section and data (for objc2 nonfragile abi).
...
llvm-svn: 63430
2009-01-30 22:07:48 +00:00
Fariborz Jahanian
279abd31a9
Generate list of implemented classes and categories in their
...
own sections (related to objc2 nonfragile abi).
llvm-svn: 63418
2009-01-30 20:55:31 +00:00
Fariborz Jahanian
097feda5e0
Code gen. for @protocol expression in the new nonfragile abi.
...
llvm-svn: 63408
2009-01-30 18:58:59 +00:00
Fariborz Jahanian
d9c28b808b
Bug fixing involving method-list in protocol meta-data
...
(objc2 nonfragile-abi).
llvm-svn: 63351
2009-01-30 00:46:37 +00:00
Fariborz Jahanian
34fe880648
Random bug fix related to protocl metadata in categories in
...
non-fragile abi.
llvm-svn: 63343
2009-01-29 23:23:06 +00:00
Fariborz Jahanian
61cd4b56c3
Set protocol linkage and visibility correctly and
...
build protocol translation table meta-data (objc2
non-fragile abi).
llvm-svn: 63329
2009-01-29 20:10:59 +00:00
Fariborz Jahanian
56b3b77c7d
Protocol meta-data for objc2's non-fragile abi.
...
Lot more to do in this area.
llvm-svn: 63326
2009-01-29 19:24:30 +00:00
Fariborz Jahanian
d27a820ae2
Add setter/getter methods to the list of methods
...
of class's meta-data (related to objc2 nonfragile abi).
llvm-svn: 63251
2009-01-28 22:46:49 +00:00
Fariborz Jahanian
066347ec7b
property metadata for objc2's nonfragile abi
...
llvm-svn: 63246
2009-01-28 22:18:42 +00:00
Fariborz Jahanian
b042a59230
Some refactoring of common code. No change in functionality.
...
llvm-svn: 63218
2009-01-28 19:12:34 +00:00
Fariborz Jahanian
3d3426f321
Set visibility of ivar offset symbols according to
...
accessibility of the ivar (related to objc2's
non-fragile abi).
llvm-svn: 63166
2009-01-28 01:36:42 +00:00
Fariborz Jahanian
40a4bcd49b
Generation of ivar-offset symbols in objc2's non-fragile abi.
...
Changed section names for meta-data (to match current gcc).
llvm-svn: 63163
2009-01-28 01:05:23 +00:00
Fariborz Jahanian
e19a1f15ae
After talking to our runtime guru, I added a comment.
...
llvm-svn: 63141
2009-01-27 22:27:56 +00:00
Fariborz Jahanian
7415caa3d4
ivar meta-data generation for nonfragile-abi.
...
Still more work to do in this area.
llvm-svn: 63126
2009-01-27 19:38:51 +00:00
Fariborz Jahanian
d0e8e85afc
Added a FIXME.
...
llvm-svn: 63071
2009-01-26 23:49:05 +00:00
Fariborz Jahanian
2612e149ef
Build method-description-list for category meta-data
...
as well (for nonfragile-abi).
llvm-svn: 63062
2009-01-26 22:58:07 +00:00
Fariborz Jahanian
99113fd577
Method decription meta-data and its setting in class_ro_t
...
meta-data.
llvm-svn: 63043
2009-01-26 21:38:32 +00:00