Commit Graph

1557 Commits

Author SHA1 Message Date
Slava Pestov
0bedd20ddd IRGen: Emit hoisted declarations at the top level 2020-09-03 16:16:51 -04:00
swift_jenkins
f60f839098 Merge remote-tracking branch 'origin/master' into master-next 2020-08-27 04:10:57 -07:00
swift_jenkins
7bda7aaf2c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-27 04:06:41 -07:00
David Zarzycki
a53f3633c0 [IRGen] NFC: Simplify IRGenModule::defineTypeMetadata
Also make `IRGenModule::getAddrOfTypeMetadata()` more clear that a GEP
is being forced and optional aliasing is involved rather than imply that
full metadata always requires a GEP (which it does not).
2020-08-26 07:03:09 -04:00
Nathan Hawes
c453ddf758 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-17 09:45:56 -07:00
swift_jenkins
6904522d4f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-15 12:54:19 -07:00
Nate Chandler
e23cc54145 [IRGen] Skip reemitting fields referenced by type context descriptor.
When reemitting a type context descriptor, several fields
- method lookup function
- dispatch thunk
- nonoverride method descriptor
were previously being reemitted.

In a couple of earlier commits, that behavior was altered to delete the
fields before reemitting them.

  3ad2777a68 [IRGen] Erase nonoverride descriptor on emission.
  c25c180c08 [IRGen] Erase thunks before emission.

Here, the behavior is changed to simply exit early when these fields are
being reemitted.  Also an assertion is added that these fields are
redefined only when reemitting the type context descriptor.
2020-08-15 09:54:54 -07:00
swift_jenkins
9ab003bcf9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-14 15:14:01 -07:00
Nate Chandler
a5a7c98be0 [metadata prespecialization] getGenericMetadata finds records.
Previously, the metadata accessor for which canonical prespecializations
had been formed included checks against the passed-in arguments to
determine whether the access matched a prespecialized record or not.

Now that the prespecialized records are attached to the nominal type
descriptor for the type, eliminate this hard-coded generated code and
instead let swift_getGenericMetadata do the work of looking through the
prespecializations.
2020-08-14 11:19:10 -07:00
Nathan Hawes
f0c8b8e571 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-14 11:06:27 -07:00
nate-chandler
6dddf96faf Merge pull request #33442 from nate-chandler/generic-metadata-prespecialization-components/record-canonical-prespecializations
[metadata prespecialization] Add canonical prespecialization to end of type descriptors.
2020-08-14 09:59:26 -07:00
Nate Chandler
5114f22e5e [metadata prespecialization] Reemit dependent values.
The metadata accessor and type context descriptor for a nominal type
both depend on canonical metadata--the former because it returns those
metadata, the latter because it has them as trailing objects.

Here, the work is done to reemit those values when new canonical
prespecialized metadata are encountered.
2020-08-13 17:44:05 -07:00
swift-ci
1d9bad4039 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-13 17:23:10 -07:00
Saleem Abdulrasool
fc164ce098 IRGen: be less aggressive about applying COMDAT
COMDAT can only be applied to definitions, not declarations.  This
manifested in builds of llbuild with SwiftPM on Windows.  The nominal
type descriptor accessor declaration was marked as COMDAT.
2020-08-13 10:42:03 -07:00
Nate Chandler
665100d74f [IRGen] Teach defineAlias to replace useds.
Previously, it was possible to alias an old LinkEntity which was marked
used (i.e. in LLVMUsed) or compiler used (i.e. in LLVMCompilerUsed).
The result of defining such an alias was a failure downstream when
writing out the lists of globals.

Here, the old value is removed from the list before it is invalidated.
2020-08-12 19:18:23 -07:00
David Zarzycki
00f4700496 Handle expanded enums in upstream LLVM (ZOS and GOFF) 2020-08-12 09:05:38 -04:00
swift_jenkins
baf7116b7c Merge remote-tracking branch 'origin/master' into master-next 2020-08-08 18:07:37 -07:00
swift-ci
4dd4a42112 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-08 18:04:04 -07:00
John McCall
03d94b44a6 Add default IR attributes to helper functions and convert
several more places to use getOrCreateHelperFunction.

This means that several of these places are now emitting
shared functions rather than private ones, which I've
verified is okay.  There are some other places where
privacy is still unfortunately necessary.

