Commit Graph

655 Commits

Author SHA1 Message Date
Jordan Rose
49cd5b1680 Use SourceFile in IRGen.
The only real change here is that module-wide IR (autolinking and ObjC
runtime flags) have been pushed up from emitTranslationUnit (now
emitSourceFile) to its only caller, performIRGeneration.

Swift SVN r9075
2013-10-09 18:38:24 +00:00
Joe Groff
bea03d27f4 Bring back frame pointers.
The backend team needs them for performance analysis.

Swift SVN r8791
2013-09-30 20:29:18 +00:00
Michael Gottesman
4dc7cee606 Add in the option -disable-llvm-optzns to swift.
-disable-llvm-optzns in clang tells the frontend to do everything it would
normally do at lets say -O2, except run the actual LLVM IR passes on the
resulting IR. This is useful in the case where one wants to look at the result
of a non gauranteed SIL optimization pass at the IR level without llvm
optimizations applied.

Swift SVN r8594
2013-09-24 16:48:09 +00:00
Adrian Prantl
4829626f80 Pin the DWARF version to 3 until everyone has access to an updated
version of ld64. (echristo bumped the default for LLVM to 4 yesterday).

Swift SVN r7905
2013-09-04 17:55:33 +00:00
Jordan Rose
1e3b418f27 Remove hacks to speed up includes of "swift.swift", which doesn't exist now.
Swift SVN r7489
2013-08-22 23:20:25 +00:00
Jordan Rose
f1bc7801f4 Rework getReexportedModules to optionally find all imported modules.
...instead of just those that are re-exported. This will be used for
autolinking (and probably few other places).

As part of this, we get two name changes:
  (1) Module::getReexportedModules -> getImportedModules
  (2) TranslationUnit::getImportedModules -> getImports

The latter doesn't just get modules-plus-access-paths; it also includes
whether or not the import is re-exported. Mainly, though, it just didn't
seem like a good idea to overload this name when the two functions aren't
really related.

No tests yet, will come with autolinking.

Swift SVN r7487
2013-08-22 23:20:18 +00:00
Adrian Prantl
661315763a Debug Info: This patch implements the "emit modules when compiling -g"
proposal.
When compiling with debug info, build a swiftmodule that contains all the
type decls referenced by DWARF and emit it into a special __apple_swiftast
section in the .o file.

Swift SVN r7398
2013-08-21 01:07:30 +00:00
Joe Groff
8baa585bab IRGen: Add FixedTypeInfo methods for extra inhabitants/spare bits.
Dynamic forms of these methods will ultimately move to the fully general TypeInfo class, but for now I'm focusing on getting fixed-layout unions working. Set up methods on FixedTypeInfo for getting the fixed count of extra inhabitants and the spare bit mask for a type. Have the default implementation of extra inhabitants count use the spare bits. For now, only actually set spare bits for types with IR-level single scalar non-power-of-two integer representation (e.g., i1, or i21).

Swift SVN r7289
2013-08-16 20:56:28 +00:00
Jordan Rose
a35f7cbd4b Thread [exported] through TranslationUnit and the Serialization library.
This still doesn't do anything yet.

Swift SVN r7051
2013-08-08 19:09:21 +00:00
Chris Lattner
8956e856c6 remove the old AST capture analysis pass completely. The primary IR
gen pass has had it disabled for some time, so snip the last few uses
in the REPL and zap it.

Goodbye old friend, you were a very useful stopgap.


Swift SVN r6885
2013-08-05 14:14:17 +00:00
Adrian Prantl
adfdd7edc6 typo.
Swift SVN r6811
2013-08-01 18:47:40 +00:00
Chris Lattner
11f5b48a27 Fix a -Wdocumentation warning, and hack out NoFramePointerElimNonLeaf to
fix the build.  This isn't a proper fix (we should start putting out new attributes
on llvm::Function's, but getting the build working again seems important.


Swift SVN r6584
2013-07-25 03:41:57 +00:00
Jordan Rose
6547b9790a [serialization] Allow references to Clang-imported values.
This unfortunately duplicates the hack of directly referencing the Clang
module loader if a cross-reference points to the current module; ideally
we'd have some kind of module chain, but I'd settle for a refactoring of
the code to share with NameBinding.

