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.
This commit is contained in:
parent
cf226e93dc
commit
e4c41b07f0
2 changed files with 11 additions and 0 deletions
|
@ -308,6 +308,7 @@ impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
|
||||||
span: decl.source_info.span.stable(tables),
|
span: decl.source_info.span.stable(tables),
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
|
arg_count: self.arg_count,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,20 @@ use crate::ty::{AdtDef, ClosureDef, Const, CoroutineDef, GenericArgs, Movability
|
||||||
use crate::Opaque;
|
use crate::Opaque;
|
||||||
use crate::{ty::Ty, Span};
|
use crate::{ty::Ty, Span};
|
||||||
|
|
||||||
|
/// The SMIR representation of a single function.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Body {
|
pub struct Body {
|
||||||
pub blocks: Vec<BasicBlock>,
|
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,
|
pub locals: LocalDecls,
|
||||||
|
|
||||||
|
/// The number of arguments this function takes.
|
||||||
|
pub arg_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
type LocalDecls = Vec<LocalDecl>;
|
type LocalDecls = Vec<LocalDecl>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue