| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
It was all over the place for temporary data structures used by
individual passes. Now there is an arena specifically for that, which is
nicer.
|
| |
|
|
|
|
| |
C (or at least clang and gcc) allows declaring `static int f(...);` and
defining it later as `int f(...) {...}`, omitting the 'static' in the
latter definition.
|
| | |
|
| |
|
|
|
| |
Keeping the expr around in the decllist paves the way for VLA support
later on
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Interned strings are used pervasively, so it's a good idea to add a
layer of type safety to differentiate them from general cstrs and avoid
potential bugs from comparing non-interned and interned strings. Not
that that's happened so far that I can remember, but it could.
I'm 90% sure it's legal to alias `struct {char c;}` pointers with `char`
pointers. This specific typedef gives type safety but with a simple
one-way `internstr -> const char *` typecast (with `&istr->c`).
Converting the other way around is more intentional: a straight up cast
`(internstr)cstr` which sticks out as unchecked and probably wrong, or
calling the intern(cstr) function, which is the right way.
|
| | |
|
| | |
|
| |
|
|
| |
This is a common non-standard GNU extension.
|
| | |
|
| | |
|
| |
|
|
|
| |
Treated as unsized array T[]. This shows up in some linux headers
as a non-standard way to have flexible array members.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
With 59ca5a8db, querying if a symbol is defined is cheap. If we're
compiling code that calls foo() and we defined foo() in this compilation
unit, we already know its offset within the .text section, so use it
instead of emitting a relocation for the linker to handle. Also, put
small literal data in the .text section instead of .rodata. This seems
to improve performance (cache locality?), and as a bonus, it will be
good for aarch64's instr encoding with smallish PC-relative offsets.
|
| |
|
|
|
| |
sqlite3 was falling back to `((void*)&((char*)0)[X])` for INT_TO_PTR,
which this handles now.
|
| | |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
For duplicate cases, case value overflow
|
| | |
|
| |
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
|
| |
Use a hashmap for the toplevel, optimizing for the common use case where
the file-scope has many more declarations than local scopes do
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
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`
|
| |
|
|
|
| |
The original implementation was broken when presented with nested
short-circuiting logical operators.
|
| | |
|
| |
|
|
|
|
| |
Reverts 9abe27f6712. This simplies expr codegen, otherwise
would manually have to check `fn->curblk != NULL` repeatedly.
Later passes will easily delete those unreachable blocks
|
| |
|
|
|
| |
compiler is bootstrapping?! however, stage1 and stage2+ executables
aren't bit-identical.. small differences in the codegen.. need to look into that
|
| | |
|