#ifndef _codegen_h_ #define _codegen_h_ #include /* FILE */ #include /* for pid_t */ #include "pre.h" #include "ast.h" #include "state.h" #include "cgBackends.h" typedef struct { FILE *out; /* File where to output QBE IR */ FILE *asm_out; i64 strlit_no; i64 internal_label; /* Hash map acting as a set, which contains all strings in a compilation * unit. Strings get interned on this hash map to remove duplicates. */ HashMapStr(i64) *strings; pid_t ext_pid, ld_pid; enum CodegenBackends backend; Compiler *cctx; } CodegenCtx; void spawn_with_iofp(const char *path, char *const *argv, pid_t *pid, FILE **in, FILE **out); void process_wait(pid_t pid); CodegenCtx * codegen_new(Compiler *cm, enum CodegenBackends backend); void codegen_destroy(CodegenCtx *cgctx); void codegen(CodegenCtx *cgctx, Ast *program); #endif