Cthulhu  0.2.10
Cthulhu compiler collection
common.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-only
2 
3 #pragma once
4 
5 #include "cthulhu/ssa/ssa.h"
6 
7 typedef struct fs_t fs_t;
8 
9 typedef struct names_t
10 {
11  size_t counter;
13 } names_t;
14 
15 typedef struct visit_ast_t
16 {
19 
23 } emit_t;
24 
25 CT_LOCAL char *begin_module(emit_t *emit, fs_t *fs, const ssa_module_t *mod);
27 
28 CT_LOCAL names_t names_new(size_t size, arena_t *arena);
29 CT_LOCAL void counter_reset(emit_t *emit);
30 
31 CT_LOCAL char *get_step_name(emit_t *emit, const ssa_step_t *step);
32 CT_LOCAL char *get_block_name(emit_t *emit, const ssa_block_t *block);
33 CT_LOCAL char *get_anon_symbol_name(emit_t *emit, const ssa_symbol_t *symbol, const char *prefix);
34 CT_LOCAL char *get_anon_local_name(emit_t *emit, const ssa_local_t *local, const char *prefix);
35 CT_LOCAL char *get_step_from_block(emit_t *emit, const ssa_block_t *block, size_t index);
36 
37 CT_LOCAL const char *type_to_string(const ssa_type_t *type, arena_t *arena);
38 
39 CT_LOCAL char *c89_format_integer_literal(arena_t *arena, const mpz_t value);
CT_NODISCARD size_t size
Definition: scan.h:128
#define CT_LOCAL
Definition: compiler.h:166
an allocator object
Definition: arena.h:86
target code emitter options
Definition: common.h:16
arena_t * arena
arena to use
Definition: common.h:17
names_t anon_names
Definition: common.h:22
logger_t * reports
Definition: common.h:18
names_t block_names
Definition: common.h:20
names_t vreg_names
Definition: common.h:21
Definition: common.h:72
a logging sink
Definition: notify.c:14
an unordered hash map
Definition: map.h:38
Definition: common.h:10
map_t * names
Definition: common.h:12
size_t counter
Definition: common.h:11
CT_LOCAL char * get_block_name(emit_t *emit, const ssa_block_t *block)
Definition: common.c:77
CT_LOCAL char * get_step_name(emit_t *emit, const ssa_step_t *step)
Definition: common.c:72
CT_LOCAL char * get_step_from_block(emit_t *emit, const ssa_block_t *block, size_t index)
Definition: common.c:103
CT_LOCAL char * get_anon_local_name(emit_t *emit, const ssa_local_t *local, const char *prefix)
Definition: common.c:98
CT_LOCAL const char * type_to_string(const ssa_type_t *type, arena_t *arena)
Definition: common.c:176
CT_LOCAL char * get_anon_symbol_name(emit_t *emit, const ssa_symbol_t *symbol, const char *prefix)
Definition: common.c:93
CT_LOCAL names_t names_new(size_t size, arena_t *arena)
Definition: common.c:39
CT_LOCAL char * c89_format_integer_literal(arena_t *arena, const mpz_t value)
Definition: emit.c:309
CT_LOCAL void end_module(emit_t *emit)
CT_LOCAL void counter_reset(emit_t *emit)
Definition: common.c:49
CT_LOCAL char * begin_module(emit_t *emit, fs_t *fs, const ssa_module_t *mod)
Definition: common.c:17