I've also fixed the name of the store-extra-inhabitants
helper function to say "store" instead of "get", which
is longstanding (but harmless because it's private).

Fixes rdar://66707994.
2020-08-08 16:57:02 -04:00
Nathan Hawes
8435dc7d20 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 14:21:08 -07:00
Nathan Hawes
607e2b8822 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 13:47:48 -07:00
Nate Chandler
28cc144284 [IRGen] Add main() to __swift5_entry.
To enable lookup of the entry point, emit a pointer to that entry point
into a new section; on MachO, the __swift5_entry section of the __TEXT
segment.

rdar://problem/66402358
2020-08-03 15:40:16 -07:00
swift-ci
18516c1549 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-30 20:46:19 -07:00
swift_jenkins
e5f4c9ea97 Merge remote-tracking branch 'origin/master' into master-next 2020-07-30 19:07:53 -07:00
Brent Royal-Gordon
c4bbeb21a5 Mark main() as used
This prevents dead code stripping from removing the main() function used in widgets. This special case was added to support the integrated REPL, which was removed after Swift 5.3, and so it is no longer necessary.

Fixes rdar://65862827.
2020-07-29 17:39:51 -07:00
Nathan Hawes
898c20ee2b Manually merge remote-tracking branch 'upstream/master' into github-m-to-mn 2020-07-28 10:37:01 -07:00
Nathan Hawes
b0a2230860 Manually merge remote-tracking branch 'upstream/master' into merge-in-master 2020-07-27 09:25:01 -07:00
Meghana Gupta
b34791a0a0 Update code as per Apple Style Guide
whitelist -> allowlist
blacklist -> denylist
2020-07-24 11:37:15 -07:00
swift_jenkins
f7a1baff06 Merge remote-tracking branch 'origin/master' into master-next 2020-07-21 13:30:27 -07:00
swift-ci
4d29897ac3 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-21 08:05:28 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
Nate Chandler
d4b82bacca [metadata prespecialization] Cross-module: enums and structs.
When a generic type from a different module is not resilient within the
current module and at least one of its arguments is from the current
module, emit a non-canonical prespecialized record, and access that
metadata via a call to swift_getCanonicalSpecializedMetadata, passing in
the non-canonical record.

rdar://problem/56996727
rdar://problem/56997022
2020-07-16 14:14:01 -07:00
Varun Gandhi
ee10198e9a Manually merge master into master-next.
Fixed merge conflicts in:
- lib/ClangImporter/ClangImporter.cpp
- lib/ClangImporter/ImportType.cpp
- lib/Frontend/CompilerInvocation.cpp
- lib/Serialization/ModuleFile.cpp
- lib/TBDGen/TBDGen.cpp
2020-07-15 21:36:13 -07:00
Hamish Knight
9b2bcd13f9 [TBDGen] Return a vector of symbols instead of set
A couple of clients are iterating over the result,
so switch to a vector to ensure we don't
accidentally introduce any non-determinism.

(cherry picked from commit 56929fdaaa)
2020-07-15 18:41:57 -07:00
Hamish Knight
4daeb4fa3a Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.

(cherry picked from commit c0a2ea7d0e)
2020-07-15 18:41:52 -07:00
Hamish Knight
56929fdaaa [TBDGen] Return a vector of symbols instead of set
A couple of clients are iterating over the result,
so switch to a vector to ensure we don't
accidentally introduce any non-determinism.
2020-07-15 17:48:51 -07:00
Hamish Knight
c0a2ea7d0e Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.
2020-07-15 17:46:14 -07:00
Hamish Knight
c354b0faa1 [TBDGen] Return a vector of symbols instead of set
A couple of clients are iterating over the result,
so switch to a vector to ensure we don't
accidentally introduce any non-determinism.
2020-07-13 20:42:54 -07:00
Hamish Knight
db7fea4665 Sink linker directive computation into IRGen
With an inverted pipeline, IRGen needs to be able
to compute the linker directives itself, so sink
it down such that it can be computed by the
`IRGenDescriptor`.
2020-07-13 20:42:54 -07:00
Doug Gregor
f818a1e1b0 [Driver/IRGen] Put backward-deployment libraries into a table.
Describe the backward-deployment libraries via a preprocessor-driven
table. Macro-metaprogramming the two places in the code base---the
driver and IRGen---to use this tabble to determine which
backward-compatibility libraries to link against.
2020-07-07 23:11:37 -07:00
swift_jenkins
f496210e1a Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 14:59:55 -07:00
Hamish Knight
fa715820a9 [IRGen] Assert the SourceFile has been type-checked 2020-07-01 09:43:51 -07:00
David Zarzycki
b7664fa320 [IRGen] Adjust to upstream LLVM change
GlobalValue::getAlignment() was removed in a2caa3b61497b6be8c8b77823d0fd62b4be1f177.
2020-06-24 14:42:33 -04:00
swift_jenkins
debe1f27c8 Merge remote-tracking branch 'origin/master' into master-next 2020-06-15 11:19:44 -07:00
Keith Smiley
76ca05f7b1 reland: Emit coverage mappings for all modules
This reverts commit 499ed05fd9.

This changes the num-threads passed to 1 to avoid a multithreaded output
issue on windows
2020-06-14 13:13:47 -07:00
swift_jenkins
0bc30e312e Merge remote-tracking branch 'origin/master' into master-next 2020-06-11 07:39:16 -07:00
Arnold Schwaighofer
abfbbbeee5 Merge pull request #32213 from aschwaighofer/note_use_of_type_metadata_in_conditional_reqts
IRGen: Note use of types in conditional requirements of protocol conformances
2020-06-11 07:27:30 -07:00
swift_jenkins
136859e08f Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 20:19:05 -07:00
Saleem Abdulrasool
499ed05fd9 Revert "Emit coverage mappings for all modules" 2020-06-10 15:16:00 -07:00
swift_jenkins
e3bbcdc7df Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 12:39:02 -07:00