Commit Graph

1309 Commits

Author SHA1 Message Date
Dmitri Hrybenko
3d8e8d1e8f Remove fixed FIXMEs
Swift SVN r9304
2013-10-14 04:13:16 +00:00
Joe Groff
cf457d2210 Revert "Add support for Axle library." It breaks the build.
This reverts commit r9292.

Swift SVN r9296
2013-10-13 22:38:22 +00:00
Mon Ping Wang
41aca3e7e6 Add support for Axle library. Please note that AxeBuiltins.gyb will be
expanded soon for the other graphics builtins.


Swift SVN r9294
2013-10-13 19:54:01 +00:00
Dmitri Hrybenko
011284e9c9 Make minus sign part of IntegerLiteralExpr and make integers literals 136-bits
wide

Currently integer literals are 64-bit.  In order to allow checking for overflow
while converting an integer literal to swift.UInt/Int* types we need at least
65 bits.  But floating point numbers (Float32, Float64, Float80) are
BuiltinIntegerLiteralConvertible.  In order to allow spelling large floating
point constants, we allow 136-bit literals.

Rationale: 128 bits are enough to represent the absolute value of min/max IEEE
Binary32, and we need 1 bit to represent the sign.  136 is 129 rounded to the
next 8 bits.

The plan is to have builtins that do the overflow check and convert 136-bit
numbers to the required width.  We need these builtins for both integers and
floating point numbers to ensure that 136-bit numbers are folded into sane
constants in SIL and don’t escape to LLVM IR.


Swift SVN r9253
2013-10-12 04:52:11 +00:00
Anna Zaks
1d646a8ba8 Implement overflow checking on integer literals (1 of 2)
- Added 2 new builtins strunc_with_overflow and utrunc_with_overflow
  that perform truncation and produce a compile time error when truncation
  overflows.

- Used these builtins instead of trunc to implement "_convertFromBuiltinIntegerLiteral".

- Currently, the builtins are converted to trunc in IRGen, but we should
  not be IRGenning code that uses them, since all uses of
  "_convertFromBuiltinIntegerLiteral" should be inlined and the arguments
  constant folded.

- I had to change a test and the implementation of operator '~' in the standard library
  because they assumed that '0xFF' is a valid signed Int8. It is questionable if we should
  allow this and if we should treat signed and unsigned integers differently depending on
  how they are spelled (decimal or hexadecimal).

* This patch will be further improved (Ex: will start finding overflows on Int64, better
  deal with '-128' after the negative integer literal patch is committed.)

Swift SVN r9226
2013-10-11 22:19:14 +00:00
Dave Abrahams
e2a8c60d94 [stdlib] GenericIVar is dead; long live "var _: T"!
Swift SVN r9217
2013-10-11 20:13:13 +00:00
Dave Abrahams
293bc08309 [stdlib] Enumerator is dead; long live Generator!
Swift SVN r9124
2013-10-10 01:40:57 +00:00
John McCall
a79cee2c54 Revert "Reimplement integer arithmetic overflow checking to use special, error on overflow builtins"
This was causing massive failures at run-time.

This reverts commit 80081db973ccb7100741fea19ce8e8c116fc410f.

Conflicts:
	lib/SILPasses/ConstantPropagation.cpp
	test/SILPasses/constant_propagation.swift
	test/SILPasses/constant_propagation2.sil

Swift SVN r9050
2013-10-09 01:20:39 +00:00
Anna Zaks
ccc1dae7fd Reimplement integer arithmetic overflow checking to use special, error on overflow builtins
After talking to John, Joe, and Dave Z, we've decided that it's best to
specialize each arithmetic builtin that could overflow, instead of calling
a separate generic "staticReport" builtin and passing it enough info to
produce the message. The main advantage of this approach is that it
would be possible for the compiler to customize the message and better
link it to the builtin that overflows. For example, the constants that
participated in the computation could be printed. In addition, less code
will be generated and the compiler could, in the future, automatically
emit the overflow diagnostics/trap at runtime.

This patch introduces new versions of op_with_overflow swift builtins.
Which are lowered to llvm.op_with_overflow builtins in IRGen after the
static diagnostics. If the last argument to the builtins evaluates to true,
the overflow is unintentional. CCP uses the builtins to diagnose the overflow
detectable at compile time. FixedPoint is changed to rely on these in
implementation of primitive arithmetic operations.

Swift SVN r9034
2013-10-08 23:07:56 +00:00
Doug Gregor
fdd08a42e4 Remove a pile of typealiases that can be deduced associated type witnesses.
We can't yet remove them all due to <rdar://problem/15168483>.


