Commit Graph

655 Commits

Author SHA1 Message Date
David Ungar
1f9a4f3591 Pass around arguments for primary-specific filenames.
Get rid of IRGenOpts attributes that won’t work for batch mode and also remove fakeNamesStub.
2018-02-15 15:34:55 -07:00
Arnold Schwaighofer
2bfeb2fbcc Adapt to llvm api change CodeModel::Default is now modeled as Optional<CodeModel::Mode>.None 2018-02-15 12:53:40 -08:00
Xi Ge
87d57fdc51 Merge remote-tracking branch 'apple/master' into apple-master-llvm-swift5-transition 2018-02-15 11:22:55 -08:00
Xi Ge
d052a53ce6 Merge remote-tracking branch 'apple/master' into apple-master-next 2018-02-15 11:20:08 -08:00
Arnold Schwaighofer
2d58f08142 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
2018-02-14 15:45:43 -08:00
swift-ci
e416454ed5 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-09 23:18:50 -08:00
swift-ci
f0c2d65e1c Merge remote-tracking branch 'origin/master' into master-next 2018-01-09 23:09:03 -08:00
swift-ci
ea489cead0 Merge pull request #13844 from DougGregor/runtime-protocol-name-lookup 2018-01-09 23:06:09 -08:00
Bob Wilson
1b55b85e2b Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-09 16:12:10 -08:00
Doug Gregor
0f4963dba8 [IRGen] Put references to all emitted protocols into a special section.
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.
2018-01-09 16:10:18 -08:00
Ben Langmuir
627d6d0a9f Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/IRGen/IRGen.cpp
2018-01-09 10:54:33 -08:00
John McCall
3c54c0edfc IRGen and basic optimizer support for coroutines. 2018-01-09 11:35:09 -05:00
swift-ci
0302515cf0 Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 12:48:55 -08:00
David Ungar
51d3165874 NFC: Clarifying uses of NumThreads.
Add hasMultipleGMs predicate to SILOptions.
Rename parameters to TBD file handling to better reflect abstraction boundary.

fix
2017-12-16 13:58:01 -08:00
Bob Wilson
8d1513a260 master-next: Update for LLVM TargetSubtargetInfo.h moving to CodeGen.
In LLVM r318490, the TargetSubtargetInfo.h header file was moved from the
Target directory to the CodeGen directory. rdar://problem/35634771
2017-11-19 08:45:11 -08:00
swift-ci
d3b8ffc42a Merge remote-tracking branch 'origin/master' into master-next 2017-11-14 12:09:04 -08:00
Erik Eckstein
90c21be191 Unify the implementation of optimization mode in various option classes.
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")
2017-11-14 11:25:02 -08:00
Bob Wilson
837a8516f0 Merge remote-tracking branch 'origin/master' into master-next 2017-10-19 20:56:04 -07:00
Saleem Abdulrasool
8ab7956c42 IRGen: do not use the Large Code Model on Win64
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!
2017-10-17 15:05:53 -07:00
swift-ci
c6bb8ba0f2 Merge remote-tracking branch 'origin/master' into master-next 2017-10-06 10:09:52 -07:00
Michael Gottesman
723c6212f2 Run ObjCARCContract when optimizing no matter the IRGenOutputKind.
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
2017-10-06 08:59:58 -07:00
swift-ci
afb3d37547 Merge remote-tracking branch 'origin/master' into master-next 2017-10-03 12:29:09 -07:00
Arnold Schwaighofer
c61af365ed Truly disable thumb emission
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)
2017-10-03 11:12:13 -07:00
swift-ci
1fb83060df Merge remote-tracking branch 'origin/master' into master-next 2017-09-23 10:29:35 -07:00
Saleem Abdulrasool
7bd2256120 runtime: clean up last of -Wqual-cast warnings
This fixes up the remaining cast qualifier warnings from GCC 6.  Use
multiple casts to adjust the const qualification.  Prefer C++ style
casts.  NFC.
2017-09-22 14:14:13 -07:00
swift-ci
5702d522ab Merge remote-tracking branch 'origin/master' into master-next 2017-09-13 06:29:47 -07:00
Arnold Schwaighofer
034241e440 Revert "Use clang's effective llvm triple for IR generation (#10211)"
This reverts commit 2e3522fafc because debugging
with thumb instructions is broken and being worked on.

