Commit Graph

91 Commits

Author SHA1 Message Date
Michael Gottesman
505107ebf3 Linker changes final. 2016-02-06 11:22:27 -08:00
Michael Gottesman
c182e692f4 [upstream-update] llvm::Linker::linkModules no longer needs a NoCtx diagnostic handler. It always gets it from the llvm context. 2016-02-06 11:22:26 -08:00
Michael Gottesman
99c6e2ce55 Pass in the actual unique_ptr of the submodule to llvm::Linker::linkModules to deal with an API that was updated upstream.
What is important to note is that the submodule needs to be forwarded via a move
constructor to make sure that we do not destroy the value early.
2016-02-06 11:22:26 -08:00
Michael Gottesman
5f55a47d93 llvm::DiagnosticInfo.h upstream now has its own header llvm/IR/DiagnosticInfo.h. Include it in Immediate.cpp. 2016-02-06 11:22:26 -08:00
Michael Gottesman
248ca3d657 Update for upstream linker changes.
llvm commits:
r254449.
r254777.
2016-02-06 11:22:26 -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
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +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
Davide Italiano
7a0ab3257b [lib/Immediate] Enable built-in REPL on FreeBSD. 2015-12-22 23:46:20 +00:00
Jordan Rose
22d6437dfb Fix another -Wpessimizing-move issue.
Use braced initialization to avoid The Most Vexing Parse.
https://en.wikipedia.org/wiki/Most_vexing_parse

No functionality change.
2015-12-17 15:19:09 -08:00
Andrew Trick
739b0e9c56 Reorganize SILOptimizer directories for better discoverability.
(libraries now)

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 15:14:23 -08: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
Doug Coleman
86d99cea9b Fix eight Linux warnings.
Fix spurious docs warning that @in and @in_guaranteed should be ``fn``.

Add ``#ifdef SWIFT_OBJC_INTEROP`` to silence a -Wunused-function
on linux since that function is only used from within that #ifdef
elsewhere.

Fix three -Wunused-function warnings on linux.

Fix two -Wunreachable-code warnings on linux dealing with
SWIFT_HAVE_WORKING_STD_REGEX.
2015-12-07 15:29:41 -08:00
Jordan Rose
742c8c844f Point Linux users towards LLDB for their REPL.
The Swift compiler has a bare-bones integrated REPL for testing purposes,
but it hasn't been ported to any platforms besides OS X. The real REPL is
part of LLDB and works on both OS X and Linux.

I've already seen two questions about this error message, so at least
pointing people towards LLDB is probably a good idea.

No functionality change.
2015-12-04 16:01:23 -08:00
Joe Groff
0ad201bb05 REPL: Tear out CF-based async repl loop.
It's unnecessary nonportable complexity now that the out-of-process REPL is the primary user-facing REPL tool.

Swift SVN r32913
2015-10-27 18:02:57 +00:00
Dmitri Hrybenko
8df3dd331e Remove standard library hooks for AppKit apps in the integrated REPL
The REPL code can be simplified now.

Swift SVN r32882
2015-10-25 08:27:42 +00:00
Joe Groff
773eadb9f2 IRGen/Runtime: Populate the runtime protocol conformance table with relative references.
By using relative references, either directly to symbols internal to the current TU, or to the GOT entry for external symbols, we avoid unnecessary runtime relocations, and we save space on 64-bit platforms, since a single image is still <2GB in size. For the 64-bit standard library, this trades 26KB of fake-const data in __DATA,__swift1_proto for 13KB of true-const data in __TEXT,__swift2_proto. Implements rdar://problem/22334380.

Swift SVN r31555
2015-08-28 18:07:22 +00:00
Joe Groff
43d620c7e0 IRGen: Export direct metadata symbols at the address point of the metadata object.
This is more resilient, since we want to be able to add more information behind the address point of type objects. The start of the metadata object is now an internal "full metadata" symbol.

Note that we can't do this for known opaque metadata from the C++ runtime, since clang doesn't have a good way to emit offset symbol aliases, so for non-nominal metadata objects we still emit an adjustment inline. We also aren't able to generate references to aliases within the same module due to an MC bug with alias refs on i386 and armv7 (rdar://problem/22450593).

