aboutsummaryrefslogtreecommitdiff
path: root/include/ssa
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-03-14 21:24:44 +0100
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commitd4ca9de33906972fa06bd2b7e38cbc2b4d3574c2 (patch)
tree5e858b73db61a0f85ddfd02dd3076a8b3c8aa5af /include/ssa
parentad54d804fef1e1eb646d8ea4bd7ce65363e94fa8 (diff)
Add ssa string
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);