Commit Graph

1676 Commits

Author SHA1 Message Date
Steve Naroff fb4330f255 First step toward fixing <rdar://problem/6613046> refactor clang objc type representation.
Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).

This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). 

No functionality change.

llvm-svn: 73649
2009-06-17 22:40:22 +00:00
Chris Lattner 94dfae248b Update clang for the add ->add/fadd split. Likewise for sub and mul.
llvm-svn: 73604
2009-06-17 06:36:24 +00:00
Devang Patel 9fc4341eec It is possible that main input file does not have any symbol with debug info. To handle this edge case, always create main compile unit first.
This fixes PR 4228.

llvm-svn: 73520
2009-06-16 18:02:02 +00:00
Anders Carlsson a42ab8f3d5 Handle temporaries in default arguments.
llvm-svn: 73462
2009-06-16 03:37:31 +00:00
Chris Lattner c7d2bfacef "GCC emits an __objc_class_name_{classname} symbol for every class, and a corresponding reference to this symbol for every compilation unit that references the class. This causes linker errors when you try linking a program which references some classes but doesn't define them. The attached patch implements this support in clang, so you can compile a class with clang, reference it in a file compiled with GCC, and have it all work correctly."
Patch by David Chisnall!

llvm-svn: 73364
2009-06-15 01:09:11 +00:00
Eli Friedman 6282b3cff8 PR4390: Make sure to handle anonymous unions correctly while building
static intializers for structs.

llvm-svn: 73349
2009-06-14 21:41:37 +00:00
Chris Lattner 15ba94987a Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Chris Lattner 5abdec7978 move the various builtins stuff from libast to libbasic. This
fixes a layering violation in lib/Basic/Targets.cpp.

llvm-svn: 73318
2009-06-14 01:05:48 +00:00
Chris Lattner ecd79c6353 move GetBuiltinType from Builtin::Context to ASTContext.
llvm-svn: 73316
2009-06-14 00:45:47 +00:00
Chris Lattner d50fea52af Simplify mangleFunctionDecl by unnesting a crazy condition. This fixes
the check for extern "c" system headers, which should prevent functiondecls
from being mangled.

llvm-svn: 73311
2009-06-13 23:34:16 +00:00
Eli Friedman 3192cc8526 Fix the calling convention for structs/unions containing SSE vectors on
x86-32.  This is slightly messy, but I think it's consistent with gcc.

llvm-svn: 73306
2009-06-13 21:37:10 +00:00
Chris Lattner 4ca97c3b9e Fix PR4372, another case where non-prototyped functions can prevent
always_inline from working.

llvm-svn: 73273
2009-06-13 00:26:38 +00:00
Anders Carlsson 8783543a6f Don't assert when generating code with static_asserts.
llvm-svn: 73208
2009-06-11 21:22:55 +00:00
Daniel Dunbar 76d864c7e7 Support complex properties, ivars and message expressions.
llvm-svn: 73158
2009-06-10 04:38:50 +00:00
Eli Friedman e9ff191459 Remove a few more vector builtins.
llvm-svn: 73022
2009-06-07 09:32:56 +00:00
Eli Friedman 5a996fc0fc Now that LLVM CodeGen can handle the generic variations a bit better,
get rid of a few more clang vector builtins.

llvm-svn: 73015
2009-06-07 07:12:56 +00:00
Eli Friedman 07bbeca406 PR4339: make sure to properly extend/trunc the index of a vector element
insert/extract; the relevant instructions are defined to take only an 
i32.

