From d4ca9de33906972fa06bd2b7e38cbc2b4d3574c2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 14 Mar 2019 21:24:44 +0100 Subject: Add ssa string --- include/ssa/ssa.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/ssa') diff --git a/include/ssa/ssa.h b/include/ssa/ssa.h index 5411259..c374ffb 100644 --- a/include/ssa/ssa.h +++ b/include/ssa/ssa.h @@ -10,6 +10,7 @@ typedef enum { SSA_ASSIGN_INTER, + SSA_ASSIGN_STRING, SSA_ASSIGN_REG, SSA_ADD, SSA_SUB, @@ -36,12 +37,15 @@ typedef struct { typedef u16 SsaRegister; typedef u16 SsaIntermediateIndex; +typedef u16 SsaStringIndex; typedef u32 SsaFuncIndex; typedef struct { Buffer/*instruction data*/ instructions; - HashMap/**/ intermediates; + HashMap/**/ intermediates; + HashMap/**/ strings; SsaIntermediateIndex intermediate_counter; + SsaStringIndex string_counter; SsaRegister reg_counter; SsaFuncIndex func_counter; } Ssa; @@ -53,6 +57,7 @@ SsaNumber create_ssa_float(f64 value); CHECK_RESULT int ssa_init(Ssa *self, ScopedAllocator *allocator); CHECK_RESULT int ssa_get_unique_reg(Ssa *self, SsaRegister *result); CHECK_RESULT int ssa_ins_assign_inter(Ssa *self, SsaRegister dest, SsaNumber number); +CHECK_RESULT int ssa_ins_assign_string(Ssa *self, SsaRegister dest, BufferView str); CHECK_RESULT int ssa_ins_assign_reg(Ssa *self, SsaRegister dest, SsaRegister src); CHECK_RESULT int ssa_ins_binop(Ssa *self, SsaInstructionType binop_type, SsaRegister lhs, SsaRegister rhs, SsaRegister *result); CHECK_RESULT int ssa_ins_func_start(Ssa *self, u8 num_args, SsaFuncIndex *result); -- cgit v1.2.3