aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-05 12:56:36 +0000
committergingerBill <bill@gingerbill.org>2021-03-05 12:56:36 +0000
commit1988856eedc1a9714c42a22ea369d8154dcf7589 (patch)
tree4a7aa777e005e6ff35036e80adb310243913c234 /src
parent15dbc99cb975675b89f5efe714d5209bce972014 (diff)
Minimize the size of `runtime.Source_Code_Location` to use `i32` instead of `int`
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp32
-rw-r--r--src/ir_print.cpp4
-rw-r--r--src/llvm_backend.cpp28
3 files changed, 32 insertions, 32 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 22265fcd0..1ca7b4cd4 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -6420,8 +6420,8 @@ irValue *ir_emit_union_cast(irProcedure *proc, irValue *value, Type *type, Token
args[0] = ok;
args[1] = ir_find_or_add_entity_string(proc->module, get_file_path_string(pos.file_id));
- args[2] = ir_const_int(pos.line);
- args[3] = ir_const_int(pos.column);
+ args[2] = ir_const_i32(pos.line);
+ args[3] = ir_const_i32(pos.column);
args[4] = ir_typeid(proc->module, src_type);
args[5] = ir_typeid(proc->module, dst_type);
@@ -6480,8 +6480,8 @@ irAddr ir_emit_any_cast_addr(irProcedure *proc, irValue *value, Type *type, Toke
args[0] = ok;
args[1] = ir_find_or_add_entity_string(proc->module, get_file_path_string(pos.file_id));
- args[2] = ir_const_int(pos.line);
- args[3] = ir_const_int(pos.column);
+ args[2] = ir_const_i32(pos.line);
+ args[3] = ir_const_i32(pos.column);
args[4] = any_typeid;
args[5] = dst_typeid;
@@ -6677,8 +6677,8 @@ void ir_emit_bounds_check(irProcedure *proc, Token token, irValue *index, irValu
gbAllocator a = ir_allocator();
irValue *file = ir_find_or_add_entity_string(proc->module, get_file_path_string(token.pos.file_id));
- irValue *line = ir_const_int(token.pos.line);
- irValue *column = ir_const_int(token.pos.column);
+ irValue *line = ir_const_i32(token.pos.line);
+ irValue *column = ir_const_i32(token.pos.column);
auto args = array_make<irValue *>(ir_allocator(), 5);
@@ -6701,8 +6701,8 @@ void ir_emit_slice_bounds_check(irProcedure *proc, Token token, irValue *low, ir
gbAllocator a = ir_allocator();
irValue *file = ir_find_or_add_entity_string(proc->module, get_file_path_string(token.pos.file_id));
- irValue *line = ir_const_int(token.pos.line);
- irValue *column = ir_const_int(token.pos.column);
+ irValue *line = ir_const_i32(token.pos.line);
+ irValue *column = ir_const_i32(token.pos.column);
high = ir_emit_conv(proc, high, t_int);
if (!lower_value_used) {
@@ -6740,8 +6740,8 @@ void ir_emit_dynamic_array_bounds_check(irProcedure *proc, Token token, irValue
gbAllocator a = ir_allocator();
irValue *file = ir_find_or_add_entity_string(proc->module, get_file_path_string(token.pos.file_id));
- irValue *line = ir_const_int(token.pos.line);
- irValue *column = ir_const_int(token.pos.column);
+ irValue *line = ir_const_i32(token.pos.line);
+ irValue *column = ir_const_i32(token.pos.column);
low = ir_emit_conv(proc, low, t_int);
high = ir_emit_conv(proc, high, t_int);
@@ -7078,8 +7078,8 @@ irValue *ir_emit_source_code_location(irProcedure *proc, String procedure, Token
gbAllocator a = ir_allocator();
irValue *v = ir_alloc_value(irValue_SourceCodeLocation);
v->SourceCodeLocation.file = ir_find_or_add_entity_string(proc->module, get_file_path_string(pos.file_id));
- v->SourceCodeLocation.line = ir_const_int(pos.line);
- v->SourceCodeLocation.column = ir_const_int(pos.column);
+ v->SourceCodeLocation.line = ir_const_i32(pos.line);
+ v->SourceCodeLocation.column = ir_const_i32(pos.column);
v->SourceCodeLocation.procedure = ir_find_or_add_entity_string(proc->module, procedure);
return v;
}
@@ -8260,8 +8260,8 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) {
args[0] = ok;
args[1] = ir_find_or_add_entity_string(proc->module, get_file_path_string(pos.file_id));
- args[2] = ir_const_int(pos.line);
- args[3] = ir_const_int(pos.column);
+ args[2] = ir_const_i32(pos.line);
+ args[3] = ir_const_i32(pos.column);
args[4] = ir_typeid(proc->module, src_type);
args[5] = ir_typeid(proc->module, dst_type);
@@ -8285,8 +8285,8 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) {
args[0] = ok;
args[1] = ir_find_or_add_entity_string(proc->module, get_file_path_string(pos.file_id));
- args[2] = ir_const_int(pos.line);
- args[3] = ir_const_int(pos.column);
+ args[2] = ir_const_i32(pos.line);
+ args[3] = ir_const_i32(pos.column);
args[4] = any_id;
args[5] = id;
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index bab68cadd..c87030e84 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -1426,9 +1426,9 @@ void ir_print_value(irFileBuffer *f, irModule *m, irValue *value, Type *type_hin
ir_write_byte(f, '{');
ir_print_type(f, m, t_string); ir_write_byte(f, ' '); ir_print_value(f, m, file, t_string);
ir_write_string(f, str_lit(", "));
- ir_print_type(f, m, t_int); ir_write_byte(f, ' '); ir_print_value(f, m, line, t_int);
+ ir_print_type(f, m, t_i32); ir_write_byte(f, ' '); ir_print_value(f, m, line, t_i32);
ir_write_string(f, str_lit(", "));
- ir_print_type(f, m, t_int); ir_write_byte(f, ' '); ir_print_value(f, m, column, t_int);
+ ir_print_type(f, m, t_i32); ir_write_byte(f, ' '); ir_print_value(f, m, column, t_i32);
ir_write_string(f, str_lit(", "));
ir_print_type(f, m, t_string); ir_write_byte(f, ' '); ir_print_value(f, m, procedure, t_string);
ir_write_byte(f, '}');
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 2a6479d2f..5ce03bccf 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -186,8 +186,8 @@ void lb_emit_bounds_check(lbProcedure *p, Token token, lbValue index, lbValue le
len = lb_emit_conv(p, len, t_int);
lbValue file = lb_find_or_add_entity_string(p->module, get_file_path_string(token.pos.file_id));
- lbValue line = lb_const_int(p->module, t_int, token.pos.line);
- lbValue column = lb_const_int(p->module, t_int, token.pos.column);
+ lbValue line = lb_const_int(p->module, t_i32, token.pos.line);
+ lbValue column = lb_const_int(p->module, t_i32, token.pos.column);
auto args = array_make<lbValue>(permanent_allocator(), 5);
args[0] = file;
@@ -208,8 +208,8 @@ void lb_emit_slice_bounds_check(lbProcedure *p, Token token, lbValue low, lbValu
}
lbValue file = lb_find_or_add_entity_string(p->module, get_file_path_string(token.pos.file_id));
- lbValue line = lb_const_int(p->module, t_int, token.pos.line);
- lbValue column = lb_const_int(p->module, t_int, token.pos.column);
+ lbValue line = lb_const_int(p->module, t_i32, token.pos.line);
+ lbValue column = lb_const_int(p->module, t_i32, token.pos.column);
high = lb_emit_conv(p, high, t_int);
if (!lower_value_used) {
@@ -5415,8 +5415,8 @@ lbValue lb_emit_source_code_location(lbProcedure *p, String const &procedure, To
LLVMValueRef fields[4] = {};
fields[0]/*file*/ = lb_find_or_add_entity_string(p->module, get_file_path_string(pos.file_id)).value;
- fields[1]/*line*/ = lb_const_int(m, t_int, pos.line).value;
- fields[2]/*column*/ = lb_const_int(m, t_int, pos.column).value;
+ fields[1]/*line*/ = lb_const_int(m, t_i32, pos.line).value;
+ fields[2]/*column*/ = lb_const_int(m, t_i32, pos.column).value;
fields[3]/*procedure*/ = lb_find_or_add_entity_string(p->module, procedure).value;
lbValue res = {};
@@ -9510,8 +9510,8 @@ lbValue lb_emit_union_cast(lbProcedure *p, lbValue value, Type *type, TokenPos p
args[0] = ok;
args[1] = lb_const_string(m, get_file_path_string(pos.file_id));
- args[2] = lb_const_int(m, t_int, pos.line);
- args[3] = lb_const_int(m, t_int, pos.column);
+ args[2] = lb_const_int(m, t_i32, pos.line);
+ args[3] = lb_const_int(m, t_i32, pos.column);
args[4] = lb_typeid(m, src_type);
args[5] = lb_typeid(m, dst_type);
@@ -9572,8 +9572,8 @@ lbAddr lb_emit_any_cast_addr(lbProcedure *p, lbValue value, Type *type, TokenPos
args[0] = ok;
args[1] = lb_const_string(m, get_file_path_string(pos.file_id));
- args[2] = lb_const_int(m, t_int, pos.line);
- args[3] = lb_const_int(m, t_int, pos.column);
+ args[2] = lb_const_int(m, t_i32, pos.line);
+ args[3] = lb_const_int(m, t_i32, pos.column);
args[4] = any_typeid;
args[5] = dst_typeid;
@@ -9878,8 +9878,8 @@ lbValue lb_build_expr(lbProcedure *p, Ast *expr) {
args[0] = ok;
args[1] = lb_find_or_add_entity_string(p->module, get_file_path_string(pos.file_id));
- args[2] = lb_const_int(p->module, t_int, pos.line);
- args[3] = lb_const_int(p->module, t_int, pos.column);
+ args[2] = lb_const_int(p->module, t_i32, pos.line);
+ args[3] = lb_const_int(p->module, t_i32, pos.column);
args[4] = lb_typeid(p->module, src_type);
args[5] = lb_typeid(p->module, dst_type);
@@ -9903,8 +9903,8 @@ lbValue lb_build_expr(lbProcedure *p, Ast *expr) {
args[0] = ok;
args[1] = lb_find_or_add_entity_string(p->module, get_file_path_string(pos.file_id));
- args[2] = lb_const_int(p->module, t_int, pos.line);
- args[3] = lb_const_int(p->module, t_int, pos.column);
+ args[2] = lb_const_int(p->module, t_i32, pos.line);
+ args[3] = lb_const_int(p->module, t_i32, pos.column);
args[4] = any_id;
args[5] = id;