aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-02-16 13:58:42 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-02-16 13:58:42 -0500
commit4b5cc80f665314067e0e5b96c859acca1b2e1cb0 (patch)
tree1d8a99cba66634ad98a3faae29d3160ccefec0c9 /src/ir.cpp
parent4a957b9ea32e0539772993278a9a1f99ee3df68b (diff)
downloadzig-4b5cc80f665314067e0e5b96c859acca1b2e1cb0.tar.gz
zig-4b5cc80f665314067e0e5b96c859acca1b2e1cb0.zip
move volatile pointers to central type table
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index a346614e56..03b77a69f7 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -6226,12 +6226,12 @@ static IrInstruction *ir_get_const_ptr(IrAnalyze *ira, IrInstruction *instructio
ConstExprValue *const_val = &const_instr->value;
const_val->type = pointee_type;
type_ensure_zero_bits_known(ira->codegen, type_entry);
- const_val->data.x_type = get_pointer_to_type_volatile(ira->codegen, type_entry,
- ptr_is_const, ptr_is_volatile);
+ const_val->data.x_type = get_pointer_to_type_extra(ira->codegen, type_entry,
+ ptr_is_const, 0, ptr_is_volatile);
return const_instr;
} else {
- TypeTableEntry *ptr_type = get_pointer_to_type_volatile(ira->codegen, pointee_type,
- ptr_is_const, ptr_is_volatile);
+ TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, pointee_type,
+ ptr_is_const, 0, ptr_is_volatile);
IrInstruction *const_instr = ir_get_const(ira, instruction);
ConstExprValue *const_val = &const_instr->value;
const_val->type = ptr_type;
@@ -6547,7 +6547,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi
ConstPtrMutComptimeConst, is_const, is_volatile);
}
- TypeTableEntry *ptr_type = get_pointer_to_type_volatile(ira->codegen, value->value.type, is_const, is_volatile);
+ TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, value->value.type, is_const, 0, is_volatile);
FnTableEntry *fn_entry = exec_fn_entry(ira->new_irb.exec);
assert(fn_entry);
IrInstruction *new_instruction = ir_build_ref(&ira->new_irb, source_instruction->scope,
@@ -8838,8 +8838,8 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc
buf_sprintf("index 0 outside array of size 0"));
}
TypeTableEntry *child_type = array_type->data.array.child_type;
- return_type = get_pointer_to_type_volatile(ira->codegen, child_type,
- ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile);
+ return_type = get_pointer_to_type_extra(ira->codegen, child_type,
+ ptr_type->data.pointer.is_const, 0, ptr_type->data.pointer.is_volatile);
} else if (array_type->id == TypeTableEntryIdPointer) {
return_type = array_type;
} else if (is_slice(array_type)) {
@@ -9056,8 +9056,8 @@ static TypeTableEntry *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field
if (ptr_val->data.x_ptr.special != ConstPtrSpecialHardCodedAddr) {
ConstExprValue *struct_val = const_ptr_pointee(ptr_val);
ConstExprValue *field_val = &struct_val->data.x_struct.fields[field->src_index];
- TypeTableEntry *ptr_type = get_pointer_to_type_volatile(ira->codegen, field_val->type,
- is_const, is_volatile);
+ TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, field_val->type,
+ is_const, 0, is_volatile);
ConstExprValue *const_val = ir_build_const_from(ira, &field_ptr_instruction->base);
const_val->data.x_ptr.special = ConstPtrSpecialBaseStruct;
const_val->data.x_ptr.mut = container_ptr->value.data.x_ptr.mut;
@@ -9067,7 +9067,7 @@ static TypeTableEntry *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field
}
}
ir_build_struct_field_ptr_from(&ira->new_irb, &field_ptr_instruction->base, container_ptr, field);
- return get_pointer_to_type_volatile(ira->codegen, field->type_entry, is_const, is_volatile);
+ return get_pointer_to_type_extra(ira->codegen, field->type_entry, is_const, 0, is_volatile);
} else {
return ir_analyze_container_member_access_inner(ira, bare_type, field_name,
field_ptr_instruction, container_ptr, container_type);
@@ -9079,7 +9079,7 @@ static TypeTableEntry *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field
TypeEnumField *field = find_enum_type_field(bare_type, field_name);
if (field) {
ir_build_enum_field_ptr_from(&ira->new_irb, &field_ptr_instruction->base, container_ptr, field);
- return get_pointer_to_type_volatile(ira->codegen, field->type_entry, is_const, is_volatile);
+ return get_pointer_to_type_extra(ira->codegen, field->type_entry, is_const, 0, is_volatile);
} else {
return ir_analyze_container_member_access_inner(ira, bare_type, field_name,
field_ptr_instruction, container_ptr, container_type);
@@ -10014,8 +10014,8 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
return ira->codegen->builtin_types.entry_invalid;
}
TypeTableEntry *child_type = type_entry->data.maybe.child_type;
- TypeTableEntry *result_type = get_pointer_to_type_volatile(ira->codegen, child_type,
- ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile);
+ TypeTableEntry *result_type = get_pointer_to_type_extra(ira->codegen, child_type,
+ ptr_type->data.pointer.is_const, 0, ptr_type->data.pointer.is_volatile);
if (instr_is_comptime(value)) {
ConstExprValue *val = ir_resolve_const(ira, value, UndefBad);
@@ -11321,7 +11321,7 @@ static TypeTableEntry *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructi
TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8;
- TypeTableEntry *u8_ptr = get_pointer_to_type_volatile(ira->codegen, u8, false, dest_is_volatile);
+ TypeTableEntry *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, 0, dest_is_volatile);
IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr);
if (casted_dest_ptr->value.type->id == TypeTableEntryIdInvalid)
@@ -11409,8 +11409,8 @@ static TypeTableEntry *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructi
TypeTableEntry *usize = ira->codegen->builtin_types.entry_usize;
TypeTableEntry *u8 = ira->codegen->builtin_types.entry_u8;
- TypeTableEntry *u8_ptr_mut = get_pointer_to_type_volatile(ira->codegen, u8, false, dest_is_volatile);
- TypeTableEntry *u8_ptr_const = get_pointer_to_type_volatile(ira->codegen, u8, true, src_is_volatile);
+ TypeTableEntry *u8_ptr_mut = get_pointer_to_type_extra(ira->codegen, u8, false, 0, dest_is_volatile);
+ TypeTableEntry *u8_ptr_const = get_pointer_to_type_extra(ira->codegen, u8, true, 0, src_is_volatile);
IrInstruction *casted_dest_ptr = ir_implicit_cast(ira, dest_ptr, u8_ptr_mut);
if (casted_dest_ptr->value.type->id == TypeTableEntryIdInvalid)
@@ -11927,8 +11927,8 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira,
return ira->codegen->builtin_types.entry_invalid;
} else if (canon_type->id == TypeTableEntryIdErrorUnion) {
TypeTableEntry *child_type = canon_type->data.error.child_type;
- TypeTableEntry *result_type = get_pointer_to_type_volatile(ira->codegen, child_type,
- ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile);
+ TypeTableEntry *result_type = get_pointer_to_type_extra(ira->codegen, child_type,
+ ptr_type->data.pointer.is_const, 0, ptr_type->data.pointer.is_volatile);
if (instr_is_comptime(value)) {
ConstExprValue *ptr_val = ir_resolve_const(ira, value, UndefBad);
if (!ptr_val)