about summary refs log tree commit diff
path: root/compiler/stable_mir/src
diff options
context:
space:
mode:
authorKirby Linvill <kjlinvill@gmail.com>2023-10-23 18:07:07 +0100
committerKirby Linvill <kjlinvill@gmail.com>2023-10-25 22:15:47 +0100
commite4c41b07f0b7fd15e19818b3349bb4bf726342d2 (patch)
treed13a12dc78efc156a37433cb99f5ab0e79f9af84 /compiler/stable_mir/src
parentcf226e93dcb0e21e2daa7c26aca0c5b46ff1b646 (diff)
downloadrust-e4c41b07f0b7fd15e19818b3349bb4bf726342d2.tar.gz
rust-e4c41b07f0b7fd15e19818b3349bb4bf726342d2.zip
Add arg_count field to Body in Stable MIR
This field allows SMIR consumers to identify which locals correspond to
argument locals. It simply exposes the arg_count field from the MIR
representation.
Diffstat (limited to 'compiler/stable_mir/src')
-rw-r--r--compiler/stable_mir/src/mir/body.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/stable_mir/src/mir/body.rs b/compiler/stable_mir/src/mir/body.rs
index fc617513aee..34dff7a6214 100644
--- a/compiler/stable_mir/src/mir/body.rs
+++ b/compiler/stable_mir/src/mir/body.rs
@@ -2,10 +2,20 @@ use crate::ty::{AdtDef, ClosureDef, Const, CoroutineDef, GenericArgs, Movability
 use crate::Opaque;
 use crate::{ty::Ty, Span};
 
+/// The SMIR representation of a single function.
 #[derive(Clone, Debug)]
 pub struct Body {
     pub blocks: Vec<BasicBlock>,
+
+    /// Declarations of locals.
+    ///
+    /// The first local is the return value pointer, followed by `arg_count`
+    /// locals for the function arguments, followed by any user-declared
+    /// variables and temporaries.
     pub locals: LocalDecls,
+
+    /// The number of arguments this function takes.
+    pub arg_count: usize,
 }
 
 type LocalDecls = Vec<LocalDecl>;