Skip to content

Commit

Permalink
Merge pull request katef#483 from katef/kate/llvm
Browse files Browse the repository at this point in the history
Add llvm codegen
  • Loading branch information
katef authored Jul 4, 2024
2 parents f35887d + 49118f5 commit 6b76c46
Show file tree
Hide file tree
Showing 16 changed files with 977 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ jobs:
cc: [ clang, gcc ]
make: [ bmake ]
debug: [ DEBUG, RELEASE ] # RELEASE=1 is a no-op
lang: [ "vm -x v1", "vm -x v2", asm, c, rust, vmc, vmops, go, goasm ]
lang: [ "vm -x v1", "vm -x v2", asm, c, rust, vmc, vmops, go, goasm, llvm ]
exclude:
- os: macos
cc: gcc # it's clang anyway
Expand Down
1 change: 1 addition & 0 deletions fuzz/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ fuzz_all_print_functions(FILE *f, const char *pattern, bool det, bool min, const
r |= fsm_print_sh(f, fsm);
r |= fsm_print_go(f, fsm);
r |= fsm_print_rust(f, fsm);
r |= fsm_print_llvm(f, fsm);
assert(r == 0 || errno != 0);

fsm_free(fsm);
Expand Down
2 changes: 2 additions & 0 deletions include/fsm/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct fsm;
* fsm_print_vmc - ISO C90 code, VM style
* fsm_print_vmdot - Graphviz Dot format, showing VM opcodes
* fsm_print_rust - Rust code
* fsm_print_llvm - Live Laugh Virtual Machine
* fsm_print_sh - Shell script (bash dialect)
* fsm_print_go - Go code
* fsm_print_goasm/vmasm_* - Assembly in various dialects
Expand Down Expand Up @@ -58,6 +59,7 @@ fsm_print fsm_print_vmasm_amd64_go; /* output amd64 assembler in Go format */
fsm_print fsm_print_sh;
fsm_print fsm_print_go;
fsm_print fsm_print_rust;
fsm_print fsm_print_llvm;
fsm_print fsm_print_vmops_c;
fsm_print fsm_print_vmops_h;
fsm_print fsm_print_vmops_main;
Expand Down
4 changes: 4 additions & 0 deletions include/print/esc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ escputc json_escputc;
escputc pcre_escputc;
escputc rust_escputc_char;
escputc rust_escputc_str;
escputc llvm_escputc_char;

int
awk_escputcharlit(FILE *f, const struct fsm_options *opt, char c);

int
c_escputcharlit(FILE *f, const struct fsm_options *opt, char c);

void
llvm_escputcharlit(FILE *f, const struct fsm_options *opt, char c);

void
rust_escputcharlit(FILE *f, const struct fsm_options *opt, char c);

Expand Down
1 change: 1 addition & 0 deletions src/fsm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ print_name(const char *name)
{ "vmc", fsm_print_vmc },
{ "vmdot", fsm_print_vmdot },
{ "rust", fsm_print_rust },
{ "llvm", fsm_print_llvm },
{ "sh", fsm_print_sh },
{ "go", fsm_print_go },

Expand Down
1 change: 1 addition & 0 deletions src/libfsm/libfsm.syms
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fsm_print_vmasm_amd64_att
fsm_print_vmasm_amd64_nasm
fsm_print_vmasm_amd64_go
fsm_print_rust
fsm_print_llvm
fsm_print_sh
fsm_print_go
fsm_print_vmops_c
Expand Down
1 change: 1 addition & 0 deletions src/libfsm/print/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SRC += src/libfsm/print/irdot.c
SRC += src/libfsm/print/irjson.c
SRC += src/libfsm/print/json.c
SRC += src/libfsm/print/rust.c
SRC += src/libfsm/print/llvm.c
SRC += src/libfsm/print/sh.c
SRC += src/libfsm/print/go.c
SRC += src/libfsm/print/vmc.c
Expand Down
Loading

0 comments on commit 6b76c46

Please sign in to comment.