Commit Graph

1245 Commits

Author SHA1 Message Date
Mike Stump 6764593098 Fixup codegen for nested blocks that use copy/dispose in the inner
blocks, so that the outer blocks use it as well.  Radar 6762279

llvm-svn: 68811
2009-04-10 18:52:28 +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
Anders Carlsson 6ef4ea499f Rename variables to avoid conflict.
llvm-svn: 68764
2009-04-10 04:59:59 +00:00
Chris Lattner 6bc4aaa2eb Make messages consistent.
llvm-svn: 68756
2009-04-10 00:37:08 +00:00
Chris Lattner 5286e774ee reject codegen of __thread variables as unimplemented, rdar://6775265
llvm-svn: 68755
2009-04-10 00:35:59 +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
Anders Carlsson 479e6fc7a7 Use the new EmitCallArgs function. No indented functionality change.
llvm-svn: 68652
2009-04-08 23:13:16 +00:00
Anders Carlsson 60ce3fe140 Add code for emitting call arguments (not used yet).
llvm-svn: 68639
2009-04-08 20:47:54 +00:00
Anders Carlsson 03a409feda We weren't generating correct code for calls to variadic member functions.
llvm-svn: 68635
2009-04-08 20:31:57 +00:00
Devang Patel 2ac33a08d5 Use presumed location to get line number info.
llvm-svn: 68630
2009-04-08 19:47:04 +00:00
Daniel Dunbar d92123fd2a Make sure value is initialized when built w/o asserts.
llvm-svn: 68615
2009-04-08 16:23:09 +00:00
Daniel Dunbar 3b358a3d83 Make debug info work when using -save-temps.
- This is pretty ugly, but the most obvious solution. Chime in if you
   have a nicer one.

 - The problem is that with -save-temps, clang-cc has no idea what the
   name of the original input file is. However, the user expects to be
   able to set breakpoints based on the input file name.

 - We support this by providing a new option -main-file-name (similar
   to -dumpbase used by gcc) which allows the driver to pass in the
   original file name.

 - <rdar://problem/6753383> building with clang using --save-temps
   gets the compile unit name from the .i file...

llvm-svn: 68595
2009-04-08 05:11:16 +00:00
Anders Carlsson 80f97ab08f Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
llvm-svn: 68593
2009-04-08 04:48:15 +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
Sanjiv Gupta 562d68e8db Pointer width on targets like PIC16 is 16-bit, while the valid index size to GEP is only 32 or 64. So promote index to 32 in such cases.
llvm-svn: 68590
2009-04-08 04:16:39 +00:00
Anders Carlsson a60cbcdfe6 Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
llvm-svn: 68583
2009-04-08 02:55:55 +00:00
Daniel Dunbar ea10ab668f Visibility attributes should only be set on definition.
llvm-svn: 68561
2009-04-07 22:36:33 +00:00
Anders Carlsson 5f50c651e9 Shuffle some call code around. No functionality change.
llvm-svn: 68557
2009-04-07 22:10:22 +00:00
Fariborz Jahanian 57eb2e021e Propagte -fvisibility to objc2's class symbols.
llvm-svn: 68543
2009-04-07 20:26:30 +00:00
Anders Carlsson d8db853243 Remove some dead code.
llvm-svn: 68532
2009-04-07 18:53:02 +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
Daniel Dunbar 4fab57ddea Implement __sync_{add,sub,and,or,xor}_and_fetch and
__sync_bool_compare_and_swap.
 - <rdar://problem/6762223> [sema/irgen] support
   __sync_bool_compare_and_swap and __sync_add_and_fetch

llvm-svn: 68482
2009-04-07 00:55:51 +00:00
Anders Carlsson 350da60733 Use the new getFunctionInfo that takes a BlockPointerType parameter, and get rid of getBlockFunctionType from CGBlocks.cpp
llvm-svn: 68478
2009-04-07 00:20:24 +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
Anders Carlsson 6f811f149b Add a getFunctionInfo that takes a BlockPointerType.
llvm-svn: 68452
2009-04-06 18:05:26 +00:00
Anders Carlsson 2266e244b5 Simplify C++ member function calls.
llvm-svn: 68451
2009-04-06 17:45:20 +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
Anders Carlsson 468fa6366b Add some basic support for generating C++ member functions.
llvm-svn: 68425
2009-04-04 20:47:02 +00:00
Anton Korobeynikov c847824e8e Basic support for regparm codegen
llvm-svn: 68414
2009-04-04 00:49:24 +00:00
Anders Carlsson e5fd6f2227 Add support for calling C++ member functions.
llvm-svn: 68412
2009-04-03 22:50:24 +00:00
Anders Carlsson b15b55c2d0 Add a getFunctionInfo that takes a CXXMethodDecl.
llvm-svn: 68411
2009-04-03 22:48:58 +00:00
Steve Naroff 55a719835d Add a comment/FIXME so Eli can sleep better:-))
llvm-svn: 68379
2009-04-03 09:44:50 +00:00
Fariborz Jahanian befc9dfbff Implement -fvisibility.
llvm-svn: 68369
2009-04-03 03:28:57 +00:00
Daniel Dunbar fd6cfcffa2 Add target hook for setting symbol prefix and section of unicode
string literals.

