Commit Graph

170 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Erik Eckstein
37762bd65f Adapt to llvm change "Remove the PreserveSource linker mode."
The llvm commit message suggests that the linker mode might be re-activated again.
Therefore I have only commented out the relevant code and not removed it.



Swift SVN r22989
2014-10-28 13:30:19 +00:00
Michael Gottesman
2691142e3c Unbreak build by update for LLVM API change.
Swift SVN r22949
2014-10-26 21:34:32 +00:00
Joe Groff
cac5807ae2 SILGen: Emit "main" as a SIL function.
Eliminate the intermediate top_level_code function. Now that SIL is expressive enough to express a "main" function, there's no reason for it, and this eliminates a bunch of mystery code in IRGen to thunk from main to top_level_code by reaching for hardcoded symbol names. Demystify the special code for setting up C_ARGC and C_ARGV by having SILGen look for a transparent "_didEnterMain" hook in the stdlib and emit a call to it.

Swift SVN r22525
2014-10-05 04:13:24 +00:00
Graham Batty
ad410d6d48 Add stub REPL driver for non-Apple
Swift SVN r22358
2014-09-29 19:02:29 +00:00
Lang Hames
b28cfbc5b6 Remove setUseMCJIT calls in lib/Immediate/Immediate.cpp - now that the old JIT
has been removed, MCJIT is the default.

<rdar://problem/16525932>


Swift SVN r22194
2014-09-23 01:04:38 +00:00
Lang Hames
4b39fcc14a Remove #include of JIT.h from lib/Immediate/Immediate.cpp.
The REPL is using MCJIT now, and the old JIT (JIT.h) is going away.



Swift SVN r22187
2014-09-22 21:55:51 +00:00
Lang Hames
76422d06f5 Switch the interpreter and REPL modes (lib/Immediate/Immediate.cpp) over to
MCJIT.

<rdar://problem/16525932>


Swift SVN r22184
2014-09-22 21:34:44 +00:00
Michael Gottesman
c02643e281 Update swift for llvm trunk change r217548.
Swift SVN r21861
2014-09-11 00:30:00 +00:00
Dmitri Hrybenko
42b25d939d Update for upstream LLVM changes is MemoryBuffer APIs
Swift SVN r21409
2014-08-22 08:28:03 +00:00
Jordan Rose
9ddf57f7ba Don't treat missing imports as a fatal error in REPL mode.
We don't want typos in import statements to take down the whole REPL, but we
/do/ want the REPL to be honoring fatal errors that effectively take down the
ASTContext.

This doesn't (yet) apply to the real LLDB REPL, which does not use
SourceFileKind::REPL for its input. The right option to test there is
LangOpts.DebuggerSupport, but that's currently being set for Playgrounds as
well. I've filed <rdar://problem/18090611> for LLDB to adjust their input.

Part of <rdar://problem/17994094>

Swift SVN r21383
2014-08-21 22:36:22 +00:00
Dmitri Hrybenko
826f6cfd1f Update for upstream LLVM API changes
Swift SVN r21279
2014-08-19 13:15:08 +00:00
Jordan Rose
4eebcb9853 Change ASTContext's LoadedModules map to be keyed by Identifiers, not strings.
No intended functionality change, but there's no reason to be performing
string lookups here.

Swift SVN r20902
2014-08-01 18:03:47 +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
Doug Gregor
71cd9245ba Rename swift_stdlib_core -> swiftCore and swift_runtime -> swiftRuntime.
We can't use underscores in plists, so just makes the names consistent
<rdar://problem/17652418>.

Swift SVN r19954
2014-07-14 22:19:03 +00:00
Jordan Rose
373f0ce863 [Interpreter] Honor -F when trying to dlopen framework dependencies.
Previously we were only getting system search paths (via dlopen), so you
couldn't ever load system frameworks.

This is the compiler side of <rdar://problem/17629517>, which is
unfortunately not the useful part.

Swift SVN r19831
2014-07-10 22:02:02 +00:00
Dmitri Hrybenko
b9b7121d5c More updates for '0' being new invalid buffer ID
Swift SVN r19610
2014-07-07 14:57:24 +00:00
Mark Lacey
dccd703315 Use <system_error> rather than llvm/Support/system_error.h.
Rafael removed the latter in r210803.

Swift SVN r18842
2014-06-12 21:53:16 +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
Dmitri Hrybenko
1352536722 stdlib: move REPL hooks to private namespace
Swift SVN r17818
2014-05-10 01:13:08 +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