scf.git
47 hours agofix: heap overflow when memcpy() in scf_vector.h, it is a common memory BUG of C... master
yu.dongliang [Tue, 23 Jun 2026 07:44:21 +0000 (15:44 +0800)]
fix: heap overflow when memcpy() in scf_vector.h, it is a common memory BUG of C language.

2 days agoflat anonymous union & struct.
yu.dongliang [Tue, 23 Jun 2026 07:34:06 +0000 (15:34 +0800)]
flat anonymous union & struct.

2 days agomov parse code of 'struct, union, class' to one module
yu.dongliang [Tue, 23 Jun 2026 07:30:17 +0000 (15:30 +0800)]
mov parse code of 'struct, union, class' to one module

4 days ago1, delete member 'code' of 'scf_rela_t' & use 'rela->inst->c' to get its 3ac code,
yu.dongliang [Sun, 21 Jun 2026 03:00:14 +0000 (11:00 +0800)]
1, delete member 'code' of 'scf_rela_t' & use 'rela->inst->c' to get its 3ac code,
2, x64/peephole: move some 'code to make instruction' into some little functions, in order to decrease code of key functions.

4 days ago1, support C macro: #ifndef, #ifdef, #endif for .h file, auto search .h path in the...
yu.dongliang [Sun, 21 Jun 2026 02:53:40 +0000 (10:53 +0800)]
1, support C macro: #ifndef, #ifdef, #endif for .h file, auto search .h path in the same dir of .c file.
2, delete some un-used old files.

7 days agosupport func_ptr var & func_ptr array[]
yu.dongliang [Wed, 17 Jun 2026 16:24:36 +0000 (00:24 +0800)]
support func_ptr var & func_ptr array[]

7 days agosupport function pointer array.
yu.dongliang [Wed, 17 Jun 2026 14:57:54 +0000 (22:57 +0800)]
support function pointer array.

7 days agodelete some un-used member vars and code for them.
yu.dongliang [Wed, 17 Jun 2026 14:55:05 +0000 (22:55 +0800)]
delete some un-used member vars and code for them.

10 days ago1, fix: memory layout of stack error int X64,
yu.dongliang [Sun, 14 Jun 2026 11:09:00 +0000 (19:09 +0800)]
1, fix: memory layout of stack error int X64,
2, fix: x64 peephole: when a register is changed, then memory data based on it invalid.

2 weeks ago../lex/scf_lex_util.c
yu.dongliang [Tue, 9 Jun 2026 11:07:52 +0000 (19:07 +0800)]
../lex/scf_lex_util.c

2 weeks ago1, support const double / float literal number such as .618, .5f, etc.
yu.dongliang [Tue, 9 Jun 2026 11:02:52 +0000 (19:02 +0800)]
1, support const double / float literal number such as .618, .5f, etc.
2, support const number calculate with u64 type.

7 weeks agoadd scf_utf8_len() to get a UTF-8 char & its bytes
yu.dongliang [Sat, 2 May 2026 06:43:52 +0000 (14:43 +0800)]
add scf_utf8_len() to get a UTF-8 char & its bytes

4 months agoprint Naja binary instruction when dis-asm
yu.dongliang [Thu, 29 Jan 2026 08:57:55 +0000 (16:57 +0800)]
print Naja binary instruction when dis-asm

4 months agoasm: support .align and .org for naja
yu.dongliang [Wed, 28 Jan 2026 11:42:44 +0000 (19:42 +0800)]
asm: support .align and .org for naja

5 months agoasm: support .align and .org for x64
yu.dongliang [Fri, 23 Jan 2026 14:43:52 +0000 (22:43 +0800)]
asm: support .align and .org for x64

5 months agoasm: support simple asm code for x64 & naja
yu.dongliang [Wed, 21 Jan 2026 13:50:59 +0000 (21:50 +0800)]
asm: support simple asm code for x64 & naja

5 months ago../elf/scf_elf_link.c
yu.dongliang [Sun, 11 Jan 2026 15:24:25 +0000 (23:24 +0800)]
../elf/scf_elf_link.c

5 months agofix: _x64_set_offset_for_jmps() for number label for ASM
yu.dongliang [Sat, 10 Jan 2026 14:57:01 +0000 (22:57 +0800)]
fix: _x64_set_offset_for_jmps() for number label for ASM

5 months agoasm: ../lib/x64/_start.s ok
yu.dongliang [Sat, 10 Jan 2026 12:55:47 +0000 (20:55 +0800)]
asm: ../lib/x64/_start.s ok