llvm-svn: 68363
2009-04-03 00:57:44 +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
Mike Stump d3e3885f2d Remove -ftrapu.
llvm-svn: 68330
2009-04-02 18:15:54 +00:00
Sanjiv Gupta 639f2d92f8 Don't use static globals for params as it confuses the optimzer that their values are never being used in the function.
llvm-svn: 68328
2009-04-02 17:51:27 +00:00
Anders Carlsson 4eca109941 Implement mangling of declarations inside functions.
llvm-svn: 68321
2009-04-02 16:24:45 +00:00
Anders Carlsson f2125a02db Mangle VarDecls correctly.
llvm-svn: 68320
2009-04-02 16:05:20 +00:00
Anders Carlsson 810679c37a Move the function decl mangling code out into its own function. No functionality change.
llvm-svn: 68319
2009-04-02 15:51:53 +00:00
Anders Carlsson cbaeb9e633 Emit code for linkage specifications.
llvm-svn: 68300
2009-04-02 05:55:18 +00:00
Anders Carlsson f7e01ffa4a When compiling C++ code, always mangle the names of static block var decls.
llvm-svn: 68280
2009-04-02 03:29:47 +00:00
Mike Stump 40968598c7 Fixup -ftrapv to be more gcc compatible. -ftrapu (for want of a
better name) is the option that SmallTalk can use to intercept all
overflows, including unsigned.  I added some testcases so we don't
break anything.

Also included is another patch from David for += and friends.

llvm-svn: 68267
2009-04-02 01:03:55 +00:00
Steve Naroff 8d816d6cb5 CodeGenModule::GetAddrOfConstantCFString():
- Finish up support for converting UTF8->UTF16 to support ObjC @"string" constants.

Remove warning from CheckObjCString.

As the FIXME in the test case indicates, I still have a bug to work out (apparently with \u handling).

llvm-svn: 68245
2009-04-01 21:16:31 +00:00
Mike Stump 0c61b7322a Add -ftrapv support, patch from David Chisnall; well all except the
clang option code that is and two bug fixes.

llvm-svn: 68240
2009-04-01 20:28:16 +00:00
Fariborz Jahanian c2d5618083 Fixes a problem where the compiler is reporting the wrong size to the Gnu
runtime on 64-bit architectures.
Patch by David Chisnall

llvm-svn: 68238
2009-04-01 19:49:42 +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
Douglas Gregor b4b81d8ab1 Revert r68221, -ftrapv support, which causes several regressions in
Clang's test suite.

llvm-svn: 68230
2009-04-01 18:59:55 +00:00
Mike Stump fbc8c132ba Add -ftrapv support, patch from David Chisnall; well all except the
clang option code that is.

llvm-svn: 68221
2009-04-01 18:19:33 +00:00
Steve Naroff 29cae66bde Add ConvertUTF module from http://www.unicode.org/Public/PROGRAMS/CVTUTF.
#ifdef'd out the 5 conversion routines that we don't currently need.

Still need a bit more work in GetAddrOfConstantCFString(). Added a FIXME to indicate this.

Expect to remove the FIXME today...

llvm-svn: 68208
2009-04-01 15:50: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
Daniel Dunbar e80bd1897c x86-32 Darwin ABI: Handle small structures correctly.
- Small structures are returned in a register if: 
    1. They fit nicely in a  register.
    2. All fields fit nicely in a register.
   (more or less)

 - We now pass the first 5000 ABITests if unions are disabled.

 - <rdar://problem/6497882> [irgen] x86-32 ABI compatibility with
   small structs