llvm-svn: 73005
2009-06-06 19:09:26 +00:00
Anton Korobeynikov 18adbf5f07 Add new ABIArgInfo kind: Extend. This allows target to implement its own argument
zero/sign extension logic (consider, e.g. target has only 64 bit registers and thus
i32's should be extended as well).

llvm-svn: 72998
2009-06-06 09:36:29 +00:00
Eli Friedman 6813eb125f Get rid of a bunch of dead builtins.
llvm-svn: 72996
2009-06-06 08:31:46 +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
Daniel Dunbar feeeda70e2 weak_import should not make definitions have weak linkage.
- <rdar://problem/6948703> clang treats weak_import like weak

llvm-svn: 72967
2009-06-05 22:58:34 +00:00
Anton Korobeynikov 5bda50f84e Update cmake script
llvm-svn: 72963
2009-06-05 22:08:54 +00:00
Anton Korobeynikov 244360d62b Factor out TargetABIInfo stuff into separate file. No functionality change.
llvm-svn: 72962
2009-06-05 22:08:42 +00:00
Devang Patel 9e24386c65 Set function Attribute::NoImplicitFloat appropriately.
llvm-svn: 72961
2009-06-05 22:05:48 +00:00
Daniel Dunbar 4be99ff767 ABI handling: Fix nasty thinko where IRgen could generate an out-of-bounds read
when generating a coercion for ABI handling purposes.
 - This may only manifest itself when building at -O0, but the practical effect
   is that other arguments may get clobbered.

 - <rdar://problem/6930451> [irgen] ABI coercion clobbers other arguments

llvm-svn: 72932
2009-06-05 07:58:54 +00:00
Daniel Dunbar dd050567c1 Fix -Asserts build warnings.
llvm-svn: 72910
2009-06-05 02:03:25 +00:00
Devang Patel 6e467b1a46 Set function attribute llvm::Attribute::NoRedZone appropriately.
llvm-svn: 72902
2009-06-04 23:32:02 +00:00
Chris Lattner 0261e5c960 Make ReplaceUsesOfNonProtoTypeWithRealFunction verify that a call is *to* the
function of interest, not an operand of it.

llvm-svn: 72869
2009-06-04 16:47:43 +00:00
Anders Carlsson 43c52cdc29 Use PushConditionalTempDestruction/PopConditionalTempDestruction for the ternary operator.
llvm-svn: 72842
2009-06-04 03:00:32 +00:00
Anders Carlsson f47a3de83c Use conditional temp destruction for || and &&.
llvm-svn: 72838
2009-06-04 02:53:13 +00:00
Anders Carlsson 7d313fc09b Make PushCXXTemporary and PopCXXTemporary handle conditional temporaries.
llvm-svn: 72837
2009-06-04 02:47:33 +00:00
Anders Carlsson 44bfcf0f97 Add PushConditionalTempDestruction/PopConditionalTempDestruction.
llvm-svn: 72835
2009-06-04 02:22:12 +00:00
Anders Carlsson ea89e2b813 Make sure to push a cleanup block.
llvm-svn: 72831
2009-06-04 02:08:08 +00:00
Fariborz Jahanian 7c80959a97 Cleanup/Refactoring of ivar collection. No change in functionality.
llvm-svn: 72827
2009-06-04 01:19:09 +00:00
Mike Stump fa0c645bae Fix cmake builds.
llvm-svn: 72814
2009-06-03 22:24:28 +00:00
Eli Friedman dd27484888 PR4316: Fix IRGen for cast-to-union extension.
llvm-svn: 72803
2009-06-03 20:45:06 +00:00
Anders Carlsson 4c49bb95f8 More temporary work.
llvm-svn: 72796
2009-06-03 19:05:16 +00:00
Anders Carlsson 6d36343ed8 Store more information about live temporaries. No functionality change for now.
llvm-svn: 72793
2009-06-03 18:54:26 +00:00
Anders Carlsson 82aea737a7 Move code generation of C++ temporaries into a new file.
llvm-svn: 72792
2009-06-03 18:40:21 +00:00
Eli Friedman cb9d07caeb Add support for __builtin_unwind_init.
Also, committing an #if 0'ed __builtin_setjmp and __builtin_longjmp 
implementation I've had sitting in my tree for a while.  I haven't 
enabled it because the LLVM backend support isn't complete yet.

llvm-svn: 72727
2009-06-02 09:37:50 +00:00
Eli Friedman f6bd15038c If we recognize alloca, treat it as a builtin. This fixes uses of
alloca without declaring it.

llvm-svn: 72719
2009-06-02 07:10:30 +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
Eli Friedman e32c02114f PR4289: Make sure "&func" has the right LLVM type when "func" is a
K&R-style definition.

llvm-svn: 72690
2009-06-01 10:04:20 +00:00
Anders Carlsson fa7c608ecc Fix a thinko.
llvm-svn: 72679
2009-06-01 00:26:14 +00:00
Anders Carlsson ca50119a31 Check for null correctly for new expressions.
llvm-svn: 72678
2009-06-01 00:05:16 +00:00
Anders Carlsson cba81fc4de Improve irgen of 'new' further.
llvm-svn: 72677
2009-05-31 21:53:59 +00:00
Anders Carlsson 96c012ff8b ...and aggregate POD types.
llvm-svn: 72676
2009-05-31 21:12:26 +00:00
Anders Carlsson 60d0c2c1c2 Support for complex types.
llvm-svn: 72675
2009-05-31 21:07:58 +00:00
Anders Carlsson ec71f61608 Better support for scalar POD types in 'new' expressions.
llvm-svn: 72674
2009-05-31 20:56:36 +00:00
Anders Carlsson 1832f52b10 Very basic irgen support for new expressions.
llvm-svn: 72672
2009-05-31 20:21:44 +00:00
Anders Carlsson 0955f20473 Don't try to call getFileCharacteristic if the function declaration has an invalid source location (as is the case for the global allocation functions.
llvm-svn: 72671
2009-05-31 20:19:23 +00:00
Anders Carlsson 4a7b49b56a Add a new function for emitting new functions.
llvm-svn: 72656
2009-05-31 01:40:14 +00:00
Anders Carlsson 8eb93e72f7 Emit destructors correctly for temporaries.
llvm-svn: 72655
2009-05-31 00:34:10 +00:00
Anders Carlsson f3f91cee43 When possible, don't emit the cleanup block. Instead, just move the instructions to the current block.
llvm-svn: 72654
2009-05-31 00:33:20 +00:00
Anders Carlsson c0092ad333 Implement VisitCXXExprWithTemporaries for complex expressions.
llvm-svn: 72653
2009-05-31 00:12:05 +00:00
Anders Carlsson 2262b307aa Call EmitCXXExprWithTemporaries.
llvm-svn: 72652
2009-05-31 00:09:15 +00:00
Anders Carlsson fd2af0cf86 Add lvalue irgen support for CXXBindTemporaryExpr.
llvm-svn: 72649
2009-05-30 23:30:54 +00:00
Anders Carlsson 3be22e27b6 More temporary support.
llvm-svn: 72648
2009-05-30 23:23:33 +00:00
Eli Friedman f7f9f68722 Some small fixes for fields of reference type.
llvm-svn: 72636
2009-05-30 21:09:44 +00:00
Anders Carlsson 4b2434da54 Remove VarDecl from CXXConstructExpr.
llvm-svn: 72633
2009-05-30 20:56:46 +00:00
Anders Carlsson 0a63741a3f Add code for emitting C++ destructors. Not used yet.
llvm-svn: 72591
2009-05-29 21:03:38 +00:00
Douglas Gregor 7de5966d76 Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.

llvm-svn: 72590
2009-05-29 20:38:28 +00:00
Eli Friedman 9444638e4e Re-add a slightly more general version of the check from r72578; it is
actually necessary in some obscure cases.

llvm-svn: 72585
2009-05-29 19:23:46 +00:00
Mike Stump a678874975 Oops, the testcase I was thinking of is supposed to error out. I
tried other things that might trip, but they all worked.

llvm-svn: 72584
2009-05-29 19:14:13 +00:00
Mike Stump 7f12d51a48 Fixup codegen for composition of vla types using a normal array type.
llvm-svn: 72578
2009-05-29 17:06:45 +00:00
Mike Stump df0fe27b66 Fixup the rest of the trivial cases of the codegen of volatile. If
any body can spot codegen bugs with volatile, or knows of any in the
bug database, let me know.

llvm-svn: 72572
2009-05-29 15:46:01 +00:00
Eli Friedman 2a69547f38 PR4281: Fix bogus CodeGen assertion. The issue is that
getUnqualifiedType() doesn't strip off all qualifiers for non-canonical 
types.

llvm-svn: 72552
2009-05-28 23:04:00 +00:00
Mike Stump 01c2d0a17c Not setting all the fields is confusing...
llvm-svn: 72506
2009-05-28 00:16:27 +00:00
Daniel Dunbar 16f422ec86 Fix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar RValue.
llvm-svn: 72504
2009-05-27 23:45:33 +00:00
Fariborz Jahanian 7c1baf46d6 No write-barrier for initializations.
llvm-svn: 72492
2009-05-27 19:54:11 +00:00
Fariborz Jahanian 7551257f00 Change a confusing variable name.
llvm-svn: 72491
2009-05-27 19:48:48 +00:00
Anders Carlsson ddcbfe7b53 IRgen support for calls to functions that return references to aggregate exressions.
llvm-svn: 72479
2009-05-27 16:45:02 +00:00
Eli Friedman 751aa72b72 Fix up constant expression handling to deal with the address
of a reference correctly.

llvm-svn: 72463
2009-05-27 06:04:58 +00:00
Eli Friedman 55422ad068 Add IRGen support for local variables of reference type.
llvm-svn: 72462
2009-05-27 05:39:06 +00:00
Eli Friedman b909bf4937 Add IRGen support for return statements in functions with reference
type.

llvm-svn: 72459
2009-05-27 04:56:12 +00:00
Anders Carlsson 4034a95dc8 Handle operator call expressions where the callee is a member function.
llvm-svn: 72458
2009-05-27 04:18:27 +00:00
Anders Carlsson d8b7ae205e Functions that return references can be rvalues as well.
llvm-svn: 72457
2009-05-27 03:37:57 +00:00
Anders Carlsson 4ae70ff9a3 Add support for emitting calls to functions that return references (as lvalues only for now)
llvm-svn: 72449
2009-05-27 01:45:47 +00:00
Mike Stump 3e97f3b35d Fix typo. I also fixed the hard to read case differences, so that no
one else is tempted to copy the style, incorrectly.

llvm-svn: 72448
2009-05-27 01:42:21 +00:00
Anders Carlsson 3a9463bfda Rename an EmitCallExpr function to EmitCall to make it clear that it doesn't emit an expr.
llvm-svn: 72446
2009-05-27 01:22:39 +00:00
Mike Stump ec3cbfe8c6 Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).
llvm-svn: 72439
2009-05-26 22:03:21 +00:00
Daniel Dunbar bee70bd1e7 Use .data() instead of &...[0].
- Just SmallVectors this time.

