Quentin Carbonneaux
b24af7d3f7
revert 1b7770e271
...
Quotes are used on Apple target
variants to flag that we must
not add the _ symbol prefix.
2024-04-22 14:01:50 +02:00
Michael Forney
99169df2ff
parse: use dynamically sized hashtable for temporaries
...
This significantly improves parsing performance for massive functions
with a huge number of temporaries. Parsing the 86MiB IL produced
by cproc during zig bootstrap drops from 17m15s to 2.5s (over 400x
speedup).
The speedup is much smaller for IL produced from normal non-autogenerated
C code. Parsing the sqlite3 amalgamation drops from 0.40s to 0.33s.
2024-04-13 13:31:02 +02:00
Quentin Carbonneaux
fc98435f81
add "make wc"
2024-04-12 11:49:00 +02:00
Quentin Carbonneaux
875c1abf93
drop unnecessary check
2024-04-12 11:37:35 +02:00
Quentin Carbonneaux
8ded7a56a2
add common linkage for data
2024-04-12 11:33:58 +02:00
Quentin Carbonneaux
4a809d69b5
fold scaled offsets in addresses
2024-04-11 14:14:53 +02:00
Quentin Carbonneaux
8e8f706436
drop over-zealous offset accumulation
2024-04-11 10:22:46 +02:00
Quentin Carbonneaux
2d046a0ac6
use mgen in amd64/isel.c
2024-04-09 21:47:16 +02:00
Quentin Carbonneaux
a609527752
mgen: match automatons and C generation
...
The algorithm to generate matchers
took a long time to be discovered
and refined to its present version.
The rest of mgen is mostly boring
engineering.
Extensive fuzzing ensures that the
two core components of mgen (tables
and matchers generation) are correct
on specific problem instances.
2024-04-09 21:45:42 +02:00
Quentin Carbonneaux
56e2263ca4
fuse ac rules in ins-tree matching
...
The initial plan was to have one
matcher per ac-variant, but that
leads to way too much generated
code. Instead, we can fuse ac
variants of the rules and have
a smarter matching algorithm to
recover bound variables.
2024-04-09 21:34:57 +02:00
Quentin Carbonneaux
8a5e1c3a23
does not look too good
2024-04-09 21:34:57 +02:00
Quentin Carbonneaux
a374da3c2e
modulo ac matching and more tests
2024-04-09 21:32:49 +02:00
Quentin Carbonneaux
24d1324424
wip ins-tree matcher
2024-04-09 21:32:49 +02:00
Quentin Carbonneaux
a2ad38086c
mcf's improved rsval()
...
It is semantically the same but
does not rely on implementation-
defined behavior.
2024-04-07 22:18:01 +02:00
Quentin Carbonneaux
dc3f7d7c4a
fix accidentally noop loop
...
Credit goes to Roland Paterson-Jones
for spotting this bug.
2024-04-04 21:56:50 +02:00
Quentin Carbonneaux
de5ced474d
do not parse +N constants
...
The parsing code for these constants
conflicts with the Tplus token.
2024-04-03 23:30:07 +02:00
Richard McCormack
c8fc20b8ef
Eliminate fully overlapping blits after coalescing stack slots
...
I noticed that my compiler was generating redundant blits, and after
looking through the QBE debug output I believe that I found some low
hanging fruit to help clean them up.
I'm new to this codebase, so please treat this patch with a lot of
skepticism. Happy to make any changes.
Thanks for reviewing, and thank you for QBE!
2024-04-03 22:12:36 +02:00
Michael Forney
85827e2232
check that data alignment is in range and a power of two
...
Otherwise, the alignment gets truncated to fit in char, so
`align 256` is handled as no alignment requirement.
2024-03-28 10:35:11 +01:00
Michael Forney
1b7770e271
Drop quotes around floating point constant labels
...
This is incompatible with binutils gas older than 2.26.
2024-03-26 09:22:06 +01:00
Nguyễn Gia Phong
be5d46fe7d
test/fpcnv: skip of inexactly converted integers
...
In C, if a floating point cannot be represented exactly as an integer,
conversion from the former to the latter is implementation-defined.
Therefore, it can be flaky to test this against QBE-defined behavior.
This was discovered from (unsigned int) 4294967295.0f being an UB,
because (uint64_t) 4294967295.0f is 4294967296 > UINT_MAX
on amd64 when compiled by either gcc or clang.
2024-03-07 16:52:43 +01:00
Nguyễn Gia Phong
b582e84e10
remove duplicated function declarations
...
References: 12f9d16c7b
("create cfg.c for cfg-related functions")
2024-03-07 16:46:10 +01:00
Quentin Carbonneaux
9ee57a637a
update copyright years
2024-03-07 16:45:22 +01:00
Nguyễn Gia Phong
190fd3fb09
declare check-rv64 as a phony make target
...
References: 4e93eeaa3b
("add rv64 backend")
2024-03-07 16:44:48 +01:00
Quentin Carbonneaux
bd7a73d0ea
fix bug in alias analysis
...
The handling of phi was incorrect
and we would sometimes miss escapes.
We now handle phis at the very end
of the pass to make sure the defs
for their arguments have all been
processed.
2024-03-07 16:40:51 +01:00
Tobias Heider
2d683e0c53
Print total number of tests run to get a better view of how much is broken.
2024-01-29 10:24:41 +01:00
Quentin Carbonneaux
1f69842fb8
fix link in doc
2024-01-03 12:12:41 +01:00
Drew DeVault
85287081c4
dbgloc: add column argument
...
dbgloc line [col]
This is implemented in a backwards-compatible manner.
2024-01-02 12:12:05 +01:00
Chenguang Wang
24d68e841f
Add missing documentation for union types and VAL.
...
See previous discussion here[1]. It's unclear to me how to preview HTML page
generated from the .txt file, though.
[1]: https://lists.sr.ht/~mpu/qbe/%3C87cz1jq26k.fsf%40greenfork.me%3E
2024-01-02 11:51:34 +01:00
Quentin Carbonneaux
4bc4c9584a
revert 5af33410
...
Causes errors with stock toolchain
on OpenBSD.
2024-01-02 11:16:08 +01:00
Tobias Heider
5af33410f6
Fix IBT/BTI by instrumenting function calls
2023-12-30 15:59:25 +01:00
Lorenz (xha)
00501eeb6e
hard-code $(CC) to equal "cc"
...
this fixes the build on FreeBSD, where the value of $(CC) recently
changed from "cc" (13.2) to "c99" (14).
Signed-off-by: Lorenz (xha) <me@xha.li>
2023-12-30 15:50:35 +01:00
Josiah Frentsos
d023bdaa6b
Fix architecture detection on OpenBSD/arm64
2023-09-25 09:49:35 +02:00
Quentin Carbonneaux
c5aca682a2
comments in amd64 isel
2023-08-28 22:45:41 +02:00
Michael Forney
d6c9669c3c
Fix conversion from float/double to unsigned int
...
signed int can't represent all the values of unsigned int, so we
need to do the conversion to signed long, and use the lower 32 bits
as the result.
2023-08-26 15:16:45 +02:00
Quentin Carbonneaux
d41d91ddd8
test.sh fixes for devuan linux
2023-08-18 17:21:48 +02:00
Quentin Carbonneaux
36946a5142
file,loc become dbgfile,dbgloc
2023-08-18 15:12:56 +02:00
Quentin Carbonneaux
baf11b7175
parseline() tweaks
2023-06-07 10:11:58 +02:00
Thomas Bracht Laumann Jespersen
0d929287d7
implement line number info tracking
...
Support "file" and "loc" directives. "file" takes a string (a file name)
assigns it a number, sets the current file to that number and records
the string for later. "loc" takes a single number and outputs location
information with a reference to the current file.
2023-06-06 18:44:51 +02:00
Alexey Yerin
e493a7f233
Bump NString
2023-05-31 09:25:58 +02:00
Quentin Carbonneaux
50452b88e9
fix sub-word returns on arm64_apple
2023-05-09 12:39:51 +02:00
Locria Cyber
96f16f958a
Fix 1 C UB
2023-04-03 16:08:46 +02:00
Quentin Carbonneaux
a3dfbb9c04
amd64_apple: one more thread-local symbols fix
...
We now treat thread-local
symbols in Mems properly.
2023-04-02 19:21:16 +02:00
Quentin Carbonneaux
eda2db5737
tests for thread-local addresses
2023-04-02 18:54:26 +02:00
Quentin Carbonneaux
1ec70daee6
amd64_apple: support thread-local addresses
...
Non-store/load instructions were
not lowered correctly for thread-
local symbols. This is an attempt
at a fix (cannot test for now).
2023-04-02 16:51:49 +02:00
Quentin Carbonneaux
56f4b5be4c
amd64_sysv: fix offsets in thread-local Oaddr
2023-04-02 15:48:48 +02:00
Quentin Carbonneaux
28d9ca8eae
print prefix for thread-local symbols
2023-04-02 15:20:16 +02:00
Quentin Carbonneaux
a9d3e06a57
amd64_sysv: thread-local support in Oaddr
...
Thanks to Lassi Pulkkinen for
flagging the issue and pointing
me to Ulrich Drepper's extensive
doc [1].
[1] https://people.redhat.com/drepper/tls.pdf
2023-04-02 14:48:52 +02:00
Quentin Carbonneaux
5fee3da6ac
rename blknew() to newblk()
...
This is consistent with newtmp()
and newcon().
2023-03-22 11:43:46 +01:00
Quentin Carbonneaux
eb9fcece9e
naming nit
2023-03-19 07:38:24 +01:00
Quentin Carbonneaux
011dfc839d
silence format warning more reliably
2023-03-16 16:22:11 +01:00