5 months agoadd a simple assembler for x64 ASM
yu.dongliang [Fri, 2 Jan 2026 11:13:30 +0000 (19:13 +0800)]
add a simple assembler for x64 ASM

5 months agoREADME.md
yu.dongliang [Fri, 2 Jan 2026 11:06:39 +0000 (19:06 +0800)]
README.md

6 months agoupdate Naja byte code, add some instructions to it
yu.dongliang [Mon, 22 Dec 2025 15:43:59 +0000 (23:43 +0800)]
update Naja byte code, add some instructions to it

6 months agouse scf_ast_find_proper_function() instead of _semantic_find_proper_function2(),...
yu.dongliang [Sat, 13 Dec 2025 08:04:59 +0000 (16:04 +0800)]
use scf_ast_find_proper_function() instead of _semantic_find_proper_function2(), delete some unused code

6 months agofix: for() loop without cond expr, such as 'for( ; ; )'
yu.dongliang [Tue, 18 Nov 2025 13:35:37 +0000 (21:35 +0800)]
fix: for() loop without cond expr, such as 'for( ; ; )'

6 months agosupport declare var in for(), such as for(int i = 0; ; )
yu.dongliang [Sun, 16 Nov 2025 15:25:15 +0000 (23:25 +0800)]
support declare var in for(), such as for(int i = 0; ; )

6 months agosupport ++, -- for float & double
yu.dongliang [Fri, 14 Nov 2025 14:56:54 +0000 (22:56 +0800)]
support ++, -- for float & double

6 months ago1, set 'start flag' of a new basic block to the 3ac code for 'assign to a pointer',
yu.dongliang [Mon, 10 Nov 2025 08:13:47 +0000 (16:13 +0800)]
1, set 'start flag' of a new basic block to the 3ac code for 'assign to a pointer',
2, mov DAG optimizer of basic block before auto gc,
3, add x64 native 'seta, setb, setae, setbe' for float cmp,
4, fix: x64_inst_is_useful().

6 months agofix: 'inline error' for ../examples/list_test.c, fix x64 opcode for array index
yu.dongliang [Thu, 23 Oct 2025 10:56:13 +0000 (18:56 +0800)]
fix: 'inline error' for ../examples/list_test.c, fix x64 opcode for array index

6 months agore-name key word 'create' to 'new'
yu.dongliang [Sat, 11 Oct 2025 08:08:29 +0000 (16:08 +0800)]
re-name key word 'create' to 'new'

6 months agofix: scf_dag_node_same() for create()
yu.dongliang [Thu, 28 Aug 2025 12:33:09 +0000 (20:33 +0800)]
fix: scf_dag_node_same() for create()

6 months agofix: error when 'enum' var in 'switch-case'
yu.dongliang [Mon, 25 Aug 2025 04:02:02 +0000 (12:02 +0800)]
fix: error when 'enum' var in 'switch-case'

6 months agofix: _scf_op_create()
yu.dongliang [Fri, 22 Aug 2025 09:04:51 +0000 (17:04 +0800)]
fix: _scf_op_create()

6 months agofix: x64 xmm registers, update function signature
yu.dongliang [Tue, 19 Aug 2025 08:10:38 +0000 (16:10 +0800)]
fix: x64 xmm registers, update function signature

6 months agofix: auto gc _find_dn_active()
yu.dongliang [Sun, 10 Aug 2025 02:22:21 +0000 (10:22 +0800)]
fix: auto gc _find_dn_active()

6 months agofix: x64 x64_load_bb_colors2()
yu.dongliang [Sat, 9 Aug 2025 16:53:11 +0000 (00:53 +0800)]
fix: x64 x64_load_bb_colors2()

6 months agofix: __x64_so_add_dyn()
yu.dongliang [Thu, 7 Aug 2025 09:38:25 +0000 (17:38 +0800)]
fix: __x64_so_add_dyn()

6 months agofix: struct array run core dump
yu.dongliang [Fri, 1 Aug 2025 13:23:21 +0000 (21:23 +0800)]
fix: struct array run core dump

6 months agosplit scf_parse_compile() to scf_parse_compile() and scf_parse_to_obj(), fix x64...
yu.dongliang [Sun, 27 Jul 2025 16:23:46 +0000 (00:23 +0800)]
split scf_parse_compile() to scf_parse_compile() and scf_parse_to_obj(), fix x64 peephole error for global var