llvm-svn: 72432
2009-05-26 19:40:20 +00:00
Mike Stump 25306cacc6 Esnure that if we have a volatile structure as the destination, that
we actually have a destination.

llvm-svn: 72429
2009-05-26 18:57:45 +00:00
Daniel Dunbar 1518b64ddc When trying to pass an argument on the stack, assume LLVM will do the right
thing for non-aggregate types.
 - Otherwise we unnecessarily pin values to the stack and currently end up
   triggering a backend bug in one case.

 - This loose cooperation with LLVM to implement the ABI is pretty ugly.

 - <rdar://problem/6918722> [irgen] clang miscompile of many pointer varargs on
   x86-64

llvm-svn: 72419
2009-05-26 16:37:37 +00:00
Eli Friedman 895771aa4b Handle the edge case of a weak function with incomplete type correctly.
Found by code inspection; I haven't seen this in real-world code.

llvm-svn: 72408
2009-05-26 01:22:57 +00:00
Mike Stump b9f2518626 Propagate volatile for implicit property refernces.
llvm-svn: 72353
2009-05-23 23:52:31 +00:00
Mike Stump 9afc476d4a Propagate volatile around for property references.
llvm-svn: 72352
2009-05-23 23:48:13 +00:00
Mike Stump 5e9e61b8d2 Track volatile aggregate copies better. I'm hoping someone else will decide
how to get the backend to know that the operation is volatile.