Additionally, Clang nodes are not actually validated to be from the right
module, which could be problematic for extensions or any case of actual
name collision.

Swift SVN r6519
2013-07-23 23:10:05 +00:00
Jordan Rose
b17a23112e Revert "Update for LLVM change to raw_fd_ostream's option flags."
I'm not sure what I was thinking. Thanks for actually fixing this, Sean.

This reverts r6503.

Swift SVN r6307
2013-07-16 23:16:05 +00:00
Jordan Rose
0a6d9df178 Update for LLVM change to raw_fd_ostream's option flags.
Swift SVN r6305
2013-07-16 23:11:03 +00:00
Sean Callanan
213829f946 Adapted to a changed enum in llvm to make the build
work again.


Swift SVN r6300
2013-07-16 23:01:14 +00:00
Adrian Prantl
68e1df49f5 Fix a couple more glitches that were uncovered by assertions.
Swift SVN r5774
2013-06-23 03:35:28 +00:00
Chris Lattner
2144140168 really use SIL IRGen for all recursive compilations as well, this exposes a symbol
redefinition (or linkage type) bug that causes two tests to fail.  I filed 
rdar://13670581 to track this and am plowing forward, since they seem minor.


Swift SVN r4761
2013-04-17 03:46:40 +00:00
Joe Groff
24a092bc3a IRGen: Use 'generic' cpu target.
LLVM recently changed to autodetect host features by default. Change our default to use the "generic" CPU so that we emit binaries to a portable baseline (until some time in the future when we have proper -mtune and -mattr flags).

Swift SVN r4310
2013-03-06 23:59:18 +00:00
Joe Groff
c9d6a351f5 IRGen: SIL ClosureInsts (almost).
Implement lowering of SIL ClosureInsts by packing the partial arguments into a heap allocation and emitting a thunk to unpack them and apply the closure function, similar to curried entry points. The test doesn't work quite yet because nested FuncDecls don't get visited anymore. I need to replace my hacked SIL path with a proper walk of the SIL module to generate functions and the AST to generate types.

Swift SVN r3817
2013-01-20 19:50:10 +00:00
Joe Groff
9259c0d912 IRGen: Get "hello world" to compile through SIL.
Add a path through IRGenModule to optionally codegen FuncDecls using their corresponding SIL Functions when constructed with a SILModule. Jury-rig an IRGenSILFunction subclass of IRGenFunction that does the bare minimum necessary to compile "hello world" from SIL. There are some impedance mismatches between irgen and SIL that need to be smoothed out, particularly the AST-dependent way irgen currently handles function calls. Nonetheless, `swift -sil-i hello.swift` works!

Swift SVN r3759
2013-01-14 02:57:11 +00:00
Dave Zarzycki
ed5de91828 Fix build warnings
Swift SVN r3749
2013-01-11 18:58:44 +00:00
Joe Groff
aba47a6b90 Add a '-sil-emit-llvm' option to the driver.
It doesn't do anything but crash yet. Also add an entry point fo SILGen to Subsystems so that it can be invoked without dependency on SIL or SILGen.

Swift SVN r3738
2013-01-11 01:51:54 +00:00
Chris Lattner
47dbc4051c update for mainline LLVM header file moves.
Swift SVN r3634
2013-01-02 14:38:42 +00:00
Doug Gregor
83f2874ba1 Implement support for calling imported C functions from Swift.
There is no protection whatsoever if the Clang-to-Swift type
conversion produces something that Swift doesn't lower in an
ABI-compatible way. That will be dealt with later.


