-
Notifications
You must be signed in to change notification settings - Fork 46
Add regalloc2-tool
#148
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
Add regalloc2-tool
#148
Conversation
cfallin
left a comment
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.
Thanks a bunch -- this will be really useful to have!
| let mut checker = Checker::new(&function, function.machine_env()); | ||
| checker.prepare(&output); | ||
| if let Err(e) = checker.run() { | ||
| panic!("Regsiter allocation checker failed: {e:#?}"); |
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.
s/Regsiter/Register/
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.
Fixed.
| impl SerializableFunction { | ||
| /// Creates a new `SerializableFunction` from an arbitray `Function` and | ||
| /// `MachineEnv`. | ||
| pub fn new(func: &impl Function, machine_env: MachineEnv) -> Self { |
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.
Should the second arg be a &MachineEnv? Alternately, no clone two lines below?
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.
Removed the clone.
This PR has 2 components: - A `SerializableFunction` which wraps a `Function` and `MachineEnv`. This type can be serialized and deserialized with Serde, and is enabled by the "enable-serde" feature. - A `regalloc2-tool` binary which reads a bincode-encoded `SerializableFunction` and then runs the register allocator and checker on it. This is a useful tool for debugging register allocation failures and to investigate cases of poor register allocation.
This PR has 2 components:
SerializableFunctionwhich wraps aFunctionandMachineEnv. This type can be serialized and deserialized with Serde, and is enabled by the "enable-serde" feature.regalloc2-toolbinary which reads a bincode-encodedSerializableFunctionand then runs the register allocator and checker on it.This is a useful tool for debugging register allocation failures and to investigate cases of poor register allocation.