llvm-svn: 72348
2009-05-23 22:29:41 +00:00
Mike Stump 332ec2ce81 Fix thinko, and implement aggregate volatile reads.
llvm-svn: 72347
2009-05-23 22:01:27 +00:00
Mike Stump 23abd46b79 More volatile fixes. Can't testcase these yet as ultimately volatile
is still ignored.

llvm-svn: 72344
2009-05-23 21:40:07 +00:00
Mike Stump ca9fc09c61 Collapse a few FIXMEs together and refactor to make fixing the code easier.
llvm-svn: 72342
2009-05-23 20:28:01 +00:00
Mike Stump 93700fc988 Add support for volatile RValues.
llvm-svn: 72341
2009-05-23 20:21:36 +00:00
Mike Stump 8673657275 One step to fixing up codegen for a=b, where a is a volatile struct.
llvm-svn: 72315
2009-05-23 04:13:59 +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
Mike Stump a35af82429 Fix typo.
llvm-svn: 72308
2009-05-23 02:02:29 +00:00
Fariborz Jahanian a4404f21d1 This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
compiled with -fobjc-sender-dependent-dispatch.  This is used in AOP, COP, implementing object 
planes, and a few other things.
Patch by David Chisnall.

llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Mike Stump c63428b192 Fixup codegen for __block int i; i += rhs();. Should also slightly
improve codegen in some cases.

