ox

The Ox programming language, compiler and tools (WIP)
Log | Files | Refs | README | LICENSE

gen.h (625B)


      1 #pragma once
      2 
      3 #include <unistd.h> // for libgccjit
      4 #include <libgccjit.h>
      5 
      6 #include "types.h"
      7 
      8 typedef struct LoopContext {
      9 	gcc_jit_block* break_target;
     10 	gcc_jit_block* continue_target;
     11 	struct LoopContext* prev;
     12 } LoopContext;
     13 
     14 typedef struct {
     15 	gcc_jit_context* ctx;
     16 	gcc_jit_function* prev_func;
     17 	gcc_jit_function* curr_func;
     18 	gcc_jit_function* printf_fn;
     19 	gcc_jit_function* puts_fn;
     20 	gcc_jit_block* prev_block;
     21 	gcc_jit_block* curr_block;
     22 	// gcc_jit_type *type_kind; need type too?
     23 	Scope* scope;
     24 	LoopContext* loop;
     25 	const char* src;
     26 } Gen;
     27 
     28 Gen gen_init(Scope*, const char*, Node*, bool);
     29 void gen_next(Gen*, Node*);