Commit Graph

655 Commits

Author SHA1 Message Date
Robert Widmann
ccf472d158 [NFC] Clean up performLLVM a bit
The only non-trivial bit is making the DiagnosticEngine parameter to swift::performLLVM required. No callers were taking advantage of this parameter allowing NULL.
2020-02-27 17:12:58 -08:00
Kuba Mracek
84c4864911 [arm64e] Add Swift compiler support for arm64e pointer authentication 2020-02-27 16:10:31 -08:00
Dan Zheng
1779632a6f [IRGen] NFC: silence llvm::MaybeAlign warnings.
Use `llvm::MaybeAlign` instead of `unsigned` to silence slew of warnings.
2020-02-20 08:49:28 +00:00
Hamish Knight
13217b600c [SILOptimizer] Add pipeline execution request
Add ExecuteSILPipelineRequest which executes a
pipeline plan on a given SIL (and possibly IRGen)
module. This serves as a top-level request for
the SILOptimizer that we'll be able to hang
dependencies off.
2020-02-14 09:58:32 -08:00
Hamish Knight
54629e1538 [SILOptimizer] Remove Stage param from SILPassManager
The value of this parameter doesn't appear to be
used for anything, as it gets immediately
overwritten by the pipeline stage name.
2020-02-14 09:57:27 -08:00
Hamish Knight
13bfac1820 Register IRGen SIL passes with the ASTContext
Rather than registering individual IRGen passes
when we want to execute them, store function
pointers to all the pass constructors on the
ASTContext. This will make it easier to requestify
the execution of pass pipelines.
2020-02-14 09:57:27 -08:00
Dmitri Gribenko
3566e6ed7a Merge pull request #29530 from swiftwasm/swiftwasm-ifdefs
[WebAssembly] Add ifdefs for the WASI target
2020-02-13 17:40:45 +01:00
Max Desiatov
67297904ac [WebAssembly] Add ifdefs for the WASI target 2020-02-08 07:37:10 +00:00
Mike Ash
cd2b54f74e Merge branch 'master' into master-rebranch 2020-01-24 11:30:32 -05:00
David Zarzycki
0fa9a96e00 [IRGen] Fully disable an assert that leaves junk in /tmp
In af0247e92c, this assert was partially
disabled and therefore the assert build compiler abandons large
temporary files that need to wait for /tmp to be cleaned days or weeks
later, if at all.
2020-01-24 07:47:49 -05:00
Erik Eckstein
1b312a85bd Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 10:39:20 +01:00
Robert Widmann
2af598fb52 [Gardening] Const-qualify Many Usages of CompilerInstance
For those operations that do not need to emit diagnostics or manipulate modules, there's no reason to mutate the passed instance.
2020-01-14 09:02:10 -08:00
Robert Widmann
bd57f14661 [NFC] Push const IRGenOptions and SILOptions everywhere 2020-01-13 22:01:41 -08:00
Robert Widmann
6407a4d36f [Gardening] Drop an unused parameter 2020-01-13 22:01:41 -08:00
Robert Widmann
eb61931012 [NFC] Grab the private discriminator for a file in IRGenDebugInfo
This was being done at an odd point in the frontend presumably because by that point the private discriminator had been fully computed.  Instead, push the conditions for generating the prefix data down to debug info generation and stop mutating IRGenOptions::DebugFlag in the frontend.
2020-01-13 22:01:41 -08:00
swift-ci
b03560174a Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-13 15:04:05 -08:00
Alex Suhan
eed6a4eb94 Expose function sections option (#28088)
* Expose separate function sections option to compiler

* Add function sections test
2020-01-13 14:45:01 -08:00
swift_jenkins
a812971ee5 Merge remote-tracking branch 'origin/master' into master-next 2019-12-17 15:00:16 -08:00
Xi Ge
93a83d3f14 IRGen: reuse linker directives collected from tbd gen to emit these symbols to IR 2019-12-12 22:22:28 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Adrian Prantl
bdc1eec983 Use the same alignment for writing and readin .swift_ast section contents.
This fixes a bug that made it impossible to read any subsequent Swift modules
out of a .swift_ast section a previous section had a size divisible by 4.

rdar://problem/57110020
2019-12-04 14:39:12 -08:00
swift_jenkins
be06b455b9 Merge remote-tracking branch 'origin/master' into master-next 2019-11-18 14:39:34 -08:00
Slava Pestov
86f6570662 Stop using SharedTimer except to implement FrontendStatsTracer
Name binding can trigger swiftinterface compilation, which creates
a new ASTContext and runs a compilation job. If the compiler was
run with -stats-output-dir, this could trigger an assertion because
SharedTimer is not re-entrant.

Fix this by replacing all direct uses of SharedTimer in the frontend
with FrontendStatsTracer. SharedTimer is still used to _implement_
FrontendStatsTracer, however we can collapse some of the layers in
the implementation later. Many of the usages should also become
redundant over time once more code is converted over to requests.
2019-11-18 12:05:49 -05:00
Jonas Devlieghere
2ab36e22f9 Adjust for upstream LLVM changes 2019-11-15 17:08:49 -08:00
swift_jenkins
b9f998ffa4 Merge remote-tracking branch 'origin/master' into master-next 2019-11-15 15:56:48 -08:00
swift-ci
e68ab43a97 Merge pull request #20474 from tinysun212/pr-swiftc-cygwin-3 2019-11-14 15:14:32 -08:00
Dan Liew
63e72909b5 [Sanitizers] Add Driver/Frontend option to enable sanitizer instrumentation that supports error recovery.
The new option `-sanitize-recover=` takes a list of sanitizers that
recovery instrumentation should be enabled for. Currently we only
support it for Address Sanitizer.

If the option is not specified then the generated instrumentation does
not allow error recovery.

This option mirrors the `-fsanitize-recover=` option of Clang.

We don't enable recoverable instrumentation by default because it may
lead to code size blow up (control flow has to be resumable).

The motivation behind this change is that today, setting
`ASAN_OPTIONS=halt_on_error=0` at runtime doesn't always work. If you
compile without the `-sanitize-recover=address` option (equivalent to
the current behavior of the swift compiler) then the generated
instrumentation doesn't allow for error recovery. What this means is
that if you set `ASAN_OPTIONS=halt_on_error=0` at runtime and if an ASan
issue is caught via instrumentation then the process will always halt
regardless of how `halt_on_error` is set. However, if ASan catches an
issue via one of its interceptors (e.g. memcpy) then `the halt_on_error`
runtime option is respected.

With `-sanitize-recover=address` the generated instrumentation allows
for error recovery which means that the `halt_on_error` runtime option
is also respected when the ASan issue is caught by instrumentation.

ASan's default for `halt_on_error` is true which means this issue only
effects people who choose to not use the default behavior.

rdar://problem/56346688
2019-11-12 11:33:58 -08:00
Nathan Lanza
e170f43d6f [IRGen] Change a pass to agree with a merged pair of passes upstream
SanitizerCoveragePass was meerged with ModuleSanitizerCoverage upstream
and thus this usage needs to agree.
2019-09-05 11:31:53 -07:00
Arnold Schwaighofer
20efacf2d6 Merge remote-tracking branch 'upstream/master' into master-next 2019-08-26 13:30:41 -07:00
swift-ci
ff7d2c2503 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-26 13:04:27 -07:00
Arnold Schwaighofer
af0247e92c Disable this check for now some bots are failing
rdar://54708850
2019-08-26 12:45:28 -07:00
Arnold Schwaighofer
2b41f8d8d5 Merge remote-tracking branch 'origin/master' into master-next 2019-08-26 08:57:42 -07:00
swift-ci
86e95c23aa Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-23 17:43:50 -07:00
Brent Royal-Gordon
f61dd7bc1a [NFC] Hash LLVM options more robustly
Replaces getLLVMCodeGenOptionsHash(), which combined a bunch of individual bits into a string, with writeLLVMCodeGenOptionsTo(), which writes each one separately into a raw_ostream.

This is intended to be make the hashing more future-proof. The current design needs to know exactly how many bits each of the values needs; if any of the values grew and you forgot to update this function, its bits would interfere with those of an earlier value in the hash. This new design is expected to be slightly slower, but more robust to future change in the compiler.
2019-08-23 15:17:11 -07:00
Brent Royal-Gordon
413e718811 Assert correctness of performLLVM() incremental builds
In assert builds, when performLLVM() would normally skip invoking LLVM because it believes it would generate the same code, it now generates code into a temporary file and compares it to the output. This should catch mistakes where Swift configures LLVM in ways which affect the output, but which the incremental logic doesn’t account for.
2019-08-22 19:38:08 -07:00
Brent Royal-Gordon
5cd505ae1a [NFC] Extract helper from performLLVM()
We do a particular dance to diagnose errors twice, and we’re about to do it three times.
2019-08-22 16:02:02 -07:00
Alex Langford
04c5ceb18c Adjust for svn r368826
LLVM svn r368826 changed the SectionRef::getName() interface to return an
Expected<StringRef> instead of filling out one that is passed to it.
Adjust accordingly.
2019-08-15 10:56:06 -07:00
Vedant Kumar
65c5ca4fc2 [SanitizerCoverage] Adopt new API to construct a pass instance for the legacy PM
<rdar://problem/53676581> [master-next] error: use of undeclared identifier 'createSanitizerCoverageModulePass'
2019-07-29 13:39:35 -07:00
Saleem Abdulrasool
d4af68c234 Revert "Updating usage of SanitizerCoverage."
This reverts commit 913977bfb1.
SVN r366153 reverts the necessary LLVM changes.
2019-07-16 15:18:10 -07:00
Puyan Lotfi
913977bfb1 Updating usage of SanitizerCoverage. 2019-07-12 11:53:56 -07:00
Gwen Mittertreiner
67cfef2d60 SectionRef::getContents() now returns Expected
Updated uses of object::SectionRef::getContents() since it now returns
an Expected<StringRef> instead of modifying the one it's passed.

See also: git-svn-id:
https://llvm.org/svn/llvm-project/llvm/trunk@360892
91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 16:02:41 -07:00
swift-ci
f01b166f3d Merge remote-tracking branch 'origin/master' into master-next 2019-03-13 20:49:17 -07:00
Arnold Schwaighofer
c2aab0018f Merge pull request #23214 from aschwaighofer/remove_heap_allocation_of_std_thread
IRGen: Remove heap allocation of std::thread
2019-03-13 20:34:16 -07:00
Saleem Abdulrasool
b97857e99f IRGen: adjust for SVN r355989
SVN r355989 adds support for the XCOFF file format.  For now, treat it as a COFF
target, though XCOFF and COFF are different.
2019-03-13 13:31:24 -07:00
swift-ci
e106bdaa17 Merge remote-tracking branch 'origin/master' into master-next 2019-03-12 09:09:02 -07:00
Arnold Schwaighofer
4682caa292 IRGen: Move coroutine passes to be scheduled before tsan
The coroutine transformation passes can't seem to handle tsan'ified
code.

My attempt at reducing a test case failed.

rdar://48719789
2019-03-11 14:30:01 -07:00
Arnold Schwaighofer
76bf9f4ffa IRGen: Remove heap allocation of std::thread 2019-03-11 12:42:22 -07:00
swift-ci
cf177cc3eb Merge remote-tracking branch 'origin/master' into master-next 2019-03-06 07:49:31 -08:00
Arnold Schwaighofer
38063aa96a Increase the stack size limit for running llvm codegen threads to 8MB
Without this compilation may fail in llvm because we run out of stack space. The
limit for the main thread is 8MB on mac osx but 512KB for other threads.

rdar://47787344
2019-03-05 09:50:16 -08:00
Saleem Abdulrasool
e800003c7a IRGen: adjust for SVN r353985
Adjust for ASAN being ported to the new pass manager.
2019-02-19 09:30:53 -08:00