-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
506 refactor value handling #511
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
// no value to return, skip writing | ||
rule <k> #execTerminator(terminator(terminatorKindReturn, _SPAN)) ~> _ | ||
=> | ||
#execBlockIdx(TARGET) | ||
</k> | ||
<currentFunc> _ => CALLER </currentFunc> | ||
//<currentFrame> | ||
<currentBody> _ => #getBlocks(FUNCS, CALLER) </currentBody> | ||
<caller> CALLER => NEWCALLER </caller> | ||
<dest> _ => NEWDEST </dest> | ||
<target> someBasicBlockIdx(TARGET) => NEWTARGET </target> | ||
<unwind> _ => UNWIND </unwind> | ||
<locals> ListItem(_:NewLocal) _ => NEWLOCALS </locals> | ||
//</currentFrame> | ||
// remaining call stack (without top frame) | ||
<stack> ListItem(StackFrame(NEWCALLER, NEWDEST, NEWTARGET, UNWIND, NEWLOCALS)) STACK => STACK </stack> | ||
<functions> FUNCS </functions> | ||
requires CALLER in_keys(FUNCS) | ||
[preserves-definedness] // CALLER lookup defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to think of what this looks like in the mir code. What is an example of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new rule is for the case where local _0
has not been written to (it is still sort NewLocal
) but the function returns. That happens regularly when a function returns nothing (i.e., unit). We used to "write" the noValue
as a NoOp but now the sort is different so we should skip it.
TypedLocal
by subsortsTypedValue
,NewLocal
,MovedLocal
(renaming constructors)Evaluation
with result sortTypedValue
forOperand
andRValue
MIRError
sort inhabited by all errors, and a labelled stop rule