Commit Graph

1764 Commits (bb169a7b36a658ed463787655df54e3f59133d98)

Author SHA1 Message Date
Andrew Kelley b35dad88b4 add tests for function alignment handling
See #37
2017-08-30 00:06:14 -04:00
Andrew Kelley 2d57622355 add test for @alignCast on a slice
See #37
2017-08-29 23:39:54 -04:00
Andrew Kelley 898d65baa9 more alignment improvements
* add alignment capability for fn protos
 * add @alignCast
 * fix some ast rendering code
 * fix some ir rendering code
 * add error for pointer cast increasing alignment
 * update allocators in std to correctly align

See #37
2017-08-29 23:33:25 -04:00
Andrew Kelley 910a96f046 fix tests 2017-08-29 17:10:11 -04:00
Andrew Kelley 816689a3b1 ptrCast gives compile error for increasing alignment
See #37
2017-08-29 16:52:31 -04:00
Andrew Kelley be94299666 prevent implicitly increasing pointer alignment
See #37
2017-08-29 15:19:15 -04:00
Andrew Kelley 8f682efbc5 pass all tests without triggering assertions
fixes tests when targeting darwin
2017-08-29 09:30:22 -04:00
Andrew Kelley 1116d82197 fix bitfield pointer syntax
See #37
2017-08-29 08:35:51 -04:00
Andrew Kelley c5c9d98065 introduce align keyword
* remove `@setGlobalAlign`
 * add align keyword for setting alignment on functions and
   variables.
 * loads and stores use alignment from pointer
 * memcpy, memset use alignment from pointer
 * add syntax for pointer alignment
 * slices can have volatile
 * add u2, i2 primitives
 * ignore preferred align and use abi align everywhere
 * back to only having alignOf builtin.
   preferredAlignOf is too tricky to be useful.
   See #432. Partial revert of
   e726925e80.

See #37
2017-08-29 07:51:34 -04:00
Andrew Kelley b8ed0cb374 remove workaround for LLVM not respecting "nobuiltin"
now that we depend on LLVM 5.0.0 we can remove the
workaround.

closes #393
2017-08-28 04:28:42 -04:00
Andrew Kelley d7a539906d Merge branch 'embed-lld'
Zig now depends on LLVM 5.0.0.

For the latest version that supports LLVM 4.0.1, use
2a49c876be.

Unfortunately we had to embed LLD into Zig due to some
MACH-O related LLD bugs. One of them is already upstream
and another is awaiting feedback on the llvm-dev mailing
list.

You can use cmake option -DZIG_FORCE_EXTERNAL_LLD=ON to
still use external LLD if you want to live with the MACH-O
bugs or if your system LLD is patched.

Closes #273
2017-08-28 04:09:09 -04:00
Andrew Kelley 1525e2c056 travis: use external lld for linux 2017-08-28 03:56:42 -04:00
Andrew Kelley d302ddab08 build: fix embedded LLD build 2017-08-28 03:34:50 -04:00
Andrew Kelley 7f9de4b945 travis: use external lld for apple
since the binary I uploaded to build against has the LLD fixes
2017-08-28 03:32:43 -04:00
Andrew Kelley 6c7e975b75 remove remnants of depending on darwin system linker 2017-08-28 03:31:57 -04:00
Andrew Kelley e6b7b8a070 build: use embedded LLD by default 2017-08-28 03:12:23 -04:00
Andrew Kelley 1a1414fc42 LLD: workaround for buggy MACH-O code
Reported upstream:
http://lists.llvm.org/pipermail/llvm-dev/2017-August/116904.html
2017-08-27 17:55:13 -04:00
Andrew Kelley 7b4977f5e2 LLD: apply "[MACH-O] Fix the ASM code generated...
for __stub_helpers section"

This applies 93ca847862af07632197dcf2d8a68b9b27a26d7a
from the llvm-project git monorepo.
2017-08-27 17:51:58 -04:00
Andrew Kelley 4794281d64 embed LLD 5.0.0
This is 48aaa9f66120f72b5d7e4a90b32fee40a3386ce9 from the
git monorepo.
2017-08-27 17:46:59 -04:00
Andrew Kelley ebdc6b594d all tests passing in MacOS
depends on LLD 5.0.0 with 3 patches

