Commit Graph

263 Commits

Author SHA1 Message Date
Jordan Rose
92623006d6 Fix incorrect use of std::move.
Noticed by inspection. No functionality change because the actual argument
is a StringRef anyway.

Swift SVN r22765
2014-10-15 19:28:07 +00:00
Jordan Rose
49a6c8eb7b Do all target info management in Clang, and drop -target-abi / -target-feature.
Previously we hardcoded a few important default CPUs, ABIs, and features into
Swift's driver, duplicating work in Clang. Now that we're using Clang's
driver to create the Clang "sub-compiler", we can delegate this work to Clang.

As part of this, I've dropped the options for -target-abi (which was a
frontend-only option anyway) and -target-feature (which was a hidden driver
option and is a frontend-only option in /Clang/). We can revisit this later
if it becomes interesting. I left in -target-cpu, which is now mapped
directly to Clang's -mcpu=.

Swift SVN r22449
2014-10-01 23:55:40 +00:00
Michael Gottesman
c02643e281 Update swift for llvm trunk change r217548.
Swift SVN r21861
2014-09-11 00:30:00 +00:00
Ted Kremenek
ff5f742c68 Update Swift version to '1.1'. This includes bumping the Swift
ABI version to '2'.

This patch shows that we need to consolidate where we encode
version information in our CMake build; that's for a later patch.

Implements rdar://problem/18238390.

Swift SVN r21850
2014-09-10 20:49:59 +00:00
Michael Gottesman
4c953d7f33 Rename OptimizeARC library => LLVMPasses library.
OptimizeARC does not only contain an optimize arc pass: the library also
includes aa. What this really is a repository of the extra passes and
infrastructure that we inject into LLVM. Thus LLVMPasses is a more descriptive
name. It also matches SILPasses.

I also taught lit how to use the new llvm-opt driver for running swift llvm
passes through opt without having to remember how to setup the dynamic swift
llvm pass dylib. You can use this in lit tests by using the substitution
%llvm-opt.

Swift SVN r21654
2014-09-02 20:51:40 +00:00
Andrew Trick
9ce5894db1 Fix raw_fd_ostream calls for ToT constructor changes
Swift SVN r21447
2014-08-25 23:29:36 +00:00
Jordan Rose
64d8f31d26 [IRGen] Register Objective-C classes explicitly in immediate mode as well.
Otherwise we can't use KVO with script files.

Swift SVN r21390
2014-08-21 23:50:14 +00:00
John McCall
f7ebe89949 Set up the ARM retainAutoreleasedReturnValue markers
correctly in optimized builds.

rdar://17999904

Swift SVN r21323
2014-08-20 22:48:55 +00:00
John McCall
fd92ef7c15 Use the *Swift* ABI version in the objc_imageinfo.
Not sure what I was thinking before, especially with
the obviously-wrong comment.

Swift SVN r21221
2014-08-14 23:45:37 +00:00
Pete Cooper
5579167754 Add the swift AA pass to the LLVM pass managers called in IRGen.
These are -O results which differ by >= 1.0%

