Commit Graph

265 Commits

Author SHA1 Message Date
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
Michael Gottesman
8d00a6cb59 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	stdlib/public/SDK/GameplayKit/CMakeLists.txt
	test/DebugInfo/bound-namealiastype.swift
	test/DebugInfo/structs.swift
	test/IRGen/c_globals.swift
	test/SourceKit/DocSupport/doc_clang_module.swift
	test/SourceKit/Indexing/index_with_clang_module.swift
	utils/update-checkout
2016-06-25 01:13:50 -07:00
Brian Gesiak
328de9e280 [SR-1738] add_swift_library takes SHARED/STATIC arg
As a first step to allowing the build script to build *only*
static library versions of the stdlib, change `add_swift_library`
such that callers must pass in `SHARED`, `STATIC`, or `OBJECT_LIBRARY`.

Ideally, only these flags would be used to determine whether to
build shared, static, or object libraries, but that is not currently
the case -- `add_swift_library` also checks whether the library
`IS_STDLIB` before performing certain additional actions. This will be
cleaned up in a future commit.
2016-06-16 13:15:58 -04:00
practicalswift
5a3067e24e [gardening] Fix plural issues. 2016-05-21 18:45:31 +02:00
Mark Lacey
da9c346444 Functions with differing phis should not be merged.
Check that the incoming blocks of phi nodes are identical, and block
function merging if they are not.

rdar://problem/26387654
2016-05-20 08:58:43 -07:00
Michael Gottesman
79ca98da41 [cmake] Properly use COMPONENT_DEPENDS when adding the dependency from swiftLLVMPasses on LLVMAnalysis.
We were previously just getting lucky. This ensures that we are doing this correctly.

rdar://26357000
2016-05-18 16:20:24 -07:00
eeckstein
951086f62e Merge pull request #2531 from practicalswift/fix-llvmmergefunctions-header
[gardening] Add licensing preamble.
2016-05-16 13:49:52 -07:00
practicalswift
e6e360bcfb Merge pull request #2535 from practicalswift/code-whitespace
[gardening] Add missing whitespace.
2016-05-15 07:46:22 +02:00
practicalswift
54427ca61e [gardening] Add missing whitespace. 2016-05-15 07:45:52 +02:00
swift-ci
04f44e22f9 Merge pull request #2533 from practicalswift/remove-unused-var 2016-05-14 18:27:53 -07:00
practicalswift
21c872c590 [gardening] Fix recently introduced typos. 2016-05-14 20:33:28 +02:00
practicalswift
6cc92e78b4 [gardening] Remove unused variable FuncsInCallCycleToMerge. 2016-05-14 19:49:48 +02:00
practicalswift
db585be16f [gardening] Add licensing preamble. 2016-05-14 19:25:50 +02:00
Erik Eckstein
cbe78e0839 fix build error in LLVMMergeFunctions caused by upstream llvm changes
(cherry picked from commit 610996a71fade98ea43d9047740feb02b8d4eac3)
2016-05-13 22:04:50 -07:00
Saleem Abdulrasool
f363c5496e [upstream-update] update AA interface usage
SVN r262490 reformulated the Alias Analysis interfaces.  The TLI is no longer
needed to construct the AA Result.  Because the TLI was used specifically for
the base constructor, we now no longer need that option.  Simplify it according
to the new API.  NFC.

(cherry picked from commit 12dc8a831c)
(cherry picked from commit 270a4c240781e012a1c0d63c581102707130e02b)
2016-05-13 22:03:24 -07:00
Erik Eckstein
f0022a5aac Add an LLVM pass to merge similar functions.
It's like LLVM's MergeFunctions pass, except that it can also merge functions which differ by some constants.
The intention is to merge specialized functions which only differ by metadata lookups. But it can also merge other types of functions.
It gives ~7% code size reducation for the stdlib.

There are still some open TODOs, e.g. to share common code with LLVM's MergeFunctions pass (currently much code is just copied).
2016-05-11 09:46:46 -07:00
Doug Gregor
77a876877f Adjust to LLVM r265762. 2016-04-14 10:13:10 -07:00
John McCall
21e9f5949a Merge remote-tracking branch 'origin/master' into master-next 2016-04-08 13:29:39 -07:00
Roman Levenstein
d8e28bb690 Handle the [nonatomic] attribute in IRGen and LLVM passes.
Properly lower reference counting SIL instructions with nonatomic attribute as invocations of corresponding non-atomic reference counting runtime functions.
2016-04-06 22:30:23 -07:00
practicalswift
a45e7b82fb [gardening] Fix recently introduced typo: "targe" → "target" 2016-04-02 11:31:26 +02:00
Roman Levenstein
b985794992 Prepare IRGen and LLVM passes to use the new preserve_most calling convention, but do not enable it yet.
The convention should be enabled once we can properly build the runtime library using Siwft's own clang/llvm binaries.
2016-04-01 14:19:47 -07:00
Saleem Abdulrasool
12dc8a831c [upstream-update] update AA interface usage
SVN r262490 reformulated the Alias Analysis interfaces.  The TLI is no longer
needed to construct the AA Result.  Because the TLI was used specifically for
the base constructor, we now no longer need that option.  Simplify it according
to the new API.  NFC.
2016-03-26 02:01:19 -07:00
Erik Eckstein
bf87de3bc3 Fix a memory leak caused by the ReleaseDevirtualizer.
This occured if a stack-promoted object with a devirtualized final release is not actually allocated on the stack.
Now the ReleaseDevirtualizer models the procedure of a final release more accurately.
It inserts a set_deallocating instruction and calles the deallocator (instead of just the deinit).