llvm-svn: 72273
2009-05-22 19:07:20 +00:00
Daniel Dunbar 499f3f9c5d x86_64 ABI: Account for sret parameters consuming an integer register.
- PR4242.

llvm-svn: 72268
2009-05-22 17:33:44 +00:00
Sanjiv Gupta 47e296149e Targets like PIC16 generate Static decls for automatic variables, emit the appropriate debug descriptor as well in that case.
llvm-svn: 72261
2009-05-22 13:54:25 +00:00
Torok Edwin 5b34933b90 Set correct calling convention even if there is a bitcast in the way.
This attempts to fix PR4239.

llvm-svn: 72251
2009-05-22 07:25:06 +00:00
Mike Stump aed08f9929 Fixup blocks codegen for { __block i; i = rhs(); }, we want the rhs
evaluated first.  This can also improve codegen just a bit as we might
have another register to play with for the evaluation of the rhs.

llvm-svn: 72226
2009-05-21 21:05:15 +00:00
Jay Foad 7d0479f2c2 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Fariborz Jahanian a6bed8370e Minor refactoring. Uses an existing API to lookup a class method.
llvm-svn: 72203
2009-05-21 01:03:45 +00:00
Fariborz Jahanian d20a03f308 This patch provides preliminary support for non-fragile instance variables on the GNU runtime.
It currently requires a patches to GNU libobjc (and so is not enabled by default) which are currently 
being tested and reviewed by GNUstep before being pushed upstream.
This patch does not allow support for synthesized ivars, but does provide the infrastructure 
needed for supporting them.
Patch by David Chisnall

llvm-svn: 72175
2009-05-20 18:41:51 +00:00
Eli Friedman c21cb44de2 Handle the remaining unhandled cases in EmitReferenceBindingToExpr.
It would be nice if someone could write an ObjC++ testcase for the case 
of passing a property returning a struct to a function taking a const
reference.

