Commit Graph

1116 Commits

Author SHA1 Message Date
Devang Patel f4c205b2fa Add support to emit debug info for objective-c interfaces.
(This is not yet used.)

llvm-svn: 65573
2009-02-26 21:10:26 +00:00
Daniel Dunbar 76ba41ce4f Add Type::hasPointerRepresentation predicate.
- For types whose native representation is a pointer.

 - Use to replace ExprConstant.cpp:HasPointerEvalType,
   CodeGenFunction::isObjCPointerType.

llvm-svn: 65569
2009-02-26 20:52:22 +00:00
Daniel Dunbar d26d5c220b Remove PointerLikeType.
- Having pointers and references share a base was not a useful
   notion.

llvm-svn: 65567
2009-02-26 19:54:52 +00:00
Daniel Dunbar 201351933a Change PointersToResolve to list the pointee type to resolve, not the
pointer type.
 - Drops use of PointerLikeType.
 - No intended functionality change.

llvm-svn: 65566
2009-02-26 19:48:14 +00:00
Daniel Dunbar e2617d97a5 Drop uses of isPointerLikeType.
- No functionality change.

llvm-svn: 65560
2009-02-26 19:03:24 +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
Anders Carlsson 600183db9e Classify enum types correctly
llvm-svn: 65533
2009-02-26 17:31:15 +00:00
Daniel Dunbar b98d1f7140 x86_64 ABI: Qualified id types are passed as pointers.
- <rdar://problem/6622451> Bad x86_64 code gen for message call taking one argument.

llvm-svn: 65510
2009-02-26 07:21:35 +00:00
Mike Stump b750d928ce CodeGen support for copied BlockDeclRefExprs.
llvm-svn: 65487
2009-02-25 23:33:13 +00:00
Daniel Dunbar 4208835eec Temporarily disable clearing of insert point (to indicate unreachable
code) when calling noreturn functions; general expression emission
isn't ready to do the right thing in all cases.

llvm-svn: 65473
2009-02-25 20:59:29 +00:00
Daniel Dunbar 1cdbc5404b Allow constant initializers to reference their defining decl.
- PR3662.

llvm-svn: 65472
2009-02-25 20:08:33 +00:00
Daniel Dunbar a374e60e57 Fold GeneraticStaticBlockVarDecl into callers.
- No functionality change.

llvm-svn: 65470
2009-02-25 19:45:19 +00:00
Daniel Dunbar 22a87f94a9 Pull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
global variable) out of GenerateStaticBlockVarDecl. 
 - No intended functionality change.
 - Prep for some mild cleanups and PR3662.

llvm-svn: 65466
2009-02-25 19:24:29 +00:00
Devang Patel 410dc00184 Fix comments.
llvm-svn: 65423
2009-02-25 01:36:11 +00:00
Devang Patel 9d7d17a8ec Enable debug info emission for objc methods.
llvm-svn: 65422
2009-02-25 01:09:46 +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
Devang Patel ab19ecad22 If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
llvm-svn: 65403
2009-02-24 23:16:03 +00:00
Chris Lattner d7e7b8e411 first wave of fixes for @encode sema support. This is part of PR3648.
The big difference here is that (like string literal) @encode has 
array type, not pointer type.

llvm-svn: 65391
2009-02-24 22:18:39 +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 d4ecca135a Fix IRgen of constant expressions referring to external/static
variables.
 - PR3657.

llvm-svn: 65381
2009-02-24 18:41:57 +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 36ae309434 Add a note about an IRgen optimization opportunity.
llvm-svn: 65376
2009-02-24 06:34:04 +00:00
Anders Carlsson 729a8202d0 Prevent accidental copying of CodeGenFunction and CodeGenModule.
llvm-svn: 65372
2009-02-24 04:21:31 +00:00
Anders Carlsson b9c9e1d16f Pass the CodeGenModule object to GenerateBlockFunction, instead of *this (which will call the copy constructor).
Also, since we're creating a new CodeGenFunction object for each block function, we don't need to clear the BreakContinueStack.

llvm-svn: 65371
2009-02-24 04:19:41 +00:00
Mike Stump 18e91257e4 Ensure that we can't break or continue out of a block.
llvm-svn: 65370
2009-02-24 02:59:30 +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
Douglas Gregor e62c0a45dd Improve merging of function declarations. Specifically:
- When we are declaring a function in local scope, we can merge with
    a visible declaration from an outer scope if that declaration
    refers to an entity with linkage. This behavior now works in C++
    and properly ignores entities without linkage.
  - Diagnose the use of "static" on a function declaration in local
    scope.
  - Diagnose the declaration of a static function after a non-static
    declaration of the same function.
  - Propagate the storage specifier to a function declaration from a
    prior declaration (PR3425)
  - Don't name-mangle "main"

llvm-svn: 65360
2009-02-24 01:23:02 +00:00
Fariborz Jahanian 392124c78e We should not generate __weak write barrier on indirect reference
of a pointer to object; This patch does this odd behavior according to
gcc.

llvm-svn: 65334
2009-02-23 18:59:50 +00:00
Daniel Dunbar 1234749853 Add low level support for generating invoke instead of calls.
- No functionality change.

llvm-svn: 65325
2009-02-23 17:26:39 +00:00
Anders Carlsson e14282e274 Make sure to reset the DidCallStackSave variable before emitting a compound statement. Fixes PR3649.
llvm-svn: 65291
2009-02-22 18:44:21 +00:00
Fariborz Jahanian 0773533b27 More objc gc work. Match gcc's treatment of ivar access
true a local pointer to objective-c object in generating
write barriers.

llvm-svn: 65290
2009-02-22 18:40:18 +00:00
Mike Stump e8b2d066ea Copy some clenaups from Eli to code that I copied. :-)
llvm-svn: 65286
2009-02-22 13:55:31 +00:00
Mike Stump 624497c29a Cleanp code with some recent suggestions.
llvm-svn: 65285
2009-02-22 13:27:11 +00:00
Daniel Dunbar bb525c3c7f x86_64 ABI: Actually, we can always pass things we want to pass in
memory using Indirect; this was a holdover from when CGCall wasn't as
robust.

