Add chibicc

This program popped up on Hacker News recently. It's the only modern
compiler I've ever seen that doesn't have dependencies and is easily
modified. So I added all of the missing GNU extensions I like to use
which means it might be possible soon to build on non-Linux and have
third party not vendor gcc binaries.
This commit is contained in:
Justine Tunney 2020-12-05 12:20:41 -08:00
parent e44a0cf6f8
commit 8da931a7f6
298 changed files with 19493 additions and 11950 deletions

View file

@ -63,7 +63,7 @@ struct Machine {
uint8_t *p;
} real;
uint64_t cr3;
uint8_t xmm[16][16] aligned(16);
uint8_t xmm[16][16];
uint8_t es[8];
uint8_t ds[8];
uint8_t fs[8];
@ -165,7 +165,7 @@ struct Machine {
uint8_t icache[1024][40];
void (*onbinbase)(struct Machine *);
void (*onlongbranch)(struct Machine *);
} aligned(64);
} forcealign(64);
struct Machine *NewMachine(void) nodiscard;
void FreeMachine(struct Machine *);

View file

@ -38,8 +38,8 @@
(!IsModeDbg() && __SSE3__ + 0 && \
(__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 408)
typedef int int_v _Vector_size(16) aligned(16);
typedef long long_v _Vector_size(16) aligned(16);
typedef int int_v _Vector_size(16) forcealign(16);
typedef long long_v _Vector_size(16) forcealign(16);
static float_v Addps(struct Machine *m, float_v x, float_v y) {
return x + y;

View file

@ -4,8 +4,8 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
typedef float float_v _Vector_size(16) aligned(16);
typedef double double_v _Vector_size(16) aligned(16);
typedef float float_v _Vector_size(16) forcealign(16);
typedef double double_v _Vector_size(16) forcealign(16);
void OpUnpcklpsd(struct Machine *, uint32_t);
void OpUnpckhpsd(struct Machine *, uint32_t);

View file

@ -4,12 +4,12 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
void OpUd(struct Machine *, uint32_t) noreturn;
void HaltMachine(struct Machine *, int) noreturn;
void ThrowDivideError(struct Machine *) noreturn;
void ThrowSegmentationFault(struct Machine *, int64_t) noreturn;
void ThrowProtectionFault(struct Machine *) noreturn;
void OpHlt(struct Machine *, uint32_t) noreturn;
void OpUd(struct Machine *, uint32_t) wontreturn;
void HaltMachine(struct Machine *, int) wontreturn;
void ThrowDivideError(struct Machine *) wontreturn;
void ThrowSegmentationFault(struct Machine *, int64_t) wontreturn;
void ThrowProtectionFault(struct Machine *) wontreturn;
void OpHlt(struct Machine *, uint32_t) wontreturn;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */