Age | Commit message (Collapse) | Author | |
---|---|---|---|
2024-04-27 | Store enum constant value in struct decl | Michael Forney | |
2024-04-27 | Implement variable length arrays | Nihal Jere | |
Variably modified types are required for C23. Since QBE doesn't currently support saving and restoring the stack pointer, a current limitation is that we can't reclaim stack space from VLAs that go out of scope. This is potentially problematic for VLAs appearing in a loop, but this case is uncommon enough that it is silently ignored for now. Implements: https://todo.sr.ht/~mcf/cproc/1 References: https://todo.sr.ht/~mcf/cproc/88 Co-authored-by: Michael Forney <mforney@mforney.org> | |||
2024-04-27 | qbe: Add extra size for strict alignment with QBE instruction | Michael Forney | |
With upcoming VLA support, the size might not be constant. | |||
2024-04-27 | qbe: Temporarily set func->end = func->start in funcalloc | Michael Forney | |
This way way can just use funcinst. | |||
2024-04-27 | Use hlt to implement noreturn | Michael Forney | |
2024-04-27 | qbe: Use expression type when loading | Michael Forney | |
If we are loading the first element of an array, or first member of a structure, the expression type may be different from the object type. | |||
2024-04-21 | expr: Create decl for compound literal during parse | Michael Forney | |
2024-04-20 | qbe: Track 'thread' prefix in value kind | Michael Forney | |
Adding a bool field increases the size of struct value by 8 due to alignment. In the future, maybe we just use something like VALUE_DECL instead. | |||
2024-04-20 | qbe: Disallow address of TLS variables in static initializers | Michael Forney | |
The address of an object with thread storage duration is not an address constant. | |||
2024-04-20 | qbe: Pass struct decl to mkglobal instead of fields from the decl | Michael Forney | |
2024-04-20 | decl: Keep track of storage duration in struct decl | Michael Forney | |
2024-04-19 | implement _Thread_local storage class | Drew DeVault | |
Implements: https://todo.sr.ht/~mcf/cproc/8 | |||
2024-04-16 | qbe: Clarify comment | Michael Forney | |
2024-04-15 | decl: Support variadic functions with no other parameters | Michael Forney | |
2024-04-15 | decl: Save and re-open parameter scope for body | Michael Forney | |
2024-04-15 | Remove support for non-prototype function declarations and definitions | Michael Forney | |
These were removed in C23. | |||
2024-04-12 | Use struct decl for function parameters | Michael Forney | |
2024-04-12 | decl: Add name field to decl struct | Michael Forney | |
2024-04-06 | Remove some unnecessary use of array type length | Michael Forney | |
2024-03-24 | map: Use separately allocated struct map | Michael Forney | |
2024-03-23 | expr: Keep track of storage duration of compound literals | Michael Forney | |
2024-03-16 | Fix C23 empty initializers | Michael Forney | |
These should should act as zero initializers, but since init==NULL was used to mean both "no initializer" and "empty initializer", empty initializers weren't zero-initializing the variable. | |||
2022-11-26 | Check object alignment in only one place | Michael Forney | |
2022-11-26 | Move kind-specific decl fields to union | Michael Forney | |
2022-11-26 | Keep track of asmname in decl and remove globalname() | Michael Forney | |
2022-06-27 | qbe: Insert dead block when compiling unreachable code after a jump | Michael Forney | |
QBE will optimize out these blocks, and the dead block prevents the possibility of NULL value usage when further control flow follows. Fixes #80. | |||
2022-05-19 | Add unreachable returns to silence compiler warnings | Michael Forney | |
2022-03-22 | Allow unnamed parameters in function definitions | Michael Forney | |
2022-03-10 | qbe: Only return 0 from main if it has type int | Michael Forney | |
Though C11 5.1.2.2.1 says that main must have a return type of int, we could still encounter a program which declares it as something else. This is undefined behavior, but we should not produce invalid QBE IL in this case. Also, 5.1.2.2.3 specifies that the implicit return 0 should only apply when main's return type is compatible with int. | |||
2022-02-10 | qbe: Switch to new unsigned-float conversion operators | Michael Forney | |
2022-02-10 | qbe: Switch to unary negation | Michael Forney | |
This fixes bugs involving floating point negative zero. | |||
2022-01-22 | Handle unary minus specially instead of 0 - x | Michael Forney | |
This is necessary to fix unary negation of floating-point 0 (also depends on a pending qbe patch). | |||
2022-01-22 | Remove most usage of fixed-width integer types | Michael Forney | |
We only require a type of at least 64 bits, so just use unsigned long long. Only siphash remains as the last user of uint64_t. | |||
2022-01-22 | Port to C99 | Michael Forney | |
2021-11-25 | Add __builtin_unreachable stub | Michael Forney | |
2021-10-25 | decl: Allow alignment > 16 of locals | Michael Forney | |
This is not yet supported by QBE, so for now we allocate a bit extra and choose the address in the allocated region with an aligned address. | |||
2021-10-25 | qbe: Add helper function for mkinst | Michael Forney | |
This simplifies the creation of allocation instructions in the start block. | |||
2021-10-25 | qbe: Use ... to separate named and variadic arguments | Michael Forney | |
This requires a not-yet-upstream QBE patch, and is needed for riscv64 support, since the calling convention may be different depending on whether the argument is named or variadic. | |||
2021-10-18 | expr: Make sure __builtin_va_end argument is evaluated for side-effects | Michael Forney | |
2021-10-18 | qbe: Fix jnz controlled by short/char type | Michael Forney | |
Although we don't need the cnew in this case, we still need to do the appropriate extension to 32-bit. | |||
2021-10-03 | expr: Use end pointer to detect string-to-number conversion failures | Michael Forney | |
We explicitly ignore ERANGE for strtod, and in any other error case, the end pointer is set to the beginning of the string. | |||
2021-10-03 | qbe: Remove some unused includes | Michael Forney | |
We now hard-code the float precision in the format string instead of using the float.h macros. The other headers were never used (except maybe prior to the first commit). | |||
2021-10-02 | qbe: Re-add conversion to bool RHS of logical and/or | Michael Forney | |
7e838669 removed conversion to bool for int expressions used only to control jnz, but incorrectly dropped the conversion for the right-hand-side of logical and/or as well. We need the result of the expression to be 0 or 1, so we still need that conversion. | |||
2021-09-29 | qbe: Add missing check that binary operator is + for address constant | Michael Forney | |
2021-09-29 | Rename uint64_t field of constant union to u | Michael Forney | |
This will prepare us for adding a signed int64_t field called i. | |||
2021-09-29 | Use unsigned long long for sizes and offsets | Michael Forney | |
We don't need exact-width integer types here. | |||
2021-09-28 | Skip unnecessary conversion to bool for logical and conditional expressions | Michael Forney | |
As in ede6a5c9, if an expression is used only to control a jnz, we don't need to convert it to a 0 or 1 value. QBE ignores the upper 32-bits of the argument to jnz, so the conversion is still needed for pointer, long, and floating point types (including float since -0 has non-zero bit representation). | |||
2021-09-14 | qbe: Support more aligned types in funccopy | Michael Forney | |
We don't have any of these currently, but it's easier to support than to error out. | |||
2021-09-14 | qbe: Fix temporary type for < 8 byte aligned struct copies | Michael Forney | |
2021-09-13 | qbe, init: Handle prefixed string literals | Nihal Jere | |