Commit graph

61 commits

Author SHA1 Message Date
Quentin Carbonneaux
8ded7a56a2 add common linkage for data 2024-04-12 11:33:58 +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
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
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
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
Quentin Carbonneaux
a6cd65d498 link pthread in tests 2022-12-25 16:38:46 +01:00
Quentin Carbonneaux
26c1c30b7d new blit instruction 2022-12-14 23:18:26 +01:00
Quentin Carbonneaux
9126afa2da new hlt block terminator
It is handy to express when
the end of a block cannot be
reached. If a hlt terminator
is executed, it traps the
program.

We don't go the llvm way and
specify execution semantics as
undefined behavior.
2022-11-27 21:48:21 +01:00
Quentin Carbonneaux
79f3673d20 new arm64_apple target
Should make qbe work on apple
arm-based hardware.
2022-10-03 10:41:26 +02:00
Quentin Carbonneaux
0b26cd4f5e parse sb,ub,sh,uh abi types 2022-10-03 10:41:03 +02:00
Quentin Carbonneaux
f5ad580886 regenerate test/vararg2.ssa
- update the test generation script to
  match some manual changes
- fix some variadic calls to printf
- add a test case where an odd number of
  slots is used on the stack before varargs
2022-08-31 17:16:29 +02:00
Haelwenn (lanodan) Monnier
2b451a28d8 tools/test.sh: Without a TARGET, use $CC if defined
cc can be absent in Gentoo to make sure the right compiler is picked,
for example when clang is preferred or when cross-compiling.
2022-06-14 18:46:38 +02:00
illiliti
6cd5f70286 Makefile: POSIXify
Makefile now compatible with gmake, bmake, smake and pdpmake.
2022-06-14 13:58:01 +02:00
Quentin Carbonneaux
cec9855fa0 detect target in tests 2022-03-15 22:34:03 +01:00
Quentin Carbonneaux
7f7e34cd1f new abi stress test 2022-03-10 16:01:50 +01:00
Quentin Carbonneaux
65821c9b14 disable pie for rv64 tests 2022-02-25 10:51:22 +01:00
Michael Forney
4e93eeaa3b add rv64 backend
It is mostly complete, but still has a few ABI bugs when passing
floats in structs, or when structs are passed partly in register,
and partly on stack.
2022-02-17 22:43:12 +01:00
Quentin Carbonneaux
2fd3a95d6f update token hash params 2022-01-28 11:07:40 +01:00
Eyal Sawady
e91d121581 Add a negation instruction
Necessary for floating-point negation, because
`%result = sub 0, %operand` doesn't give the correct sign for 0/-0.
2022-01-23 11:43:59 +01:00
Michael Forney
900805a8fe use unified diff format for test output
This make it easier to understand the differences.
2021-10-26 21:34:31 +02:00
Quentin Carbonneaux
9858a12730 use -static when cross-compiling tests 2021-10-17 21:21:45 +02:00
Michael Forney
2dd269f522 test: include exit status in test failure reason
This was intended, but was missing due to a typo in the test status
variable.
2021-08-23 10:24:54 +02:00
Michael Forney
097dc86c45 use toolchain to determine aarch64 sysroot path 2021-03-18 12:11:35 +01:00
Michael Forney
0678bee578 Revert "arm64: try qemu-system-aarch64"
This reverts commit be3a67a7f5.

qemu-system-aarch64 is a full system emulator and is not suitable
for running the qbe test suite (at least without a kernel and root
filesystem).
2021-03-18 12:09:58 +01:00
Quentin Carbonneaux
d3313ade5f disable pie for arm64 tests 2021-03-02 10:25:46 +01:00
Reini Urban
be3a67a7f5 arm64: try qemu-system-aarch64 2021-03-02 10:25:33 +01:00
Drew DeVault
83c2108341 add data $name = section "section" ...
This allows you to explicitly specify the section to emit the data
directive for, allowing for sections other than .data: for example, .bss
or .init_array.
2021-03-02 10:00:08 +01:00
Quentin Carbonneaux
6130985274 add asm diffing in test script 2019-05-05 16:04:14 +02:00
Michael Forney
f622efa05a Rearrange the fields in Ins so the bit-fields get packed together 2019-03-14 10:12:55 +01:00
Eugene Sharygin
39b1f468b0 fix compiler command in testcc
This commit adds missing quotation marks around the argument to the
function, and changes the value of `-x' option to `c` (lowercase) as per
GCC manual [1].

[1]: https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Overall-Options.html
2017-10-07 21:19:18 +02:00
Quentin Carbonneaux
e54f7a0fda adjust test.sh for ubuntu 2017-09-25 14:41:25 +02:00
Quentin Carbonneaux
1883ab1e01 unscrew freebsd tests 2017-04-11 17:42:51 -04:00
Quentin Carbonneaux
8241685fb9 always disable pie in tests 2017-04-09 18:08:40 -04:00
Quentin Carbonneaux
c52f9162c4 misc fixes for osx
With the default toolchain, it looks like we have to
make sure all symbols are loaded using rip-relative
addressing.
2017-04-08 22:23:40 -04:00
Quentin Carbonneaux
e4bc35149c add cross testing for arm64 2017-04-08 22:10:01 -04:00
Quentin Carbonneaux
a9d81338b1 add support for closure calls
Compiling languages with closures often requires passing
an extra environment parameter to the called function.

One solution is to use a convention, and reserve, say,
the first argument for that purpose.   However, that
makes binding to C a little less smooth.

Alternatively, QBE now provides a way to remain fully
ABI compatible with C by having a "hidden" environment
argument (marked with the keyword 'env').  Calling a
function expecting an environment from C will make the
contents of the environment undefined, but the normal
arguments will be passed without alteration.  Conversely,
calling a C function like it is a closure by passing
it an environemnt will work smoothly.
2017-02-15 20:17:13 -05:00
Quentin Carbonneaux
d9f1121763 tests for variable argument lists 2017-02-10 11:06:00 -05:00
Quentin Carbonneaux
b99a8b0d07 support variable argument lists
This change is backward compatible, calls to
"variadic" functions (like printf) must now be
annotated (with ...).
2017-02-10 11:05:54 -05:00
Quentin Carbonneaux
f5917c35bd attempt to fix cc flags in tests 2017-01-04 22:01:55 -05:00
Quentin Carbonneaux
b976b2da5c more performance improvements in the parser 2017-01-04 15:02:07 -05:00
Quentin Carbonneaux
103f427356 minor bugs in lexh tool 2016-12-31 14:17:11 -05:00
Quentin Carbonneaux
cd458524b3 new tool to improve lexing speed 2016-12-30 22:05:27 -05:00
Quentin Carbonneaux
8032339c59 disable pie (default on some os) 2016-12-05 02:50:08 -05:00
Quentin Carbonneaux
3e8a18dd1b return non-zero when tests fail 2016-10-24 14:36:35 -04:00
Quentin Carbonneaux
48896b0598 improve tests output for contbuild 2016-10-19 19:36:33 -04:00