From ebafdb958c1aa6b41c28fc7d45f44e38a69a3bd5 Mon Sep 17 00:00:00 2001 From: Daniele Cocca Date: Sun, 20 Mar 2022 20:57:56 +0000 Subject: AstGen: don't coerce inputs to usize in asmExpr Instead, use ResultLoc.none to allow for the expression type to be inferred [^1]. This effectively moves the type coercion to Sema, in order to turn comptime values into usable values for the backends to consume. Right now the coercion is applies as comptime_int -> usize and comptime_float -> f64, as an arbitrary choice. [^1]: https://github.com/ziglang/zig/blob/9f25c8140cb859fcea7023362afcb29b1e4df41f/src/AstGen.zig#L207-L208 --- src/AstGen.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/AstGen.zig') diff --git a/src/AstGen.zig b/src/AstGen.zig index 296eb80e7c..b66f7b868b 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -6842,7 +6842,7 @@ fn asmExpr( const name = try astgen.identAsString(symbolic_name); const constraint_token = symbolic_name + 2; const constraint = (try astgen.strLitAsString(constraint_token)).index; - const operand = try expr(gz, scope, .{ .ty = .usize_type }, node_datas[input_node].lhs); + const operand = try expr(gz, scope, .none, node_datas[input_node].lhs); inputs[i] = .{ .name = name, .constraint = constraint, -- cgit v1.2.3