llvm-svn: 65278
2009-02-22 08:17:51 +00:00
Eli Friedman 825fe7565e Eliminate a bunch of code which should be dead.
llvm-svn: 65267
2009-02-22 07:29:04 +00:00
Daniel Dunbar 075d642e24 x86_64 ABI: Make sure to pass vectors that we want to pass in memory
as byval. Otherwise LLVM will have its own opinion about where to put
things.

We now pass all gcc dg.compat tests on x86_64.

llvm-svn: 65266
2009-02-22 07:22:25 +00:00
Daniel Dunbar c64c481d18 x86_64 ABI: Pass 32-bit vectors as Integer to match gcc. We don't care
about these much but <2 x i16> shows up in the gcc test suite.

llvm-svn: 65264
2009-02-22 04:48:22 +00:00
Daniel Dunbar f25afad9e5 x86_64 ABI: Classify <1 x i64> as INTEGER (match gcc not llvm-gcc).
Also, make sure to pass <1 x i64> as i64 (not <1 x i64>, which doesn't
quite work yet in the backend).

llvm-svn: 65262
2009-02-22 04:16:10 +00:00
Eli Friedman 34ef305759 Last part of PR3254: use the same alignment computation in Sema and
CodeGen.  I'm not sure whether this actually makes any visible 
difference, but it's better to be consistent anyway.

llvm-svn: 65259
2009-02-22 03:23:43 +00:00
Fariborz Jahanian a9fecf3f9e local array of objects are non-gc'able.
llvm-svn: 65251
2009-02-21 23:37:19 +00:00
Steve Naroff 8487e3e541 More work to integrate newly added ObjCQualifiedClassType into the type system.
This is necessary 'plumbing' to fix <rdar://problem/6497631> Message lookup is sometimes different than gcc's.

llvm-svn: 65248
2009-02-21 21:17:01 +00:00
Mike Stump 2ac40a9ff8 The blocks ABI is wrong, add a FIXME.
llvm-svn: 65243
2009-02-21 20:07:44 +00:00
Mike Stump cb2fbcb0c9 Add CodeGen support for the helper for BlockDeclRefExprs. The easier
stuff is mostly done.  Move BlockHasCopyDispose up.

llvm-svn: 65242
2009-02-21 20:00:35 +00:00
Fariborz Jahanian 10bec1099c Handle case of none gc'able objects regardless of their
type.

llvm-svn: 65205
2009-02-21 00:30:43 +00:00
Daniel Dunbar 3c81dabd76 Emit extern_weak when needed.
- PR3629.

llvm-svn: 65203
2009-02-21 00:24:10 +00:00
Daniel Dunbar 0c4eda5923 We must always mangle attribute overloadable functions; even if in a
system header.
 - Prevents a codegen crash when anything used anything in tgmath! :)

llvm-svn: 65200
2009-02-20 23:09:27 +00:00
Daniel Dunbar 2f3a3d9f7a Add some IRgen improvement notes.
llvm-svn: 65146
2009-02-20 19:34:45 +00:00
Daniel Dunbar 27032de34b Shorten; no functionality change.
llvm-svn: 65145
2009-02-20 19:34:33 +00:00
Daniel Dunbar 5006f4a5f0 Take advantage of noreturn attribute to add unreachable instruction &
clear insertion point. The rest of IRgen should theoretically take
advantage of this to avoid emitting dead code. Theory != Practice.

llvm-svn: 65141
2009-02-20 18:54:31 +00:00
Chris Lattner a499715c83 remove some more methods from objc decls, using the iterator
interfaces more consistently.

llvm-svn: 65138
2009-02-20 18:43:26 +00:00
Daniel Dunbar cdbb5e336d Set call attribute for direct calls (i.e. noreturn).
- Remove an unused variant of EmitCallExpr overload.

llvm-svn: 65130
2009-02-20 18:06:48 +00:00
Chris Lattner 90669d0500 switch ObjCMethodDecl's parameter list from being explicitly managed to an ObjCList.
llvm-svn: 65114
2009-02-20 06:23:21 +00:00
Eli Friedman 719ed1a9ab Initialize the Init variable to something reasonable when we emit an
error, so we don't crash.

llvm-svn: 65099
2009-02-20 01:18:21 +00:00
Fariborz Jahanian c86fb5ecb4 More objc gc's ir-gen fixes.
llvm-svn: 65097
2009-02-20 01:14:43 +00:00
Mike Stump 2a9baebae1 Deox and Capitolize.
llvm-svn: 65093
2009-02-20 00:45:51 +00:00
Mike Stump f5a5c4fa11 Fix spacing.
llvm-svn: 65089
2009-02-20 00:19:45 +00:00
Fariborz Jahanian 0f466c746f More objc's gc ir-gen stuff.
llvm-svn: 65077
2009-02-19 23:36:06 +00:00
Mike Stump a67033294a Add enough checking to ensure that non-constant block literals don't
appear to be constant.  I'll probably redo this and throw it all away
later once we have codegen for BlockDeclRefExprs.

llvm-svn: 65070
2009-02-19 22:01:56 +00:00
Daniel Dunbar 18e1444f82 Remove IRgen constant emission assumption that LValue APValue results
only occur for pointer types; they are also possible for integer types
now.
 - No intended functionality change, IntExprEvaluate doesn't return
   LValue results yet.

llvm-svn: 65066
2009-02-19 21:44:24 +00:00
Anders Carlsson f96954ca30 Add irgen support for the noinline attribute.
llvm-svn: 65056
2009-02-19 19:22:11 +00:00
Fariborz Jahanian 3114e94e10 Generate the conservative objc gc's API for now.
llvm-svn: 65051
2009-02-19 18:29:24 +00:00
Daniel Dunbar f0acf7bd4c Don't emit K&R unprototyped function definitions as varargs.
- <rdar://problem/6584606> clang/x86-64 - too many reg saves

