929 Commits

Author SHA1 Message Date
Andrew Kelley
fb67a7260d link: recognize that Windows does not have POSIX fs modes 2020-05-01 06:47:20 -04:00
Andrew Kelley
2bae942800 add ZIR compare output test case to test suite 2020-05-01 06:47:20 -04:00
Ian Simonson
a2c3ebb756 Use transCreateNodeInfixOp instead of maybeSuppressResult 2020-04-30 19:10:10 +10:00
Ian Simonson
e6fa0beb33 Translate-C convert bools to int in complex expressions
Pre-requisite for having a test case for #5062
In complex C statements which are outside of macros,
it is valid C to perform e.g. a bitor between an
integer and a boolean `5 | (8 == 9)`

Currently this results in a zig error after translating
as `c_int | bool` is invalid Zig.

Detects if a sub-expression of a numeric operator is
boolean and if so converts it to int
2020-04-30 12:48:27 +10:00
Andrew Kelley
03dd1fca94
Merge pull request #5195 from tadeokondrak/opaquetype-to-type-opaque
@OpaqueType -> `@Type(.Opaque)
2020-04-28 16:21:07 -04:00
Tadeo Kondrak
83d2d7ab8a
Mangle field names with a local counter in records
See https://github.com/ifreund/river/issues/17 for an issue that occurs
because the field names are mangled globally. When using the generated
bindings, you have no choice but to use the unstable names or redeclare
the entire struct. This commit changes the behaviour to use a local
counter per record declaration, so the names are predictable each time.
2020-04-28 08:45:51 -06:00
Tadeo Kondrak
17e41f6cd3
@OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
Andrew Kelley
41e17106cd zig fmt: still print the relative path
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
2020-04-27 13:38:19 -04:00
Ryan Liptak
fdff381a56 fmt: Fix relative paths with . and .. on Windows
This is a band-aid fix due to NtCreateFile failing on paths with . or .. in them.
2020-04-27 13:35:59 -04:00
Andrew Kelley
c22b54c9d8 stage2 zir: remove dead code
this was part of the live coding stream and I forgot to delete it before
committing
2020-04-26 17:37:04 -04:00
Andrew Kelley
d44c9bdbd9 ir: elemptr and add instructions 2020-04-26 01:20:58 -04:00
Andrew Kelley
9ebf25d145 link: change default executable mode to 0o777
Jonathan S writes:

On common systems with a 022 umask, this will still result in a
file created with 755 permissions, but it works appropriately if the
system is configured more leniently. (As another data point, C's fopen
seems to open files with the 666 mode.)
2020-04-24 15:36:08 -04:00
Andrew Kelley
058937e44d bug fixes to make it work 2020-04-24 02:09:30 -04:00
Andrew Kelley
229e99ca37 codegen: write the updated code size to PT_LOAD section header 2020-04-23 23:53:52 -04:00
Andrew Kelley
2d35f71fa9 codegen rdx set immediate 2020-04-23 20:30:20 -04:00
Andrew Kelley
757d13d784 codegen supports embedded-in-code constants
also coerce no longer requires a bitcast
2020-04-23 20:23:16 -04:00
Andrew Kelley
0ac502f372 codegen for setting rax and rdi registers 2020-04-23 19:40:17 -04:00
Andrew Kelley
63b54bcf51 codegen for inline assembly 2020-04-23 18:58:47 -04:00
Andrew Kelley
99ec614b71 codegen for const ints and string literals 2020-04-23 17:46:01 -04:00
Andrew Kelley
24a01eed90 basics of writing ELF and machine code generation 2020-04-23 16:41:20 -04:00
Andrew Kelley
a3dfe36ca1 zir-to-elf skeleton 2020-04-22 23:42:58 -04:00
Andrew Kelley
e8545db9d4
Merge pull request #5130 from ziglang/stage2-ir
beginnings of non-LLVM self-hosted backend
2020-04-22 14:42:46 -04:00
Andrew Kelley
1eda2ada9a std.math.big.Int: don't rely on the allocator when printing 2020-04-22 03:49:50 -04:00
Andrew Kelley
d58233b361 ir: improve ZIR emission enough to emit hello world 2020-04-22 03:08:50 -04:00
Andrew Kelley
b1a86040dd ir: emit zir for fntype 2020-04-22 00:26:37 -04:00
Andrew Kelley
993e654554 emit zir skeleton 2020-04-22 00:04:52 -04:00
Andrew Kelley
2e6ccec100 ir: analyze asm instruction 2020-04-21 22:19:32 -04:00
Andrew Kelley
8d3e4147d5 ir: analyze deref instruction 2020-04-21 21:33:55 -04:00
Andrew Kelley
2c11acf807 ir: analyze fieldptr instruction 2020-04-21 21:14:56 -04:00
Andrew Kelley
c12bc8652e ir: analyze ptrtoint 2020-04-21 20:34:40 -04:00
Andrew Kelley
2cdbb5f472 ir: analyze int casting 2020-04-21 19:48:59 -04:00
Haze Booth
78e2a203e3 Remove std.lazyInit 2020-04-21 18:04:37 -04:00
Andrew Kelley
0746028a2a ir: analyze int instruction 2020-04-21 17:54:00 -04:00
Andrew Kelley
69878207e7 ir: analyze as instruction 2020-04-21 17:33:41 -04:00
Andrew Kelley
25679b63eb ir: analyze primitive instruction 2020-04-21 17:11:42 -04:00
Andrew Kelley
8671e8d6d4 ir: analyze fntype instruction 2020-04-21 17:06:09 -04:00
Andrew Kelley
22e7ca5613 ir: analysis of fn instruction 2020-04-21 16:06:15 -04:00
Andrew Kelley
9a2ea5ca42 ir: comptime coerceArrayPtrToSlice 2020-04-21 13:50:04 -04:00
Andrew Kelley
fb63ba2577 ir: type coercion skeleton 2020-04-21 13:24:25 -04:00
Andrew Kelley
8e0bcaca9b ir: analyze str instruction 2020-04-21 01:20:01 -04:00
Andrew Kelley
4c7507cceb ir: semantic analysis skeleton 2020-04-21 00:56:30 -04:00
Andrew Kelley
cc1c2bd568 simplify ZIR spec; separate parsing/rendering from analysis 2020-04-20 19:21:03 -04:00
Andrew Kelley
af4ccf34c1 ir: render keyword parameters 2020-04-19 23:59:00 -04:00
Andrew Kelley
f7786d0ca8 ir: render function body 2020-04-19 23:39:34 -04:00
Andrew Kelley
e74c5a7c24 ir: nice rendering of string literal constants 2020-04-19 20:44:18 -04:00
Andrew Kelley
ded6e0326d ir: rendering skeleton 2020-04-19 20:04:11 -04:00
Andrew Kelley
1f3eeb5443 ir: parse type noreturn 2020-04-19 19:31:50 -04:00
Andrew Kelley
104ae419e4 ir: parse export instruction 2020-04-19 19:31:50 -04:00
Andrew Kelley
f020999ca3 ir: parse asm instructions 2020-04-19 19:31:50 -04:00
Andrew Kelley
82e294cf09 ir: parse deref instruction 2020-04-19 19:31:50 -04:00