Swift SVN r3249
2012-11-27 00:34:48 +00:00
Eli Friedman
a9f685d94b Fix my crazy swift.swift inlining hack so it doesn't pull in llvm.global_ctors. <rdar://problem/12539597>.
Swift SVN r3032
2012-10-20 00:01:26 +00:00
Eli Friedman
dd299a35af Fix for LLVM TargetData -> DataLayout rename.
Swift SVN r2959
2012-10-09 23:18:24 +00:00
Eli Friedman
519a683557 Shuffle around code to avoid a crash after IRGen errors.
Swift SVN r2510
2012-08-02 21:51:19 +00:00
Chris Lattner
32f529f1db Split arc-optimizer into two passes: arc-optimize and arc-expand.
This makes the two phases independently testable, but is also the
right thing to do: previously we'd form swift_retain early enough
that inlining would inline them from previously optimized callees
into callers, and this would block some mid-level optimizations
from doing nice things (because swift_retain isn't no-escape).

It's a small thing, but doing this allows us to eliminate a few 
more "and x, 9223372036854775807"'s from the stdlib.  We also
end up doing a lot less optimizations because we do them early
instead of only having the optimizations exposed after inlining
deeply.



Swift SVN r2114
2012-06-02 16:43:51 +00:00
Eli Friedman
e2bfb30772 Add a verifier pass at the end of the optimization pipeline, to catch bugs in the ARC optimizer etc.
Swift SVN r2073
2012-05-30 18:47:41 +00:00
Chris Lattner
d1487a3ede Scaffolding for ARC optimizer pass.
Swift SVN r2027
2012-05-28 00:04:29 +00:00
Eli Friedman
28cddd1b90 Make sure we use the right IR generation options for the IRGen standard library hack.
Swift SVN r1801
2012-05-10 22:22:18 +00:00
Eli Friedman
8f290b63a8 Extend the ugly standard library hack so it works for static compilation. We should be inlining from the standard library now everywhere except the REPL.
Swift SVN r1792
2012-05-10 01:14:56 +00:00
Chris Lattner
204b416229 raw_fd_ostream doesn't set the "has_error" bit in its ctor if it failed to open the file, it returns the error through the string reference error argument. This is half of fixing rdar://11388418.
The other half is on the llvm side.


Swift SVN r1761
2012-05-06 16:19:26 +00:00
Eli Friedman
ca1f3270bc A couple minor tweaks to IRGen: turn on inlining when we're optimizing, and turn off non-leaf frame pointer elimination when we're generating an object file.
Swift SVN r1749
2012-05-05 02:16:07 +00:00
Eli Friedman
dc213bca76 Implement basic REPL under swift -repl. Known demo-blockers: need error recovery, need better brace/paren handling, need to implement the "print" part of REPL.
Swift SVN r1452
2012-04-18 00:52:11 +00:00
Eli Friedman
37de44a35d Implement changes to parsing/sema/etc so that we can implement a REPL and the main module parses the same way as a REPL.
Next step: implement an actual REPL.



Swift SVN r1441
2012-04-16 23:52:01 +00:00
Eli Friedman
d295d02c42 Initial interpreter implementation. The included pieces are enough to get the included simple.swift running in swift -i mode. <rdar://problem/10962290>, part 1.
Swift SVN r1319
2012-04-04 01:34:42 +00:00
John McCall
6b935588e5 On second thought, components need to be known in the AST.
Swift SVN r918
2011-12-07 03:57:41 +00:00
John McCall
c756d37afd Basic Component interface.
Swift SVN r911
2011-12-06 21:48:27 +00:00
Chris Lattner
7568876781 update for mainline api change.
Swift SVN r895
2011-12-05 22:52:50 +00:00
John McCall
2a4352b4ca Fix the build for LLVM API changes.
Swift SVN r869
2011-11-16 19:30:31 +00:00
Chris Lattner
d2ed4c2f3f remove some unneeded ASTContext arguments from subsystem entrypoints
now that it is reachable from TU


Swift SVN r815
2011-11-01 18:33:48 +00:00
Chris Lattner
9298082ebb move Diagnostics header to include/swift/AST to match .cpp files.
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
dfd529ce3a rename diags::foo to diag::foo
Swift SVN r779
2011-10-22 00:36:19 +00:00
Chris Lattner
f92f616aaf remove hte ASTContext::hadError bool.
Swift SVN r778
2011-10-22 00:32:39 +00:00
Chris Lattner
5e8370dea0 eliminate some printouts from IRGen in favor of real diagnostics.
Swift SVN r777
2011-10-22 00:32:14 +00:00
John McCall
b6f312aea0 Verification should clearly follow each phase rather than coming
at the start of the next phase.



Swift SVN r731
2011-09-24 09:32:18 +00:00
John McCall
5fddb24ddc Basic verifier framework.
Swift SVN r728
2011-09-23 23:50:02 +00:00
John McCall
54ff2ccf4a Lop the last word off ModuleDecl and TranslationUnitDecl.
Swift SVN r693
2011-09-06 21:43:46 +00:00