Commit Graph

156 Commits

Author SHA1 Message Date
swift-ci
d782c18cff Merge remote-tracking branch 'origin/master' into master-next 2017-12-19 14:29:52 -08:00
Joe Shajrawi
91d763e5ac Lower the FunctionMergeThreshold from 30 to 15 2017-12-19 11:20:33 -08:00
Bob Wilson
47dde9695d [master-next] Update to use ModRefInfo enum from llvm r320107 2017-12-08 16:51:49 -08:00
Arnold Schwaighofer
3ae6d7cb4d runtime/IRGen: return the argument from swift_retain family of functions
On architectures where the calling convention uses the same argument register as
return register this allows the argument register to be live through the calls.

We use LLVM's 'returned' attribute on the parameter to facilitate this.

We used to perform this optimization via an optimization pass. This was ripped
out some time ago around commit 955e4ed652.
By using LLVM's 'returned' attribute on swift_*retain, we get the same
optimization from the LLVM backend.
2017-09-19 07:16:37 -07:00
swift-ci
a9bcdddb77 Merge remote-tracking branch 'origin/master' into master-next 2017-05-24 17:48:35 -07:00
Erik Eckstein
d342041420 Mangling: use ‘Tm’ mangling for merged functions
Previously merged functions just got the name with a “_merged” suffix
2017-05-24 17:00:16 -07:00
Michael Gottesman
28df98f971 Merge remote-tracking branch 'origin/master' into master-next 2017-05-08 14:57:21 -07:00
Michael Gottesman
3f1a3c7cb8 [llvm-arc] Remove dead incorrect code.
The code I am ripping out was meant to look at the input argument, not the
return value so was incorrect. Luckily this code was actually dead since whether
or not we returned no capture or unknown, we bailed.

Since the code is already dead, just rip it out.
2017-05-08 12:06:31 -07:00
Bob Wilson
8d61e93e81 Adapt to LLVM r301812 rename of WeakVH to WeakTrackingVH 2017-05-07 22:25:49 -07:00
Bob Wilson
e917b3cabf Tidy loop iterator to match the MergeFunctions.cpp change from LLVM r273808 2017-05-07 22:23:34 -07:00
Bob Wilson
4051d57d12 Adjust for LLVM r302060: avoid ArgNo+1 attribute indexing 2017-05-06 22:01:34 -07:00
swift-ci
502bda365b Merge remote-tracking branch 'origin/master' into master-next 2017-05-05 13:48:34 -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
Bob Wilson
c35eed4964 Update SwiftMergeFunctions::replaceDirectCallers to match LLVM r300272 2017-04-16 22:05:15 -07:00
Bob Wilson
dcf374dbed Adjust for LLVM r299949: Remove nullptr for Module::getOrInsertFunction
Module::getOrInsertFunction no longer needs the trailing nullptr argument,
and leaving it there causes a crash.
2017-04-13 14:35:07 -07:00
Bob Wilson
bd81b41de4 Update Swift master-next after LLVM API change in r300014.
AttributeSet was added back again, wrapping AttributeSetNode*.
2017-04-13 11:25:22 -07:00
swift-ci
6b8c0aa04a Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 20:28:32 -07:00
Saleem Abdulrasool
cfb9da8dfe Adjust for SVN r299899 2017-04-11 18:19:49 -07:00
Erik Eckstein
f3a7824028 MergeFunctions: now really handle self recursions correctly.
fixes rdar://problem/31519893
2017-04-11 13:57:29 -07:00
Bob Wilson
701ed9d907 Merge remote-tracking branch 'origin/master' into master-next 2017-04-07 15:36:24 -07:00
Erik Eckstein
2584078e3c MergeFunctions: handle self recursive functions correctly.
First, it fixes a crash where the eliminated function is still referenced.
This shows up if two equivalent self-recursive functions are merged and those functions are internal.
Fixes SR-4514, rdar://problem/31479425

Second, it avoids creating a not needed parameter for really equivalent self recursive functions.
2017-04-07 14:21:26 -07:00
Saleem Abdulrasool
15565c116a Adjust for SVN r298393 2017-03-22 07:44:03 -07:00
Erik Eckstein
5e80555c9b demangler: put the demangler into a separate library
Previously it was part of swiftBasic.

The demangler library does not depend on llvm (except some header-only utilities like StringRef). Putting it into its own library makes sure that no llvm stuff will be linked into clients which use the demangler library.

This change also contains other refactoring, like moving demangler code into different files. This makes it easier to remove the old demangler from the runtime library when we switch to the new symbol mangling.

Also in this commit: remove some unused API functions from the demangler Context.

