]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_smir/src/stable_mir/mir/body.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / compiler / rustc_smir / src / stable_mir / mir / body.rs
1 #[derive(Clone, Debug)]
2 pub struct Body {
3 pub blocks: Vec<BasicBlock>,
4 }
5
6 #[derive(Clone, Debug)]
7 pub struct BasicBlock {
8 pub statements: Vec<Statement>,
9 pub terminator: Terminator,
10 }
11
12 #[derive(Clone, Debug)]
13 pub enum Terminator {
14 Goto {
15 target: usize,
16 },
17 SwitchInt {
18 discr: Operand,
19 targets: Vec<SwitchTarget>,
20 otherwise: usize,
21 },
22 Resume,
23 Abort,
24 Return,
25 Unreachable,
26 Drop {
27 place: Place,
28 target: usize,
29 unwind: Option<usize>,
30 },
31 Call {
32 func: Operand,
33 args: Vec<Operand>,
34 destination: Place,
35 target: Option<usize>,
36 cleanup: Option<usize>,
37 },
38 Assert {
39 cond: Operand,
40 expected: bool,
41 msg: String,
42 target: usize,
43 cleanup: Option<usize>,
44 },
45 }
46
47 #[derive(Clone, Debug)]
48 pub enum Statement {
49 Assign(Place, Operand),
50 Nop,
51 }
52
53 #[derive(Clone, Debug)]
54 pub enum Operand {
55 Copy(Place),
56 Move(Place),
57 Constant(String),
58 }
59
60 #[derive(Clone, Debug)]
61 pub struct Place {
62 pub local: usize,
63 }
64
65 #[derive(Clone, Debug)]
66 pub struct SwitchTarget {
67 pub value: u128,
68 pub target: usize,
69 }