| ... | @@ -48,38 +48,20 @@ pub fn classifyType(ty: Type, target: Target) [2]Class { | ... | @@ -48,38 +48,20 @@ pub fn classifyType(ty: Type, target: Target) [2]Class { |
| 48 | }, | 48 | }, |
| 49 | .Bool => return direct, | 49 | .Bool => return direct, |
| 50 | .Array => return memory, | 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 | .Optional => { | 51 | .Optional => { |
| 61 | std.debug.assert(ty.isPtrLikeOptional()); | 52 | std.debug.assert(ty.isPtrLikeOptional()); |
| 62 | return direct; | 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 | .Pointer => { | 55 | .Pointer => { |
| 69 | // // Slices act like struct and will be passed by reference | 56 | std.debug.assert(!ty.isSlice()); |
| 70 | // if (ty.isSlice()) return memory; | | |
| 71 | return direct; | 57 | return direct; |
| 72 | }, | 58 | }, |
| 73 | .Union => { | 59 | .Union => { |
| 74 | const layout = ty.unionGetLayout(target); | 60 | const layout = ty.unionGetLayout(target); |
| 75 | std.debug.assert(layout.tag_size == 0); | 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 | if (ty.unionFields().count() > 1) return memory; | 62 | if (ty.unionFields().count() > 1) return memory; |
| 80 | return classifyType(ty.unionFields().values()[0].ty, target); | 63 | return classifyType(ty.unionFields().values()[0].ty, target); |
| 81 | }, | 64 | }, |
| 82 | // .AnyFrame, .Frame => return direct, | | |
| 83 | .ErrorUnion, | 65 | .ErrorUnion, |
| 84 | .Frame, | 66 | .Frame, |
| 85 | .AnyFrame, | 67 | .AnyFrame, |