-
Notifications
You must be signed in to change notification settings - Fork 783
[Code Annotations] Start Branch Hinting support, in the text format, for Breaks #7567
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
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.
Nice!
src/parser/contexts.h
Outdated
return std::nullopt; | ||
} | ||
|
||
return bool((*str)[0]); |
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.
Let's validate that the byte is a 0 or 1 as well.
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.
Done.
src/passes/Print.cpp
Outdated
@@ -2698,6 +2701,18 @@ void PrintSExpression::printDebugLocation(Expression* curr) { | |||
doIndent(o, indent); | |||
} | |||
} | |||
|
|||
auto iter2 = currFunction->codeAnnotations.find(curr); |
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.
Can we rename the iterators locIter
and annotIter
or similar? Alternatively, we could limit the scope of the iter
variables by using if (auto iter = ...; iter != ...) { }
.
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.
Done.
Co-authored-by: Thomas Lively <[email protected]>
This adds the first minimal amount of work for Branch Hinting (and
code annotations, more generally): Just the text format, and just a
single instruction (Break).
This design follows debug info: Assuming most instructions have no
branch hints (like most do not have debug info), we do not add a field
to the Break class itself, but to metadata on the side.