benchmark``````,`````````````baserun0``,````````optrun0```,`````````````delta,``speedup
Ackermann``````,`````````````1680.00```,````````1654.00```,`````````````26.00```,````````1.6%
ArrayLiteral```,`````````````887.00````,````````866.00````,`````````````21.00```,````````2.4%
Ary````````````,`````````````1143.00```,````````1120.00```,`````````````23.00```,````````2.1%
Ary3```````````,`````````````1221.00```,````````1191.00```,`````````````30.00```,````````2.5%
DeltaBlue``````,`````````````2279.00```,````````2219.00```,`````````````60.00```,````````2.7%
Dictionary`````,`````````````518.00````,````````489.00````,`````````````29.00```,````````5.9%
Dictionary2````,`````````````403.00````,````````380.00````,`````````````23.00```,````````6.1%
Dictionary3````,`````````````398.00````,````````373.00````,`````````````25.00```,````````6.7%
EditDistance```,`````````````1388.00```,````````1346.00```,`````````````42.00```,````````3.1%
Fibonacci``````,`````````````1407.00```,````````1391.00```,`````````````16.00```,````````1.2%
ForLoops```````,`````````````1426.00```,````````1406.00```,`````````````20.00```,````````1.4%
Forest`````````,`````````````793.00````,````````770.00````,`````````````23.00```,````````3.0%
Hash```````````,`````````````683.00````,````````676.00````,`````````````7.00````,````````1.0%
Histogram``````,`````````````369.00````,````````352.00````,`````````````17.00```,````````4.8%
Life```````````,`````````````70.00`````,````````71.00`````,`````````````1.00````,````````-1.4%
MatMul`````````,`````````````250.00````,````````240.00````,`````````````10.00```,````````4.2%
Memset`````````,`````````````44.00`````,````````42.00`````,`````````````2.00````,````````4.8%
MonteCarloE````,`````````````976.00````,````````966.00````,`````````````10.00```,````````1.0%
Phonebook``````,`````````````1530.00```,````````1508.00```,`````````````22.00```,````````1.5%
Prims``````````,`````````````1034.00```,````````1016.00```,`````````````18.00```,````````1.8%
R17315246``````,`````````````809.00````,````````801.00````,`````````````8.00````,````````1.0%
RIPEMD`````````,`````````````767.00````,````````749.00````,`````````````18.00```,````````2.4%
StrCat`````````,`````````````1119.00```,````````1095.00```,`````````````24.00```,````````2.2%
StringBuilder``,`````````````713.00````,````````692.00````,`````````````21.00```,````````3.0%
StringWalk`````,`````````````1229.00```,````````1208.00```,`````````````21.00```,````````1.7%
Totals`````````,`````````````42437.00``,````````41910.00``,`````````````527.00``,````````1.3%
TwoSum`````````,`````````````638.00````,````````631.00````,`````````````7.00````,````````1.1%

Swift SVN r21174
2014-08-13 16:30:59 +00:00
John McCall
64a6a7393b Include information about the Swift ABI version in
the objc_imageinfo record.

rdar://17528908

Swift SVN r21104
2014-08-08 02:52:42 +00:00
Adrian Prantl
e63fbc5d64 [LLVM Sync] Adapt this use of TargetMachine to the new interface
introduced in LLVM r214781.

Swift SVN r21028
2014-08-04 23:37:35 +00:00
Sean Callanan
ebbf503a6a In all cases where playgrounds need to register
classes, UseJIT will also be set, so we don't
need to check.

And there's an important case where we *don't*
need to register classes: testcases, which break
if we do try to register classes, with the
following assertion:

Assertion failed: (registered == c && "objc_readClassPair failed to instantiate the class in-place"), function swift_instantiateObjCClass, file /Volumes/Excelion/swift/lldb-work/llvm/tools/swift/stdlib/runtime/SwiftObject.mm, line 594.

So only register classes if UseJIT is enabled,
and ignore the playground flag.


Swift SVN r20655
2014-07-28 23:15:27 +00:00
Jordan Rose
b6818046a8 Eliminate optimization levels 0-3 in favor of -Onone/-O/-Ofast.
We were already effectively doing this everywhere /except/ when building
the standard library (which used -O2), so just use the model we want going
forward.

Swift SVN r20455
2014-07-24 01:12:59 +00:00
Arnold Schwaighofer
8fe003805f IRGen: Enable vectorization for OptLevel > 0
rdar://17186215

Swift SVN r18722
2014-06-06 00:34:25 +00:00
Arnold Schwaighofer
e50b489801 IRGen: Add missing calls to TargetMachine->addAnalysisPasses
rdar://17186215

Swift SVN r18721
2014-06-06 00:34:20 +00:00
Mark Lacey
cd00cfbf8f Fix some build warnings.
DEBUG_TYPE should be defined before the inclusion of LLVM's Support/Debug.h.

Swift SVN r18640
2014-05-26 20:17:54 +00:00
Jordan Rose
2d004856cf Don't try to autolink the underlying module in a mixed-source framework.
Doing so causes the linker to list the framework itself as one of its
dependencies, which confuses tools that depend on the linker's dependency
output.

<rdar://problem/17006845>

Swift SVN r18578
2014-05-22 23:50:38 +00:00
Joe Groff
6c280e27e2 IRGen: Emit runtime initialization into top_level_code for playgrounds.
To help with the playground's transition to top level code, hand the -playground frontend flag down to IRGenOptions, so that IRGen knows to emit runtime initializer code for classes and categories into top_level_code rather than an attributed function.

Swift SVN r18479
2014-05-21 02:11:09 +00:00
Greg Clayton
5977f42f86 Add code to initialize anything we need in the special debugger function for LLDB expressions, REPL and playground.
This current fix will initialize all objective C classes with the objective C runtime when any ObjC classes are defined in expressions

<rdar://problem/16029117>



Swift SVN r18037
2014-05-13 23:10:44 +00:00
Doug Gregor
3d3ff6811a Add a pile of missing #includes exposed by pruning includes in top-of-tree LLVM.
Swift SVN r17157
2014-05-01 14:26:34 +00:00
Jordan Rose
84f4d3b9fa Sink some triple predicates into swiftBasic.
getPlatformNameForTriple isn't currently being used anywhere elsee, but
this seems more consistent.

No functionality change.

Swift SVN r17002
2014-04-28 23:39:15 +00:00
Chris Lattner
a3916614ef respond to mainline API changes in the Debug.h header, by defining the
DEBUG_TYPE macro in all .cpp files that use the DEBUG macro.  Hopefully
this will unbreak the build.


Swift SVN r16638
2014-04-22 02:54:55 +00:00
John McCall
3cf3f42e98 When targeting arm64-apple-ios, the target CPU is cyclone,
which provides the Neon feature.  Do all the necessary
plumbing to get this from the driver to the backend.

Also, support -arch arm64, and diagnose bad -arch values
instead of silently ignoring them.  It's not clear to me
that we really want to support -arch as an alternative
to -target, but unless we rip it out or establish some
sort of real policy about it, it really ought to do
something approximating the right thing.

It would be nice if we could abstract enough of clang's
driver that we could re-use some of its basic logic about
tool chains and targets instaed of iteratively
rediscovering everything it does that's actually
critically important.

Swift SVN r16447
2014-04-17 06:36:03 +00:00
Jordan Rose
2c13b2e6fe Remove SwiftASTStreamerPass and the LegacyDebugInfo option.
Finishes the removal of the old "wrapped" module section that was made
unnecessary in r12922/3. Now that we no longer use the old compiler, we
don't need this at all. That also removes the need for SwiftTargetMachine.

No functionality change; this was all dead code.

Swift SVN r14758
2014-03-06 22:05:03 +00:00
Dmitri Hrybenko
f232267f23 Replace llvm::OwningPtr with std::unique_ptr
It looks like llvm::OwningPtr is going to be removed soon.


Swift SVN r14729
2014-03-06 09:47:17 +00:00
Dmitri Hrybenko
07cb1c935a Update for header move llvm/Linker.h -> llvm/Linker/Linker.h
While there, sort headers.


Swift SVN r14728
2014-03-06 08:59:38 +00:00
Dmitri Hrybenko
3d0e7ec09d Track upstream LLVM API change. DataLayout is not a Pass anymore
Swift SVN r14390
2014-02-26 10:03:45 +00:00
Chris Lattner
8ff9aa61ff remove a dead function
Swift SVN r14331
2014-02-25 01:29:43 +00:00
Dmitri Hrybenko
73aa816935 Track upstream change in raw_fd_ostream API
The default (F_None) used to mean F_Text, now it is F_Binary, which is arguably
a better default.  It only matters on Windows anyway, so just use F_None (to
mean binary mode) everywhere to allow Swift to be compled with older LLVM as
well as current ToT.


Swift SVN r14312
2014-02-24 21:00:00 +00:00
John McCall
c21a293243 Lazily emit SILFunctions with non-external linkage.
rdar://13013457

'import Cocoa' is still generating a ton of unnecessary
global metadata, which causes some unused VWTs to be built,
but at least we no longer generate tons of useless global
functions.  At least, we don't in IR-gen --- we still do
all the SILGen work for them.

Swift SVN r14224
2014-02-21 19:58:56 +00:00
John McCall
32cf8b3bac Preserve SIL function order in the parser and IRGen.
We're mostly not that bad about this right now, but lazy
emission is going to wreak havoc.

Note that SILGen itself doesn't really make very good decisions
about the order in which to emit functions, but step one
towards fixing that is actually respecting it.

Swift SVN r14200
2014-02-21 02:22:03 +00:00
Mark Lacey
5c696fda8b Make IR generation take an explicit LLVMContext.
Prior to r13134, the modules being constructed for IRGen always used the
LLVM global context due to <rdar://problem/15283227>, but the interface
should really take this as a parameter rather than baking the behavior
into IRGen.

Swift SVN r13260
2014-02-01 01:07:14 +00:00
Jordan Rose
fb21a2da84 Move LLVM passes into a library, and use opt to test them instead of swift.
These don't really have anything to do with Swift, and there's no reason to
include this capability in the new driver.

Swift SVN r13181
2014-01-30 23:42:38 +00:00
Mark Lacey
088d7b5f20 IRGenModule users shouldn't need to know about clang::CodeGenerator.
Swift SVN r13179
2014-01-30 22:59:00 +00:00
Mark Lacey
d69b305200 Generate IR for inline functions from Clang modules.
Currently only inline functions referenced from Swift source files, or
from the REPL, will get IR generated for them. Inline functions
referenced by other inline functions will require additional effort to
generate properly.

With this change we use the clang::CodeGenerator-created llvm::Module
for all IR generation in Swift. This is perhaps undesirable, but
unavoidable given the interface the public Clang APIs expose, which do
not allow for building a ModuleBuilder that borrows an existing
llvm::Module.

Also unfortunate is the hack to generate a UsedAttr for each imported
inline function, but the public Clang APIs do not provide a way to only
emit deferred decls without emitting other things (e.g. module flags
that conflict with what the Swift IRGen emits). Note that we do not do
IRGen for every inline function in the module - only the ones that the
importer pulls in, which appears to be only those transitively
referenced from Swift code.

Swift SVN r13134
2014-01-30 02:33:37 +00:00
Mark Lacey
9fde7f17cc Add DisableFPElim to IRGenOptions.
Use this to initialize the llvm::TargetOptions for code generation.

Swift SVN r13130
2014-01-30 00:26:57 +00:00
Mark Lacey
5e40837b62 Always pass an llvm::Module* to performIRGeneration().
Previously it would create a new module if one was not passed in. There
are no uses where we do not or cannot provide a module, so it seems
reasonable to make the interface consistently require a module.

Swift SVN r13016
2014-01-27 23:48:49 +00:00
Connor Wakamo
38e1fd44af [frontend] Added support for -disable-llvm-arc-opts.
Adjusted how this option is handled: it is now set in IRGenOptions. If set,
this prevents the relevant passes from being added at all, instead of making
them no-ops.

Swift SVN r13005
2014-01-27 21:22:46 +00:00
Jordan Rose
be0a303c7d [DebugInfo] Only write an AST into the object file with the current compiler.
i.e. not the new driver/frontend. That one will insert it as part of linking.

Swift SVN r12923
2014-01-24 18:42:07 +00:00
Jordan Rose
11008f0ed1 Split diagnostics out into separate files.
Thanks to the way we've set up our diagnostics engine, there's not actually
a reason for /everything/ to get rebuilt when /one/ diagnostic changes.
I've split them up into five categories for now: Parse, Sema, SIL, IRGen,
and Frontend, plus a set of "Common" diagnostics that are used in multiple
areas of the compiler. We can massage this later.

No functionality change, but should speed up compile times!

Swift SVN r12438
2014-01-17 00:15:12 +00:00
Greg Parker
927613bcac [IRGen] Set iOS simulator bit in Objective-C metadata.
Swift SVN r12325
2014-01-15 08:13:40 +00:00
Chris Lattner
1d9a826420 more mainline API drift.
Swift SVN r12227
2014-01-13 15:15:58 +00:00
Chris Lattner
914591b332 adjust for mainline llvm changes.
Swift SVN r12219
2014-01-13 01:18:48 +00:00
Jordan Rose
f09cd93194 [autolinking] Hack: autolink any module containing external definitions.
We're still synthesizing external definitions too eagerly, and things
getting pulled in only through submodules aren't getting properly autolinked.
(That is, AppKit imports <QuartzCore/CIImage.h> but doesn't think that
QuartzCore is visible, because it isn't.)

The first right answer is to detect that a part of QuartzCore is visible even
though the whole thing isn't. The second right answer is to properly handle
Clang submodules as real modules---there are a lot of rough edges there.
<rdar://problem/13140302>. The third right answer is that we shouldn't even
emit references to these symbols until the /user/ needs them.

And what I'm doing now is just to attempt to link to every module that we've
synthesized thunks for.

<rdar://problem/15754311>

Swift SVN r12031
2014-01-08 01:52:24 +00:00
Doug Gregor
4c9bda853e llvm/Assembly/PrintModulePass.h moved to llvm/IR/PrintModulePass.h
Swift SVN r11991
2014-01-07 15:25:30 +00:00
Jordan Rose
b1b50a134e Autolinking: include all imported modules.
Although Cocoa.framework re-exports AppKit, Foundation, and CoreData, an
arbitrary library does not re-export most of its imports. Normally this
would be fine, but the Clang importer can pull in types too eagerly and
then generate thunks and wrappers for things we don't care about. At least
for now, return to the behavior of autolinking /anything/ that gets visibly
imported.

<rdar://problem/15705923>

Swift SVN r11844
2014-01-03 01:21:11 +00:00
Connor Wakamo
59f18f9fc0 Renamed irgen::Options and irgen::OutputKind to IRGenOptions and IRGenOutputKind, and move both out of the irgen namespace now that they're in swiftAST.
Swift SVN r11405
2013-12-18 01:17:09 +00:00
Connor Wakamo
3e81830385 Move "include/swift/IRGen/Options.h" to "include/swift/AST/IRGenOptions.h".
This commit only moves the header file; updating the class so that it is no longer in the irgen namespace will be handled separately.

Swift SVN r11404
2013-12-18 01:17:09 +00:00
Adrian Prantl
e01d25bcb7 [Sync with ToT LLVM] Output the new debug info metadata version.
Swift SVN r11266
2013-12-13 21:20:50 +00:00