-typedef struct ir_block_s
-{
- const char *_label;
- filecontext_t context;
- ir_bool final; /* once a jump is added we're done */
-
- MAKE_VEC(ir_instr*, instr);
- MAKE_VEC(struct ir_block_s*, entries);
- MAKE_VEC(struct ir_block_s*, exits);
- MAKE_VEC(ir_value*, living);
-
- /* For the temp-allocation */
- size_t eid;
- ir_bool is_return;
- size_t run_id;
-
- struct ir_function_s *owner;
-} ir_block;
-
-ir_block* ir_block_new(struct ir_function_s *owner, const char *label);
-void ir_block_delete(ir_block*);
-
-void ir_block_set_label(ir_block*, const char *label);
-
-void ir_block_instr_add(ir_block*, ir_instr *instr);
-void ir_block_instr_remove(ir_block*, size_t idx);
-void ir_block_exits_add(ir_block*, ir_block *b);
-void ir_block_entries_add(ir_block*, ir_block *b);
-ir_bool ir_block_entries_find(ir_block*, ir_block *b, size_t *idx);
-
-ir_value* ir_block_create_binop(ir_block*, const char *label, ir_op_t op,
- ir_value *left, ir_value *right);
-ir_bool ir_block_create_store_op(ir_block*, ir_op_t op, ir_value *target, ir_value *what);
-ir_bool ir_block_create_store(ir_block*, ir_value *target, ir_value *what);
-
-ir_value* ir_block_create_add(ir_block*, const char *label, ir_value *l, ir_value *r);
-ir_value* ir_block_create_sub(ir_block*, const char *label, ir_value *l, ir_value *r);
-ir_value* ir_block_create_mul(ir_block*, const char *label, ir_value *l, ir_value *r);
-ir_value* ir_block_create_div(ir_block*, const char *label, ir_value *l, ir_value *r);
-ir_instr* ir_block_create_phi(ir_block*, const char *label, ir_type_t vtype);
+struct ir_block {
+ char *label;
+ lex_ctx_t context;
+ bool final; /* once a jump is added we're done */
+
+ ir_instr **instr;
+ ir_block **entries;
+ ir_block **exits;
+ ir_value **living;
+
+ /* For the temp-allocation */
+ size_t entry_id;
+ size_t eid;
+ bool is_return;
+
+ ir_function *owner;
+
+ bool generated;
+ size_t code_start;
+};
+
+ir_value* ir_block_create_binop(ir_block*, lex_ctx_t, const char *label, int op, ir_value *left, ir_value *right);
+ir_value* ir_block_create_unary(ir_block*, lex_ctx_t, const char *label, int op, ir_value *operand);
+bool GMQCC_WARN ir_block_create_store_op(ir_block*, lex_ctx_t, int op, ir_value *target, ir_value *what);
+bool GMQCC_WARN ir_block_create_storep(ir_block*, lex_ctx_t, ir_value *target, ir_value *what);
+ir_value* ir_block_create_load_from_ent(ir_block*, lex_ctx_t, const char *label, ir_value *ent, ir_value *field, int outype);
+ir_value* ir_block_create_fieldaddress(ir_block*, lex_ctx_t, const char *label, ir_value *entity, ir_value *field);
+bool GMQCC_WARN ir_block_create_state_op(ir_block*, lex_ctx_t, ir_value *frame, ir_value *think);
+
+/* This is to create an instruction of the form
+ * <outtype>%label := opcode a, b
+ */
+ir_instr* ir_block_create_phi(ir_block*, lex_ctx_t, const char *label, int vtype);