Skip to content

ISLE: Allow emitting safepoint insns#3723

Merged
cfallin merged 1 commit into
bytecodealliance:mainfrom
uweigand:isle-safepoint
Jan 25, 2022
Merged

ISLE: Allow emitting safepoint insns#3723
cfallin merged 1 commit into
bytecodealliance:mainfrom
uweigand:isle-safepoint

Conversation

@uweigand
Copy link
Copy Markdown
Member

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

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 flags: &'a F,
pub isa_flags: &'a I,
pub emitted_insts: SmallVec<[C::I; N]>,
pub emitted_insts: SmallVec<[(C::I, bool); N]>,
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Member Author

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 ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, forgot about that.

@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:x64 Issues related to x64 codegen isle Related to the ISLE domain-specific language labels Jan 25, 2022
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @cfallin, @fitzgen

Details 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:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Copy Markdown
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cfallin cfallin merged commit cd6b73f into bytecodealliance:main Jan 25, 2022
@uweigand uweigand deleted the isle-safepoint branch January 25, 2022 17:12
Comment on lines +155 to +165
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));
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:machinst Issues related to instruction selection and the new MachInst backend. cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants