| ... | @@ -4926,12 +4926,23 @@ fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CVa | ... | @@ -4926,12 +4926,23 @@ fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CVa |
| 4926 | fn airMemset(f: *Function, inst: Air.Inst.Index) !CValue { | 4926 | fn airMemset(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4927 | const pl_op = f.air.instructions.items(.data)[inst].pl_op; | 4927 | const pl_op = f.air.instructions.items(.data)[inst].pl_op; |
| 4928 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; | 4928 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; |
| | 4929 | const dest_ty = f.air.typeOf(pl_op.operand); |
| 4929 | const dest_ptr = try f.resolveInst(pl_op.operand); | 4930 | const dest_ptr = try f.resolveInst(pl_op.operand); |
| 4930 | const value = try f.resolveInst(extra.lhs); | 4931 | const value = try f.resolveInst(extra.lhs); |
| 4931 | const len = try f.resolveInst(extra.rhs); | 4932 | const len = try f.resolveInst(extra.rhs); |
| 4932 | const writer = f.object.writer(); | 4933 | const writer = f.object.writer(); |
| 4933 | | 4934 | |
| 4934 | try writer.writeAll("memset("); | 4935 | try writer.writeAll("memset("); |
| | 4936 | if (dest_ty.isVolatilePtr()) { |
| | 4937 | // This is wrong, but good enough for now. |
| | 4938 | var remove_volatile_pl = dest_ty.ptrInfo(); |
| | 4939 | remove_volatile_pl.data.@"volatile" = false; |
| | 4940 | const remove_volatile_ty = Type.initPayload(&remove_volatile_pl.base); |
| | 4941 | |
| | 4942 | try writer.writeByte('('); |
| | 4943 | try f.renderTypecast(writer, remove_volatile_ty); |
| | 4944 | try writer.writeByte(')'); |
| | 4945 | } |
| 4935 | try f.writeCValue(writer, dest_ptr, .FunctionArgument); | 4946 | try f.writeCValue(writer, dest_ptr, .FunctionArgument); |
| 4936 | try writer.writeAll(", "); | 4947 | try writer.writeAll(", "); |
| 4937 | try f.writeCValue(writer, value, .FunctionArgument); | 4948 | try f.writeCValue(writer, value, .FunctionArgument); |