Swift SVN r8988
2013-10-07 20:51:28 +00:00
Chris Lattner
1e09725368 pass -module-name to the build command for the stdlib. Rearrange to pass -c at the end to make it easier to copy and paste the line for messing with sil.
Swift SVN r8952
2013-10-07 15:20:36 +00:00
Greg Parker
c4854a037b Add whitespace to @-based control structures in FixedPoint.gyb.
Swift SVN r8914
2013-10-04 05:39:44 +00:00
Greg Parker
98b8b160e7 Use @attribute syntax in FixedPoint.swift.
Swift SVN r8913
2013-10-04 05:34:27 +00:00
Dave Abrahams
b5842cb6b4 [stdlib] Initial implementation of Character
This type can't do much but store an arbitrary very short string right now, but it works

Swift SVN r8850
2013-10-02 18:56:19 +00:00
Anna Zaks
e136245676 [SIL] Add integer overflow warnings on simple arithmetic to swift.
- Adds transparent attribute to add/mult/sub on integer types.
 - Fix a bug in ConstantPropagation that ensures that the propagation is triggered on StructExtract, when struct is simplified.
 - Slightly improve the error message.

Swift SVN r8825
2013-10-01 23:02:35 +00:00
Joe Groff
3d4c1251f1 Rename 'byref' attribute to 'inout'.
Swift SVN r8661
2013-09-25 20:56:52 +00:00
Anna Zaks
b8c4019c2a Make Int's init() 128-bit-Int-proof.
Following Jordan suggestion to r8446, replace the current version of Int's
init() to make it 128 bit-proof.

Swift SVN r8531
2013-09-20 23:24:28 +00:00
Anna Zaks
818cd1a1cc Add transparent constructors to integer types.
This time by modifying the FixedPoint.gyb and auto-generating FixedPoint.swift.

(Thanks Dmitry!)

Swift SVN r8448
2013-09-19 16:23:47 +00:00
Greg Parker
974f1e4ea9 Clean up -force_load and linkage of libswift_runtime.a. Fixes test Interpreter/Union.swift.
Swift SVN r8398
2013-09-18 06:28:53 +00:00
Doug Gregor
7d774c55d6 Replace "constructor" with "init" in a number of Swift sources.
Swift SVN r8393
2013-09-18 04:37:12 +00:00
Joe Groff
35e5a1ffbe Link swift_stdlib_core with -all_load so it links in all .o files from swift_runtime.
Swift SVN r8349
2013-09-17 21:04:43 +00:00
Greg Parker
5dd6b2a12c Reinstate workaround for rdar://14897572 (slow arm64 compilation)
Swift SVN r8318
2013-09-17 01:28:49 +00:00
Greg Parker
6a1df4bb3f Remove Int128 because it is unreliable or incomplete on some architectures.
Swift SVN r8249
2013-09-14 11:07:27 +00:00
Greg Parker
f627c439c9 Remove some Int128 assumptions from FixedPoint generator.
Swift SVN r8247
2013-09-14 07:07:35 +00:00
Greg Parker
8e13188209 Consolidate some build flags for .swift files. Add cross-compilation support.
Swift SVN r8181
2013-09-13 01:51:48 +00:00
Dave Zarzycki
462fe42725 Adopt [transparent] more
Swift SVN r7980
2013-09-06 02:44:37 +00:00
Dave Abrahams
0d34c37048 [stdlib] FixedPoint.gyb/.swift: factor out more of the boilerplate repetition
Swift SVN r7805
2013-08-30 22:07:14 +00:00
Dave Zarzycki
d1e19306c0 Email feedback from DaveA
Swift SVN r7784
2013-08-30 17:07:05 +00:00
Dave Zarzycki
32c305949a '-=' is valid on both signed/unsigned types
Also, make the output easier to review output "tables" of operators.

Swift SVN r7780
2013-08-30 16:28:33 +00:00
Dave Zarzycki
2da92327c4 Adopt [transparent] in a bunch of places
Swift SVN r7779
2013-08-30 16:28:13 +00:00
Dave Abrahams
930f786725 [stdlib] Add regeneration instructions to FixedPoint.swift
Swift SVN r7761
2013-08-29 23:00:52 +00:00
Dave Abrahams
40d3f9e022 [stdlib] Add "gyb" templating engine; use it to generate FixedPoint.swift
Eventually gyb should be integrated with the build system, but for now
we are only using it to generate one Swift file.