llvm-svn: 65032
2009-02-19 07:15:39 +00:00
Daniel Dunbar b2f4cdb233 Emission of global variable initialializer was broken in rare
situation where a tentative decl was emitted *after* the actual
initialization. This occurs in some rare situations with static decls.
 - PR3613.

 - I'm not particularly happy with this fix, but I don't see a simpler
   or more elegant solution yet.

llvm-svn: 65018
2009-02-19 05:36:41 +00:00
Mike Stump 5d2534ada7 More codegen for blocks. The type of block literals should be better.
The size calculation is improved.

llvm-svn: 64994
2009-02-19 01:01:04 +00:00
Fariborz Jahanian 83e3eea5fc Some code simplification. ir gen for gc'able array
of objects in objc.

llvm-svn: 64992
2009-02-19 00:48:05 +00:00
Douglas Gregor 5f361c9f1e Address Chris's comments regarding C++ name mangling.
llvm-svn: 64984
2009-02-18 23:53:56 +00:00
Daniel Dunbar a228a67637 Add anti-FIXME.
llvm-svn: 64969
2009-02-18 22:52:09 +00:00
Daniel Dunbar 8cdb9dae45 i386 ABI: Offset computation in va_arg was incorrect for sizeof(Ty)>4.
We are down to only failing gcc.dg/compat/vector-[12] (8 tests total).

llvm-svn: 64967
2009-02-18 22:28:45 +00:00
Daniel Dunbar e60ec0abca x86_64 ABI: Fix thinko in computation of bound for "passed in SSE regs" test.
Two more gcc/x86_64 failures down.

llvm-svn: 64963
2009-02-18 22:19:44 +00:00
Chris Lattner d7cfc246f6 rip out __builtin_overload
llvm-svn: 64961
2009-02-18 22:14:55 +00:00
Daniel Dunbar e3bba6e3d0 x86_64 ABI: "is passed in regs" computation for va_arg was broken for
things passed in mixed registers.

This knocks out 8 x86_64 failures.

llvm-svn: 64958
2009-02-18 22:05:01 +00:00
Fariborz Jahanian 9620769901 Some refactoring and simplificaiotn of objc's gc
ir gen.

llvm-svn: 64954
2009-02-18 21:49:28 +00:00
Daniel Dunbar 216f64379f Simplify.
llvm-svn: 64944
2009-02-18 19:45:21 +00:00
Fariborz Jahanian 9959eee95d Start generating gc'able code using the new
objc gc type attributes.

llvm-svn: 64935
2009-02-18 18:52:41 +00:00
Fariborz Jahanian 257eac6d0c Cleanup objc's gc attributes code no longer needed.
This make warn-weak-field.m to fail (subject of
a followup patch). 
attr-objc-gc.m no passes.

llvm-svn: 64925
2009-02-18 17:52:36 +00:00
Daniel Dunbar 617e89231d x86_64 ABI: Two bug fixes.
1. Return of _Complex long double used wrong type.

2. va_arg of types passed in two SSE registers didn't account for
extra space in register save area.

Down to 18 failures on gcc/compat/x86_64. Combined 32/64 results are:
--
		=== gcc Summary ===

# of expected passes		1292
# of unexpected failures	34
# of unsupported tests		2
--

llvm-svn: 64880
2009-02-18 03:44:19 +00:00
Mike Stump eecd39f2d7 Avoid getNameAsCString when the decl doesn't have a name.
Build of the parm list with the iterator, not end().