llvm-svn: 72159
2009-05-20 02:31:19 +00:00
Anders Carlsson 02bb7f0ac8 irgen for references to complex rvales (Very important...)
llvm-svn: 72157
2009-05-20 01:35:03 +00:00
Anders Carlsson ad007d44b6 Create a temporary if the lvalue is a bitfield. Reported by Eli.
llvm-svn: 72155
2009-05-20 01:24:22 +00:00
Anders Carlsson 145eae5224 Add support for binding references to scalar rvalues.
llvm-svn: 72153
2009-05-20 01:03:17 +00:00
Anders Carlsson 7d4c083c19 Bind references to lvalues correctly.
llvm-svn: 72150
2009-05-20 00:36:58 +00:00
Anders Carlsson 6f5a015bd9 Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)
llvm-svn: 72147
2009-05-20 00:24:07 +00:00
Anders Carlsson 2d228cef50 Improve support for irgen of references.
llvm-svn: 72133
2009-05-19 20:40:02 +00:00
Anders Carlsson 29a1be34b7 Only do the bitcast in EmitStoreOfScalar if the type is a boolean.
llvm-svn: 72125
2009-05-19 19:36:19 +00:00
Anders Carlsson 8370964257 Pass the destination QualType to EmitStoreOfScalar. No functionality change.
llvm-svn: 72118
2009-05-19 18:50:41 +00:00
Anders Carlsson 775640d248 Don't always zext the result of the not unary operator to an int.
llvm-svn: 72117
2009-05-19 18:44:53 +00:00
Anders Carlsson c82b86dfaa Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub out VisitCXXExprWithTemporaries.
llvm-svn: 72103
2009-05-19 04:48:36 +00:00
Eli Friedman cec35d7e6a Clean up some unnecessary includes.
llvm-svn: 72101
2009-05-19 04:30:57 +00:00
Fariborz Jahanian b27c94199f This patch allows clang to generate code for declared properties on the GNU runtime. As with @synchronized, this requires some extra functions that are included with other libraries (not with the GNU runtime itself) and so will cause linker errors when these are not present.
Patch by David Chisnall.

llvm-svn: 72079
2009-05-19 00:28:43 +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
Anders Carlsson 9b02760923 Since we miscompile many cases when declaring a variable with a reference type, make them unsupported for now.
llvm-svn: 72034
2009-05-18 19:55:29 +00:00
Anders Carlsson 8dd2947696 Remove an unused builtin.
llvm-svn: 72033
2009-05-18 19:25:54 +00:00
Anders Carlsson 2081200b8c Add 'cmp' SSE builtins and get rid of a bunch of other builtins.
llvm-svn: 72032
2009-05-18 19:16:46 +00:00
Anders Carlsson 23ca0b4869 Add support for converting member pointer types to LLVM types. Also mangle pointer to member functions correctly and add tests.
llvm-svn: 71981
2009-05-17 17:41:20 +00:00
Fariborz Jahanian 078cd52297 This patch fixes two bugs in the GNU Objective-C runtime implementation. One is a case in rethrowing exceptions where the C types don't match correctly (I already sent this patch to Daniel Dunbar, who found the bug, so it may have already been committed). The other fixes the case properties so that the methods generated as property accessors are added to the class structure correctly.
Patch by David Chisnall.

llvm-svn: 71980
2009-05-17 16:49:27 +00:00
Anders Carlsson d3a69ceaaf extern "C" should preserve the 'extern' qualifier for VarDecls. Fixes 6853728.
llvm-svn: 71957
2009-05-16 21:02:39 +00:00
Mike Stump 18bb9284ff Reflow some comments.
llvm-svn: 71937
2009-05-16 07:57:57 +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 19573e7d29 Factor code for adding module-level class lists into separate method.
- No functionality change.