Swift SVN r7759
2013-08-29 22:57:09 +00:00
Jordan Rose
3e992a64fa Use -module-link-name to encode library names in standard library modules.
...which allows us to drop the hardcoded logic to load specific libraries
in immediate modes.

Swift SVN r7585
2013-08-26 18:57:50 +00:00
Chris Lattner
087b035414 Refactor assign lowering out to a helper function.
Make sure that all assigns are lowered by the memory promotion pass, even those
that don't refer to a box.  These are always assignments, not initializations.



Swift SVN r7543
2013-08-23 23:36:30 +00:00
Chris Lattner
d4a0c16baa revert my r7505 patch to 'assign'. It turns out that changing
assign in this way doesn't actually make things simpler, and the
former model for assign is simpler to work with.


Swift SVN r7537
2013-08-23 22:40:56 +00:00
Chris Lattner
f6a5c78df2 Per John's advice (a few weeks ago), rework the 'assign' instruction
to being a semantic assign.  The functional difference here is only
for unowned pointers, where now the conversion from strong to unowned 
is implicit in the assign.

The logic behind this is that 'assign' is really part of SILGen, that
is only moved later to make it easier to make it be flow sensitive.
Since it is part of SILGen and will be using some of the type lowering
functionality used by SILGen, we should play by its rules.

No functionality change.


Swift SVN r7507
2013-08-23 18:15:21 +00:00
Adrian Prantl
97cdb29f5d Turn on (swift) debug symbols for debug builds. This gives us a bunch of
additional test coverage for free.

Swift SVN r7468
2013-08-22 18:36:05 +00:00
Jordan Rose
bee99803b2 Build modules alongside object files for the standard library.
...rather than as a separate step. This avoids duplicating Parse and Sema
work for these. (This is the new and correct version of r7377.)

Also, remove leftover code for building "swift.swift" and friends in lieu
of proper modules. We're not going back to those days. :-)

Swift SVN r7420
2013-08-21 20:15:00 +00:00
Dave Abrahams
c27b447edb Delete unintentionally-committed files
Swift SVN r7186
2013-08-12 23:21:41 +00:00
Dave Abrahams
128e69d934 [docs] Revise TextFormatting.* to reflect posted proposal
Swift SVN r7178
2013-08-12 21:13:03 +00:00
Peter O'Gorman
b62ebbbcd0 fix build on case-sensitive fs
Swift SVN r6772
2013-07-31 04:01:18 +00:00
Chris Lattner
fa49d75eb4 Add bool, int8, and float vectors of size 2 definitions and some supported operations.
Swift SVN r6768
2013-07-30 23:54:18 +00:00
Joe Groff
6e00dbf9b9 Remove the Swift version of the demangler.
This creates a regression in REPL printing for class instances, which now will print the mangled class name of the instance, since Object.className was using the Swift demangler to demangle the type name. REPL printing is getting an overhaul so I think this is OK for now.

Swift SVN r6704
2013-07-29 20:50:06 +00:00
Jordan Rose
2341903bb0 [Makefiles] Convert autoconf build to use modules.
Note that if you already have an autoconf build, you will need to erase
build/*/lib/*.swift (the first * being "all configurations").

Swift SVN r6534
2013-07-24 00:01:47 +00:00
Dave Zarzycki
af4e485b81 14443393 stdlib fails to build with different -o option
Somebody should verify that I didn't break the CMake build. Thanks!

Swift SVN r6346
2013-07-18 06:42:00 +00:00
Argyrios Kyrtzidis
341962ce92 [CMake] Introduce add_swift_compiler_flags() and add_swift_optimization_flags() to reduce copy-pasting.
Swift SVN r6342
2013-07-18 01:12:53 +00:00
Dmitri Hrybenko
0791041eb4 Revert the API change of r5893
This commit merges EnvironmentVariables and CommandLineArguments into a single
swift.Process global variable.  POSIX-dependent parts are available as
extension with "import POSIX".

Original message:

stdlib: split the Process class into a POSIX-dependent (EnvironmentVariables)
and POSIX-independent (CommandLineArguments) parts


Swift SVN r6331
2013-07-17 17:55:24 +00:00
Doug Gregor
5240e9a442 Remove Vec4b/Vec4f. They can be added back when someone gives them more thought.
Swift SVN r6026
2013-07-05 22:57:08 +00:00
Dmitri Hrybenko
16d8ddc093 Revert wrong changes, did not intend to commit all that
Swift SVN r6010
2013-07-05 17:13:07 +00:00
Dmitri Hrybenko
b1b1c63be5 Add a comment for r6001
Swift SVN r6009
2013-07-05 17:11:38 +00:00