llvm-svn: 64851
2009-02-17 23:25:52 +00:00
Argyrios Kyrtzidis 4b4f67ac0a Remove some redundant Decl -> Decl castings.
llvm-svn: 64804
2009-02-17 20:23:54 +00:00
Daniel Dunbar 38ad1e6138 Change EmitConstantExpr to allow failure.
IRgen no longer relies on isConstantInitializer, instead we just try
to emit the constant. If that fails then in C we emit an error
unsupported (this occurs when Sema accepted something that it doesn't
know how to fold, and IRgen doesn't know how to emit) and in C++ we
emit a guarded initializer.

This ends up handling a few more cases, because IRgen was actually
able to emit some of the constants Sema accepts but can't Evaluate().
For example, PR3398.

llvm-svn: 64780
2009-02-17 18:43:32 +00:00
Daniel Dunbar 3d926cbf79 80-cols.
llvm-svn: 64779
2009-02-17 18:31:04 +00:00
Fariborz Jahanian ece8582ca2 Renamed ASQualType to ExtQualType to reflect its more
general use; as for, objc2's gc type attributes. No
change in functionality.

llvm-svn: 64778
2009-02-17 18:27:45 +00:00
Mike Stump 03868f4ea0 Be sure to initialize Name.
llvm-svn: 64769
2009-02-17 17:18:36 +00:00
Mike Stump c6ea7c1812 Fixup spacing a little.
llvm-svn: 64768
2009-02-17 17:00:02 +00:00
Daniel Dunbar 0ee13255ee x86_64 ABI: Fix assert on return of _Complex long double.
llvm-svn: 64756
2009-02-17 07:55:55 +00:00
Daniel Dunbar 7f0e2368bb x86_64 ABI: Implement classification for bit-fields.
llvm-svn: 64727
2009-02-17 02:45:44 +00:00
Daniel Dunbar f2c6198eef x86_64 ABI: Handle va_arg arguments with alignment > 8.
llvm-svn: 64701
2009-02-16 23:38:56 +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 8eb018ab9c Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.
- Define pow[lf]?, sqrt[lf]? as builtins.

 - Add -fmath-errno option which binds to LangOptions.MathErrno

 - Add new builtin flag Builtin::Context::isConstWithoutErrno for
   functions which can be marked as const if errno isn't respected for
   math functions. Sema automatically marks these functions as const
   when they are defined, if MathErrno=0.

 - IRgen uses const attribute on sqrt and pow library functions to
   decide if it can use the llvm intrinsic.

llvm-svn: 64689
2009-02-16 22:43:43 +00:00
Chris Lattner e084c01124 fix volatile handling with ExtVectorElementExpr, so that we
emit two volatile loads for:
typedef __attribute__(( ext_vector_type(4) )) float float4;

float test(volatile float4 *P) {
  return P->x+P->y;
}

llvm-svn: 64683
2009-02-16 22:25:49 +00:00
Chris Lattner b8211f6436 introduce and use a new ExtVectorElementExpr::isArrow method, at Eli's suggestion
llvm-svn: 64681
2009-02-16 22:14:05 +00:00
Daniel Dunbar e28b359881 Fix IRgen of __builtin_memset.
- Fix test case to not only have negative tests.

llvm-svn: 64674
2009-02-16 21:52:05 +00:00
Chris Lattner 6c7ce109e0 enhance ExtVectorElementExpr to allow V->xxyy to work like (*V).xxyy
llvm-svn: 64667
2009-02-16 21:11:58 +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
Mike Stump 0e7d7b68c8 Use getNameAsCString instead of getNameAsString and reflow the type.
Thanks Anders.

llvm-svn: 64571
2009-02-14 22:49:33 +00:00
Mike Stump 2d5a2878d4 Generate the helper function for blocks. Now basic codegen is
starting to work for blocks.

llvm-svn: 64570
2009-02-14 22:16:35 +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
Douglas Gregor e711f7052e Add hook to add attributes to function declarations that we know
about, whether they are builtins or not. Use this to add the
appropriate "format" attribute to NSLog, NSLogv, asprintf, and
vasprintf, and to translate builtin attributes (from Builtins.def)
into actual attributes on the function declaration.

Use the "printf" format attribute on function declarations to
determine whether we should do format string checking, rather than
looking at an ad hoc list of builtins and "known" function names.

Be a bit more careful about when we consider a function a "builtin" in
C++.

llvm-svn: 64561
2009-02-14 18:57:46 +00:00
Daniel Dunbar 3d88672f64 x86_64 ABI: Need to use canonical types when comparing against
ASTContext types.

llvm-svn: 64533
2009-02-14 02:45:45 +00:00
Daniel Dunbar 019ef0bbfe x86_64 ABI: Pass simple types directly when possible. This is
important for both keeping the generated LLVM simple and for ensuring
that integer types are passed/promoted correctly.

llvm-svn: 64529
2009-02-14 02:09:24 +00:00
Douglas Gregor 538c3d8459 Make it possible for builtins to expression FILE* arguments, so that
we can define builtins such as fprintf, vfprintf, and
__builtin___fprintf_chk. Give a nice error message when we need to
implicitly declare a function like fprintf.

llvm-svn: 64526
2009-02-14 01:52:53 +00:00
Chris Lattner cd7bc144f6 fix rdar://6586493, a bug in codegen of the GNU
missing-?:-true-value extension.

llvm-svn: 64505
2009-02-13 23:35:32 +00:00
Douglas Gregor b9063fc1b3 Implicitly declare certain C library functions (malloc, strcpy, memmove,
etc.) when we perform name lookup on them. This ensures that we
produce the correct signature for these functions, which has two
practical impacts:

  1) When we're supporting the "implicit function declaration" feature
  of C99, these functions will be implicitly declared with the right
  signature rather than as a function returning "int" with no
  prototype. See PR3541 for the reason why this is important (hint:
  GCC always predeclares these functions).
 
  2) If users attempt to redeclare one of these library functions with
  an incompatible signature, we produce a hard error.

This patch does a little bit of work to give reasonable error
messages. For example, when we hit case #1 we complain that we're
implicitly declaring this function with a specific signature, and then
we give a note that asks the user to include the appropriate header
(e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
case #2, we show the type of the implicit builtin that was incorrectly
declared, so the user can see the problem. We could do better here:
for example, when displaying this latter error message we say
something like:

  'strcpy' was implicitly declared here with type 'char *(char *, char
  const *)'

but we should really print out a fake code line showing the
declaration, like this:

  'strcpy' was implicitly declared here as:

    char *strcpy(char *, char const *)

This would also be good for printing built-in candidates with C++
operator overloading.

The set of C library functions supported by this patch includes all
functions from the C99 specification's <stdlib.h> and <string.h> that
(a) are predefined by GCC and (b) have signatures that could cause
codegen issues if they are treated as functions with no prototype
returning and int. Future work could extend this set of functions to
other C library functions that we know about.

llvm-svn: 64504
2009-02-13 23:20:09 +00:00
Daniel Dunbar f9f039865f Set constant bit on static block vars as well. Patch by Anders Johnson!q
llvm-svn: 64502
2009-02-13 22:58:39 +00:00
Daniel Dunbar 5db3ef6fbb Simplify predicate.
llvm-svn: 64500
2009-02-13 22:49:13 +00:00
Daniel Dunbar 128a138a57 IRgen support for attribute used.
- PR3566

llvm-svn: 64492
2009-02-13 22:08:43 +00:00
Daniel Dunbar 6b8720e723 Pull MayDeferGeneration out of EmitGlobal.
- Fix emission of static functions with constructor attribute while I
   was here.
<rdar://problem/6140899> [codegen] "static" and attribute-constructor interact poorly

llvm-svn: 64488
2009-02-13 21:18:01 +00:00
Daniel Dunbar 08b26a0587 Rename EmitStatics (etc) to EmitDeferred; provide basic infrastructure
for attribute used support.  
- No functionality change.

