| ... | ... | @@ -3953,14 +3953,14 @@ bool type_is_codegen_pointer(ZigType *type) { |
| 3953 | 3953 | return get_codegen_ptr_type(type) == type; |
| 3954 | 3954 | } |
| 3955 | 3955 | |
| 3956 | | uint32_t get_ptr_align(ZigType *type) { |
| 3956 | uint32_t get_ptr_align(CodeGen *g, ZigType *type) { |
| 3957 | 3957 | ZigType *ptr_type = get_codegen_ptr_type(type); |
| 3958 | 3958 | if (ptr_type->id == ZigTypeIdPointer) { |
| 3959 | 3959 | return ptr_type->data.pointer.alignment; |
| 3960 | 3960 | } else if (ptr_type->id == ZigTypeIdFn) { |
| 3961 | 3961 | return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment; |
| 3962 | 3962 | } else if (ptr_type->id == ZigTypeIdPromise) { |
| 3963 | | return 1; |
| 3963 | return get_coro_frame_align_bytes(g); |
| 3964 | 3964 | } else { |
| 3965 | 3965 | zig_unreachable(); |
| 3966 | 3966 | } |
| ... | ... | @@ -6277,10 +6277,6 @@ uint32_t get_abi_alignment(CodeGen *g, ZigType *type_entry) { |
| 6277 | 6277 | return 1; |
| 6278 | 6278 | } else { |
| 6279 | 6279 | uint32_t llvm_alignment = LLVMABIAlignmentOfType(g->target_data_ref, type_entry->type_ref); |
| 6280 | | // promises have at least alignment 8 so that we can have 3 extra bits when doing atomicrmw |
| 6281 | | if (type_entry->id == ZigTypeIdPromise && llvm_alignment < 8) { |
| 6282 | | return 8; |
| 6283 | | } |
| 6284 | 6280 | return llvm_alignment; |
| 6285 | 6281 | } |
| 6286 | 6282 | } |
| ... | ... | @@ -6318,7 +6314,10 @@ bool type_is_global_error_set(ZigType *err_set_type) { |
| 6318 | 6314 | } |
| 6319 | 6315 | |
| 6320 | 6316 | uint32_t get_coro_frame_align_bytes(CodeGen *g) { |
| 6321 | | return g->pointer_size_bytes * 2; |
| 6317 | uint32_t a = g->pointer_size_bytes * 2; |
| 6318 | // promises have at least alignment 8 so that we can have 3 extra bits when doing atomicrmw |
| 6319 | if (a < 8) a = 8; |
| 6320 | return a; |
| 6322 | 6321 | } |
| 6323 | 6322 | |
| 6324 | 6323 | bool type_can_fail(ZigType *type_entry) { |