From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_smir/src/stable_mir/mir/body.rs | 69 ++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 compiler/rustc_smir/src/stable_mir/mir/body.rs (limited to 'compiler/rustc_smir/src/stable_mir/mir/body.rs') diff --git a/compiler/rustc_smir/src/stable_mir/mir/body.rs b/compiler/rustc_smir/src/stable_mir/mir/body.rs new file mode 100644 index 000000000..c504065c9 --- /dev/null +++ b/compiler/rustc_smir/src/stable_mir/mir/body.rs @@ -0,0 +1,69 @@ +#[derive(Clone, Debug)] +pub struct Body { + pub blocks: Vec, +} + +#[derive(Clone, Debug)] +pub struct BasicBlock { + pub statements: Vec, + pub terminator: Terminator, +} + +#[derive(Clone, Debug)] +pub enum Terminator { + Goto { + target: usize, + }, + SwitchInt { + discr: Operand, + targets: Vec, + otherwise: usize, + }, + Resume, + Abort, + Return, + Unreachable, + Drop { + place: Place, + target: usize, + unwind: Option, + }, + Call { + func: Operand, + args: Vec, + destination: Place, + target: Option, + cleanup: Option, + }, + Assert { + cond: Operand, + expected: bool, + msg: String, + target: usize, + cleanup: Option, + }, +} + +#[derive(Clone, Debug)] +pub enum Statement { + Assign(Place, Operand), + Nop, +} + +#[derive(Clone, Debug)] +pub enum Operand { + Copy(Place), + Move(Place), + Constant(String), +} + +#[derive(Clone, Debug)] +pub struct Place { + pub local: usize, +} + +#[derive(Clone, Debug)] +pub struct SwitchTarget { + pub value: u128, + pub target: usize, +} -- cgit v1.2.3