| ... | ... | @@ -48,38 +48,20 @@ pub fn classifyType(ty: Type, target: Target) [2]Class { |
| 48 | 48 | }, |
| 49 | 49 | .Bool => return direct, |
| 50 | 50 | .Array => return memory, |
| 51 | | // .ErrorUnion => { |
| 52 | | // const has_tag = ty.errorUnionSet().hasRuntimeBitsIgnoreComptime(); |
| 53 | | // const has_pl = ty.errorUnionPayload().hasRuntimeBitsIgnoreComptime(); |
| 54 | | // if (!has_pl) return direct; |
| 55 | | // if (!has_tag) { |
| 56 | | // return classifyType(ty.errorUnionPayload(), target); |
| 57 | | // } |
| 58 | | // return memory; |
| 59 | | // }, |
| 60 | 51 | .Optional => { |
| 61 | 52 | std.debug.assert(ty.isPtrLikeOptional()); |
| 62 | 53 | return direct; |
| 63 | | // var buf: Type.Payload.ElemType = undefined; |
| 64 | | // const pl_has_bits = ty.optionalChild(&buf).hasRuntimeBitsIgnoreComptime(); |
| 65 | | // if (!pl_has_bits) return direct; |
| 66 | | // return memory; |
| 67 | 54 | }, |
| 68 | 55 | .Pointer => { |
| 69 | | // // Slices act like struct and will be passed by reference |
| 70 | | // if (ty.isSlice()) return memory; |
| 56 | std.debug.assert(!ty.isSlice()); |
| 71 | 57 | return direct; |
| 72 | 58 | }, |
| 73 | 59 | .Union => { |
| 74 | 60 | const layout = ty.unionGetLayout(target); |
| 75 | 61 | std.debug.assert(layout.tag_size == 0); |
| 76 | | // if (layout.payload_size == 0 and layout.tag_size != 0) { |
| 77 | | // return classifyType(ty.unionTagType().?, target); |
| 78 | | // } |
| 79 | 62 | if (ty.unionFields().count() > 1) return memory; |
| 80 | 63 | return classifyType(ty.unionFields().values()[0].ty, target); |
| 81 | 64 | }, |
| 82 | | // .AnyFrame, .Frame => return direct, |
| 83 | 65 | .ErrorUnion, |
| 84 | 66 | .Frame, |
| 85 | 67 | .AnyFrame, |