Commit Graph

2673 Commits (d0a4110d34b8d80a9212a01f21d7be7629de8813)

Author SHA1 Message Date
Andrew Kelley da596b7e4f
Merge pull request #6255 from joachimschmidt557/stage2-arm
stage2 ARM: more instructions, return values, parameters
2020-10-04 19:49:18 -04:00
Andrew Kelley 6aa668e020
Merge pull request #6476 from kubkon/macho-exe
Link basic MachO executables with stage2
2020-10-04 19:05:45 -04:00
Andrew Kelley 302a69f127
Merge pull request #6295 from Vexu/stage2
Stage2: basic imports
2020-10-04 18:00:21 -04:00
Jakub Konka f8dd48bcd2 Fix after rebase and enable stage2 tests for macOS
Also, rewrites codegen section to store symbol address in a register
to then later invoke `callq` on the register.
2020-10-04 15:31:47 +02:00
joachimschmidt557 fb58fb2d8d stage2 ARM: add testcases for non-leaf fns, parameters, return values 2020-10-03 12:52:04 +02:00
Alexandros Naskos e31cc80130
Merge pull request #6427 from tadeokondrak/enums-explicit-tag-type-extern-allowed
Allow enums with explicit extern-allowed tag types in extern types
2020-10-03 12:51:39 +03:00
Tadeo Kondrak 65016dff32
Add test for implicit extern-allowed enum tag type in extern struct 2020-10-01 18:10:20 -06:00
Tadeo Kondrak cae49b1b9d
Add tests for enums with explicit extern-allowed tag types in extern types 2020-10-01 18:09:47 -06:00
Tadeo Kondrak 96a151d4b8
Skip @Type/@typeInfo Fn/BoundFn tests on wasm32/wasm64 2020-10-01 18:01:40 -06:00
Tadeo Kondrak e18fdc12b0
stage1: Implement @Type for Fn and BoundFn 2020-10-01 18:01:38 -06:00
Tadeo Kondrak 97ab720d84
stage1: Add alignment to TypeInfo.Fn 2020-10-01 17:59:42 -06:00
Tadeo Kondrak e187ac09cb
Update compile error tests for alignment in StructField/UnionField 2020-10-01 15:06:21 -06:00
Tadeo Kondrak 70c507911a
Update @Type tests for alignment field in UnionField and StructFIeld 2020-10-01 15:01:27 -06:00
Tadeo Kondrak c2ee66108c
Add tests for alignment field in UnionField and StructFIeld 2020-10-01 15:01:26 -06:00
Vexu d819da4350
stage2: support multiple files in tests 2020-09-30 17:00:57 +03:00
Tadeo Kondrak e903b00eec
stage1: Fix @Type(.Enum) with invalid tag_type
Fixes https://github.com/ziglang/zig/issues/6459
2020-09-30 07:02:38 -06:00
Andrew Kelley 14d6d07af2 fix the cli test expected string to support native path separators 2020-09-30 01:31:08 -04:00
Andrew Kelley b811a99af9 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 14:53:48 -07:00
LemonBoy cbbcf60968 stage1: Allow comparison with comptime-known vectors
Since comptime_{int,float} vectors are not allowed (thanks $DEITY) we
can use the element type infos to determine the minimum operand size.
2020-09-28 17:16:57 +02:00
LemonBoy 56b52dd0a3 stage1: Detect OOB access of vector value
Fixes #5710
2020-09-28 17:16:12 +02:00
Andrew Kelley b6556c944b fix another round of regressions in this branch
* std.log: still print error messages in ReleaseSmall builds.
   - when start code gets an error code from main, it uses std.log.err
     to report the error. this resulted in a test failure because
     ReleaseSmall wasn't printing `error: TheErrorCode` when an error
     was returned from main. But that seems like it should keep working.
     So I changed the std.log defaults. I plan to follow this up with a
     proposal to change the names of and reduce the quantity of the
     log levels.
 * warning emitted when using -femit-h when using stage1 backend; fatal
   log message when using -femit-h with self-hosted backend (because the
   feature is not yet available)
 * fix double `test-cli` build steps in zig's build.zig
 * update docgen to use new CLI
 * translate-c uses `-x c` and generates a temporary basename with a
   `.h` extension. Otherwise clang reports an error.
 * --show-builtin implies -fno-emit-bin
 * restore the compile error for using an extern "c" function without
   putting -lc on the build line. we have to know about the libc
   dependency up front.
 * Fix ReleaseFast and ReleaseSmall getting swapped when passing the
   value to the stage1 backend.
 * correct the zig0 CLI usage text.
 * update test harness code to the new CLI.
2020-09-26 21:03:38 -07:00
Andrew Kelley 26f2f9bf1c stage2: implement -fno-emit-bin
we are now passing the cli tests
2020-09-26 12:42:07 -07:00
Andrew Kelley 6af2990549 implement -femit-asm, -femit-docs, -femit-llvm-ir, etc
These CLI options are now forwarded to the stage1 backend.

We're not going to support the -mllvm CLI option any longer. As a
compromise, we unconditionally tell LLVM to output intel x86 syntax when
using -femit-asm.

Simplify stage1 logic; it no longer has the concept of an output
directory. --output-dir is no longer a valid CLI option. cmake uses
the `-femit-bin=[path]` option.