6 months agoupdate for native/eda
yu.dongliang [Sun, 6 Jul 2025 15:08:14 +0000 (23:08 +0800)]
update for native/eda

6 months agouse TTL Nand to combine the circuit graph in 'eda/native' module
yu.dongliang [Fri, 11 Apr 2025 12:19:45 +0000 (20:19 +0800)]
use TTL Nand to combine the circuit graph in 'eda/native' module

6 months agoadd DIV, SHR, SHL in native/eda
yu.dongliang [Fri, 14 Mar 2025 17:00:27 +0000 (01:00 +0800)]
add DIV, SHR, SHL in native/eda

6 months agosupport MUL, SHL, SHR, ... etc in native/eda
yu.dongliang [Thu, 13 Mar 2025 08:11:32 +0000 (16:11 +0800)]
support MUL, SHL, SHR, ... etc in native/eda

6 months agosupport bit member of struct, such as 'struct S { uint8_t flag:1; }; '
yu.dongliang [Thu, 6 Mar 2025 09:17:39 +0000 (17:17 +0800)]
support bit member of struct, such as 'struct S { uint8_t flag:1; }; '

6 months agouse the same syntax to C when init struct & array
yu.dongliang [Fri, 28 Feb 2025 04:17:29 +0000 (12:17 +0800)]
use the same syntax to C when init struct & array

6 months agosupport to generate shared object .so (dynamic library)
yu.dongliang [Wed, 26 Feb 2025 15:47:01 +0000 (23:47 +0800)]
support to generate shared object .so (dynamic library)

6 months agoupdate x64 peephole, support VLA in loop, and fix some bugs
yu.dongliang [Thu, 20 Feb 2025 09:37:54 +0000 (17:37 +0800)]
update x64 peephole, support VLA in loop, and fix some bugs

6 months agosupport variable length array, VLA
yu.dongliang [Mon, 17 Feb 2025 15:43:28 +0000 (23:43 +0800)]
support variable length array, VLA

6 months agofix: run error because of recursive 'type cast' in ../examples/scf_malloc.c
yu.dongliang [Fri, 29 Nov 2024 13:23:30 +0000 (21:23 +0800)]
fix: run error because of recursive 'type cast' in ../examples/scf_malloc.c

6 months agofix: scf_inst_data_same()
yu.dongliang [Mon, 11 Nov 2024 07:53:22 +0000 (15:53 +0800)]
fix: scf_inst_data_same()

6 months ago1, merge 'coroutine' to scf core framework, 2, close some logs, 3, fix: x64 integer...
yu.dongliang [Mon, 11 Nov 2024 06:01:07 +0000 (14:01 +0800)]
1, merge 'coroutine' to scf core framework, 2, close some logs, 3, fix: x64 integer register & float register No. conflict

6 months agooptimize x64 peephole for local vars
yu.dongliang [Tue, 15 Oct 2024 11:29:18 +0000 (19:29 +0800)]
optimize x64 peephole for local vars

6 months agooptimize argv[]'s sign/zero extending position of function call()
yu.dongliang [Mon, 14 Oct 2024 09:43:41 +0000 (17:43 +0800)]
optimize argv[]'s sign/zero extending position of function call()

6 months agofix: multi-return-value error, return in rax/rdi/rsi/rdx to decrease the binary code...
yu.dongliang [Sun, 13 Oct 2024 13:17:09 +0000 (21:17 +0800)]
fix: multi-return-value error, return in rax/rdi/rsi/rdx to decrease the binary code for little function

6 months agodec 'push / pop rets (return values)' in auto gc
yu.dongliang [Sun, 13 Oct 2024 08:33:59 +0000 (16:33 +0800)]
dec 'push / pop rets (return values)' in auto gc

6 months agosupport auto gc for multi-return-values
yu.dongliang [Sat, 12 Oct 2024 16:39:35 +0000 (00:39 +0800)]
support auto gc for multi-return-values

6 months agomake auto gc module more clearly, move some repeated into a function
yu.dongliang [Thu, 10 Oct 2024 14:25:59 +0000 (22:25 +0800)]
make auto gc module more clearly, move some repeated into a function

6 months agodelete some unused or repeat code
yu.dongliang [Wed, 9 Oct 2024 10:38:30 +0000 (18:38 +0800)]
delete some unused or repeat code

6 months agooptimize common sub-expr after call() analysis
yu.dongliang [Tue, 8 Oct 2024 13:26:36 +0000 (21:26 +0800)]
optimize common sub-expr after call() analysis