This changes also includes two peephole optimizations in IRGen and LLVMStackPromotion which get rid of
unused runtime calls in case the stack promoted object is really allocated on the stack.

This fixes rdar://problem/25068118
2016-03-15 12:56:54 -07:00
Roman Levenstein
2ff5755dc3 Use the "rt_" prefix for all generated wrappers to distinguish them from the actual runtime functions. 2016-02-25 06:00:30 -08:00
Roman Levenstein
99fd8b6080 Rename some macros based on the PR review comments.
- use  the SWIFT prefix for all macros
- make names of some macros shorter
2016-02-25 05:31:00 -08:00
Roman Levenstein
de3b850ce8 Use more descriptive names for calling conventions.
Rename RuntimeCC into DefaultCC
Rename RuntimeCC1 into RegisterPreservingCC
Remove RuntimeCC0 because it was identical to DefaultCC.
2016-02-25 05:31:00 -08:00
Roman Levenstein
ec04b22145 Properly propagate the calling convention into LLVM's call instructions.
Each runtime function definition in RuntimeFunctions.def states which calling convention
should be used for this runtime function.  But IRGen and LLVMPasses were not always
properly propagating this declared calling convention all the way down to llvm's Call instructions.
In many cases, the standard C convention was set for the call irrespective of the actual calling
convention defined for a given runtime function. As a result, incorrect code was generated.

This commit tries to fix all those places, where such a mismatch was found. In many cases this is
achieved by defining a helper function CreateCall in such a way that makes sure that the call instruction
gets the same calling convention as the one used by its callee operand.
2016-02-25 05:30:59 -08:00
Roman Levenstein
7350fee0e3 LLVMPasses should generate LLVM IR declarations of runtime functions in the same way as done by IRGen.
Make use of the re-usable functionality provided by IRGen. This ensures that LLVM IR generated by IRGen and
LLVMPasses for runtime functions declarations or wrappers is always in sync.
2016-02-25 05:30:58 -08:00
Roman Levenstein
4a93b3e78b Add include guards to LLVMArcOpts.h. 2016-02-17 16:12:09 -08:00
practicalswift
dd3508c785 [gardening] Fix header consistency for newly introduced file. 2016-02-10 22:14:58 +01:00
Erik Eckstein
9e28192ea3 Option -print-llvm-inline-tree for printing the inline-tree of the LLVM module.
This is useful to get information about what inlined functions contribute to the code size.
2016-02-10 12:14:23 -08:00
practicalswift
ca92efc8e6 Use consistent formatting of header comments.
Correct format:
```
//===--- Name of file - Description ----------------------------*- Lang -*-===//
```

Notes:
* Comment line should be exactly 80 chars.
* Padding: Pad with dashes after "Description" to reach 80 chars.
* "Name of file", "Description" and "Lang" are all optional.
* In case of missing "Lang": drop the "-*-" markers.
* In case of missing space: drop one, two or three dashes before "Name of file".
2016-01-04 23:00:53 +01:00
practicalswift
f91525a10f Consistent placement of "-*- [language] -*-===//" in header. 2016-01-04 09:46:20 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
149b50d901 Fix typos in code (non-comment/documentation typos). 2015-12-28 11:42:15 +01:00
Slava Pestov
36ddea64ae Merge pull request #729 from ken0nek/fix-can-not
Convert [Cc]an not -> [Cc]annot
2015-12-22 16:06:20 -08:00
practicalswift
6e3b700b44 Fix typos. 2015-12-23 00:31:13 +01:00
ken0nek
fcd8fcee91 Convert [Cc]an not -> [Cc]annot 2015-12-23 00:55:48 +09:00
Joe Groff
cf87b9d571 IRGen: Generate swift_fixLifetime marker as a private stub.
This lets us remove `swift_fixLifetime` as a real runtime entry point. Also, avoid generating the marker at all if the LLVM ARC optimizer won't be run, as in -Onone or -disable-llvm-arc-optimizer mode.
2015-12-21 18:06:18 -08:00
practicalswift
cd7d8dfaff Fix alignment as requested by @gribozavr in #692 2015-12-21 08:54:24 +01:00
practicalswift
176f487d76 Fix incorrect filenames in headers. 2015-12-20 23:59:05 +01:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00