| ... | ... | @@ -3237,22 +3237,28 @@ fn builtinCall( |
| 3237 | 3237 | return rvalue(mod, scope, rl, result, node); |
| 3238 | 3238 | }, |
| 3239 | 3239 | .float_cast => { |
| 3240 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 3241 | 3240 | const dest_type = try typeExpr(mod, scope, params[0]); |
| 3242 | 3241 | const rhs = try expr(mod, scope, .none, params[1]); |
| 3243 | | const result = try addZIRBinOp(mod, scope, src, .floatcast, dest_type, rhs); |
| 3242 | const result = try gz.addPlNode(.floatcast, node, zir.Inst.Bin{ |
| 3243 | .lhs = dest_type, |
| 3244 | .rhs = rhs, |
| 3245 | }); |
| 3244 | 3246 | return rvalue(mod, scope, rl, result, node); |
| 3245 | 3247 | }, |
| 3246 | 3248 | .int_cast => { |
| 3247 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 3248 | 3249 | const dest_type = try typeExpr(mod, scope, params[0]); |
| 3249 | 3250 | const rhs = try expr(mod, scope, .none, params[1]); |
| 3250 | | const result = try addZIRBinOp(mod, scope, src, .intcast, dest_type, rhs); |
| 3251 | const result = try gz.addPlNode(.intcast, node, zir.Inst.Bin{ |
| 3252 | .lhs = dest_type, |
| 3253 | .rhs = rhs, |
| 3254 | }); |
| 3251 | 3255 | return rvalue(mod, scope, rl, result, node); |
| 3252 | 3256 | }, |
| 3253 | 3257 | .breakpoint => { |
| 3254 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 3255 | | const result = try addZIRNoOp(mod, scope, src, .breakpoint); |
| 3258 | const result = try gz.add(.{ |
| 3259 | .tag = .breakpoint, |
| 3260 | .data = .{ .node = gz.zir_code.decl.nodeIndexToRelative(node) }, |
| 3261 | }); |
| 3256 | 3262 | return rvalue(mod, scope, rl, result, node); |
| 3257 | 3263 | }, |
| 3258 | 3264 | .import => { |
| ... | ... | @@ -3283,23 +3289,18 @@ fn builtinCall( |
| 3283 | 3289 | return rvalue(mod, scope, rl, result, node); |
| 3284 | 3290 | }, |
| 3285 | 3291 | .field => { |
| 3286 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 3287 | | const string_type = try addZIRInstConst(mod, scope, src, .{ |
| 3288 | | .ty = Type.initTag(.type), |
| 3289 | | .val = Value.initTag(.const_slice_u8_type), |
| 3290 | | }); |
| 3291 | | const string_rl: ResultLoc = .{ .ty = string_type }; |
| 3292 | | |
| 3292 | const field_name = try comptimeExpr(mod, scope, .{ .ty = .const_slice_u8_type }, params[1]); |
| 3293 | 3293 | if (rl == .ref) { |
| 3294 | | return addZirInstTag(mod, scope, src, .field_ptr_named, .{ |
| 3295 | | .object = try expr(mod, scope, .ref, params[0]), |
| 3296 | | .field_name = try comptimeExpr(mod, scope, string_rl, params[1]), |
| 3294 | return try gz.addPlNode(.field_ptr_named, node, zir.Inst.FieldNamed{ |
| 3295 | .lhs = try expr(mod, scope, .ref, params[0]), |
| 3296 | .field_name = field_name, |
| 3297 | 3297 | }); |
| 3298 | 3298 | } |
| 3299 | | return rvalue(mod, scope, rl, try addZirInstTag(mod, scope, src, .field_val_named, .{ |
| 3300 | | .object = try expr(mod, scope, .none, params[0]), |
| 3301 | | .field_name = try comptimeExpr(mod, scope, string_rl, params[1]), |
| 3302 | | }), node); |
| 3299 | const result = try gz.addPlNode(.field_val_named, node, zir.Inst.FieldNamed{ |
| 3300 | .lhs = try expr(mod, scope, .none, params[0]), |
| 3301 | .field_name = field_name, |
| 3302 | }); |
| 3303 | return rvalue(mod, scope, rl, result, node); |
| 3303 | 3304 | }, |
| 3304 | 3305 | .as => return as(mod, scope, rl, builtin_token, node, params[0], params[1]), |
| 3305 | 3306 | .bit_cast => return bitCast(mod, scope, rl, builtin_token, node, params[0], params[1]), |