Commit Graph

299 Commits

Author SHA1 Message Date
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