aboutsummaryrefslogtreecommitdiffhomepage
path: root/c/c.c
Commit message (Collapse)AuthorAgeFilesLines
* c: handle more static eval edgecases for int -> ptr lemon2025-12-131-1/+1
| | | | | sqlite3 was falling back to `((void*)&((char*)0)[X])` for INT_TO_PTR, which this handles now.
* c: case/default labels only create new blocks when necessary lemon2025-12-131-7/+11
|
* fix position independent loads of function symbols. lemon2025-12-131-3/+3
| | | | | | | | For `extern int x[1];`, can use PCREL32 for &x. But for `extern int x(int)`, must use GOTREL, when not being called directly (that's PLT). Therefore the type of an external symbol (actually just whether it denotes a function) matters when deciding what kind of relocation to emit, so keep that information.
* c: switch stmt diagnostics lemon2025-12-121-8/+49
| | | | For duplicate cases, case value overflow
* rename arraylength macro -> countof lemon2025-12-111-23/+23
|
* c: accept C99 `[static N]` style array decls, changes to fn quals lemon2025-12-111-24/+45
| | | | | | Function parameters qualifiers don't matter outside of function definition. `int (const int)` should be compatible with `int(int)` etc. So no need to store them in the typedata.
* _Alignof and stuff lemon2025-12-111-11/+18
|
* c: use a look-up table for isdecltok() lemon2025-12-111-14/+18
|
* c: optimize environment decl lookup lemon2025-12-111-6/+26
| | | | | Use a hashmap for the toplevel, optimizing for the common use case where the file-scope has many more declarations than local scopes do
* c: disallow mismatched nested extern decl, & more diagnostics lemon2025-12-111-17/+24
|
* c: support for noreturn, and decl parsing cleanup lemon2025-12-111-107/+113
|
* c: expr2reloc() change sig to return addend lemon2025-12-111-15/+12
|
* c: fix static relocation for &sym[offset] lemon2025-12-101-7/+6
|
* c: fix compound assignment type conversions when types don't match lemon2025-12-101-2/+3
|
* c: fix some static initialziers lemon2025-12-081-1/+3
|
* c: fix more declaration parsing bugs lemon2025-12-081-7/+17
|
* c: allow redeclaration with K&R and non K&R prototypes lemon2025-12-031-2/+10
|
* c: make tentative definitions work lemon2025-12-021-17/+34
|
* c: narrowing ints of different signedness... lemon2025-12-011-1/+1
|
* c: edgecase for redeclaration of implicit sized array lemon2025-12-011-1/+1
|
* c: fix some decl bugs and diagnostics lemon2025-11-301-18/+34
|
* c/type: make implicit const T* -> T* conversion warning, not error lemon2025-11-261-1/+8
|
* c: more static initializer fixes lemon2025-11-261-7/+7
|
* c: fix elided-braces initializers for nested unions lemon2025-11-261-5/+16
| | | | | | | | For example in ```c struct {int a; union { int b,c; }; int d; } X = {1,2,3}; ``` Fields `a`,`b`,`d` must get initialized to 1,2,3. Not `c`
* c: fix condexprvalue lemon2025-11-241-54/+42
| | | | | The original implementation was broken when presented with nested short-circuiting logical operators.
* c: remove unused function lemon2025-11-241-8/+0
|
* c: create dummy unreachable block after trap lemon2025-11-241-5/+1
| | | | | | Reverts 9abe27f6712. This simplies expr codegen, otherwise would manually have to check `fn->curblk != NULL` repeatedly. Later passes will easily delete those unreachable blocks
* ir: implement cvtu64f. and other bug fixes lemon2025-11-231-1/+4
| | | | | compiler is bootstrapping?! however, stage1 and stage2+ executables aren't bit-identical.. small differences in the codegen.. need to look into that
* c: check actual reachability for non-void func may not return value lemon2025-11-231-2/+6
|
* c: implement compound initializer in static context lemon2025-11-231-2/+18
|
* c: fix runtime implicit-length array initializer lemon2025-11-231-2/+3
|
* implement float varargs, and some other fixes lemon2025-11-231-0/+3
|
* c: fix precedence of conditional expression rhs lemon2025-11-221-2/+2
|
* c: make the warning for '()' function declarations less strict lemon2025-11-221-1/+1
|
* c: fix static eval for address of some array refs lemon2025-11-221-1/+3
|
* c: add decl.sym; avoid calling mkhiddensym repeatedly lemon2025-11-221-22/+16
|
* c: move warning for extension keyword til after preprocessor lemon2025-11-221-2/+9
|
* c: cast should narrow for narrow ints lemon2025-11-221-2/+3
|
* amd64/emit: fix REX-requiring 8-bit GPR encoding checking wrong reg lemon2025-11-221-0/+2
|
* remove umul lemon2025-11-211-2/+2
|
* change op names to match 285063eba44 lemon2025-11-211-20/+20
|
* rename IR classes to reflect bitsize lemon2025-11-211-16/+16
|
* c: fix conditional expr not converting operands to final type lemon2025-11-211-9/+13
|
* isel: lower allocas a different way, such that stk address gets materialized ↵ lemon2025-11-201-1/+1
| | | | when necesary
* ir: for easier debugging, keep ctype in dats, print as literal when possible lemon2025-11-201-1/+1
|
* c: implement ++/-- for bitfields lemon2025-11-191-7/+21
|
* c: remove vestigial ins variable lemon2025-11-191-93/+88
|
* debug output to stdout lemon2025-11-191-2/+2
|
* c: due to __builtin_trap (in the future also things like noreturn function ↵ lemon2025-11-151-1/+5
| | | | calls), compileexpr() can terminate current block. add checks for that in callexpr. more are probably needed..
* c: disallow void arguments lemon2025-11-151-1/+3
|