ox

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

gen.h (625B)



#pragma once

#include <unistd.h> // for libgccjit
#include <libgccjit.h>

#include "types.h"

typedef struct LoopContext {
	gcc_jit_block* break_target;
	gcc_jit_block* continue_target;
	struct LoopContext* prev;
} LoopContext;

typedef struct {
	gcc_jit_context* ctx;
	gcc_jit_function* prev_func;
	gcc_jit_function* curr_func;
	gcc_jit_function* printf_fn;
	gcc_jit_function* puts_fn;
	gcc_jit_block* prev_block;
	gcc_jit_block* curr_block;
	// gcc_jit_type *type_kind; need type too?
	Scope* scope;
	LoopContext* loop;
	const char* src;
} Gen;

Gen gen_init(Scope*, const char*, Node*, bool);
void gen_next(Gen*, Node*);