Commit Graph

228 Commits

Author SHA1 Message Date
Robin Voetter
700dee34d5
spirv: make IdResultType and IdRef weak aliases of IdResult
Previously they were strong aliases, but as these types are used quite
intermittendly it resulted in a lot of toRef() calls. Removing them
improves readability a bit.
2023-04-09 01:51:51 +02:00
Andrew Kelley
c22a30ac99 zig cc: handle the -r flag
This makes -r treated the same as -c which is to output an object file.
Zig's ELF linker code already handles multiple object files into an
object file with the -r flag to LLD.

closes #11683
2023-04-08 15:48:27 -04:00
Andrew Kelley
f289277599 Merge remote-tracking branch 'origin/master' into llvm16 2023-04-05 22:05:31 -07:00
Jakub Konka
a88c0b4d08 link: handle -u flag in all linkers
Also clean up parsing of linker args - reuse `ArgsIterator`.

In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.

MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.
2023-04-01 14:22:44 +02:00
Silver
83051b0cbf Update GDB pretty printers 2023-03-30 12:15:53 +03:00
Jacob Young
935ec9ec6a x86_64: canonicalize each br of a block 2023-03-24 17:57:58 -04:00
Andrew Kelley
1ed569e0b2 Merge remote-tracking branch 'origin/master' into llvm16 2023-03-16 17:33:24 -07:00
Jacob Young
8be6073480 tools: fix typo in lldb command 2023-03-15 00:01:44 -04:00
Jacob Young
c29c4c6f70 tools: add lldb pretty printer for std.MultiArrayList.Slice 2023-03-06 05:58:46 -05:00
Andrew Kelley
df4cfc2ecf Merge remote-tracking branch 'origin/master' into llvm16 2023-03-03 12:08:18 -07:00
Jacob Young
57236961e6 tools: revert sharing of stage2 pretty printer info
Partial revert of 1e963053d0. Now that
lldb has a new method for accessing this data that does not require
manual updating, there is no longer any reason to share this data.
2023-02-27 05:37:03 -05:00
Jacob Young
a3529c2dea tools: implement more lldb pretty printers 2023-02-27 05:37:03 -05:00
Andrew Kelley
b5b634e4e8 Merge remote-tracking branch 'origin/master' into llvm16 2023-02-19 10:20:19 -07:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Andrew Kelley
efdc94c107 Merge remote-tracking branch 'origin/master' into llvm16 2023-02-18 09:33:27 -07:00
Jan Philipp Hafer
e10c0eefde compiler_rt: add __powihf2, __powisf2, __powidf2, __powitf2, __powixf2
Implementation and tests ported from LLVM release 80.
Tests of __powihf2 created from __powisf2 tests with minor adjustments.
2023-02-12 00:10:27 +02:00
matu3ba
d976b4e4a5
compiler_rt: __divmodti4 for libgcc symbol compatibility
- Copy and adjust __divmodsi4 tests for __divmoddi4 and __divmodti4.
- Assuming d = a/b does not overflow (MIN/-1) or uses div by 0,
  then tmp = (d * b) = (a/b * b) = a does not overflow.
  => Remove wraparound for remainder in applicable routines.