llvm-svn: 64487
2009-02-13 20:29:50 +00:00
Mike Stump 499ae7ec91 Let the backend unique these.
llvm-svn: 64486
2009-02-13 20:17:16 +00:00
Mike Stump 52d9c49d88 Fix spelling.
llvm-svn: 64482
2009-02-13 19:38:12 +00:00
Mike Stump 2c867aec40 Move DescriptorUniqueCount into CGM.
llvm-svn: 64481
2009-02-13 19:36:03 +00:00
Mike Stump 7ab278db06 Move NSConcreteStackBlock into CGM.
llvm-svn: 64479
2009-02-13 19:29:27 +00:00
Douglas Gregor 10a451cb36 Eliminate an unused variable
llvm-svn: 64476
2009-02-13 19:13:32 +00:00
Mike Stump 1676c5b2d8 Reflow to 80col.
llvm-svn: 64475
2009-02-13 19:12:34 +00:00
Mike Stump 9319db8a11 Move GlobalUniqueCount up into CGM.
llvm-svn: 64473
2009-02-13 18:36:05 +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
Daniel Dunbar abe6ef932f x86_64 ABI: Support va_arg passed in mixed registers.
- Now at 1274 passes on gcc compat suite vs 1262.

llvm-svn: 64469
2009-02-13 17:46:31 +00:00
Mike Stump 971f9b6619 Condense NSConcreteGlobalBlock handling.
llvm-svn: 64461
2009-02-13 17:23:42 +00:00
Mike Stump 52197c7763 Calculate size correctly.
llvm-svn: 64459
2009-02-13 17:03:17 +00:00
Mike Stump c2c38331ca Size should be unsigned.
llvm-svn: 64458
2009-02-13 16:55:51 +00:00
Mike Stump 85284bacab Condense all the blocks code into CGBlocks.cpp.
llvm-svn: 64457
2009-02-13 16:19:19 +00:00
Mike Stump 92bbd6d435 Fixup types, the runtime uses int, not int32.
llvm-svn: 64456
2009-02-13 16:01:35 +00:00
Mike Stump 57d7354635 Fix cmake builds.
llvm-svn: 64455
2009-02-13 15:42:50 +00:00
Mike Stump b7074c0013 Fixup spacing a tad.
llvm-svn: 64454
2009-02-13 15:32:32 +00:00
Mike Stump 005c9a62b5 Move GenericBlockLiteralType into CGM.
llvm-svn: 64452
2009-02-13 15:25:34 +00:00
Mike Stump 650c932d80 Move BlockDescriptorType into CGM.
llvm-svn: 64451
2009-02-13 15:16:56 +00:00
Anders Carlsson 63784f4e5e Add CodeGen support for the nodebug attribute.
llvm-svn: 64445
2009-02-13 08:11:52 +00:00
Eli Friedman 1efaaeaa69 Initial implementation of arbitrary fixed-width integer types.
Currently only used for 128-bit integers.

Note that we can't use the fixed-width integer types for other integer 
modes without other changes because glibc headers redefines (u)int*_t 
and friends using the mode attribute.  For example, this means that uint64_t
has to be compatible with unsigned __attribute((mode(DI))), and 
uint64_t is currently defined to long long.  And I have a feeling we'll 
run into issues if we try to define uint64_t as something which isn't 
either long or long long.

This doesn't get the alignment right in most cases, including 
the 128-bit integer case; I'll file a PR shortly.  The gist of the issue 
is that the targets don't really expose the information necessary to 
figure out the alignment outside of the target description, so there's a 
non-trivial amount of work involved in getting it working right.  That 
said, the alignment used is conservative, so the only issue with the 
current implementation is ABI compatibility.

This makes it trivial to add some sort of "bitwidth" attribute to make 
arbitrary-width integers; I'll do that in a followup.

We could also use this for stuff like the following for compatibility 
with gcc, but I have a feeling it would be a better idea for clang to be 
consistent between C and C++ modes rather than follow gcc's example for 
C mode.
struct {unsigned long long x : 33;} x;
unsigned long long a(void) {return x.x+1;}

llvm-svn: 64434
2009-02-13 02:31:07 +00:00
Douglas Gregor adb0201418 Add mangling for variadic functions and conversion functions
llvm-svn: 64425
2009-02-13 01:28:03 +00:00
Douglas Gregor 5fec5b0495 Add basic support for C++ name mangling according to the Itanium C++
ABI to the CodeGen library. Since C++ code-generation is so
incomplete, we can't exercise much of this mangling code. However, a
few smoke tests show that it's doing the same thing as GCC. When C++
codegen matures, we'll extend the ABI tester to verify name-mangling
as well, and complete the implementation here.

At this point, the major client of name mangling is in the uses of the
new "overloadable" attribute in C, which allows overloading. Any
"overloadable" function in C (or in an extern "C" block in C++) will
be mangled the same way that the corresponding C++ function would be
mangled.

llvm-svn: 64413
2009-02-13 00:10:09 +00:00
Daniel Dunbar 53bf741208 Honor attribute section on static block var decls.
llvm-svn: 64411
2009-02-12 23:32:54 +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
Mike Stump ab3afd8f2d Initial codegen for block literals. This is a work in progress. I've
tried to put FIXMEs on the most important things to fix up.  Lots left
to do including more codegen, more documentation and cleaning code and
style cleanups.

llvm-svn: 64390
2009-02-12 18:29:15 +00:00
Anders Carlsson 6a60fa2428 Add a very basic implemenation of global blocks. This needs to be cleaned up.
llvm-svn: 64387
2009-02-12 17:55:02 +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
Daniel Dunbar 648bf78333 Support __attribute__(section(<name>))
llvm-svn: 64380
2009-02-12 17:28:23 +00:00
Daniel Dunbar 753cc07d13 x86_64: Initial varargs support.
- Doesn't yet handle case where values are passed in mixed (general
   purpose & floating point) registers; otherwise largely
   functional. Code still needs some cleaning.

Fixes:
MultiSource/Applications/lua/lua
MultiSource/Applications/siod/siod
MultiSource/Applications/sqlite3/sqlite3
SingleSource/Regression/C/PR640
SingleSource/UnitTests/2003-07-09-SignedArgs
SingleSource/UnitTests/2007-03-02-VaCopy

gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes		1262
# of unexpected failures	56
# of unresolved testcases	34
# of unsupported tests		2

Compare to: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090209/012050.html

