zig/src
Andrew Kelley 89763c9a0d
stage1 is now a hybrid of C++ and Zig
This modifies the build process of Zig to put all of the source files
into libcompiler.a, except main.cpp and userland.cpp.

Next, the build process links main.cpp, userland.cpp, and libcompiler.a
into zig1. userland.cpp is a shim for functions that will later be
replaced with self-hosted implementations.

Next, the build process uses zig1 to build src-self-hosted/stage1.zig
into libuserland.a, which does not depend on any of the things that
are shimmed in userland.cpp, such as translate-c.

Finally, the build process re-links main.cpp and libcompiler.a, except
with libuserland.a instead of userland.cpp. Now the shims are replaced
with .zig code. This provides all of the Zig standard library to the
stage1 C++ compiler, and enables us to move certain things to userland,
such as translate-c.

As a proof of concept I have made the `zig zen` command use text defined
in userland. I added `zig translate-c-2` which is a work-in-progress
reimplementation of translate-c in userland, which currently calls
`std.debug.panic("unimplemented")` and you can see the stack trace makes
it all the way back into the C++ main() function (Thanks LemonBoy for
improving that!).

This could potentially let us move other things into userland, such as
hashing algorithms, the entire cache system, .d file parsing, pretty
much anything that libuserland.a itself doesn't need to depend on.

This can also let us have `zig fmt` in stage1 without the overhead
of child process execution, and without the initial compilation delay
before it gets cached.

See #1964
2019-04-16 19:12:20 -04:00
..
all_types.hpp organize how the single threaded option is passed around 2019-04-14 11:01:01 -04:00
analyze.cpp stage1: const_values_equal support tagged union 2019-04-16 13:55:23 -04:00
analyze.hpp remove the lazy value stuff 2019-04-02 18:31:18 -04:00
ast_render.cpp introduce the enum literal type 2019-03-24 00:44:18 -04:00
ast_render.hpp translate-c: use C pointer type everywhere 2019-02-11 14:56:59 -05:00
bigfloat.cpp fix NaN comparing equal to itself 2019-04-04 22:07:15 -04:00
bigfloat.hpp fix NaN comparing equal to itself 2019-04-04 22:07:15 -04:00
bigint.cpp Fix normalization of right-shifted BigInt at CT 2019-04-11 03:49:15 -04:00
bigint.hpp add @popCount intrinsic 2018-07-07 00:25:32 -04:00
blake2.h stage1: import blake2b implementation 2018-09-05 23:23:11 -04:00
blake2b.c stage1: build blake code with -std=c99 2018-09-11 17:29:18 -04:00
buffer.cpp the same string literal codegens to the same constant 2018-01-11 21:02:30 -05:00
buffer.hpp struct types get fully qualified names 2019-02-28 15:40:57 -05:00
c_tokenizer.cpp translate-c: add support for integer suffixes on 0 (zero) litteral inside macro definitions 2019-03-10 14:56:35 -04:00
c_tokenizer.hpp translate-c: refactor prefix and suffix op C macro parsing 2017-12-07 11:52:52 -05:00
cache_hash.cpp don't close cache manifest file prematurely 2019-04-13 12:33:29 +02:00
cache_hash.hpp stage1 caching system: detect problematic mtimes 2019-03-11 10:26:08 -04:00
codegen.cpp stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
codegen.hpp stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
compiler.cpp stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
compiler.hpp stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
config.h.in avoid a string that is too long for msvc 2019-03-12 18:09:40 -04:00
errmsg.cpp Fix the color of compiler messages for light-themed terminal. 2017-12-04 19:22:34 +09:00
errmsg.hpp use size_t for indexes 2016-09-19 11:54:01 -04:00
error.cpp better error message when os_file_overwrite fails 2019-04-02 15:21:08 -04:00
error.hpp better error message when os_file_overwrite fails 2019-04-02 15:21:08 -04:00
hash_map.hpp rewrite scope implementation 2016-12-01 21:08:12 -05:00
ir.cpp link: exemption for wasm instead of wasi 2019-04-15 16:59:34 -05:00
ir.hpp better handle quota of setEvalBranchQuota 2019-04-13 16:55:59 -04:00
ir_print.cpp fixed 1726 2019-04-06 10:56:07 +02:00
ir_print.hpp make undefined as a constant value lazy 2017-04-23 14:34:40 -04:00
libc_installation.cpp stage1: fix debug builds on macOS 2019-04-05 15:39:00 -04:00
libc_installation.hpp fixed libc command on mingw 2019-03-29 23:16:17 -05:00
link.cpp remove workaround for LLD bug 2019-04-16 03:58:15 -04:00
list.hpp fix some -Wconversion errors 2017-04-10 20:02:39 -04:00
main.cpp stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
os.cpp make os_file_close poison file handle after close 2019-04-13 12:31:49 +02:00
os.hpp make os_file_close poison file handle after close 2019-04-13 12:31:49 +02:00
parse_f128.c parse_f128.c: fix whitespace 2019-03-23 13:46:50 -04:00
parse_f128.h get rid of restrict; it's not supported by MSVC 2019-03-22 16:08:19 -04:00
parser.cpp implement allowzero pointer attribute 2019-03-25 12:55:45 -04:00
parser.hpp remove namespace type; files are empty structs 2019-02-28 10:11:32 -05:00
range_set.cpp better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
range_set.hpp better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
softfloat.hpp depend on embedded SoftFloat-3d instead of __float128 2017-09-14 01:46:47 -04:00
target.cpp wasm: force single threaded 2019-04-14 10:21:48 -04:00
target.hpp wasm: force single threaded 2019-04-14 10:21:48 -04:00
tokenizer.cpp implement allowzero pointer attribute 2019-03-25 12:55:45 -04:00
tokenizer.hpp implement allowzero pointer attribute 2019-03-25 12:55:45 -04:00
translate_c.cpp freestanding target adds -ffrestanding to cc parameters 2019-04-16 12:06:14 -04:00
translate_c.hpp breaking changes to zig build API and improved caching 2019-03-08 23:23:11 -05:00
userland.cpp stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
userland.h stage1 is now a hybrid of C++ and Zig 2019-04-16 19:12:20 -04:00
util.cpp tier 2 support for freebsd 2018-11-27 20:56:43 -05:00
util.hpp stage1 caching system: detect problematic mtimes 2019-03-11 10:26:08 -04:00
windows_com.hpp compiling on mingw is now supported (#1542) 2018-09-18 00:13:17 -04:00
windows_sdk.cpp fixed mingw compilation 2018-10-27 11:35:01 -04:00
windows_sdk.h self-hosted: add first compare-output test 2018-07-23 00:35:53 -04:00
zig_clang.cpp translate-c: move some code to the C API 2019-04-16 04:32:48 -04:00
zig_clang.h translate-c: move some code to the C API 2019-04-16 04:32:48 -04:00
zig_clang_cc1_main.cpp update clang driver code to 8.0.0rc3 2019-02-28 09:27:07 -05:00
zig_clang_cc1as_main.cpp update clang driver code to 8.0.0rc3 2019-02-28 09:27:07 -05:00
zig_clang_driver.cpp update clang driver code to 8.0.0rc3 2019-02-28 09:27:07 -05:00
zig_llvm.cpp more regression fixes. empty test passes again 2019-04-02 18:31:19 -04:00
zig_llvm.h Merge remote-tracking branch 'origin/master' into llvm8 2019-02-28 09:19:18 -05:00