Browse Source
Cranelift: Add an `is_safepoint` predicate to `Opcode` (#9066)
pull/9071/head
Nick Fitzgerald
3 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
9 additions and
1 deletions
-
cranelift/codegen/src/ir/dfg.rs
-
cranelift/codegen/src/ir/instructions.rs
|
|
@ -587,7 +587,7 @@ impl DataFlowGraph { |
|
|
|
/// Panics if the given instruction is not a (non-tail) call instruction.
|
|
|
|
pub fn append_user_stack_map_entry(&mut self, inst: Inst, entry: UserStackMapEntry) { |
|
|
|
let opcode = self.insts[inst].opcode(); |
|
|
|
assert!(opcode.is_call() && !opcode.is_return()); |
|
|
|
assert!(opcode.is_safepoint()); |
|
|
|
self.user_stack_maps.entry(inst).or_default().push(entry); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -193,6 +193,14 @@ impl Opcode { |
|
|
|
pub fn constraints(self) -> OpcodeConstraints { |
|
|
|
OPCODE_CONSTRAINTS[self as usize - 1] |
|
|
|
} |
|
|
|
|
|
|
|
/// Is this instruction a GC safepoint?
|
|
|
|
///
|
|
|
|
/// Safepoints are all kinds of calls, except for tail calls.
|
|
|
|
#[inline] |
|
|
|
pub fn is_safepoint(self) -> bool { |
|
|
|
self.is_call() && !self.is_return() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// This trait really belongs in cranelift-reader where it is used by the `.clif` file parser, but since
|
|
|
|