aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-02qbe: Error on use of long double rather than trigger assertionMichael Forney
2021-09-02pp: Implement #line directives and gcc line markersMichael Forney
Fixes #66.
2021-08-30Update qbe submoduleMichael Forney
2021-08-20utf: Add missing return for invalid UTF-8Michael Forney
2021-08-15utf: Use C99 types for UTF-16/32 character instead of C11 char16_t/char32_tMichael Forney
Some operating systems do not support uchar.h, and glibc only defines char16_t/char32_t for GNU C compilers.
2021-08-15decl: Don't accept abstract function declarator when disallowedMichael Forney
When declarator() is called with allowabstract == false, the caller can assume that it will always return the identifier being declared. However, abstract function declarators were incorrectly accepted in this case with name set to NULL instead of erroring out due to invalid syntax. To fix this, only skip forward to function declarator parsing for abstract declarators, since this is the only case where we can't immediately tell whether we have a parenthesized declarator or a function declarator. Fixes #74.
2021-07-06Add functions for encoding/decoding UTF-8/16Michael Forney
These will be needed to implement wide string literals.
2021-07-05qbe: StyleMichael Forney
2021-07-05qbe: Fix bitfield sign extension with types shorter than intMichael Forney
2021-07-02qbe: Mark static const data as suchMichael Forney
2021-07-02qbe: Remove more unnecessary copy instructionsMichael Forney
Now that we don't track QBE types within values, we don't have to worry about generating incorrect SSA when passing an 'l' value to a function taking a 'w'. So we can just return the source value instead of emitting a dummy copy instruction.
2021-07-02qbe: Remove repr from struct value and use per-instruction class insteadMichael Forney
This way we avoid leaking backend-specific details of type representation outside qbe.c. It also facilitates some future simplifications.
2021-07-01qbe: Remove unnecessary distinction between loaduw and loadswMichael Forney
We always store the result to a w temporary, so there is no difference. In fact, QBE provides loadw as an alias for loadsw precisely for this reason.
2021-07-01decl: Check that the flexible array member (if present) is lastMichael Forney
2021-07-01decl: Disallow members with incomplete typesMichael Forney
Make an exception for flexible array members, though we should also check that the flexible array member, if any, is last.
2021-07-01decl: Check that struct/union has at least one memberMichael Forney
2021-07-01qbe: Reorganize struct value to reduce size to 8 bytesMichael Forney
Make the ID an unsigned int. This will make it small enough to efficiently pass struct value by value. It also simplifies things slightly.
2021-06-30stmt: Check that controlling expression is a scalar, and drop unneeded ↵Michael Forney
conversion The conversion is only needed for floating types. QBE isn't able to optimize it away for integer types yet, so removing this unnecessary conversion has a substantial performance benefit.
2021-06-30qbe: Move aggregate copying to separate functionMichael Forney
2021-06-30qbe: Remove before unnecessary adds during copyMichael Forney
2021-06-28Add stringconcat function to concatenate adjacent string literalsMichael Forney
This function also ensures that the string prefixes (if any) are compatible. It should make it easier to implement wide string support.
2021-06-16Add initial NetBSD supportMichael Forney
2021-05-02expr: Include NUL-terminator in string expression dataMichael Forney
This will facilitate the support of wide-string literals. Based on patch from Nihal Jere.
2021-05-02qbe: Use fixed precision of 17 when printing floating point constantsMichael Forney
It appears that some operating systems don't yet support the C11 DBL_DECIMAL_DIG. In order to ensure consistent output no matter the precision of long double (which varies from arch to arch), just use a fixed 17, which is sufficient for IEEE 754 binary64.
2021-04-23Make some static data constMichael Forney
2021-04-23targ: Use correct char signedness for aarch64 and riscv64Michael Forney
2021-04-22Update test for DBL_DECIMAL_DIGMichael Forney
2021-04-21qbe: Print floating point with DBL_DECIMAL_DIG precisionMichael Forney
DECIMAL_DIG may vary from system to system depending on the width of long double, causing one of the tests to fail.
2021-04-21CI: Pin FreeBSD to 12.x for nowMichael Forney
FreeBSD 13 no longer contains a standalone assembler in the base install, and also added a hard-requirement on _Thread_local.
2021-04-21Add support for riscv64 targetMichael Forney
QBE support isn't quite there yet, but is progressing smoothly.
2021-04-11Check in static-assert-struct test expected outputMichael Forney
2021-04-11decl: Allow _Static_assert in struct declarationMichael Forney
2021-04-11decl: Allow _Alignas(0)Michael Forney
C11 6.7.5p6 says "An alignment specification of zero has no effect".
2021-04-08qbe: Remove unnecessary value copy for struct/union typesMichael Forney
Previously, this was needed so that an aggregate type value was updated to be an 'l' type value. However, since 5ff1d2fa the aggregate type name is stored in a separate parameter in IARG/ICALL instructions, so we can just re-use the same pointer value.
2021-04-08Remove unused mkswitch declarationMichael Forney
2021-04-08CI: Fix debian-aarch64 dependency packagesMichael Forney
It appears that these packages recommended by gcc-aarch64-linux-gnu and qemu-user are no longer installed automatically, so list them explicitly.
2021-04-08qbe: Remove unnecessary extension for relational operandsMichael Forney
The operands are already promoted, so never need to be extended. These extend()s were added in 7d746860 in an attempt to fix a bug related to the comparison of values with type smaller than int. However, the real bug was that the operands should have been promoted to int by usual arithmetic conversions, which was fixed later in a8131372.
2021-04-07qbe: Remove __PRETTY_FUNCTION__ declarationMichael Forney
We no longer define __GNUC__ so we don't have to work around glibc's assert definition anymore.
2021-04-06qbe: Shorten a few overly long linesMichael Forney
2021-03-31qbe: Slight simplificationMichael Forney
2021-03-31qbe: Use second argument of call/arg to store type nameMichael Forney
2021-03-31qbe: Use separate type for block/labelMichael Forney
Labels are no longer used as instruction arguments.
2021-03-31qbe: Switch to fixed-size instruction structMichael Forney
Move jump and phi instructions to struct block, and function arguments to their own instruction. This will facilitate allocating instructions as an array.
2021-03-30Add struct passing call testMichael Forney
The struct-passing test checks for function definitions with struct arguments, but we were missing a test for function calls with struct arguments.
2021-03-27qbe: Change value kind naming schemeMichael Forney
2020-12-07CI: Drop obsolete OpenBSD patchMichael Forney
2020-12-07Support -pthread compiler flag.Érico Rolim
POSIX requires -lpthread, but most Linux manual pages recommend using -pthread, and a lot of projects use it.
2020-10-21Update qbe submoduleMichael Forney
2020-09-12Update qbe submoduleMichael Forney
2020-09-05Add a patch to fix OpenBSD bootstrap on 6.7Michael Forney
This issue is already fixed in -current.