Commit Graph

834 Commits

Author SHA1 Message Date
Fariborz Jahanian 9c56fc956f Objective-C. Fixes an assert where because of captured
variable in block is over-aligned with an align
attribute causing block metadata size not be multiple
of alignment. rdar://17878679

llvm-svn: 215449
2014-08-12 15:51:49 +00:00
Frederic Riss 787d9d640e Debuginfo: Correctly tag variadic ObjC methods with DW_TAG_unspecified_parameter.
Fixes rdar://13690847

llvm-svn: 215423
2014-08-12 04:42:23 +00:00
Fariborz Jahanian 495bc3f5f6 Objective-C ARC. Use of non-retain/autorelease API
for building Objective-C array literals in ARC
mode. rdar://17554063

llvm-svn: 215232
2014-08-08 17:31:14 +00:00
Fariborz Jahanian d45e7cec42 Objective-C arc. Switch the Objective-C dictionary literal in ARC mode
to use non-retain/autorelease API variants of ObjC objects. wip.
rdar://17554063

llvm-svn: 215146
2014-08-07 20:57:35 +00:00
Fariborz Jahanian 2a25dba153 Objective-C ARC. More code for Objective-C's
new APIs for literals. nfc. wip. rdar://17554063

llvm-svn: 215043
2014-08-06 23:40:31 +00:00
Tobias Grosser b3af390087 Revert "Emit column debug information for loads"
This broke the following gdb tests:

gdb.base__annota1.exp
gdb.base__consecutive.exp
gdb.python__py-symtab.exp
gdb.reverse__consecutive-precsave.exp
gdb.reverse__consecutive-reverse.exp

I will look into this.

This reverts commit 214162.

llvm-svn: 214163
2014-07-29 06:53:14 +00:00
Tobias Grosser 01b923d55b Emit column debug information for loads
This allows us to give more precise diagnostics.

Diego kindly tested the impact on debug info size: "The increase on average
debug sizes is 0.1%. The total file size increase is ~0%."

llvm-svn: 214162
2014-07-29 06:10:47 +00:00
Hal Finkel a2347baaec Mark C++ reference parameters as dereferenceable
Because references must be initialized using some evaluated expression, they
must point to something, and a callee can assume the reference parameter is
dereferenceable. Taking advantage of a new attribute just added to LLVM, mark
them as such.

Because dereferenceability in addrspace(0) implies nonnull in the backend, we
don't need both attributes. However, we need to know the size of the object to
use the dereferenceable attribute, so for incomplete types we still emit only
nonnull.