llvm-svn: 64370
2009-02-12 09:04:14 +00:00
Anders Carlsson 2437cbfa3b Add support for generating block call expressions.
llvm-svn: 64346
2009-02-12 00:39:25 +00:00
Daniel Dunbar e9fcadd2a6 Use EmitVAListRef instead of EmitLValue directly to handle array decay
case on x86_64.

llvm-svn: 64333
2009-02-11 22:25:55 +00:00
Daniel Dunbar 8d9dc4a6d5 Support IRgen of va_arg of structure as l-value.
llvm-svn: 64325
2009-02-11 20:59:32 +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
Douglas Gregor 6ec47f0d59 Silence a warning about an unused variable in -Asserts builds
llvm-svn: 64306
2009-02-11 16:17:49 +00:00
Chris Lattner 746b21361f Fix rdar://6518463, increment of a bool is always true, due to
subtle and non-obvious promotion rules.  We already handle += 
and +1 correctly.

llvm-svn: 64296
2009-02-11 07:40:06 +00:00
Chris Lattner 60dcdc7062 finish off codegen support for sub of pointer to functions,
finishing off rdar://6520707

llvm-svn: 64295
2009-02-11 07:21:43 +00:00
Anders Carlsson 7ccf3e4e28 Handle the case where EmitBlock might be called multiple times for the same block. Fixes PR3536.
llvm-svn: 64252
2009-02-10 22:50:24 +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
Daniel Dunbar e46506eaea Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes.
- Missed this file.

llvm-svn: 64238
2009-02-10 21:44:36 +00:00
Daniel Dunbar 2d0746fb97 Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes.
llvm-svn: 64235
2009-02-10 20:44:09 +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
Daniel Dunbar 9403cd6d85 Tweak x86-64 ABI to allow reuse for vararg handling.
llvm-svn: 64221
2009-02-10 17:06:09 +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 33747b6c41 Start removing the old Obj-C EH stack now that the cleanup stack is used instead.
llvm-svn: 64203
2009-02-10 05:52:02 +00:00
Sanjiv Gupta e99ad00fd2 Function parameters for PIC16 are like local variables. So use the keyword ".auto." to mangle their names. The working of PIC16AsmPrinter relies on that keyword currently.
llvm-svn: 64198
2009-02-10 04:17:25 +00:00
Daniel Dunbar 0007961241 Support va_arg on _Complex.
gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes		1110
# of unexpected failures	74
# of unresolved testcases	168
# of unsupported tests		2

llvm-svn: 64197
2009-02-10 03:03:30 +00:00
Daniel Dunbar 9bfb4de38b ABI: Correctly handle load/store of values which have a different LLVM
memory representation (e.g., bool).
 - This upgrades (downgrades) MultiSource/Applications/ClamAV/clamscan
   to a miscompile and fixes
   SingleSource/UnitTests/2003-05-31-CastToBool.

llvm-svn: 64194
2009-02-10 01:51:39 +00:00
Daniel Dunbar 1d425460d5 Add util Emit{LoadOf,StoreTo}Scalar methods to encapsulate conversion
from LLVM memory type to/from LLVM temporary type.
 - No intended functionality change.

llvm-svn: 64191
2009-02-10 00:57:50 +00:00
Daniel Dunbar d5f1f55e28 Make sure to initialize local variables, even if they were ignored by
ABI.

llvm-svn: 64187
2009-02-10 00:06:49 +00:00
Anders Carlsson 15949b3a32 Use the new cleanup infrastructure for VLAs. The next iteration of patches will remove the old Obj-C EH cleanup code.
llvm-svn: 64161
2009-02-09 20:41:50 +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 1ac6282c5b Replace a bunch of EmitBranch calls with EmitBranchThroughCleanup. No functionality change (yet).
llvm-svn: 64159
2009-02-09 20:31:03 +00:00
Anders Carlsson ff0bb6ce62 Save and restore the DidCallStackSave variable
llvm-svn: 64157
2009-02-09 20:23:40 +00:00
Anders Carlsson f4478e94b8 Add DidCallStackSave variable to CodeGenFunction.
llvm-svn: 64156
2009-02-09 20:20:56 +00:00
Douglas Gregor 8bf4205c70 Start processing template-ids as types when the template-name refers
to a class template. For example, the template-id 'vector<int>' now
has a nice, sugary type in the type system. What we can do now:

  - Parse template-ids like 'vector<int>' (where 'vector' names a
    class template) and form proper types for them in the type system.
  - Parse icky template-ids like 'A<5>' and 'A<(5 > 0)>' properly,
    using (sadly) a bool in the parser to tell it whether '>' should
    be treated as an operator or not.

This is a baby-step, with major problems and limitations:
  - There are currently two ways that we handle template arguments
  (whether they are types or expressions). These will be merged, and,
  most likely, TemplateArg will disappear.
  - We don't have any notion of the declaration of class template
  specializations or of template instantiations, so all template-ids
  are fancy names for 'int' :)

llvm-svn: 64153
2009-02-09 18:46:07 +00:00
Mike Stump fc49682f20 Add some more documentation. Also reflowed comments to 80 col.
llvm-svn: 64105
2009-02-08 23:14:22 +00:00
Anders Carlsson 9c964ac272 Reuse case destinations.
llvm-svn: 64100
2009-02-08 22:46:50 +00:00
Anders Carlsson f57b9eef62 Always check if we can remove branch fixups, even if the cleanup stack is empty.
llvm-svn: 64099
2009-02-08 22:45:15 +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 76180ea456 Misc fixes to the cleanup stack code.
llvm-svn: 64096
2009-02-08 22:13:37 +00:00
Mike Stump a6dbd7b25a When we're at the stack depth we want, there isn't anything to do.
llvm-svn: 64095
2009-02-08 22:00:53 +00:00
Mike Stump 284d177c7f Wire up break and continue processing to the new stack depth adjuster.
If people could beat on it and let me know if there are any new
semantics required by newer language standards or DRs or any little
details I goofed on, I'd be happy to fix any issues found.

