aboutsummaryrefslogtreecommitdiff
path: root/include/ssa
diff options
context:
space:
mode:
Diffstat (limited to 'include/ssa')
-rw-r--r--include/ssa/ssa.h7
1 files changed, 6 insertions, 1 deletions
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/*<SsaNumberType, IntermediateIndex>*/ intermediates;
+ HashMap/*<SsaNumberType, SsaIntermediateIndex>*/ intermediates;
+ HashMap/*<BufferView, SsaStringIndex>*/ 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);