@@ -413,7 +413,7 @@ static LLVMValueRef gen_err_name(CodeGen *g, AstNode *node) {
413
413
}
414
414
415
415
LLVMValueRef indices[] = {
416
- LLVMConstNull (g->builtin_types .entry_isize ->type_ref ),
416
+ LLVMConstNull (g->builtin_types .entry_usize ->type_ref ),
417
417
err_val,
418
418
};
419
419
return LLVMBuildInBoundsGEP (g->builder , g->err_name_table , indices, 2 , " " );
@@ -937,7 +937,7 @@ static LLVMValueRef gen_cast_expr(CodeGen *g, AstNode *node) {
937
937
938
938
int len_index = wanted_type->data .structure .fields [1 ].gen_index ;
939
939
LLVMValueRef len_ptr = LLVMBuildStructGEP (g->builder , cast_expr->tmp_ptr , len_index, " " );
940
- LLVMValueRef len_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref ,
940
+ LLVMValueRef len_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref ,
941
941
actual_type->data .array .len , false );
942
942
LLVMBuildStore (g->builder , len_val, len_ptr);
943
943
@@ -978,13 +978,13 @@ static LLVMValueRef gen_cast_expr(CodeGen *g, AstNode *node) {
978
978
979
979
LLVMValueRef new_len;
980
980
if (dest_size == 1 ) {
981
- LLVMValueRef src_size_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref , src_size, false );
981
+ LLVMValueRef src_size_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref , src_size, false );
982
982
new_len = LLVMBuildMul (g->builder , src_len, src_size_val, " " );
983
983
} else if (src_size == 1 ) {
984
- LLVMValueRef dest_size_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref , dest_size, false );
984
+ LLVMValueRef dest_size_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref , dest_size, false );
985
985
if (want_debug_safety (g, node)) {
986
986
LLVMValueRef remainder_val = LLVMBuildURem (g->builder , src_len, dest_size_val, " " );
987
- LLVMValueRef zero = LLVMConstNull (g->builtin_types .entry_isize ->type_ref );
987
+ LLVMValueRef zero = LLVMConstNull (g->builtin_types .entry_usize ->type_ref );
988
988
LLVMValueRef ok_bit = LLVMBuildICmp (g->builder , LLVMIntEQ, remainder_val, zero, " " );
989
989
LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock (g->cur_fn ->fn_value , " SliceWidenOk" );
990
990
LLVMBasicBlockRef fail_block = LLVMAppendBasicBlock (g->cur_fn ->fn_value , " SliceWidenFail" );
@@ -1159,12 +1159,12 @@ static LLVMValueRef gen_array_elem_ptr(CodeGen *g, AstNode *source_node, LLVMVal
1159
1159
1160
1160
if (array_type->id == TypeTableEntryIdArray) {
1161
1161
if (want_debug_safety (g, source_node)) {
1162
- LLVMValueRef end = LLVMConstInt (g->builtin_types .entry_isize ->type_ref ,
1162
+ LLVMValueRef end = LLVMConstInt (g->builtin_types .entry_usize ->type_ref ,
1163
1163
array_type->data .array .len , false );
1164
1164
add_bounds_check (g, source_node, subscript_value, LLVMIntEQ, nullptr , LLVMIntULT, end);
1165
1165
}
1166
1166
LLVMValueRef indices[] = {
1167
- LLVMConstNull (g->builtin_types .entry_isize ->type_ref ),
1167
+ LLVMConstNull (g->builtin_types .entry_usize ->type_ref ),
1168
1168
subscript_value
1169
1169
};
1170
1170
set_debug_source_node (g, source_node);
@@ -1268,13 +1268,13 @@ static LLVMValueRef gen_slice_expr(CodeGen *g, AstNode *node) {
1268
1268
if (node->data .slice_expr .end ) {
1269
1269
end_val = gen_expr (g, node->data .slice_expr .end );
1270
1270
} else {
1271
- end_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref , array_type->data .array .len , false );
1271
+ end_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref , array_type->data .array .len , false );
1272
1272
}
1273
1273
1274
1274
if (want_debug_safety (g, node)) {
1275
1275
add_bounds_check (g, node, start_val, LLVMIntEQ, nullptr , LLVMIntULE, end_val);
1276
1276
if (node->data .slice_expr .end ) {
1277
- LLVMValueRef array_end = LLVMConstInt (g->builtin_types .entry_isize ->type_ref ,
1277
+ LLVMValueRef array_end = LLVMConstInt (g->builtin_types .entry_usize ->type_ref ,
1278
1278
array_type->data .array .len , false );
1279
1279
add_bounds_check (g, node, end_val, LLVMIntEQ, nullptr , LLVMIntULE, array_end);
1280
1280
}
@@ -1283,7 +1283,7 @@ static LLVMValueRef gen_slice_expr(CodeGen *g, AstNode *node) {
1283
1283
set_debug_source_node (g, node);
1284
1284
LLVMValueRef ptr_field_ptr = LLVMBuildStructGEP (g->builder , tmp_struct_ptr, 0 , " " );
1285
1285
LLVMValueRef indices[] = {
1286
- LLVMConstNull (g->builtin_types .entry_isize ->type_ref ),
1286
+ LLVMConstNull (g->builtin_types .entry_usize ->type_ref ),
1287
1287
start_val,
1288
1288
};
1289
1289
LLVMValueRef slice_start_ptr = LLVMBuildInBoundsGEP (g->builder , array_ptr, indices, 2 , " " );
@@ -1408,7 +1408,7 @@ static LLVMValueRef gen_field_access_expr(CodeGen *g, AstNode *node, bool is_lva
1408
1408
if (struct_type->id == TypeTableEntryIdArray) {
1409
1409
Buf *name = &node->data .field_access_expr .field_name ;
1410
1410
assert (buf_eql_str (name, " len" ));
1411
- return LLVMConstInt (g->builtin_types .entry_isize ->type_ref ,
1411
+ return LLVMConstInt (g->builtin_types .entry_usize ->type_ref ,
1412
1412
struct_type->data .array .len , false );
1413
1413
} else if (struct_type->id == TypeTableEntryIdStruct || (struct_type->id == TypeTableEntryIdPointer &&
1414
1414
struct_type->data .pointer .child_type ->id == TypeTableEntryIdStruct))
@@ -2043,7 +2043,7 @@ static LLVMValueRef gen_struct_memcpy(CodeGen *g, AstNode *source_node, LLVMValu
2043
2043
LLVMValueRef src_ptr = LLVMBuildBitCast (g->builder , src, ptr_u8, " " );
2044
2044
LLVMValueRef dest_ptr = LLVMBuildBitCast (g->builder , dest, ptr_u8, " " );
2045
2045
2046
- TypeTableEntry *isize = g->builtin_types .entry_isize ;
2046
+ TypeTableEntry *usize = g->builtin_types .entry_usize ;
2047
2047
uint64_t size_bytes = LLVMStoreSizeOfType (g->target_data_ref , type_entry->type_ref );
2048
2048
uint64_t align_bytes = get_memcpy_align (g, type_entry);
2049
2049
assert (size_bytes > 0 );
@@ -2052,7 +2052,7 @@ static LLVMValueRef gen_struct_memcpy(CodeGen *g, AstNode *source_node, LLVMValu
2052
2052
LLVMValueRef params[] = {
2053
2053
dest_ptr, // dest pointer
2054
2054
src_ptr, // source pointer
2055
- LLVMConstInt (isize ->type_ref , size_bytes, false ),
2055
+ LLVMConstInt (usize ->type_ref , size_bytes, false ),
2056
2056
LLVMConstInt (LLVMInt32Type (), align_bytes, false ),
2057
2057
LLVMConstNull (LLVMInt1Type ()), // is volatile
2058
2058
};
@@ -2871,8 +2871,8 @@ static LLVMValueRef gen_container_init_expr(CodeGen *g, AstNode *node) {
2871
2871
LLVMValueRef elem_val = gen_expr (g, field_node);
2872
2872
2873
2873
LLVMValueRef indices[] = {
2874
- LLVMConstNull (g->builtin_types .entry_isize ->type_ref ),
2875
- LLVMConstInt (g->builtin_types .entry_isize ->type_ref , i, false ),
2874
+ LLVMConstNull (g->builtin_types .entry_usize ->type_ref ),
2875
+ LLVMConstInt (g->builtin_types .entry_usize ->type_ref , i, false ),
2876
2876
};
2877
2877
set_debug_source_node (g, field_node);
2878
2878
LLVMValueRef elem_ptr = LLVMBuildInBoundsGEP (g->builder , tmp_array_ptr, indices, 2 , " " );
@@ -2989,7 +2989,7 @@ static LLVMValueRef gen_for_expr(CodeGen *g, AstNode *node) {
2989
2989
VariableTableEntry *index_var = node->data .for_expr .index_var ;
2990
2990
assert (index_var);
2991
2991
LLVMValueRef index_ptr = index_var->value_ref ;
2992
- LLVMValueRef one_const = LLVMConstInt (g->builtin_types .entry_isize ->type_ref , 1 , false );
2992
+ LLVMValueRef one_const = LLVMConstInt (g->builtin_types .entry_usize ->type_ref , 1 , false );
2993
2993
2994
2994
LLVMBasicBlockRef cond_block = LLVMAppendBasicBlock (g->cur_fn ->fn_value , " ForCond" );
2995
2995
LLVMBasicBlockRef body_block = LLVMAppendBasicBlock (g->cur_fn ->fn_value , " ForBody" );
@@ -3005,7 +3005,7 @@ static LLVMValueRef gen_for_expr(CodeGen *g, AstNode *node) {
3005
3005
LLVMValueRef len_val;
3006
3006
TypeTableEntry *child_type;
3007
3007
if (array_type->id == TypeTableEntryIdArray) {
3008
- len_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref ,
3008
+ len_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref ,
3009
3009
array_type->data .array .len , false );
3010
3010
child_type = array_type->data .array .child_type ;
3011
3011
} else if (array_type->id == TypeTableEntryIdStruct) {
@@ -3154,7 +3154,7 @@ static LLVMValueRef gen_var_decl_raw(CodeGen *g, AstNode *source_node, AstNodeVa
3154
3154
}
3155
3155
}
3156
3156
if (!ignore_uninit && want_debug_safety (g, source_node)) {
3157
- TypeTableEntry *isize = g->builtin_types .entry_isize ;
3157
+ TypeTableEntry *usize = g->builtin_types .entry_usize ;
3158
3158
uint64_t size_bytes = LLVMStoreSizeOfType (g->target_data_ref , variable->type ->type_ref );
3159
3159
uint64_t align_bytes = get_memcpy_align (g, variable->type );
3160
3160
@@ -3163,7 +3163,7 @@ static LLVMValueRef gen_var_decl_raw(CodeGen *g, AstNode *source_node, AstNodeVa
3163
3163
LLVMTypeRef ptr_u8 = LLVMPointerType (LLVMInt8Type (), 0 );
3164
3164
LLVMValueRef fill_char = LLVMConstInt (LLVMInt8Type (), 0xaa , false );
3165
3165
LLVMValueRef dest_ptr = LLVMBuildBitCast (g->builder , variable->value_ref , ptr_u8, " " );
3166
- LLVMValueRef byte_count = LLVMConstInt (isize ->type_ref , size_bytes, false );
3166
+ LLVMValueRef byte_count = LLVMConstInt (usize ->type_ref , size_bytes, false );
3167
3167
LLVMValueRef align_in_bytes = LLVMConstInt (LLVMInt32Type (), align_bytes, false );
3168
3168
LLVMValueRef params[] = {
3169
3169
dest_ptr,
@@ -3771,7 +3771,7 @@ static LLVMValueRef gen_test_fn_val(CodeGen *g, FnTableEntry *fn_entry) {
3771
3771
LLVMSetGlobalConstant (str_global_val, true );
3772
3772
LLVMSetUnnamedAddr (str_global_val, true );
3773
3773
3774
- LLVMValueRef len_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref , buf_len (fn_name), false );
3774
+ LLVMValueRef len_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref , buf_len (fn_name), false );
3775
3775
3776
3776
LLVMTypeRef ptr_type = LLVMPointerType (g->builtin_types .entry_u8 ->type_ref , 0 );
3777
3777
LLVMValueRef name_fields[] = {
@@ -3813,7 +3813,7 @@ static void generate_error_name_table(CodeGen *g) {
3813
3813
3814
3814
LLVMValueRef fields[] = {
3815
3815
LLVMConstBitCast (str_global, u8_ptr_type->type_ref ),
3816
- LLVMConstInt (g->builtin_types .entry_isize ->type_ref , buf_len (name), false ),
3816
+ LLVMConstInt (g->builtin_types .entry_usize ->type_ref , buf_len (name), false ),
3817
3817
};
3818
3818
values[i] = LLVMConstNamedStruct (str_type->type_ref , fields, 2 );
3819
3819
}
@@ -3986,7 +3986,7 @@ static void do_code_gen(CodeGen *g) {
3986
3986
LLVMSetGlobalConstant (test_fn_array_val, true );
3987
3987
LLVMSetUnnamedAddr (test_fn_array_val, true );
3988
3988
3989
- LLVMValueRef len_val = LLVMConstInt (g->builtin_types .entry_isize ->type_ref , g->test_fn_count , false );
3989
+ LLVMValueRef len_val = LLVMConstInt (g->builtin_types .entry_usize ->type_ref , g->test_fn_count , false );
3990
3990
LLVMTypeRef ptr_type = LLVMPointerType (LLVMTypeOf (test_fn_vals[0 ]), 0 );
3991
3991
LLVMValueRef fields[] = {
3992
3992
LLVMConstBitCast (test_fn_array_val, ptr_type),
@@ -4611,7 +4611,7 @@ static void define_builtin_fns(CodeGen *g) {
4611
4611
builtin_fn->param_types = allocate<TypeTableEntry *>(builtin_fn->param_count );
4612
4612
builtin_fn->param_types [0 ] = nullptr ; // manually checked later
4613
4613
builtin_fn->param_types [1 ] = nullptr ; // manually checked later
4614
- builtin_fn->param_types [2 ] = g->builtin_types .entry_isize ;
4614
+ builtin_fn->param_types [2 ] = g->builtin_types .entry_usize ;
4615
4615
builtin_fn->ref_count = 1 ;
4616
4616
4617
4617
LLVMTypeRef param_types[] = {
@@ -4635,7 +4635,7 @@ static void define_builtin_fns(CodeGen *g) {
4635
4635
builtin_fn->param_types = allocate<TypeTableEntry *>(builtin_fn->param_count );
4636
4636
builtin_fn->param_types [0 ] = nullptr ; // manually checked later
4637
4637
builtin_fn->param_types [1 ] = g->builtin_types .entry_u8 ;
4638
- builtin_fn->param_types [2 ] = g->builtin_types .entry_isize ;
4638
+ builtin_fn->param_types [2 ] = g->builtin_types .entry_usize ;
4639
4639
builtin_fn->ref_count = 1 ;
4640
4640
4641
4641
LLVMTypeRef param_types[] = {
0 commit comments