llvm-svn: 64079
2009-02-08 09:22:19 +00:00
Anders Carlsson 66c384ac2e More cleanup stack work, PopCleanupBlock now returns a struct with the switch block and end block.
llvm-svn: 64072
2009-02-08 07:46:24 +00:00
Anders Carlsson ae91d9b140 Split some functions up
llvm-svn: 64069
2009-02-08 03:55:35 +00:00
Anders Carlsson a586ad7f85 CleanupScope needs to push the cleanup block in its destructor
llvm-svn: 64068
2009-02-08 03:22:36 +00:00
Anders Carlsson 3c21dd5a80 Implement support for branch fixups.
llvm-svn: 64064
2009-02-08 01:23:05 +00:00
Anders Carlsson 7d70fd27a4 More cleanup stack work.
llvm-svn: 64059
2009-02-08 00:50:42 +00:00
Anders Carlsson fbfb5e6530 When emitting blocks, keep track of which cleanup scope they have. Minor fixes and cleanup.
llvm-svn: 64053
2009-02-08 00:16:35 +00:00
Anders Carlsson cadb9a6a34 Emit a cleanup block for the cleanup attribute
llvm-svn: 64052
2009-02-07 23:51:38 +00:00
Anders Carlsson be0f76a712 Add support for emitting cleanup blocks. Make EmitCompoundStatement emit cleanup blocks if necessary
llvm-svn: 64051
2009-02-07 23:50:39 +00:00
Anders Carlsson 2cf8c44e43 Add a simple RAII object, to be used for pushing a cleanup entry and make the insertion point be the cleanup block.
llvm-svn: 64048
2009-02-07 23:30:41 +00:00
Mike Stump 0509d9635b Ensure we track all the stack depths for all break and continue points
correctly.  This should lay the ground work to throw the big switch
and start code gening break and continue in the presense of vlas.

llvm-svn: 64046
2009-02-07 23:02:10 +00:00
Anders Carlsson 15cb75a20c Add plumbing for the cleanup stack.
llvm-svn: 64043
2009-02-07 22:53:43 +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
Mike Stump 56d2a15829 Format for 80-cols.
llvm-svn: 64030
2009-02-07 20:14:12 +00:00
Mike Stump 6d8a617474 Ensure that we don't miscodegen if vlas creap into the top of the for.
This will allow us to generate break and continue even if vlas are
involved without worry that we'll silently generate bad code.

llvm-svn: 64028
2009-02-07 20:09:00 +00:00
Mike Stump dc0d6be7b9 Arrange to have the correct StackDepth for while statements.
llvm-svn: 64021
2009-02-07 18:08:12 +00:00
Mike Stump 1f8be1b9ac Fit into 80-col.
llvm-svn: 64020
2009-02-07 17:18:33 +00:00
Mike Stump 1d91dd98ad Fixup goto codegen in and around VLAs.
llvm-svn: 64014
2009-02-07 12:52:26 +00:00
Daniel Dunbar ee9e4c274b Set load/store alignment when doing ABI coercions.
- Currently, this is producing poor code, but we prefer correctness
   to performance for now. Eventually we should be able to generally
   avoid having to set the alignment when we control the alignment of
   the alloca.

 - This knocks out 33/1000 failures on my single argument ABI tests,
   down to 22/1000 and 18 of these appear to be gcc bugs. Woot.

llvm-svn: 64001
2009-02-07 02:46:03 +00:00
Daniel Dunbar d404862cf9 When making dummy file entries, the directory name should also be
non-empty.

llvm-svn: 63986
2009-02-07 00:40:41 +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
Daniel Dunbar fe2fb0af5a Use 'compile' instead of 'codegen' when reporting error to user.
llvm-svn: 63952
2009-02-06 19:18:03 +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
Anders Carlsson 31f8649f83 Follow Eli's advice and store the VLA size with the native size_t type. Fixes PR3491.
llvm-svn: 63879
2009-02-05 19:43:10 +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
Daniel Dunbar 5d3dbd64e1 Implement Direct ABIInfo semantics.
- No intended functionality change, this is essentially enabling
   direct passing of complex and aggregate values, which no ABI is
   using.

llvm-svn: 63863
2009-02-05 11:13:54 +00:00
Daniel Dunbar cea3af4e54 Simplify test for whether we need an alloca to hold an indirect return
value.
 - No functionality change.

llvm-svn: 63859
2009-02-05 09:24:53 +00:00
Daniel Dunbar 747865af0c Implement ABI Indirect sematics for arguments.
- No intended functionality change, all current ABI implementations
   were only using indirect for complex/aggregate types, which were
   being passed indirectly with the Direct ABIInfo kind.

llvm-svn: 63858
2009-02-05 09:16:39 +00:00
Daniel Dunbar b8b1c679c4 Merge ABIInfo StructRet/ByVal into Indirect.
- No (intended) functionality change, the semantic changes are to come.

llvm-svn: 63850
2009-02-05 08:00:50 +00:00
Daniel Dunbar c79407fc40 Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.
llvm-svn: 63845
2009-02-05 07:09:07 +00:00
Dale Johannesen 621c3512a3 Reapply Daniel's patch to match up with llvm 63765.
Untested, Daniel or Nate please review.

llvm-svn: 63814
2009-02-05 01:50:47 +00:00
Daniel Dunbar 70245be397 x86-32: Use Ignore to avoid passing empty structs (instead of Expand).
llvm-svn: 63813
2009-02-05 01:50:07 +00:00
Daniel Dunbar 0103574d55 Honor ByVal alignment. Patch by Nate Begeman!
llvm-svn: 63811
2009-02-05 01:31:19 +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
Daniel Dunbar 8045343ca2 Initialize alignment field for ByVal ABIInfo correctly.
llvm-svn: 63809
2009-02-05 01:01:30 +00:00
Daniel Dunbar fff09f335d Unbreak CGFunctionInfo::Profile method and reenable caching of ABI
information.

llvm-svn: 63799
2009-02-05 00:00:23 +00:00
Daniel Dunbar 400c040e01 Chase LLVM TOT in circles (i.e., revert r63773 to match revert of
r63765).

