diff options
| author | Andy Wang <cbeuw.andy@gmail.com> | 2023-04-11 16:23:35 +0200 |
|---|---|---|
| committer | Andy Wang <cbeuw.andy@gmail.com> | 2023-04-11 16:23:35 +0200 |
| commit | cecb901e683cdc1a2ffbb1e331ba4f262e2215c0 (patch) | |
| tree | 9939ddb334d43179bee358eae0192a52f118724a /compiler | |
| parent | dfe024e1041d1cba1d3191024de3b7128c6734e6 (diff) | |
| download | rust-cecb901e683cdc1a2ffbb1e331ba4f262e2215c0.tar.gz rust-cecb901e683cdc1a2ffbb1e331ba4f262e2215c0.zip | |
Add Offset binary op to custom mir
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_build/src/build/custom/parse/instruction.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index 54028dfe87b..931fe1b2433 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -148,6 +148,11 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { )), ) }, + @call("mir_offset", args) => { + let ptr = self.parse_operand(args[0])?; + let offset = self.parse_operand(args[1])?; + Ok(Rvalue::BinaryOp(BinOp::Offset, Box::new((ptr, offset)))) + }, @call("mir_len", args) => Ok(Rvalue::Len(self.parse_place(args[0])?)), ExprKind::Borrow { borrow_kind, arg } => Ok( Rvalue::Ref(self.tcx.lifetimes.re_erased, *borrow_kind, self.parse_place(*arg)?) |