llvm-svn: 71898
2009-05-15 21:48:48 +00:00
Anders Carlsson 37604a0984 A C++ member function always has either weak linkage (if it's inline or defined inline) or strong linkage (other cases).
llvm-svn: 71873
2009-05-15 18:35:39 +00:00
Anders Carlsson f6e9ece507 Name mangling for class template specializations and template arguments.
llvm-svn: 71861
2009-05-15 16:09:15 +00:00
Mike Stump 2c002929b2 Fixup debug information for the location information for __block
variables.  For this to work, the backend needs to handle more complex
forms for locations.

A typical utterance would be:

        %forwarding = getelementptr %0* %use_by_ref, i32 0, i32 1               ; <i8**> [#uses=1]
        %0 = load i8** %forwarding              ; <i8*> [#uses=1]
        %1 = bitcast i8* %0 to %0*              ; <%0*> [#uses=1]
        %x = getelementptr %0* %1, i32 0, i32 4         ; <i32*> [#uses=1]
        %2 = bitcast i32* %x to { }*            ; <{ }*> [#uses=1]
        call void @llvm.dbg.declare({ }* %2, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))

Presently when selection finds something it doesn't understand, it
just avoids generating any information, which is safe, just
incomplete.  Radar 6867696

llvm-svn: 71824
2009-05-15 00:29:54 +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
Mike Stump 31f099c8c2 Enhance debug information for block literals. Radar 6867696
llvm-svn: 71763
2009-05-14 02:03:51 +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
Daniel Dunbar ffdb8439d7 ABI handling: Fix invalid assertion, it is possible for a valid
coercion to be specified which truncates padding bits. It would be
nice to still have the assert, but we don't have any API call for the
unpadding size of a type yet.

llvm-svn: 71695
2009-05-13 18:54:26 +00:00
Fariborz Jahanian 1880136520 Removed 4-letter :) word in comment.
Used simple array for Selector build.

llvm-svn: 71674
2009-05-13 16:19:02 +00:00
Chris Lattner afde259240 implement __sync_synchronize and __sync_lock_release,
rdar://6880573

llvm-svn: 71637
2009-05-13 04:46:13 +00:00
Chris Lattner 94578cba76 add support for __sync_nand_and_fetch and __sync_fetch_and_nand,
rdar://6880573

llvm-svn: 71636
2009-05-13 04:37:52 +00:00
Chris Lattner 46813bbfa2 Fix rdar://6880259 - invalid function name in block call (__NSConcreteGlobalBlock2)
by using the appropriate CGM interface instead of directly creating a global.

llvm-svn: 71617
2009-05-13 02:50:56 +00:00
Chris Lattner e541ea3a61 implement l-value codegen of comma expr
llvm-svn: 71595
2009-05-12 21:28:12 +00:00
Chris Lattner e0be0dfced push GlobalDecl through enough of the CodeGenModule interfaces
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in 
member-functions.cpp:test2, but when it does, its body should
get emitted.

llvm-svn: 71594
2009-05-12 21:21:08 +00:00
Chris Lattner d035ebda2f add an initial stab at emitting deferred c++ inline functions. This handles static
functions and methods declared inline, but not ctors/dtors or methods not declared
inline (apparently my previous patch wasn't good enough).

llvm-svn: 71591
2009-05-12 21:02:27 +00:00
Chris Lattner eb7466d24a cleanups, no functionality change.
llvm-svn: 71590
2009-05-12 20:58:15 +00:00
Chris Lattner bea5b622be static methods don't get this pointers.
llvm-svn: 71586
2009-05-12 20:27:19 +00:00
Chris Lattner e7834115eb revert my previous patch, I committed the wrong file.
llvm-svn: 71585
2009-05-12 20:26:52 +00:00
Chris Lattner cd74ffa3eb static methods don't get this pointers.
llvm-svn: 71583
2009-05-12 20:21:39 +00:00
Fariborz Jahanian e4128642a7 Fixed typos, used DenseSet for keeping track of
selectors which need use Nonfrgile API for
message dispatch.

llvm-svn: 71578
2009-05-12 20:06:41 +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
Daniel Dunbar bbfd054746 Darwin x86-32 ABI: Now that structure passing is farther along, we
don't need special treatment for unions.

llvm-svn: 71559
2009-05-12 17:00:20 +00:00
Daniel Dunbar 203e2e8dd8 x86-64 ABI: clang incorrectly passes union { long double, float } in
register.
 - Merge algorithm was returning MEMORY as it should.

llvm-svn: 71556
2009-05-12 15:22:40 +00:00