intern identifiers

This commit is contained in:
2026-06-10 21:27:00 +02:00
parent d6e03b6f08
commit cdbe4fbc99
16 changed files with 497 additions and 182 deletions
+2 -4
View File
@@ -1,6 +1,7 @@
package ir
import "../source"
import "../symbol"
import "../types"
import "core:mem"
@@ -34,7 +35,6 @@ Instruction :: struct {
}
Function :: struct {
name: string,
link_name: string,
c_abi: bool,
is_main: bool,
@@ -45,7 +45,7 @@ Function :: struct {
}
Global :: struct {
name: string,
name: symbol.Id,
type: types.Type,
is_static: bool,
static_value: i64,
@@ -77,13 +77,11 @@ destroy_instructions :: proc(instructions: []Instruction, allocator: mem.Allocat
destroy_module :: proc(module: ^Module) {
for function in module.functions {
delete(function.name, module.allocator)
delete(function.link_name, module.allocator)
delete(function.param_types, module.allocator)
destroy_instructions(function.instructions, module.allocator)
}
for global in module.globals {
delete(global.name, module.allocator)
destroy_instructions(global.initializer, module.allocator)
}
delete(module.functions)