6 months agooptimize operator handlers
yu.dongliang [Mon, 7 Oct 2024 05:08:08 +0000 (13:08 +0800)]
optimize operator handlers

6 months agofix: pointer ++ / -- / += / -= error
yu.dongliang [Sun, 6 Oct 2024 15:48:15 +0000 (23:48 +0800)]
fix: pointer ++ / -- / += / -= error

6 months agofix: core dump with ../examples/mat_mul_strassen.c
yu.dongliang [Sun, 6 Oct 2024 10:37:52 +0000 (18:37 +0800)]
fix: core dump with ../examples/mat_mul_strassen.c

6 months agofix: x64 SIB encode error for register r12, r13.
yu.dongliang [Sat, 5 Oct 2024 11:28:59 +0000 (19:28 +0800)]
fix: x64 SIB encode error for register r12, r13.
fix: DAG of call() error when function has no arg.
fix: change pointer add / sub to address of array.
fix: optimize 'const teq'

6 months agofix: macro pre-process error when arg has multi-words,
yu.dongliang [Fri, 4 Oct 2024 15:31:52 +0000 (23:31 +0800)]
fix: macro pre-process error when arg has multi-words,
fix: DAG error for auto type cast 'int n = 2; sizeof(int) * n * n',
fix: optimize const teq error for assert(0), macro extends as below:
do {
if (!0)
printf(...);
} while (0)

6 months agofor member array[0] in the end of a struct
yu.dongliang [Thu, 3 Oct 2024 06:07:56 +0000 (14:07 +0800)]
for member array[0] in the end of a struct

6 months agooptimize switch-case for "const literal string"
yu.dongliang [Wed, 2 Oct 2024 09:07:57 +0000 (17:07 +0800)]
optimize switch-case for "const literal string"

6 months agosupport "const literal string" in 'case' for 'switch'
yu.dongliang [Wed, 2 Oct 2024 04:30:07 +0000 (12:30 +0800)]
support "const literal string" in 'case' for 'switch'

6 months agoclose some debug logs
yu.dongliang [Tue, 1 Oct 2024 05:26:25 +0000 (13:26 +0800)]
close some debug logs

6 months agodelete ../core/scf_optimizer_dominators_reverse.c
yu.dongliang [Tue, 1 Oct 2024 04:25:04 +0000 (12:25 +0800)]
delete ../core/scf_optimizer_dominators_reverse.c

6 months agostruct & array init with '{.key = value, } ok
yu.dongliang [Mon, 30 Sep 2024 11:32:45 +0000 (19:32 +0800)]
struct & array init with '{.key = value, } ok

6 months agofix: scf_lex_word_clone() lost copy data when some type
yu.dongliang [Sun, 29 Sep 2024 06:15:47 +0000 (14:15 +0800)]
fix: scf_lex_word_clone() lost copy data when some type

6 months agoupdate lex for '.'
yu.dongliang [Sat, 28 Sep 2024 13:10:19 +0000 (21:10 +0800)]
update lex for '.'

6 months agouse 'while loop' instead of 'recursive call' for macro
yu.dongliang [Fri, 27 Sep 2024 09:27:26 +0000 (17:27 +0800)]
use 'while loop' instead of 'recursive call' for macro

6 months agosupport simple macro function, like A(x) --> #x --> x
yu.dongliang [Thu, 26 Sep 2024 15:18:45 +0000 (23:18 +0800)]
support simple macro function, like A(x) --> #x --> x

6 months agosupport simple macro define, rename some long struct name
yu.dongliang [Thu, 26 Sep 2024 07:07:21 +0000 (15:07 +0800)]
support simple macro define, rename some long struct name

6 months agofix: parse error for 'int main(int argc, char* argv[])', delete some unused code
yu.dongliang [Mon, 23 Sep 2024 08:31:05 +0000 (16:31 +0800)]
fix: parse error for 'int main(int argc, char* argv[])', delete some unused code

6 months agoREADME.md
yu.dongliang [Fri, 20 Sep 2024 12:02:20 +0000 (20:02 +0800)]
README.md

6 months agoupdate README.md for main()
yu.dongliang [Mon, 16 Sep 2024 03:24:28 +0000 (11:24 +0800)]
update README.md for main()

6 months agosupport [-s sysroot] of main() argv to select the sysroot dir
yu.dongliang [Mon, 2 Sep 2024 08:52:12 +0000 (16:52 +0800)]
support [-s sysroot] of main() argv to select the sysroot dir