llvm-svn: 213386
2014-07-18 15:52:10 +00:00
Fariborz Jahanian 451b92ab6a Objective-C. Introducing __attribute__((objc_runtime_name("runtimename"))
to be applied to class or protocols. This will direct IRGen
for Objective-C metadata to use the new name in various places
where class and protocol names are needed.
rdar:// 17631257

llvm-svn: 213167
2014-07-16 16:16:04 +00:00
Fariborz Jahanian 3705790adf Improve test of my previous patch. rdar://17633301
llvm-svn: 213081
2014-07-15 17:47:58 +00:00
Fariborz Jahanian bc94c94be4 Objective-C IRGen. Fixes an inconsistant linkage of
ObC's metaclass metadata with its class metadata which
results in an assert. rdar://17633301

llvm-svn: 213076
2014-07-15 17:14:34 +00:00
Oliver Stannard c8e3b5f849 Improve robustness of tests for module flags metadata
Fix clang tests to not break if the ID numbers of module flags metadata
nodes change.

llvm-svn: 211276
2014-06-19 16:10:21 +00:00
Fariborz Jahanian 0b3bc24e39 Objective-C IRGen. Patch to generate a weak symbol reference when
'super' dispatches a class method in category for OBJC_METACLASS.
This is when class is a weak_import class.
// rdar://16529125

llvm-svn: 210547
2014-06-10 17:08:04 +00:00
Nick Lewycky 9b46eb8112 Add 'nonnull' parameter or return attribute when producing an llvm pointer type in a function type where the C++ type is a reference. Update the tests.
llvm-svn: 209723
2014-05-28 09:56:42 +00:00
David Blaikie aabde05da1 DebugInfo: Avoid creating DILexicalScopeFiles when the filename in the current scope has not changed.
This looks like the right way for this check to work, but there is
another semi-obvious bug, I would think: why is CurLoc not zero'd out
between functions? The possibility for it to bleed between them seems
problematic. (& indeed I caused tests to fail when I fixed this a
different way, by setting CurLoc to SourceLocation() and the end of
EmitFunctionEnd... )

The changes to debug-info-blocks.m are due to a mismatch between the
source manager's file naming and CGDebugInfo's default handling when no
-main-file-name is specified. This actually reveals somewhat of a bug in
the debug info when using source files from standard in, too. See the
comment in CGDebugInfo::CreateCompileUnit for more details.

llvm-svn: 208742
2014-05-14 00:29:00 +00:00
David Blaikie ef8a951882 Build debug info for ObjC interface types at the end of the translation unit to ensure all ivars are included.
This takes a different approach than the
completedType/requiresCompleteType work which relies on AST callbacks to
upgrade the type declaration to a definition. Instead, just defer
constructing the definition to the end of the translation unit.

This works because the definition is never needed by other debug info
(so far as I know), whereas the definition of a struct may be needed by
other debug info before the end of the translation unit (such as
emitting the definition of a member function which must refer to that
member function's declaration).

If we had a callback for whenever an IVar was added to an ObjC interface
we could use that, and remove the need for the ObjCInterfaceCache, which
might be nice. (also would need a callback for when it was more than
just a declaration so we could get properties, etc).

A side benefit is that we also don't need the CompletedTypeCache
anymore. Just rely on the declaration-ness of a type to decide whether
its definition is yet to be emitted.

There's still the PR19562 memory leak, but this should hopefully make
that a bit easier to approach.

llvm-svn: 208015
2014-05-05 23:23:53 +00:00
David Blaikie fc55cb6e14 ObjC IVars aren't added when the type isn't emitted after the interface extension
llvm-svn: 208014
2014-05-05 23:23:50 +00:00
Adrian Prantl c4405c87c6 Make test independent of label. Thanks to Richard Smith for catching this!
llvm-svn: 207489
2014-04-29 02:27:33 +00:00
Richard Smith dfbe47650e Run this test through instnamer to stop it failing on non-asserts clang builds.
llvm-svn: 207488
2014-04-29 02:18:35 +00:00
Adrian Prantl 2cede0f92c Debug info: Improve line table for functions with cleanups an early exit
and no return expr at the end of the function.
The "function has only simple returns" check in FinishFunction tests
whether the number of simple return exprs equals the number of return
exprs, but so far a fallthrough at the end of a function was not counted
as a return, which would result in cleanup code being associated with the
wrong source line.

rdar://problem/16733984.

llvm-svn: 207480
2014-04-29 01:07:59 +00:00
Fariborz Jahanian 9da2a799ab Objective-C [IRGen]. Fixes a crash in IRGen involving use of
'typeof' to extract type of an @encode expression used
in an initializer. // rdar://16655340

llvm-svn: 207004
2014-04-23 17:44:58 +00:00
Fariborz Jahanian 33079ee0e6 Objective-C [IRGen]. Add encoding for 'weak' attribute of a
'readonly' property. // rdar://16136439

llvm-svn: 205477
2014-04-02 22:49:42 +00:00
Tim Northover a2ee433c8d ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely
still some rough edges, so please bring up any issues you see with
this patch.

As with the LLVM commit though, we think it'll be more useful for
merging with AArch64 from within the tree.

llvm-svn: 205100
2014-03-29 15:09:45 +00:00
Rafael Espindola ef3e831965 Don't produce a L symbol in __DATA,__data.
The section __DATA,__data is atomized by the linker and cannot have L symbols.

llvm-svn: 204879
2014-03-27 00:02:45 +00:00
Justin Bogner 52a6a97d70 test: Give instrumentation based profiling tests their own directory
These tests are logically related, but they're spread about several
different CodeGen directories. Consolidate them in one place to make
them easier to manage.

llvm-svn: 203541
2014-03-11 04:37:49 +00:00
Fariborz Jahanian f322f2fb61 Objective-C IRGen. Fixes several regressions caused by changes made
to setting of ObjC linkages. //rdar://16206443

llvm-svn: 203521
2014-03-11 00:25:05 +00:00
Rafael Espindola 060062a433 Use llvm.compiler.used instead of llvm.used for objc symbols.
LLVM currently has a hack (shouldEmitUsedDirectiveFor) that causes it to not
print no_dead_strip for symbols starting with 'l' or 'L'. These are exactly the
ones that the clang's objc codegen is producing. The net result, is that it is
equivalent to llvm.compiler.used.

The need for putting the private symbol in llvm.compiler.used should be clear
(the objc runtime uses them). The reason for also putting the weak symbols in
it is for LTO: ld64 will not ask us to preserve the it.

llvm-svn: 203172
2014-03-06 22:15:10 +00:00
Rafael Espindola dec97f82f7 Make the test a bit stronger by showing what is added to llvm.used.
llvm-svn: 203170
2014-03-06 22:02:16 +00:00
Bob Wilson c845c00a5b PGO: Add support for Objective-C blocks.
llvm-svn: 203157
2014-03-06 20:24:27 +00:00
Rafael Espindola 70efc5b4db Revert "Use private linkage for remaining GlobalVariables with private names."
This reverts commit r203059.

Revert while we discuss what does it mean to be private and weak.

llvm-svn: 203141
2014-03-06 18:54:12 +00:00
Bob Wilson 9c86656d62 Run -fprofile-instr tests with %clang_cc1.
This should help avoid problems like the buildbot fallout from my change in
r203085. I left the CodeGenCXX tests alone for now.

llvm-svn: 203131
2014-03-06 17:18:34 +00:00
NAKAMURA Takumi e1879a90f8 CodeGenObjC/instr-profile.m: Add -target darwin to appease bots.
This expected;
  ; Function Attrs: uwtable
  define internal void @"\01+[A foreach:]"(i8* %self, i8* %_cmd, %0* %array) #0 {

But the Name is mangled on other hosts; (x86_64-unknown-unknown)
  ; Function Attrs: nounwind uwtable
  define internal void @_c_A__foreach_(i8* %self, i8* %_cmd, %1* %array) #0 {

llvm-svn: 203092
2014-03-06 07:29:30 +00:00
Bob Wilson b3fd21a42f Attempt to fix buildbots by dropping the -LABEL from some FileCheck patterns.
llvm-svn: 203090
2014-03-06 06:49:37 +00:00
Bob Wilson 5ec8fe19cf PGO: add instrumentation for Objective-C methods.
llvm-svn: 203085
2014-03-06 06:10:02 +00:00
Rafael Espindola d0bb55a1d4 Use private linkage for remaining GlobalVariables with private names.
This patch changes the remaining GlobalVariables using "\01L" and
"\01l" prefixes to use private linkage. What is strange about them is
that they currently use WeakAnyLinkage. There is no comment stating
why and that is really odd since the symbols are completely hidden, so
it doesn't make sense for them to be weak.

Clang revisions like r63329, r63408, r63770, r65761 set the linkage to
weak, but don't say why. I suspect they were just copying llvm-gcc.

In llvm-gcc I found r58599 and r56322 that set DECL_WEAK, but they
were just syncing from the apple gcc. I am not exactly sure what that
means, since the last commit to
svn://gcc.gnu.org/svn/gcc/branches/apple was in 2006, 2 years earlier.

In summary, I have no idea why weak linkage was being used :-(

To quote John McCall, "Let’s try without it and see" :-)

llvm-svn: 203059
2014-03-06 01:57:34 +00:00
Fariborz Jahanian dafffbe2be Objective-C IRGen. Fix up the hueristics for determining
if an ivar offset load is invariant iff inside an instance method
and ivar belongs to instance method's class and one of its super class.
// rdar://16095748

llvm-svn: 202872
2014-03-04 18:34:52 +00:00
Fariborz Jahanian 1d5c1fad68 Objective-C. Fixes a regression when figuring out linkage
for metadata symbols for forward referenced protocols which 
are never defined.  // rdar://16203115

llvm-svn: 202761
2014-03-03 21:53:57 +00:00
Rafael Espindola 5179a4ea28 Use private linkage for globals we already name with \01L and \01l.
In llvm the only semantic difference between internal and private is that llvm
tries to hide private globals my mangling them with a private prefix. Since
the globals changed by this patch already had the magic don't mangle marker,
there should be no change in the generated assembly.

A followup patch should then be able to drop the \01L and \01l prefixes and let
llvm mangle as appropriate.

llvm-svn: 202419
2014-02-27 19:01:11 +00:00
Fariborz Jahanian a7352db7b4 Objective-C. Remove an assertion which asserts
on correctly handled block layout IRGen. 
// rdar://16111839

llvm-svn: 202063
2014-02-24 19:10:37 +00:00
Bob Wilson 8ab1691091 Do not put instrumentation counters before phis in ObjC for-in loops.
We still don't use the PGO to set branch weights for these loops, but at
least this keeps the compiler from crashing. <rdar://problem/16137778>

llvm-svn: 202002
2014-02-24 01:13:09 +00:00
Nico Rieck e6a1582595 Fix broken CHECK lines
llvm-svn: 201477
2014-02-16 07:29:41 +00:00
Nico Rieck 140db2767b Fix broken RUN lines
llvm-svn: 201475
2014-02-16 07:28:32 +00:00
Fariborz Jahanian 7741101dce [IRGen]. Fixes a crash in using Objective-C array
properties by fixing shouldBindAsLValue to accept arrays
(like record types) because we always manipulate
them in memory. Patch suggested by John MaCall.
// rdar://15610943

llvm-svn: 201428
2014-02-14 19:37:25 +00:00
Adrian Prantl 375fddcf5c relax testcase and make ppc64 buildbots happy.
llvm-svn: 201250
2014-02-12 19:26:19 +00:00
Adrian Prantl 2039d44603 Document and improve the debug-property-synth.m test based on the
information provided in the referenced radar.

llvm-svn: 201248
2014-02-12 18:24:07 +00:00
Adrian Prantl ab340334dc Revert "Remove bad debug info test."
This reverts commit r201183.
The test, albeit undocumented and badly written is still testing something
useful. It will be updated in a subsequent commit.

llvm-svn: 201247
2014-02-12 18:24:04 +00:00
David Blaikie e5a3560777 Remove bad debug info test.
Another test that's testing through assembly from Clang which is
problematic. An attempt to upgrade this to just be an IR-generation test
was unsuccessful (I was unable to get this test to fail) but it looks
like there's other, better, test coverage in this area
(test/CodeGenObjC/debuginfo-properties.m) anyway.

llvm-svn: 201183
2014-02-11 21:37:47 +00:00
Timur Iskhodzhanov ad47776d90 Use an Itanium triple in DWARF debug info tests
This should fix the clang part of the breakage in r200340.

llvm-svn: 200435
2014-01-30 01:01:36 +00:00
Fariborz Jahanian 13b4304937 Objective-C [IRGen]. Generator a tail call to objc_getProperty() in
synthesized getters for performance improvement. 
// rdar://15884113

llvm-svn: 200430
2014-01-30 00:16:39 +00:00
Fariborz Jahanian 33fa962441 Objective-C. provide legacy encoding of *id and *Class types
instead of crashing.  // rdar://15824769.

llvm-svn: 200338
2014-01-28 20:41:15 +00:00