llvm-svn: 68197
2009-04-01 07:45:00 +00:00
Daniel Dunbar 58e2971bb0 x86-32 Darwin ABI: Single element arrays can be part of "single
element structures", which have different ABI rules.
 - Current return-arguments-32 status is: 1 out of 1000 failures (-7)

 - Also, vectors inside "single element structs" require special
   handling.

llvm-svn: 68196
2009-04-01 07:08:38 +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
Daniel Dunbar cd76e673eb x86-32 Darwin ABI: Handle direct return of vectors.
- Current return-arguments-32 status is: 8 out of 1000 failures (-7)

llvm-svn: 68192
2009-04-01 06:13:08 +00:00
Daniel Dunbar f77e292a0f Fix a subtle bug where the cleanup scope entries had a dangling block reference
- <rdar://problem/6732143> Crash when generating @synchronize for
   zero-cost exception

 - Thanks to Anders for helping track down the problem.

llvm-svn: 68186
2009-04-01 04:37:47 +00:00
Chris Lattner d18136a644 fix the two xfails I added with a previous patch by making ObjC interface
types get completed when their definition is seen if previously laid out by
the code generator.

llvm-svn: 68177
2009-04-01 02:36:43 +00:00
Chris Lattner 6483908957 move trivial forwarding function inline.
llvm-svn: 68176
2009-04-01 02:08:13 +00:00
Chris Lattner 87bc387f8f tidy some code.
llvm-svn: 68174
2009-04-01 02:00:48 +00:00
Mike Stump cafa0a9746 Fix block comparisons. Radar 6732116.
llvm-svn: 68171
2009-04-01 01:17:39 +00:00
Anders Carlsson 237f349073 Implement code generation of namespaces and add mangling tests.
llvm-svn: 68170
2009-04-01 00:58:25 +00:00
Anders Carlsson 12edad2c50 Fix a bug (that I thought I had fixed already) where mangling a prefix could get us into an infinite loop
llvm-svn: 68168
2009-04-01 00:42:16 +00:00
Anders Carlsson 7a6f8b9281 Fix a mangling bug where functions with no arguments weren't getting the 'v' parameter specifier.
llvm-svn: 68162
2009-04-01 00:15:23 +00:00
Daniel Dunbar 08b216abf1 Add Target hooks for IRgen of [cf]string literals.
- Notably, set section on cfstring literal string data (for now, this
   is done everywhere because it matches what we were already doing
   for the CFString data itself)

 - <rdar://problem/6599098> [irgen] linker requires objc string data
   to go into cstring

llvm-svn: 68160
2009-03-31 23:42:16 +00:00
Chris Lattner f41e87f4cd Change UsedArray to be a vector of WeakVH to fix a dangling pointer problem that occurs when
attribute(used) and asm renaming are used together.

llvm-svn: 68155
2009-03-31 22:37:52 +00:00
Chris Lattner 2739d2bbe6 remove some obsolete comments, use an AssertingVH.
llvm-svn: 68151
2009-03-31 22:17:44 +00:00
Daniel Dunbar 35579146aa x86_32 Darwin ABI: Treat empty unions like empty structures.
- Current return-arguments-32 status: 15/1000 failures

llvm-svn: 68132
2009-03-31 19:01:39 +00:00
Fariborz Jahanian 89d239796a Patch to fix proptocol reference ir-gen for GNU runtime.
Patch by David Chisnal.

llvm-svn: 68125
2009-03-31 18:27:22 +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 05aa49128c remove a dead prototype
llvm-svn: 68105
2009-03-31 09:07:15 +00:00
Chris Lattner 733dc19be6 remove the warning. We don't control what users do, and this code
is run for perfectly reasonable things like NSString* because type
layout is recursive.

llvm-svn: 68104
2009-03-31 09:04:50 +00:00
Chris Lattner 3e2f36e905 do not *copy* objc interface types, just use their reference.
llvm-svn: 68102
2009-03-31 08:55:07 +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
Douglas Gregor dc572a3266 Improve the representation of template names in the AST. This
representation handles the various ways in which one can name a
template, including unqualified references ("vector"), qualified
references ("std::vector"), and dependent template names
("MetaFun::template apply").

One immediate effect of this change is that the representation of
nested-name-specifiers in type names for class template
specializations (e.g., std::vector<int>) is more accurate. Rather than
representing std::vector<int> as

  std::(vector<int>)

we represent it as

  (std::vector)<int>

which more closely follows the C++ grammar. 

Additionally, templates are no longer represented as declarations
(DeclPtrTy) in Parse-Sema interactions. Instead, I've introduced a new
OpaquePtr type (TemplateTy) that holds the representation of a
TemplateName. This will simplify the handling of dependent
template-names, once we get there.