llvm-svn: 63795
2009-02-04 23:40:00 +00:00
Daniel Dunbar 56e7552c73 Add ABIArgInfo::dump()
llvm-svn: 63794
2009-02-04 23:24:38 +00:00
Daniel Dunbar 46353ece18 Use correct signature for calling enumeration mutation function.
llvm-svn: 63782
2009-02-04 22:00:33 +00:00
Daniel Dunbar fb5fdf1f14 Temporarily disable caching of ABI results; this is going horribly
wrong in some cases.

llvm-svn: 63780
2009-02-04 21:36:22 +00:00
Daniel Dunbar 1e8052b36d Add -femit-all-decls codegen option.
- Emits all declarations, even unused (static) ones.
 - Useful when doing minimization of codegen problems (otherwise
   problems localized to a static function aren't minimized well).

llvm-svn: 63776
2009-02-04 21:19:06 +00:00
Daniel Dunbar a45bdbbb6a Add asserts that the function signature matches the other arguments provide
to CGCall functions.

llvm-svn: 63775
2009-02-04 21:17:21 +00:00
Daniel Dunbar 91b73d441e (llvm up) Update for intrinsic lookup changes.
llvm-svn: 63773
2009-02-04 21:09:15 +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
Fariborz Jahanian b73a23e47e Patch fixes messaging for GNU runtime.
Patch by David Chisnall

llvm-svn: 63769
2009-02-04 20:31:19 +00:00
Daniel Dunbar 6e3b7df125 Handle demotion of coerced arguments (as in void a(x) short x; { ... }).
llvm-svn: 63726
2009-02-04 07:22:24 +00:00
Chris Lattner 88ea93e6b4 lower the interface to getLineNumber like we did for
getColumnNumber.  This fixes a FIXME in 
SourceManager::getPresumedLoc because we now just decompose
the sloc once.

llvm-svn: 63701
2009-02-04 01:06:56 +00:00
Daniel Dunbar 310c5b1ab1 Update passing of _Bool values to match what function was declared to take.
llvm-svn: 63697
2009-02-04 00:55:44 +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
Daniel Dunbar 84388bf397 Use CGCall infrastructure to call enumeration mutation function.
llvm-svn: 63685
2009-02-03 23:55:40 +00:00
Fariborz Jahanian 82c72e1ee4 Several new declarations for objc2 nonfragile
abi messaging.

llvm-svn: 63684
2009-02-03 23:49:23 +00:00
Daniel Dunbar 1ef7373ee8 Fix return type for calls to objc_setProperty.
llvm-svn: 63683
2009-02-03 23:43:59 +00:00
Daniel Dunbar a33461150d Use ConvertTypeForMem when creating alloca for scalar argument.
llvm-svn: 63681
2009-02-03 23:04:57 +00:00
Daniel Dunbar ee3da87ce7 Add CodeGenFunction::ConvertTypeForMem forwarding function.
llvm-svn: 63678
2009-02-03 23:03:55 +00:00
Fariborz Jahanian e80f317886 GNUStep fast enumeration.
Patch by David Chisnall.

llvm-svn: 63666
2009-02-03 21:52:35 +00:00
Daniel Dunbar fc7c76159c x86_64 ABI: Initial implementation of ABI compliant parameter passing.
- Now only 27/500 failures on ABITest single argument tests; from
   350/500. :)
 - As with return types, a large percentage of these are likely to be
   gcc bugs, not yet reviewed.

Also, fix bug in handling of Ignore ABI type in argument lists.

llvm-svn: 63654
2009-02-03 20:00:13 +00:00
Daniel Dunbar 2f219b0770 ABI handling: Implement coercion for argument types (in addition to
return types).

llvm-svn: 63645
2009-02-03 19:12:28 +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
Sanjiv Gupta c1b58d40e6 Targets that don't have stack use global address space for parameters.
Specify external linkage for such globals so that llvm optimizer do
not assume there values initialized as zero.

llvm-svn: 63636
2009-02-03 18:07:49 +00:00
Fariborz Jahanian ebc4c9d2a3 Minor objc2 bug fix.
llvm-svn: 63635
2009-02-03 17:34:34 +00:00
Sanjiv Gupta 3cac613eb8 Fixed the typo in comment.
llvm-svn: 63634
2009-02-03 17:23:12 +00:00
Daniel Dunbar 32931eb21d Change ABIInfo to compute information for a full signature at a time
(the main point of this restructing).

llvm-svn: 63619
2009-02-03 06:51:18 +00:00
Daniel Dunbar 0136282a9c Remove ABIArgInfo::Default kind, ABI is now responsible for specifying
acceptable kind with more precise semantics.

llvm-svn: 63617
2009-02-03 06:30:17 +00:00
Daniel Dunbar 67dace890f Add ABIArgInfo::Direct kind, which passes arguments using whatever the
native IRgen type is. This is like Default, but without any extra
semantics (like automatic tweaking of structures or void).

llvm-svn: 63615
2009-02-03 06:17:37 +00:00
Daniel Dunbar 5a0acdc982 Add two FIXMEs.
llvm-svn: 63613
2009-02-03 06:02:10 +00:00
Daniel Dunbar b52d077d8b Always use CGFunctionInfo to access ABI information.
llvm-svn: 63612
2009-02-03 05:59:18 +00:00
Daniel Dunbar 313321ea23 Move ABIArgInfo into CGFunctionInfo, computed on creation.
- Still have to convert some consumers over.

llvm-svn: 63610
2009-02-03 05:31:23 +00:00
Daniel Dunbar 6d6b0d309a Move ABIInfo/ABIArgInfo classes into ABIInfo.h
llvm-svn: 63586
2009-02-03 01:05:53 +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 e0be82956b Memoize CGFunctionInfo construction.
llvm-svn: 63576
2009-02-03 00:07:12 +00:00
Daniel Dunbar 3668cb2d3c Change CGFunctionInfo args iterator to not include the return type.
llvm-svn: 63571
2009-02-02 23:43:58 +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