-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ISLE: Allow emitting safepoint insns #3723
Conversation
Change the implementation of emitted_insts in IsleContext from a plain vector of instructions into a vector of tuples, where the second element is a boolean that indicates whether this instruction should be emitted as a safepoint. This allows targets to emit safepoint insns via ISLE.
{ | ||
pub lower_ctx: &'a mut C, | ||
pub flags: &'a F, | ||
pub isa_flags: &'a I, | ||
pub emitted_insts: SmallVec<[C::I; N]>, | ||
pub emitted_insts: SmallVec<[(C::I, bool); N]>, |
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.
This probably increases memory usage by a considerable amount due to padding. Maybe we could instead have an is_safepoint
method on instructions?
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.
This vector tends to be small, it only holds the machine instructions emitted for a single CLIF instruction. So I don't think memory usage is really any concern here ...
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.
Right, forgot about that.
Subscribe to Label Action
This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "cranelift:area:machinst", "cranelift:area:x64", "isle"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
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!
self.emitted_insts | ||
.push((MInst::MovN { rd, imm, size }, false)); | ||
} else { | ||
let imm = MoveWideConst::maybe_with_shift(imm16 as u16, i * 16).unwrap(); | ||
self.emitted_insts.push(MInst::MovZ { rd, imm, size }); | ||
self.emitted_insts | ||
.push((MInst::MovZ { rd, imm, size }, false)); | ||
} | ||
} else { | ||
let imm = MoveWideConst::maybe_with_shift(imm16 as u16, i * 16).unwrap(); | ||
self.emitted_insts.push(MInst::MovK { rd, imm, size }); | ||
self.emitted_insts | ||
.push((MInst::MovK { rd, imm, size }, false)); |
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.
Could we use self.emit(..)
here to hide the bool tuple entry, which is noise/distracting/raises irrelevant questions for new code readers who stumble upon 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.
Ah I see this already merged, I'll send a follow up PR.
Change the implementation of emitted_insts in IsleContext from
a plain vector of instructions into a vector of tuples, where
the second element is a boolean that indicates whether this
instruction should be emitted as a safepoint.
This allows targets to emit safepoint insns via ISLE.
@cfallin @fitzgen