Instead of using the target that was passed to the driver. Use the target from
the clang importer that might have been changed by clang (i.e armv7 to thumbv7
on darwin)
rdar://32599805
Introduce a new section that contains (relative) references to all of the
Swift protocol descriptors emitted into this module. We'll use this to
find protocol descriptors by name.
This commit is mostly refactoring.
*) Introduce a new OptimizationMode enum and use that in SILOptions and IRGenOptions
*) Allow the optimization mode also be specified for specific SILFunctions. This is not used in this commit yet and thus still a NFC.
Also, fixes a minor bug: we didn’t run mandatory IRGen passes for functions with @_semantics("optimize.sil.never")
The large code model is not necessary. Large Address Aware should be
sufficient for dealing with the higher address ranges. Using the large
code model breaks the DLL storage semantics on Windows. With this we
are able to build most of the standard library for all variants of
Windows.
Addresses SR-6150!
Previously, we were just running ObjCARCContract when codegening. This is out of
character with the rest of the LLVM passes in Swift, namely that after these
have run, an IR pass no longer contains any compiler intrinsics. This can be
seen by SwiftARCContract running in the -O pipeline.
This commit harmonizes the behavior here.
For testing purposes, I added a flag that disables the running of
ObjCARCContract for testing purposes.
rdar://34824507
Interpreter support for thumb is not yet properly implemented/tested.
Disable thumb emission.
This change is necessary because LLVM now uses the features string in the
metadata. This features string contains '+thumb'.
This is a follow-up to 034241e440.
rdar://32599805
rdar://34781037 (tests that expect non-thumb instructions are failing)
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
The default when creating a target machine should be to leave the
code model unspecified (at least that is the default argument value).
The previous change (7526d07525) also missed one place that needed
to be updated.
This reverts commit 7526d07525.
That commit was applied to master-next for changes in swift-llvm's
upstream-with-swift branch that are not included in the swift-4.1-branch.
* Use clang's effective llvm triple for IR generation
Instead of using the target that was passed to the driver. Use the target from
the clang importer that might have been changed by clang (i.e armv7 to thumbv7
on darwin)
rdar://32599805
* Address review comments
* Fix test case osx-targets.swift
* Fix pic.swift test case
* Fix test abi_v7k.swift
* Address review comment for test osx-targets.swift
This is accomplished by recognizing this specific situation and
replacing the 'objc' attribute with a hidden '_objcRuntimeName'
attribute. This /only/ applies to classes that are themselves
non-generic (including any enclosing generic context) but that have
generic ancestry, and thus cannot be exposed directly to Objective-C.
This commit also eliminates '@NSKeyedArchiverClassName'. It was
decided that the distinction between '@NSKeyedArchiverClassName' and
'@objc' was too subtle to be worth explaining to developers, and that
any case where you'd use '@NSKeyedArchiverClassName' was already a
place where the ObjC name wasn't visible at compile time.
This commit does not update diagnostics to reflect this change; we're
going to change them anyway.
rdar://problem/32414557
Register class names for NSKeyedArchiver and NSKeyedUnarchiver based on the @NSKeyedArchiveLegacy and @_staticInitializeObjCMetadata class attributes.
@NSKeyedArchiveLegacy registers a class name translation.
@_staticInitializeObjCMetadata just makes sure that the metadata of a class is instantiated.
This registration code is executed as a static initializer, like a C++ global constructor.
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.
The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).
See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
We don't want LLVM aggresively inlining llvm.memcpy instructions and similar
aggressive optimizations to save code size.
For example the X86 target sets max stores per memset to 16 and max stores per
memcpy to 8 (vs 4).
Loop optimizations are also a lot more aggressive.
rdar://31691017
At some point, pass definitions were heavily macro-ized. Pass
descriptive names were added in two places. This is not only redundant
but a source of confusion. You could waste a lot of time grepping for
the wrong string. I removed all the getName() overrides which, at
around 90 passes, was a fairly significant amount of code bloat.
Any pass that we want to be able to invoke by name from a tool
(sil-opt) or pipeline plan *should* have unique type name, enum value,
commend-line string, and name string. I removed a comment about the
various inliner passes that contradicted that.
Side note: We should be consistent with the policy that a pass is
identified by its type. We have a couple passes, LICM and CSE, which
currently violate that convention.
The type deduction may fail due to no explicit conversion to the
ArrayRef data type. Add explicit casts. Use the sizeof operator on the
value being constructed rather than the explicit type of the value to
allow the size to be deduced from the value.
A lot of files transitively include Expr.h, because it was
included from SILInstruction.h, SILLocation.h and SILDeclRef.h.
However in reality most of these files don't do anything
with Exprs, especially not anything in IRGen or the SILOptimizer.
Now we're down to 171 files in the frontend which depend on
Expr.h, which is still a lot but much better than before.
This gives big code size wins for unused types and also for types, which are never used in a generic context.
Also it reduces the amount of symbols in the symbol table.
The size wins heavily depend on the project. I have seen binary size reductions from 0 to 20% on real world projects.
rdar://problem/30119960