2023-02-11 14:41:08 +02:00
matu3ba
1bda8be2a3
compiler_rt: __ashlsi3, __ashrsi3, __lshrsi3 for symbol compatibility
These are unused in LLVM, but in gcc used for example by rl78.
Move test files into common file, add tests for aforementioned routines
and missing ones for __lshrti3.
2023-02-11 14:25:01 +02:00
Stephen Gregoratto
d4ce0fe7fe Update Linux syscall list for 6.1, support Mips64
Follow up for #14541.
2023-02-05 03:25:21 -05:00
ee7
289e8fab79 langref, tools: rename --single-threaded to -fsingle-threaded
Commit 40f5e5dfc6 ("CLI: introduce -fsingle-threaded/
-fno-single-threaded", 2021-12-01) removed the `--single-threaded`
option, but didn't update all mentions of it.

    $ zig version
    0.11.0-dev.1568+c9b957c93
    $ zig build-exe --help | grep single
      -fsingle-threaded         Code assumes there is only one thread
      -fno-single-threaded      Code may not assume there is only one thread
    $ zig build-exe --single-threaded foo.zig
    error: unrecognized parameter: '--single-threaded'
2023-02-04 23:24:07 +02:00
Andrew Kelley
56311b8bbb update clang options data to LLVM 16 2023-01-26 16:49:49 -07:00
Andrew Kelley
0ca3582a86 update CPU features to LLVM 16 2023-01-26 16:36:14 -07:00
fn ⌃ ⌥
33682a29c6 Rewrite update_crc_catalog in zig and move tests to separate file 2023-01-22 07:16:49 -08:00
fn ⌃ ⌥
be4468be37 std.hash.crc: implement algorithms listed in CRC RevEng catalog 2023-01-21 07:04:09 -08:00
Motiejus Jakštys
6b3f59c3a7 zig run/cc: recognize "-x language"
This commit adds support for "-x language" for a couple of hand-picked
supported languages. There is no reason the list of supported languages
to not grow (e.g. add "c-header"), but I'd like to keep it small at the
start.

Alternative 1
-------------

I first tried to add a new type "Language", and then add that to the
`CSourceFile`. But oh boy what a change it turns out to be. So I am
keeping myself tied to FileExt and see what you folks think.

Alternative 2
-------------

I tried adding `Language: ?[]const u8` to `CSourceFile`. However, the
language/ext, whatever we want to call it, still needs to be interpreted
in the main loop: one kind of handling for source files, other kind of
handling for everything else.

Test case
---------

*standalone.c*

    #include <iostream>

    int main() {
        std::cout << "elho\n";
    }

Compile and run:

    $ ./zig run -x c++ -lc++ standalone.c
    elho
    $ ./zig c++ -x c++ standalone.c -o standalone && ./standalone
    elho

Fixes #10915
2023-01-13 21:38:11 -05:00
Jan Philipp Hafer
301a89849b tools: build all tools in ci to prevent bitrot
No LLVM assertions were triggered for me.
Closes #12015
Closes #12022
Closes #12223
2023-01-06 01:18:46 +02:00
Guillaume Wenzek
a44085dc2a
add -fopt-bisect-limit 2023-01-03 13:05:09 +02:00
Manlio Perillo
f8f1c6ac06 parser: ensure the documented grammar matches grammar.y
Move the parsing of Root from the parse function to the Parser.parseRoot
method.

Add an empty line between each rule, for consistency with grammar.y.

Ensure that normal doc-comments are always on the top, for consistency.

Add extract-grammar.zig to the tools directory; it is used to extract
the PEG grammar from parse.zig, so that it can be compared with
grammar.y.
2022-12-30 17:11:59 +02:00
Frank Denis
8d66aacb64
compiler-rt: implement __udivei4 and __umodei4 (#14023)
Allows dividing and formatting arbitrary-large unsigned integers.
2022-12-22 16:29:19 -05:00
Jakub Konka
e9e804edc8 Add missing clang opts: -install_name and -undefined 2022-12-18 15:52:51 +01:00
Robin Voetter
5299c57060
adapt update_spriv_features to changed std pattern 2022-11-23 19:17:58 +01:00
Robin Voetter
074ba69ba6
spirv: assembler
spirv: introduce SpvModule.Fn to generate function code into

spirv: assembler error message setup

spirv: runtime spec info

spirv: inline assembly tokenizer

spirv: inline assembly lhs result/opcode parsing

spirv: forgot to fmt

spirv: tokenize opcodes and assigned result-ids

spirv: operand parsing setup

spirv: assembler string literals

spirv: assembler integer literals

spirv: assembler value enums

spirv: assembler bit masks

spirv: update assembler to new asm air format

spirv: target 1.5 for now

Current vulkan sdk version (1.3.204) ships spirv tools targetting 1.5,
and so these do not work with binaries targetting 1.6 yet. In the
future, this version number should be decided by the target.

spirv: store operands in flat arraylist.

Instead of having dedicated Operand variants for variadic operands,
just flatten them and store them in the normal inst.operands list.
This is a little simpler, but is not easily decodable in the operand
data representation.

spirv: parse variadic assembly operands

spirv: improve assembler result-id tokenization

spirv: begin instruction processing

spirv: only remove decl if it was actually allocated

spirv: work around weird miscompilation

Seems like there are problems with switch in anonymous struct literals.

spirv: begin resolving some types in assembler

spirv: improve instruction processing

spirv: rename some types + process OpTypeInt

spirv: process OpTypeVector

spirv: process OpTypeMatrix and OpTypeSampler

spirv: add opcode class to spec, remove @exclude'd instructions

spirv: process more type instructions

spirv: OpTypeFunction

spirv: OpTypeOpaque

spirv: parse LiteralContextDependentNumber operands

spirv: emit assembly instruction into right section

spirv: parse OpPhi parameters

spirv: inline assembly inputs

spirv: also copy air types

spirv: inline assembly outputs

spirv: spir-v address spaces

spirv: basic vector constants/types and shuffle

spirv: assembler OpTypeImage

spirv: some stuff

spirv: remove spirv address spaces for now
2022-11-23 19:17:58 +01:00
Andrew Kelley
58430ae6d1 outline atomics: ret instead of jump to ret
After this, the machine code generated by zig matches identically to
gcc's after the differences in loading the have_lse flag.
2022-11-21 17:17:02 -07:00
Andrew Kelley
95ee8ab77d simplify outline atomics
* Rely on libSystem when targeting macOS.
 * Make tools/gen_outline_atomics.zig more idiomatic.
 * Remove the CPU detection / auxval checking from compiler_rt. This
   functionality belongs in a different component. Zig's compiler_rt
   must not rely on constructors. Instead it will export a symbol for
   setting the value, and start code can detect and activate it.
 * Remove the separate logic for inline assembly when the target does or
   does not have lse support. `.inst` works in both cases.
2022-11-21 17:17:02 -07:00
Devin Singh
a8f2d00ec4 compiler_rt: add outlined lse atomics for aarch64 2022-11-21 17:17:02 -07:00
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Andrew Kelley
5b9c8d1d6f add m68k target CPU features 2022-10-20 09:21:06 -07:00
Andrew Kelley
4f9345d20b Revert "adding static and dynamic ZigEquivalent
enums so that we can branch to set `link_mode` properly when we iterate
over the clang arguments. also replaced `dynamic` flag in
clang_options_data.zig with proper definition similarly to `static`."

This reverts commit 6af0eeb58d.

This change needs more careful consideration. It regressed
zig-bootstrap due to cmake passing `-static -lkernel32` and zig failing
with error.UnableToStaticLink.

See https://github.com/ziglang/zig-bootstrap/issues/134
2022-10-18 14:16:07 -07:00
Jacob Young
1e963053d0 tools: add lldb stage2 pretty printers
* Fix untagged struct names in debug info for llvm.
 * Factor out common stage2 pretty printer data.
 * Add lldb version of stage2 pretty printers.
2022-10-17 07:55:28 -04:00
cod1r
6af0eeb58d adding static and dynamic ZigEquivalent enums so that we can branch to set link_mode properly when we iterate over the clang arguments. also replaced dynamic flag in clang_options_data.zig with proper definition similarly to static. 2022-10-13 13:12:17 +02:00
Andrew Kelley
de7270028d Merge remote-tracking branch 'origin/master' into llvm15 2022-08-29 14:10:59 -07:00
Veikka Tuominen
62ff8871ed stage2+stage1: remove type parameter from bit builtins
Closes #12529
Closes #12511
Closes #6835
2022-08-22 11:19:20 +03:00
Andrew Kelley
c0b7f20893 stage2: implement stack protectors
This is one of the final remaining TODOs for the LLVM backend.
2022-08-19 03:41:13 -07:00
Jakub Konka
a0ec07fdec cc: add support for -M flag 2022-08-08 14:26:10 +02:00
Jakub Konka
80c9d3f3b1 update update_clang_options.zig to latest formatting changes 2022-08-08 14:25:45 +02:00
Andrew Kelley
d631bfe060 update clang CLI options to LLVM 15 2022-08-02 19:43:38 -07:00
Andrew Kelley
c75226d033 update target CPU features for LLVM 15 2022-08-02 19:22:09 -07:00
Meghan Denny
b5861193e0 std: rename std.Target.systemz to .s390x 2022-07-28 23:22:44 -07:00
r00ster
cff5d9c805
std.mem: add first method to SplitIterator and SplitBackwardsIterator 2022-07-25 22:04:30 +03:00