See #273
2017-08-27 17:16:42 -04:00
Andrew Kelley 5fd579a51c macos passing all tests except for building a shared library
see #273
2017-08-27 05:44:03 -04:00
Andrew Kelley ff2c794612 all behavior tests passing for macos
See #273
2017-08-27 05:15:24 -04:00
Andrew Kelley 91536813ec macos updates
* try some macos travis stuff
 * put c in the link libs for macos since we always link with libSystem
 * for non-native targets on macos, allow runtime symbol resolution
   - it's causing an infinite loop in LLD.
 * for macos, always build compiler_rt and turn on LinkOnce because
   compiler_rt on darwin is missing some stuff.
2017-08-27 02:51:25 -04:00
Andrew Kelley 01f88bf8c6 travis again 2017-08-27 01:28:04 -04:00
Andrew Kelley fedccf9d2d travis try again 2017-08-27 01:19:18 -04:00
Andrew Kelley 6623a11b2c travis: add macos script 2017-08-27 01:07:06 -04:00
Andrew Kelley b59aa7b906 fixups to linux build 2017-08-27 00:28:17 -04:00
Andrew Kelley 29a418c9d5 progress toward tests passing on MacOS 2017-08-27 00:11:09 -04:00
Andrew Kelley 2a49c876be audit alignment for functions
see #37
2017-08-26 15:20:39 -04:00
Andrew Kelley 95aed8c457 Merge branch 'align' 2017-08-26 14:26:43 -04:00
Andrew Kelley a0ae575ff8 codegen for enums chooses best order of tag and union fields
closes #396
2017-08-26 14:25:52 -04:00
Andrew Kelley 40feecb3e4 fixups from previous commit
See #396
2017-08-26 13:51:51 -04:00
scurest 5bc877017e use most_aligned_member+padding to represent enum unions 2017-08-26 13:48:16 -04:00
Andrew Kelley e726925e80 remove @alignOf and add @cAbiAlignOf and @preferredAlignOf
See #396
2017-08-26 13:29:24 -04:00
Andrew Kelley 3a4ea41fe8 add some asserts in switch analysis code 2017-08-26 13:06:13 -04:00
Andrew Kelley 2b8f98a52c fix wrong switch target type with enum from .h file
fixes crash when else => unreachable is missing
2017-08-26 12:23:12 -04:00
Andrew Kelley 105a09e1d6 fix invalid llvm IR for const enum
closes #394
2017-08-26 00:34:40 -04:00
Andrew Kelley 234030c37a update build to look for llvm 5.0 2017-08-26 00:34:40 -04:00
Andrew Kelley 8f57544410 update travis for llvm 5 2017-08-26 00:34:40 -04:00
Andrew Kelley 2bd6c60752 update for llvm 5.0.0rc1 2017-08-26 00:34:40 -04:00
Andrew Kelley 6aa04c422b float division by zero check only when FloatMode.Optimzed
closes #395
2017-08-25 20:44:32 -04:00
Andrew Kelley a0223e513f add zig-compiler-completions to Related Projects 2017-08-25 20:14:33 -04:00
Andrew Kelley db613d38f0 implement comptime bitcasting from array 2017-08-25 20:05:10 -04:00
Andrew Kelley 4d8269f69f fix some casts on const data causing segfault 2017-08-25 19:54:20 -04:00
Andrew Kelley 754f7809e3 refactor - codegen llvm functions lazily 2017-08-25 13:13:07 -04:00
Andrew Kelley 629aa10c56 unreachable still codegens to unreachable in ReleaseFast test mode
closes #430
2017-08-25 10:20:06 -04:00
Andrew Kelley 5dddb45ec7 fix compiler test errors
closes #428

Thanks Marc Tiehuis for diagnosing this bug
2017-08-22 11:54:58 -04:00
Andrew Kelley 0a922d3bca move docs to website 2017-08-20 17:30:02 -04:00
Andrew Kelley d5271d1e49 more zen 2017-08-20 12:10:21 -04:00
Andrew Kelley be16034275 std.math: remove constants that can be derived
from others at compile time
2017-08-20 05:43:40 -04:00