llvm-svn: 68074
2009-03-30 22:58:21 +00:00
Fariborz Jahanian ed308a94da Code gen does not yet supports __asm__ on a variable
declaration. Reject it.

llvm-svn: 68058
2009-03-30 20:32:06 +00:00
Fariborz Jahanian 3b636c15e0 Use CodeGenModule API for ObjC runtime function references.
Patch by David Chisnall.

llvm-svn: 68043
2009-03-30 18:02:14 +00:00
Chris Lattner 5bbb3c8ad9 Push DeclGroup much farther throughout the compiler. Now the various
productions (except the already broken ObjC cases like @class X,Y;) in 
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.

This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc).  These have been
fixed.

Still TODO:

1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
   be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.

I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.

llvm-svn: 68002
2009-03-29 16:50:03 +00:00
Eli Friedman bbcf49e410 Initial implementation of ARM ABI. Mostly untested. Note that I'm not
really intending to take ownership of this; I wrote this mostly because 
I was curious about how the ARM ABI works.  It should be a decent start, 
though.

llvm-svn: 67969
2009-03-29 00:15:25 +00:00
Chris Lattner 529efc74ad rename some methods.
llvm-svn: 67923
2009-03-28 06:33:19 +00:00
Chris Lattner cf16983179 change HandleTranslationUnit to take an ASTContext instead of TranslationUnit
llvm-svn: 67910
2009-03-28 04:11:33 +00:00
Eli Friedman 754d5ac658 Trivial cleanup.
llvm-svn: 67899
2009-03-28 03:27:06 +00:00
Eli Friedman 09a9b6e335 Move where block-related variables are initialized so that block
types don't get generated when blocks aren't used.

llvm-svn: 67898
2009-03-28 03:24:54 +00:00
Eli Friedman 9127aa1caf Minor cleanup.
llvm-svn: 67896
2009-03-28 03:10:45 +00:00
Eli Friedman e381f7e3e9 Misc small fixes/cleanups/comment changes.
llvm-svn: 67895
2009-03-28 02:45:41 +00:00
Eli Friedman 8b7b1b1aee Change compound assignment operators to keep track of both the promoted
LHS type and the computation result type; this encodes information into 
the AST which is otherwise non-obvious.  Fix Sema to always come up with the 
right answer for both of these types.  Fix IRGen and the analyzer to 
account for these changes.  This fixes PR2601.  The approach is inspired 
by PR2601 comment 2.

Note that this changes real *= complex in CodeGen from a silent 
miscompilation to an explicit error.

I'm not really sure that the analyzer changes are correct, or how to 
test them... someone more familiar with the analyzer should check those 
changes.

llvm-svn: 67889
2009-03-28 01:22:36 +00:00
Devang Patel afc1c1d405 Do not emit debug information for variables while generating optimized code. The llvm optimizer and code generator are not yet ready to support optimized code debugging.
llvm-svn: 67876
2009-03-27 23:16:32 +00:00
Eli Friedman 7044b76707 Finish off semantic analysis for regparm, and remove the warning. Also
remove a redundant error in CodeGen.

llvm-svn: 67868
2009-03-27 21:06:47 +00:00
Fariborz Jahanian a2d609e2f1 Besides the warning, issue unsupported diagnostics in
ir gen. No intended change in functionality.

llvm-svn: 67857
2009-03-27 18:38:55 +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
Chris Lattner 984fac5f5f most of this is plumbing to get CompileOptions down into
CodeGenModule.  Once there, add a new NoCommon option to
it and implement -fno-common.

llvm-svn: 67735
2009-03-26 05:00:52 +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
Mike Stump 871c1f6f88 Remove -f__block as codegen for __block variables should be solid.
llvm-svn: 67697
2009-03-25 18:05:39 +00:00
Mike Stump d2142cffbf Fixup codegen for block literals that bleed copy/dispose information
from previous block literals.

llvm-svn: 67696
2009-03-25 17:58:24 +00:00
Chris Lattner 8c37df4f91 simplify some conditionals, don't copy LangOptions.
llvm-svn: 67674
2009-03-25 03:28:08 +00:00
Devang Patel 94406c954f Encode language.
llvm-svn: 67650
2009-03-24 20:35:51 +00:00
Daniel Dunbar bf1fe8c36c Support member reference on ?: of struct type.
llvm-svn: 67603
2009-03-24 02:38:23 +00:00