rdar://32599805
2017-09-12 13:59:53 -07:00
swift-ci
e6d9418ab8 Merge remote-tracking branch 'origin/master' into master-next 2017-08-17 13:29:21 -07:00
Graydon Hoare
04d11afdad [Stats] Collect IR/LLVM always-on stats correctly when multithreading. 2017-08-17 13:45:06 -04:00
George Karpenkov
efe143c2f4 Adding support for -sanitize=fuzzer flag (#11381)
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.
2017-08-07 18:16:51 -07:00
George Karpenkov
8b368e92c3 Adding support for -sanitize=fuzzer flag. (#9450)
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.
2017-08-07 17:07:19 -07:00
Bob Wilson
19f9237d7c [master-next] More updates for LLVM r309911 CodeModel changes.
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.
2017-08-03 18:44:10 -07:00
Bob Wilson
6d3dceaf47 [master-next] Reapply "[IRGen] The "default" LLVM code model is now Small."
This reverts commit 1d5400bf1a.
2017-08-03 17:10:47 -07:00
Bob Wilson
1d5400bf1a Revert "[IRGen] The "default" LLVM code model is now Small."
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.
2017-08-03 14:22:23 -07:00
Sean Callanan
7526d07525 [IRGen] The "default" LLVM code model is now Small. 2017-08-03 10:22:01 -07:00
Erik Eckstein
d111dca25f IRGen: fix debugging timers
When enabled, those timers caused a crash when doing multithreaded whole module optimizations.
2017-06-15 15:04:34 -07:00
Arnold Schwaighofer
2e3522fafc Use clang's effective llvm triple for IR generation (#10211)
* 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
2017-06-13 16:26:14 -07:00
Jordan Rose
f0aca936c7 Allow '@objc(RuntimeName)' on classes with generic ancestry.
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
2017-06-05 17:32:25 -07:00
Graydon Hoare
56460309bc [Stats] Add always-on statistic for NumLLVMBytesOutput. 2017-05-31 17:30:40 -07:00
Joe Shajrawi
edea7d04b3 Add a flag (false by default) for large loadable types pass 2017-05-22 14:25:25 -07:00
Erik Eckstein
b1d5c77cec Runtime support for the NSArchiver class attributes.
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.
2017-05-08 14:00:03 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
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.
2017-05-05 09:45:53 +02:00
Arnold Schwaighofer
5b80649dec IRGen: Use LLVM -Os mode to compile swift
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
2017-04-20 07:59:39 -07:00
Andrew Trick
be1881aa1f Remove redundant Transform.getName() definitions.
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.
2017-04-09 15:20:28 -07:00
Saleem Abdulrasool
70771a8975 IRGen: fix construction of ArrayRef
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.
2017-03-21 14:59:07 -07:00
Slava Pestov
162b2d252e AST: Include gardening to minimize dependencies on Expr.h
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.
2017-03-12 22:26:56 -07:00
Erik Eckstein
41c17a5b0c IRGen: emit type metadata and (value) witness tables lazily.
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
2017-03-10 12:50:43 -08:00
Hugh Bellamy
1f3ff2c7d1 Change the generated code model to Large on Windows 64 bit 2017-02-18 12:46:29 +07:00
David Farler
46b869e10a [IRGen] Build fix: duplicate case value
Going with the older case, both result in an llvm_unreachable.
2017-02-07 17:13:48 -08:00
Hugh Bellamy
86d204c6fe Merge pull request #7052 from hughbe/object-model
Fix warnings for llvm::Triple::Wasm after updating LLVM to upstream
2017-02-08 08:01:55 +07:00