Swift SVN r31523
2015-08-27 05:18:38 +00:00
Joe Groff
f705c561e3 Revert "IRGen: Export direct metadata symbols at the address point of the metadata object."
This reverts commit r31515. It causes an LLVM error on the release bots.

Swift SVN r31516
2015-08-27 01:44:56 +00:00
Joe Groff
8e2ce60f5b IRGen: Export direct metadata symbols at the address point of the metadata object.
This is more resilient, since we want to be able to add more information behind the address point of type objects, and also makes IR a lot less cluttered. The start of the metadata object is now an internal "full metadata" symbol.

Note that we can't do this for known opaque metadata from the C++ runtime, since clang doesn't have a good way to emit offset symbol aliases, so for non-nominal metadata objects we still emit an adjustment inline.

Swift SVN r31515
2015-08-27 01:34:22 +00:00
Jordan Rose
14e04a95c6 [REPL] Use llvm::outs() instead of printf.
And change the welcome prompt to be less friendly.

Swift SVN r31503
2015-08-26 19:35:33 +00:00
Jordan Rose
38261ce1f3 Pull the integrated REPL out into a separate source file.
No intended functionality change, although this may make it easier to
get the REPL up and running on Linux. This is still useful for compiler
hackers even if it's not an end-user feature.

Swift SVN r31502
2015-08-26 19:35:27 +00:00
Doug Gregor
edbb75eef8 Eliminate the 'Module' variant from UnqualifiedLookupResult.
Make unqualified lookup always provide a declaration for the things it
finds, rather than providing either a module or a declaration. Unify
various code paths in our type checker now that module declarations
come in with the other declarations.

Swift SVN r28286
2015-05-07 21:10:55 +00:00
Doug Gregor
b8995b0aa3 Transform the Module class into ModuleDecl.
Modules occupy a weird space in the AST now: they can be treated like
types (Swift.Int), which is captured by ModuleType. They can be
treated like values for disambiguation (Swift.print), which is
captured by ModuleExpr. And we jump through hoops in various places to
store "either a module or a decl".

Start cleaning this up by transforming Module into ModuleDecl, a
TypeDecl that's implicitly created to describe a module. Subsequent
changes will start folding away the special cases (ModuleExpr ->
DeclRefExpr, name lookup results stop having a separate Module case,
etc.).

Note that the Module -> ModuleDecl typedef is there to limit the
changes needed. Much of this patch is actually dealing with the fact
that Module used to have Ctx and Name public members that now need to
be accessed via getASTContext() and getName(), respectively.

Swift SVN r28284
2015-05-07 21:10:50 +00:00
John McCall
753b101f6a Propagate return values from main() in -interpret mode.
rdar://20809122

Swift SVN r28139
2015-05-04 23:58:34 +00:00
Jordan Rose
69dc123a9f Don't diagnose failing to load an autolinked library in immediate mode.
Otherwise, we can run into trouble when the SDK is out of sync with the
host OS.

rdar://problem/20274745

Swift SVN r26494
2015-03-24 18:44:55 +00:00
Dmitri Hrybenko
a6a97e6543 Unbreak the build after upstream CMake changes
Swift SVN r26088
2015-03-13 04:20:04 +00:00
Erik Eckstein
460eea3b95 Let the frontend options handle multiple output files.
This will be needed for split-llvm code generation.
If multiple -o options are specified and only a single output file is needed
(currently always), the last one wins. This is NFC.



Swift SVN r25884
2015-03-09 16:24:52 +00:00
Andrew Trick
af711933b7 Update DataLayout API for upstream LLVM changes.
Swift SVN r25771
2015-03-04 23:21:47 +00:00
Manman Ren
eae8adc562 Code simplification.
Swift SVN r25450
2015-02-21 01:16:55 +00:00
Manman Ren
26431e0eac Update interface of getIRTargetOptions. Review feedback from Jordan.
Swift SVN r25441
2015-02-20 23:33:05 +00:00
Ben Langmuir
98c64214a3 Update for LLVM PassManager change r229094
PassMangager.h is gone.

Swift SVN r25272
2015-02-13 16:36:45 +00:00
Jordan Rose
75b09688c8 Reformat into an early return.
No functionality change.

Swift SVN r25122
2015-02-10 06:01:41 +00:00
Jordan Rose
e9a590e35c Initialize a stack variable.
...and hopefully fix the load failures in immediate modes.