6 months agosupport 'enum' & add a test examples/enum.c
yu.dongliang [Mon, 2 Sep 2024 06:47:01 +0000 (14:47 +0800)]
support 'enum' & add a test examples/enum.c

6 months agooptimize some code for lex & DFA module
yu.dongliang [Fri, 30 Aug 2024 07:44:20 +0000 (15:44 +0800)]
optimize some code for lex & DFA module

6 months agosupport argc & argv in main() for x64, support fopen(), fclose(), ...
yu.dongliang [Wed, 28 Aug 2024 08:56:16 +0000 (16:56 +0800)]
support argc & argv in main() for x64, support fopen(), fclose(), ...

6 months agofix: error when get the return err code of create(), such as examples/ret2_err.c
yu.dongliang [Tue, 27 Aug 2024 10:43:05 +0000 (18:43 +0800)]
fix: error when get the return err code of create(), such as examples/ret2_err.c

6 months agosupport Chinese Programming with UTF-8 in 0x4e00 ~ 0x9fa5, 支持中文编程. delete some 'assert()'
yu.dongliang [Fri, 23 Aug 2024 10:43:11 +0000 (18:43 +0800)]
support Chinese Programming with UTF-8 in 0x4e00 ~ 0x9fa5, 支持中文编程. delete some 'assert()'

6 months agoadd NAND / NOR / NOT gate in native/eda
yu.dongliang [Sun, 23 Jun 2024 11:20:02 +0000 (19:20 +0800)]
add NAND / NOR / NOT gate in native/eda

6 months agoadd MUL() in native/eda, fix 3ac error for 'pre ++'
yu.dongliang [Thu, 13 Jun 2024 09:24:31 +0000 (17:24 +0800)]
add MUL() in native/eda, fix 3ac error for 'pre ++'

6 months agosupport 'sub' in native/eda module
yu.dongliang [Mon, 10 Jun 2024 08:38:46 +0000 (16:38 +0800)]
support 'sub' in native/eda module

6 months agoclose some unused logs
yu.dongliang [Thu, 9 May 2024 13:12:22 +0000 (21:12 +0800)]
close some unused logs

6 months agoupdate native/eda
yu.dongliang [Sun, 21 Apr 2024 12:04:52 +0000 (20:04 +0800)]
update native/eda

6 months agochange resistance value from complex to real number in native/eda
yu.dongliang [Wed, 17 Apr 2024 08:53:24 +0000 (16:53 +0800)]
change resistance value from complex to real number in native/eda

6 months agosupport 'switch-case' & delete some unused code
yu.dongliang [Fri, 12 Apr 2024 12:08:30 +0000 (20:08 +0800)]
support 'switch-case' & delete some unused code

6 months agoREADME.md
yu.dongliang [Mon, 25 Mar 2024 10:19:37 +0000 (18:19 +0800)]
README.md

6 months agoREADME.md
yu.dongliang [Sat, 23 Mar 2024 15:46:29 +0000 (23:46 +0800)]
README.md

6 months agouse scf/pack instead of protobuf in native/eda
yu.dongliang [Sat, 9 Mar 2024 14:09:20 +0000 (22:09 +0800)]
use scf/pack instead of protobuf in native/eda

6 months agoscf/pack: add a simpile compression algorithm
yu.dongliang [Sat, 9 Mar 2024 05:40:21 +0000 (13:40 +0800)]
scf/pack: add a simpile compression algorithm

6 months agoscf/pack: support var array and object array
yu.dongliang [Mon, 4 Mar 2024 11:17:38 +0000 (19:17 +0800)]
scf/pack: support var array and object array

6 months agoadd a simple data pack module 'scf/pack'
yu.dongliang [Thu, 22 Feb 2024 04:01:08 +0000 (12:01 +0800)]
add a simple data pack module 'scf/pack'

6 months agodelete some unused code
yu.dongliang [Sat, 30 Dec 2023 14:46:48 +0000 (22:46 +0800)]
delete some unused code

6 months agodelete some unused code
yu.dongliang [Wed, 27 Dec 2023 16:45:56 +0000 (00:45 +0800)]
delete some unused code

6 months agodelete 'bb_list_head' in optimizer callback()
yu.dongliang [Tue, 26 Dec 2023 14:00:35 +0000 (22:00 +0800)]
delete 'bb_list_head' in optimizer callback()

6 months agodelete some unused code
yu.dongliang [Mon, 18 Dec 2023 15:01:27 +0000 (23:01 +0800)]
delete some unused code