Commit Graph

43 Commits

Author SHA1 Message Date
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Andrew Trick
84450b4c43 Reorganize SILOptimizer directories for better discoverability.
(Headers first)

It has been generally agreed that we need to do this reorg, and now
seems like the perfect time. Some major pass reorganization is in the
works.

This does not have to be the final word on the matter. The consensus
among those working on the code is that it's much better than what we
had and a better starting point for future bike shedding.

Note that the previous organization was designed to allow separate
analysis and optimization libraries. It turns out this is an
artificial distinction and not an important goal.
2015-12-11 12:34:51 -08:00
Mark Lacey
ea4af7309e Remove another use of getInstList().
Missed this in r32307, which added front()/back() to SILBasicBlock.

Swift SVN r32318
2015-09-29 23:22:16 +00:00
Mark Lacey
8f001ed174 Use a SILBuilder in SILExtract rather than calling a ctor.
Swift SVN r32111
2015-09-21 05:58:59 +00:00
Erik Eckstein
f73e2e6ee9 Register SILAnalysis classes directly in the constructor of the PassManager.
This reduces some redundant code.



Swift SVN r31939
2015-09-14 21:56:15 +00:00
Michael Gottesman
e864f02690 In all executables make sure to completely initialize LLVM.
I also added a macro called INITIALIZE_LLVM(argc, argv) which moves this logic
into one place and should be used at the beginning of *all* binaries. It
initializes an LLVM shutdown object, sets up the pretty stack trace, and then
initializes all of the parts of LLVM. This will make it easy to update this in
the future.

The reason why a macro was required was because of llvm_shutdown_obj, an RAII
object that cleans up LLVM. It has to be at the function level scope of the main
function.

Swift SVN r31815
2015-09-09 04:37:38 +00:00
Slava Pestov
5a16405330 Fix compile errors from r31420
Swift SVN r31424
2015-08-24 00:23:59 +00:00
Jordan Rose
8106a11dac Disallow @objc on non-ObjC-rooted classes.
These classes don't show up well in generated headers (rdar://problem/20855568),
can't actually be allocated from Objective-C (rdar://problem/17184317), and
make the story of "what is exposed to Objective-C" more complicated. Better
to just disallow them.

All classes are still "id-compatible" in that they can be converted to
AnyObject and passed to Objective-C, they secretly implement NSObjectProtocol
(via our SwiftObject root class), and their members can still be individually
exposed to Objective-C.

The frontend flag -disable-objc-attr-requires-foundation-module will disable
this requirement as well, which is still necessary for both the standard
library and a variety of tests I didn't feel like transforming.

Swift SVN r29760
2015-06-27 16:27:56 +00:00
Slava Pestov
fd256e70e3 EmitGuaranteedSelf is always on now
NFC except for removal of flag

Swift SVN r28427
2015-05-11 18:21:37 +00:00
Michael Gottesman
5f1206526f Enable +0 self in both sil-opt and sil-extract.
Swift SVN r27245
2015-04-13 01:23:11 +00:00
Luqman Aden
51bf4f36ab [sil-extract] Try matching against demangled function names for -func
option.

rdar://problem/20235182

Swift SVN r27198
2015-04-10 02:22:52 +00:00
Erik Eckstein
f520ef894a Add the PassKind as a property in SILTransform.
To set the PassKind automatically, I needed to refactor some code of the pass manager and the pass definitions.
The main changes are:
1) SILPassManager now has an add-function for each pass: PM.add(createP()) -> PM.addP()
2) I removed the ARGS argument in Passes.def, which we didn't use anyway.



Swift SVN r26756
2015-03-31 14:08:19 +00:00
Luqman Aden
3f83973928 Handle multiple sib inputs.
Swift SVN r26572
2015-03-26 01:21:21 +00:00
Arnold Schwaighofer
f79e6abd2e Missing header includes ...
Swift SVN r26454
2015-03-23 22:05:47 +00:00
Luqman Aden
bc2c96d764 [sil-extract] Handle SIB inputs.
Swift SVN r26077
2015-03-13 01:30:02 +00:00
Manman Ren
a43db3621f [Driver] add InputFileKind to FrontendOptions.
Separate InputFileKind from SourceFileKind, FrontendOptions will now use
InputFileKind, while Module will use SourceFileKind.

This is in preparation for adding an input file kind for LLVM IR.

rdar://19048891


Swift SVN r25555
2015-02-26 19:13:39 +00:00
Jordan Rose
dbd3b60f6b [Serialization] Move (Module)Status and validateSerializedAST into a namespace.
Also into a separate file.

Before (swift/Serialization/SerializedModuleLoader.h):
  ModuleStatus
  SerializedModuleLoader::ValidationInfo
  SerializedModuleLoader::ExtendedValidationInfo
  SerializedModuleLoader::isSerializedAST
  SerializedModuleLoader::validateSerializedAST

After (swift/Serialization/Validation.h):
  serialization::Status
  serialization::ValidationInfo
  serialization::ExtendedValidationInfo
  serialization::isSerializedAST
  serialization::validateSerializedAST

No functionality change, just a lot of renaming and a bit of reorganizing.