Swift SVN r25121
2015-02-10 06:01:37 +00:00
Dmitri Hrybenko
12630f9c43 Integrated REPL: fix autolinking
The list of libraries to be loaded was not sorted in the topological
order of dependencies, and we don't know the dependencies in advance.
Now we try to load all libraries until we stop making progress.

rdar://19742274

Swift SVN r25069
2015-02-07 06:52:44 +00:00
Jordan Rose
a3a6c2695b Put the current target into LangOptions.
This has been long in coming. We always had it in IRGenOpts (in string form).
We had the version number in LangOpts for availability purposes. We had to
pass IRGenOpts to the ClangImporter to actually create the right target.
Some of our semantic checks tested the current OS by looking at the "os"
target configuration! And we're about to need to serialize the target for
debugging purposes.

Swift SVN r24468
2015-01-16 02:48:54 +00:00
Graham Batty
05e020e54b Make immediate mode work on non-osx.
Swift SVN r24279
2015-01-08 20:55:15 +00:00
Dmitri Hrybenko
6670bb76ec Rewrite the CMake build system
Swift SVN r24124
2014-12-23 22:15:30 +00:00
Jordan Rose
14a2909cab Pass -L, -l, and -framework to REPL and interpret mode jobs.
...and then honor them.

While here, make -l a little more flexible (see interpret_with_options test).

rdar://problem/17830826, which unblocks the LLDB feature for the same.

Swift SVN r24033
2014-12-19 17:33:03 +00:00
Dmitri Hrybenko
2fffe295ee Fix indentation
Swift SVN r23946
2014-12-15 21:30:28 +00:00
Quentin Colombet
14a667801c [JIT] Before linking the module of the current line for execution, save it so
it can be linked again to produce the whole IR to dump. Indeed, with the new
JIT, the link process destroys the source module.

<rdar://problem/19191413>


Swift SVN r23945
2014-12-15 21:25:31 +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
Joe Groff
17e85e60e4 Consistently set target, CPU, and subtarget options in AOT and JIT mode.
Factor out the code that sets up llvm::TargetOptions and SubtargetFeatures via Clang, and reuse it in immediate mode to properly set up the ExecutionEngine to be consistent with the environment we emitted code for. This makes it so that we can use code that lowers to, for instance, SSE3 intrinsics, in particular stuff like GLKit code imported from Clang.

Swift SVN r23646
2014-12-03 06:40:18 +00:00
Adrian Prantl
41a30f5988 Support line table only DWARF for Swift. <rdar://problem/19106981>
The new option is called -gline-tables-only to mirror clang.

Swift SVN r23615
2014-12-02 17:44:23 +00:00
Ben Langmuir
e9e1666ab0 Update for upstream LLVM changes
* removal of StringMap's GetOrCreateValue
* SmallSet::insert now returns a pair like std::set

Swift SVN r23435
2014-11-19 16:49:30 +00:00
Doug Gregor
b3badc601a Handle consistency checking that requires the entire module.
Objective-C method unintended override checking is one such case where
properly checking unintended overrides requires us to essentially look
at the whole module, because one translation unit may declare
something that produces an Objective-C method "setFoo:" in a
superclass while another translation unit declares something with a
distinct name that produces an Objective-C method "setFoo:". So, when
we don't have a primary file (e.g., when we're doing the merge-module
step), delay such checks until after all the source files for the
module have been type-checked. When there is a primary file, we
perform the checking that we can based on type checking that primary
file (and whatever got touched along the way), so we get a subset of
the proper diagnostics.

Swift SVN r23179
2014-11-08 06:20:57 +00:00
Arnold Schwaighofer
c4b4e90108 Revert "LOCAL: Revert "Adapt to llvm change "Remove the PreserveSource linker mode."""
This reverts commit r22997. Committed this by mistake sorry!

Swift SVN r22999
2014-10-29 01:57:53 +00:00
Arnold Schwaighofer
9d785080fd LOCAL: Revert "Adapt to llvm change "Remove the PreserveSource linker mode.""
This reverts commit 76e0fe125500e9b4c31aa4bf27fd19bda66246ef.

Swift SVN r22997
2014-10-29 01:56:14 +00:00