-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stage2 bit_shifting.zig passing #10532
Conversation
5ce7495
to
97f08e3
Compare
@@ -2647,7 +2647,7 @@ pub const FuncGen = struct { | |||
switch (struct_ty.zigTypeTag()) { | |||
.Struct => { | |||
var ptr_ty_buf: Type.Payload.Pointer = undefined; | |||
const llvm_field_index = llvmFieldIndex(struct_ty, field_index, target, &ptr_ty_buf); | |||
const llvm_field_index = llvmFieldIndex(struct_ty, field_index, target, &ptr_ty_buf).?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming here that airStructFieldVal
should never be emitted when the field is zero sized, as then the result would always be comptime know, so the instruction would never make it to llvm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That assumption is sound 👍
resolveTypeForCodegen is called when we needed to resolve a type fully, even through pointer. This commit fully implements this, even through pointer fields on structs and unions. The function has now also been renamed to resolveTypeFully
`runtime_param_index` is used to get the parameter type from `fn_type`, but this variable was not incremented for zero sized parameters, causing two zero sized parameters of different type to cause miss complication.
It is possible for Zig to emit field ptr instructions to fields whos type is zero sized. In this case llvm should return a pointer which points to the next none zero sized parameter.
97f08e3
to
3871d5e
Compare
This required some llvm and struct+union work. Hope I did it right. Each commit contains reasoning for why this change was done