Note the changes to test/cli.zig. This breaks the CLI API that Godbolt
is using so we're going to want to open a PR to help them upgrade to the
new CLI for the upcoming Zig 0.7.0 release.
2020-09-26 01:47:27 -07:00
Andrew Kelley 21b407b17f update test case for init-exe with respect to new template
Now it uses std.log.info instead of std.debug.print
2020-09-25 18:21:21 -07:00
Andrew Kelley 0c70bb4fce Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-21 21:16:46 -07:00
Andrew Kelley afac5d2895 fix regressed stage2 test harness 2020-09-21 21:14:01 -07:00
LemonBoy f92d01c8a8 stage1: Fix edge case in casting between optional types
Closes #6370
2020-09-18 22:12:22 -04:00
Tadeo Kondrak 2962be8135 stage1: fix @Type(.Union) not resolving its tag type
Fixes https://github.com/ziglang/zig/issues/6339
2020-09-16 20:34:01 +03:00
Andrew Kelley 5d8fec3d4c Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-14 21:57:01 -07:00
Veikka Tuominen d073836894
Merge pull request #6172 from tadeokondrak/@Type(.Union)
Implement @Type for Union
2020-09-14 16:43:49 +03:00
Andrew Kelley 2a8fc1a18e stage2: caching system integration & Module/Compilation splitting
* update to the new cache hash API
 * std.Target defaultVersionRange moves to std.Target.Os.Tag
 * std.Target.Os gains getVersionRange which returns a tagged union
 * start the process of splitting Module into Compilation and "zig
   module".
   - The parts of Module having to do with only compiling zig code are
     extracted into ZigModule.zig.
   - Next step is to rename Module to Compilation.
   - After that rename ZigModule back to Module.
 * implement proper cache hash usage when compiling C objects, and
   properly manage the file lock of the build artifacts.
 * make versions optional to match recent changes to master branch.
 * proper cache hash integration for compiling zig code
 * proper cache hash integration for linking even when not compiling zig
   code.
 * ELF LLD linking integrates with the caching system. A comment from
   the source code:

   Here we want to determine whether we can save time by not invoking LLD when the
   output is unchanged. None of the linker options or the object files that are being
   linked are in the hash that namespaces the directory we are outputting to. Therefore,
   we must hash those now, and the resulting digest will form the "id" of the linking
   job we are about to perform.
   After a successful link, we store the id in the metadata of a symlink named "id.txt" in
   the artifact directory. So, now, we check if this symlink exists, and if it matches
   our digest. If so, we can skip linking. Otherwise, we proceed with invoking LLD.

 * implement disable_c_depfile option
 * add tracy to a few more functions
2020-09-13 19:29:07 -07:00
Andrew Kelley 800c5de2ae update the stack trace test case for lines added to start.zig 2020-09-10 14:40:33 -07:00
Vexu 0833c8d06b
translate-c: support sizeof and _Alignof in macros
Closes  #6301
2020-09-10 13:04:03 +03:00
Vexu 749417a1f3
translate-c: check for builtin typedef macro identifiers
Closes #6292
2020-09-09 16:29:16 +03:00
Tadeo Kondrak acdf1f0bde
@Type for union fixes 2020-09-07 06:23:50 -06:00
Tadeo Kondrak ff2ed966bb
Implement @Type for Union
This removes TypeInfo.UnionField.enum_field, which is redundant with
TypeInfo.Union.tag_type.
2020-09-07 06:23:24 -06:00
Veikka Tuominen 41bbadbb9a
Merge pull request #6246 from Vexu/field
Remove deprecated fields on `type`
2020-09-05 13:58:02 +03:00
Vexu 09c861b829
update rest of tests 2020-09-04 22:49:14 +03:00
Vexu 6b2f4fd20d
langref: atomic ops are allowed on pointers
Closes #6217
2020-09-04 22:02:39 +03:00
Vexu 1df0f3ac24
update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
Andrew Kelley c86108dd63
Merge pull request #6229 from LemonBoy/fix-6054
ir: Typecheck the sentinel value in *[N:S1]T to [S2]T casts
2020-09-02 19:13:21 -04:00
Andrew Kelley 12ce6eb8f6 stage2: support dbg_stmt at comptime 2020-09-02 00:09:24 -07:00
Tadeo Kondrak 1b2154dfe2 builtin: Add TypeInfo.StructField.is_comptime 2020-09-02 00:17:59 -04:00
Andrew Kelley 4c13d020db stage2: proper split of requireRuntimeBlock and requireFunctionBlock
* improve the ZIR generated of variable decls
   - utilize the same ZIR for the type and init value when possible
   - init value gets a result location with the variable type.
     no manual coercion is required.
 * no longer use return instructions to extract values out of comptime
   blocks. Instead run the analysis and then look at the corresponding
   analyzed instruction, relying on the comptime mechanism to report
   errors when something could not be comptime evaluated.
2020-09-01 12:39:47 -07:00
LemonBoy c51b871c45 ir: Typecheck the sentinel value in *[N:S1]T to [S2]T casts
Closes #6054
2020-09-01 17:29:10 +02:00
Andrew Kelley 717b0e8275 stage2: introduce the ability for Scope.Block to be comptime
This gives zir_sema analysis the ability to check if the current scope
is expected to be comptime.
2020-08-31 23:34:58 -07:00
Andrew Kelley 8dc58a4e94
Merge pull request #6208 from tadeokondrak/remove-@OpaqueType
Remove @OpaqueType
2020-08-31 17:44:03 -04:00
Tadeo Kondrak 82273f1a2a translate_c: fix shadowing on nested blocks 2020-08-31 20:29:57 +03:00
Tadeo Kondrak a2c47d2b0b
Remove @OpaqueType 2020-08-30 19:02:23 -06:00
Vexu cc26cb9b23 stage2: codegen needed for basic for loop 2020-08-26 19:50:56 -07:00