Commit Graph

101 Commits

Author SHA1 Message Date
Rui Ueyama 90d1f7f199 Make struct member access to work with `=` and `?:` 2020-12-07 12:00:06 +09:00
Rui Ueyama 80ea9d427c Add atomic_exchange 2020-12-07 12:00:06 +09:00
Rui Ueyama ca27455b92 Add atomic_compare_exchange 2020-12-07 12:00:06 +09:00
Rui Ueyama 86785fceb1 Add -fpic and -fPIC options 2020-12-07 12:00:06 +09:00
Rui Ueyama f0c98e0d59 [GNU] Treat labels-as-values as compile-time constant 2020-12-07 12:00:06 +09:00
Rui Ueyama 4f165ec60b [GNU] Support labels-as-values 2020-12-07 12:00:06 +09:00
Rui Ueyama d90c73b605 [GNU] Support case ranges 2020-12-07 12:00:06 +09:00
Rui Ueyama e0bf168041 Add long double 2020-12-07 12:00:06 +09:00
Rui Ueyama 8d130ab93f Emit size and type for symbols 2020-12-07 12:00:06 +09:00
Rui Ueyama 07f901057f Add pointer arithmetic for VLA 2020-12-07 12:00:06 +09:00
Rui Ueyama 77275c546a Add alloca() 2020-12-07 12:00:06 +09:00
Rui Ueyama b3772845bd Add thread-local variable 2020-12-07 12:00:06 +09:00
Rui Ueyama 6d344ed945 Add -fcommon and -fno-common flags 2020-12-07 12:00:06 +09:00
Rui Ueyama 85e46b1071 Add tentative definition 2020-12-07 12:00:06 +09:00
Rui Ueyama 6a2dc5a48a Use __attribute__((format(print, ...))) to find programming errors 2020-12-07 12:00:06 +09:00
Rui Ueyama e5f4ca90fd Do not emit static inline functions if referenced by no one 2020-12-07 12:00:06 +09:00
Rui Ueyama a2535163e2 Add basic "asm" statement 2020-12-07 12:00:06 +09:00
Rui Ueyama 9c36dd727c Make "main" to implicitly return 0 2020-12-07 12:00:06 +09:00
Rui Ueyama 5257ee0f20 Make an array of at least 16 bytes long to have alignment of at least 16 bytes
Quote from AMD64 System V ABI: "An array uses the same alignment as
its elements, except that a local or global array variable of length
at least 16 bytes or a C99 variable-length array variable always has
alignment of at least 16 bytes."
2020-12-07 12:00:06 +09:00
Rui Ueyama 54c2b3b18f Handle op=-style assignments to bitfields 2020-12-07 12:00:06 +09:00
Rui Ueyama cc852fe99d Add bitfield 2020-12-07 12:00:06 +09:00
Rui Ueyama b6d3cd00df Allow variadic function to take more than 6 parameters 2020-12-07 12:00:06 +09:00
Rui Ueyama d7bad96114 Allow to define a function returning a struct 2020-12-07 12:00:06 +09:00
Rui Ueyama c72df1c9be Allow to call a fucntion returning a struct 2020-12-07 12:00:06 +09:00
Rui Ueyama d63b1f410a Allow struct argument 2020-12-07 12:00:06 +09:00
Rui Ueyama 5e0f8c47e3 Allow struct parameter 2020-12-07 12:00:06 +09:00
Rui Ueyama 9021f7f5de Support passed-on-stack parameters 2020-12-07 12:00:06 +09:00
Rui Ueyama b29f052102 Support passed-on-stack arguments 2020-12-07 12:00:06 +09:00
Rui Ueyama d367510fcc Add #include "..." 2020-12-07 12:00:06 +09:00
Rui Ueyama d06a8ac6e6 Add function pointer 2020-12-07 12:00:06 +09:00
Rui Ueyama e452cf7215 Support variadic function with floating-point parameters 2020-12-07 12:00:06 +09:00
Rui Ueyama c6b30568b4 Allow to define a function that takes/returns flonums 2020-12-07 12:00:06 +09:00
Rui Ueyama 8ec1ebf176 Allow to call a function that takes/returns flonums 2020-12-07 12:00:06 +09:00
Rui Ueyama 0ce1093027 Handle flonum for if, while, do, !, ?:, || and && 2020-12-07 12:00:06 +09:00
Rui Ueyama 83f76ebb66 Add flonum +, -, * and / 2020-12-07 12:00:06 +09:00
Rui Ueyama cf9ceecb2f Add flonum ==, !=, < and <= 2020-12-07 12:00:06 +09:00
Rui Ueyama 29de46aed4 Add "float" and "double" local variables and casts 2020-12-07 12:00:06 +09:00
Rui Ueyama 1e57f72d8a Add floating-point constant 2020-12-07 12:00:06 +09:00
Rui Ueyama 34ab83bdf4 Add unsigned integral types 2020-12-07 12:00:06 +09:00
Rui Ueyama 754a24fafc Add va_start to support variadic functions 2020-12-07 12:00:06 +09:00
Rui Ueyama dcd4579226 Handle a function returning bool, char or short
x86-64 psABI says that only the least significant 8 bits are
significant if RAX has a return value of a function returning bool.
Likewise, it looks like only the least significant 1 or 2 bytes
are guaranteed to have a correct value for char and short return
values, respectively.
2020-12-07 12:00:06 +09:00
Rui Ueyama 6a0ed71107 Align stack frame to 16 byte boundaries 2020-12-07 12:00:06 +09:00
Rui Ueyama ee252e6ce7 Add do ... while 2020-12-07 12:00:06 +09:00
Rui Ueyama eb85527656 Add static global variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 30b3e216cd Add return that doesn't take any value 2020-12-07 12:00:06 +09:00
Rui Ueyama 9df51789e7 Add _Alignof and _Alignas 2020-12-07 12:00:06 +09:00
Rui Ueyama 006a45ccd4 Add extern 2020-12-07 12:00:06 +09:00
Rui Ueyama 157356c769 Align global variables 2020-12-07 12:00:06 +09:00
Rui Ueyama 3d216e3e06 Emit uninitialized global data to .bss instead of .data 2020-12-07 12:00:06 +09:00
Rui Ueyama 1eae5ae367 Handle union initializers for global variable 2020-12-07 12:00:06 +09:00