diff options
| author | Kirby Linvill <kjlinvill@gmail.com> | 2023-10-23 18:07:07 +0100 |
|---|---|---|
| committer | Kirby Linvill <kjlinvill@gmail.com> | 2023-10-25 22:15:47 +0100 |
| commit | e4c41b07f0b7fd15e19818b3349bb4bf726342d2 (patch) | |
| tree | d13a12dc78efc156a37433cb99f5ab0e79f9af84 /compiler/stable_mir/src | |
| parent | cf226e93dcb0e21e2daa7c26aca0c5b46ff1b646 (diff) | |
| download | rust-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.rs | 10 |
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>; |
