0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/src
Andrew Kelley 8e68d43ad3
avoid needlessly creating global constants
This deletes some legacy cruft, and produces leaner object files.
Example:

```
var x: i32 = 1234;

export fn entry() i32 {
    return x;
}
```

This produces:

```
@x = internal unnamed_addr global i32 1234, align 4
@0 = internal unnamed_addr constant i32* @x, align 8
```

and @0 is never even used. After this commit, @0 is not produced.

This fixes a bug: Zig was creating invalid LLVM IR when one of these
globals that shouldn't exist takes the address of a thread local
variable. In LLVM 8.0.0rc2, it would produce a linker error. But
probably after my bug report is solved it will be caught by the IR
verifier.

https://bugs.llvm.org/show_bug.cgi?id=40652
History 2019-02-10 10:58:00 -05:00
..
all_types.hpp implement vector addition with safety checking 2019-02-09 14:44:33 -05:00
analyze.cpp fix not updating debug info type of optional error sets 2019-02-09 20:41:26 -05:00
analyze.hpp thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
ast_render.cpp thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
ast_render.hpp rewrite parseh to use AST instead of direct types 2017-09-02 04:11:23 -04:00
bigfloat.cpp add f16 type 2018-06-27 16:20:04 +02:00
bigfloat.hpp add f16 type 2018-06-27 16:20:04 +02:00
bigint.cpp @bitreverse intrinsic, part of #767 (#1865) 2019-01-02 16:47:47 -05: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 Crash fixes and small improvements to inline asm. (#1756) 2018-11-19 16:22:21 -05:00
c_tokenizer.cpp translate-c: refactor prefix and suffix op C macro parsing 2017-12-07 11:52:52 -05: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 collapse os_file_mtime into os_file_open_r and check for directory 2019-01-30 16:06:18 -05:00
cache_hash.hpp bring back zig-cache 2018-09-11 22:25:52 -04:00
codegen.cpp avoid needlessly creating global constants 2019-02-10 10:58:00 -05:00
codegen.hpp require running std lib tests coherently 2019-02-06 14:32:20 -05:00
compiler.cpp remove zig build --init. add zig init-lib and zig init-exe 2018-09-17 17:11:18 -04:00
compiler.hpp remove zig build --init. add zig init-lib and zig init-exe 2018-09-17 17:11:18 -04:00
config.h.in find libc and zig std lib at runtime 2018-03-30 17:10:54 -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 stage1: better file path handling 2018-11-26 20:04:35 -05:00
error.hpp stage1: better file path handling 2018-11-26 20:04:35 -05:00
hash_map.hpp rewrite scope implementation 2016-12-01 21:08:12 -05:00
ir.cpp @truncate: comptime 0 when target type is 0 bits 2019-02-09 21:38:34 -05:00
ir.hpp backport copy elision changes 2019-01-29 22:30:30 -05:00
ir_print.cpp fix using the result of @intCast to u0 2019-02-07 16:02:45 -05:00
ir_print.hpp make undefined as a constant value lazy 2017-04-23 14:34:40 -04:00
link.cpp require running std lib tests coherently 2019-02-06 14:32:20 -05:00
list.hpp fix some -Wconversion errors 2017-04-10 20:02:39 -04:00
main.cpp require running std lib tests coherently 2019-02-06 14:32:20 -05:00
os.cpp os.cpp: fix regression on Windows from 59c050e7 2019-01-31 16:52:59 -05:00
os.hpp collapse os_file_mtime into os_file_open_r and check for directory 2019-01-30 16:06:18 -05:00
parser.cpp thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
parser.hpp New Zig formal grammar (#1685) 2018-11-13 05:08:37 -08: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 fixups 2018-12-26 15:25:54 -05:00
target.hpp fixups 2018-12-26 15:25:54 -05:00
tokenizer.cpp thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
tokenizer.hpp thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
translate_c.cpp fixups 2018-12-26 15:25:54 -05:00
translate_c.hpp limit integer types to maximum bit width of 65535 2018-11-06 11:09:14 -05:00
util.cpp tier 2 support for freebsd 2018-11-27 20:56:43 -05:00
util.hpp Crash fixes and small improvements to inline asm. (#1756) 2018-11-19 16:22:21 -05: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_llvm.cpp fix vector debug info tripping LLVM assertion 2019-02-04 22:16:16 -05:00
zig_llvm.h fix vector debug info tripping LLVM assertion 2019-02-04 22:16:16 -05:00