fixes rdar://problem/30503344
2017-03-09 13:42:43 -08:00
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
practicalswift
65b0219f7b [gardening] Fix typos 2017-02-14 20:04:08 +01:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00
practicalswift
0193f2b872 [gardening] Fix typos 2017-02-04 09:22:38 +01:00
Erik Eckstein
36c807b0d1 LLVM passes: use new FunctionComparator utility in the SwiftMergeFunctions pass.
Now that the FunctionComparator is a separate utility in LLVM, the SwiftMergeFunctions pass can use it instead of duplicating the code.
This is pure refactoring. NFC.
2017-01-27 13:53:13 -08:00
Han Sangjin
b8dd577693 [swiftc] Fixed for Cygwin
Fixed for the difference of Cygwin with other Windows variants (MSVC,
Itanium, MinGW).

- The platform name is renamed to "cygwin" from "windows" which is used
  for searching the standard libraries.

- The consideration for DLL storage class (DllExport/DllImport) is not
  required for Cygwin and MinGW. There is no problem when linking in
  these environment.

- Cygwin should use large memory model as default.(This may be changed
  if someone ports to 32bit)

- Cygwin and MinGW should use the autolink feature in the sameway of
  Linux due to the linker's limit.
2017-01-19 05:48:24 +09:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Michael Gottesman
59c6a64f5a [gardening] 0 => nullptr. Fixed with clang-tidy. 2016-12-06 23:14:13 -08:00
Hugh Bellamy
1aa951dfb2 Fix errors and warnings building swift/IRGen on Windows using MSVC (#5958) 2016-11-30 13:27:02 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
4552fc8f88 [gardening] Use American English: "behaviour" → "behavior" 2016-11-05 20:33:57 +01:00
Michael Gottesman
b018645418 [semantic-arc] Add __swift_endBorrow support to LLVMPasses and make sure it is removed by LLVMARCContract.cpp. 2016-10-17 14:43:28 -07:00
Michael Gottesman
1ed04f8d94 [semantic-arc] Use BaseModRef effects from LLVMSwift.def in LLVMSwiftAA instead of a switch. 2016-10-17 14:43:28 -07:00
Michael Gottesman
7f45e39af6 [semantic-arc] Update parsing of Swift function names in LLVM to use LLVMSwift.def. 2016-10-17 14:43:28 -07:00
Michael Gottesman
21ec1109fa [semantic-arc] Add LLVMSwift.def for metaprogramming Swift Operations in LLVM.
For semantic ARC I need to add an endBorrow entrypoint that will be removed by
ARCContract.cpp. In the process I am doing a little bit of cleanup.

In this commit, I only use this to generate the enum RT_Kind in LLVMARCOpts.h. I
verified it was the same using a diff tool. I am going to do further updates in
subsequent commits to make the diff easy to see.
2016-10-17 14:43:28 -07:00
Saleem Abdulrasool
8e1a88e985 LLVMPasses: fix DLL storage for merged functions
When constructing the body of the merged function, the internal function is
given internal linkage always.  It is only accessible through the adjusting
thunks which retain the original DLL storage.  Ensure that we reset the DLL
storage which it inherited from the first function.
2016-10-06 08:09:23 -07:00
Erik Eckstein
bd0d2bfed4 Remove the LLVM stack promotion pass and related SIL optimization logic.
It's not needed anymore because array buffers are now allocated with alloc_ref instead of a swift_bufferAllocate runtime call.
2016-09-16 11:02:19 -07:00
Dmitri Gribenko
fbb3cf35a5 Revert "New SIL instructions to support tail-allocated arrays in SIL." 2016-09-15 00:25:25 -07:00
Erik Eckstein
6ae818c9d1 Remove the LLVM stack promotion pass and related SIL optimization logic.
It's not needed anymore because array buffers are now allocated with alloc_ref instead of a swift_bufferAllocate runtime call.
2016-09-14 14:54:18 -07:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Xin Tong
026cee2f84 Fix a globalvariable initializer bug in LLVMSwiftARC 2016-08-22 14:23:21 -07:00
Michael Gottesman
b3819c6783 [cmake] Rename COMPONENT_DEPENDS to LLVM_COMPONENT_DEPENDS (#4311)
Now that I am going to be adding an IN_SWIFT_COMPONENT argument, I need to do
this to distinguish the concepts of an LLVM_COMPONENT and a SWIFT_COMPONENT.
2016-08-16 12:13:34 -04:00
Mark Lacey
4b826b1e2e Silence a few release-build warnings. 2016-07-23 18:33:45 -07:00
Mark Lacey
1c00ac4c6d Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/IRGen/IRGen.cpp
	test/DebugInfo/parent-scope.swift
2016-07-15 19:23:53 -07:00
Saleem Abdulrasool
7352392830 IRGen: add support for DLL Storage semantics
Add initial support for modelling DLL Storage semantics for global values.  This
is needed to support the indirect addressing mechanism used on Windows.
2016-07-06 18:03:57 -07:00
Saleem Abdulrasool
3ad600faa6 MergeFunctions: use a custom ordering comparator
This updates MergeFunctions with a custom ordering comparator for the
AtomicOrdering.  This is needed after a LLVM API change which changes the
AtomicOrdering to a strongly typed enumeration.
2016-06-25 01:57:24 -07:00