diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-04-24 21:22:53 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 7f524c427597cc998f243769b0e22e4f450c55cf (patch) | |
tree | 0dba782c2214d1ce5309ba71cfd3dddaee4a52a1 /include | |
parent | 328a9c8310e8bab250b04e9e001ab0d890d33074 (diff) |
Progressing on bytecode (to c), fix ssa resolving multiple times
Diffstat (limited to 'include')
-rw-r--r-- | include/ast.h | 4 | ||||
-rw-r--r-- | include/ssa/ssa.h | 4 | ||||
-rw-r--r-- | include/std/file.h | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/include/ast.h b/include/ast.h index c010538..c40be22 100644 --- a/include/ast.h +++ b/include/ast.h @@ -57,7 +57,8 @@ typedef enum { typedef enum { AST_NOT_RESOLVED, AST_RESOLVING, - AST_RESOLVED + AST_RESOLVED, + AST_SSA_RESOLVED } AstResolveStatus; typedef struct { @@ -69,6 +70,7 @@ typedef struct { AstValue value; AstType type; AstResolveData resolve_data; + SsaRegister ssa_reg; } Ast; struct Scope { diff --git a/include/ssa/ssa.h b/include/ssa/ssa.h index 32d1ba6..e1e2d01 100644 --- a/include/ssa/ssa.h +++ b/include/ssa/ssa.h @@ -44,7 +44,8 @@ typedef struct { Buffer/*instruction data*/ instructions; HashMap/*<SsaNumber, SsaIntermediateIndex>*/ intermediates_map; Buffer/*SsaNumber*/ intermediates; - HashMap/*<BufferView, SsaStringIndex>*/ strings; + HashMap/*<BufferView, SsaStringIndex>*/ strings_map; + Buffer/*BufferView*/ strings; SsaIntermediateIndex intermediate_counter; SsaStringIndex string_counter; SsaRegister reg_counter; @@ -77,6 +78,7 @@ SsaNumber create_ssa_integer(i64 value); SsaNumber create_ssa_float(f64 value); SsaNumber ssa_get_intermediate(Ssa *self, SsaIntermediateIndex index); +BufferView ssa_get_string(Ssa *self, SsaStringIndex index); CHECK_RESULT int ssa_init(Ssa *self, ScopedAllocator *allocator); CHECK_RESULT int ssa_get_unique_reg(Ssa *self, SsaRegister *result); diff --git a/include/std/file.h b/include/std/file.h index c6753fd..9184053 100644 --- a/include/std/file.h +++ b/include/std/file.h @@ -32,8 +32,7 @@ CHECK_RESULT int mapped_file_init(MappedFile *self, const char *filepath, Mapped CHECK_RESULT int mapped_file_deinit(MappedFile *self); #endif -/* @data will be allocated with am_malloc, should be deallocated with am_free */ -CHECK_RESULT int read_whole_file(const char *filepath, char **data, usize *size); +CHECK_RESULT int read_whole_file(const char *filepath, Buffer *result); /* @result_path will be allocated with am_malloc, should be deallocated with am_free */ CHECK_RESULT int file_get_canonical_path(const char *filepath, char **result_path, usize *result_path_size); |