Swift SVN r25226
2015-02-12 05:32:25 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Mark Lacey
c7edf7fd39 Allow sil-extract to dump all functions if no '-func' option is given.
Swift SVN r24396
2015-01-13 20:41:47 +00:00
Mark Lacey
a1a0a7d21e Add -sdk and -resource-dir options to sil-extract.
Swift SVN r24395
2015-01-13 20:24:11 +00:00
Dmitri Hrybenko
1eea220932 Use one module cache directory for all the lit tests to speed them up
Doing so is safe even though we have mock SDK.  The include paths for
modules with the same name in the real and mock SDKs are different, and
the module files will be distinct (because they will have a different
hash).

This reduces test runtime on OS X by 30% and brings it under a minute on
a 16-core machine.

This also uncovered some problems with some tests -- even when run for
iOS configurations, some tests would still run with macosx triple.  I
fixed the tests where I noticed this issue.

rdar://problem/19125022

Swift SVN r23683
2014-12-04 11:21:48 +00:00
Michael Gottesman
123b8e6f61 Access SILOptions in SILPassManager via the SILModule now that we store the SILOptions in the SILPassManager.
Swift SVN r23651
2014-12-03 20:39:05 +00:00
Michael Gottesman
85e2502f96 Pass in SILOptions to SILModule.
This should have been done a long time ago since SILOptions are options that
should be able to effect everything SIL related. In this case I just want to
pass in a flag on the SILModule to enable +0 self. By putting it on the
SILModule I can conveniently check it in SILFunctionType without exposing any
internal state from SILFunctionType.cpp.

Swift SVN r23647
2014-12-03 07:43:52 +00:00
Michael Gottesman
c99a982db1 [sil-extract] Actually delete functions in sil-extract.
sil-extract previously would get rid of the bodies of functions
significantly reducing the size of the IR. Set up a pass manager so that
we can run the actual dead function elimination pass and do an even
better job.

Swift SVN r22163
2014-09-21 23:09:47 +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
Manman Ren
52a89d59fc sil-extract: disable access control to access members from sil.
rdar://17752327


Swift SVN r21185
2014-08-13 22:41:21 +00:00
Pete Cooper
0d0defff9a Update which matches clang r212408, ie, using ErrorOr for file loading
Swift SVN r19607
2014-07-07 14:49:01 +00:00
Jordan Rose
2cac7e1c58 SIL tools always operate as -parse-stdlib, even when working with modules.
r18796 added a check that the standard library is always available when
not working in -parse-stdlib or SIL mode, but sil-opt and sil-extract have
no need to load the stdlib if the module file they're working on does not
depend on it. Treat these tools as if they are always in a -parse-stdlib mode.

This fixes the failure in witness_tables.sil, which is due to us pulling in
witness tables from all loaded modules.

Swift SVN r18807
2014-06-11 19:02:05 +00:00
Mark Lacey
a9368d137b Update file contents for rename of DeadCodeElimination.
Now that the file is called DiagnoseUnreachable.cpp, update the contents
to match.

Swift SVN r18614
2014-05-24 07:02:17 +00:00
Argyrios Kyrtzidis
796afac0af [Frontend] Rename CompilerInstance::performParse() -> performSema() to make it more clear that it is doing parsing + type checking.
Swift SVN r17597
2014-05-07 02:13:49 +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
Michael Gottesman
4e73547a3e Change SerializedSILLoader::create to return a unique_ptr and use that everywhere so we don't leak SILLoaders.
Swift SVN r15700
2014-03-31 22:57:03 +00:00
Jordan Rose
49ec7c1ea1 Use SWIFT_MODULE_CACHE_PATH for all tools.
Now that the standard library depends on Clang headers, every single tool
needs to specifically avoid using the default module cache when
SWIFT_MODULE_CACHE_PATH is set.

<rdar://problem/16294222>

Swift SVN r14937
2014-03-12 00:27:24 +00:00
Dmitri Hrybenko
255b8e88c8 Fix a leak that I introduced in r14729: FrontendOptions does not own input
buffers, so undo 'unique_ptr'fication here


Swift SVN r14733
2014-03-06 13:53:04 +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
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
Dmitri Hrybenko
fef36edc6b Try to fix the build following the LLVM raw_fd_ostream API change
Swift SVN r14304
2014-02-24 17:21:49 +00:00
Michael Gottesman
ba7dfd054a [sil-extract] Teach SILExtract how to deserialize SIL from swift modules like SILOpt.
Now sil-extract can be used on the stdlib (when we can deserialize it).

Swift SVN r14251
2014-02-22 04:11:02 +00:00
Michael Gottesman
259f657562 [sil-extract] Fix header.
Swift SVN r11395
2013-12-17 22:22:14 +00:00
Michael Gottesman
33b2564d70 [sil-extract] Instead of deleting functions, just make them have no basic blocks (i.e. be external).
This gives us as a lot of brevity and simplicity. I plan on adding a trivial
remove globals pass to sil-extract to clean these up.

The mechanism that I am using to do this is:

1. Split the entry basic block at its entrance, insert an unreachable terminator.
2. Use DCE to remove all of the original basic blocks. Thus the function will
only consist of 1 BB whose only instruction is a terminator.
3. Go through and clear the functions basic block list.

The key thing about this approach is that it leaves all of the heavy lifting to
DCE.

Swift SVN r11347
2013-12-16 11:50:43 +00:00
Michael Gottesman
73ad8921b4 Add in a simple SIL Extract utility that currently only handles functions.
This utility is similar to llvm-extract, a tool in LLVM that makes it simpler to
reduce test case by stripping out any global which matches a criteria. Currently
we only deal with functions and the only criteria is an exact name match.

Swift SVN r11343
2013-12-16 09:33:27 +00:00