Add public API to retrieve internal locals
This commit is contained in:
parent
93d1b3e92a
commit
f4d80a5f09
@ -33,15 +33,21 @@ pub fn new(blocks: Vec<BasicBlock>, locals: LocalDecls, arg_count: usize) -> Sel
|
||||
Self { blocks, locals, arg_count }
|
||||
}
|
||||
|
||||
/// Gets the function's return local.
|
||||
/// Return local that holds this function's return value.
|
||||
pub fn ret_local(&self) -> &LocalDecl {
|
||||
&self.locals[0]
|
||||
}
|
||||
|
||||
/// Gets the locals in `self` that correspond to the function's arguments.
|
||||
/// Locals in `self` that correspond to this function's arguments.
|
||||
pub fn arg_locals(&self) -> &[LocalDecl] {
|
||||
&self.locals[1..self.arg_count + 1]
|
||||
}
|
||||
|
||||
/// Internal locals for this function. These are the locals that are
|
||||
/// neither the return local nor the argument locals.
|
||||
pub fn internal_locals(&self) -> &[LocalDecl] {
|
||||
&self.locals[self.arg_count + 1..]
|
||||
}
|
||||
}
|
||||
|
||||
type LocalDecls = Vec<LocalDecl>;
|
||||
|
Loading…
Reference in New Issue
Block a user