cranelift codegen: add a supplementary method add_call_site to CodeSink;

This allows keeping track of indirect call sites, for instance.
This commit is contained in:
Benjamin Bouvier
2020-04-01 16:05:34 +02:00
parent f4c4a84b84
commit 6a68130d5b
3 changed files with 25 additions and 2 deletions

View File

@@ -16,7 +16,9 @@ pub use self::relaxation::relax_branches;
pub use self::shrink::shrink_instructions;
pub use self::stackmap::Stackmap;
use crate::ir::entities::Value;
use crate::ir::{ConstantOffset, ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode};
use crate::ir::{
ConstantOffset, ExternalName, Function, Inst, JumpTable, Opcode, SourceLoc, TrapCode,
};
use crate::isa::TargetIsa;
pub use crate::regalloc::RegDiversions;
use core::fmt;
@@ -162,6 +164,11 @@ pub trait CodeSink {
/// Add a stackmap at the current code offset.
fn add_stackmap(&mut self, _: &[Value], _: &Function, _: &dyn TargetIsa);
/// Add a call site for a call with the given opcode, returning at the current offset.
fn add_call_site(&mut self, _: Opcode, _: SourceLoc) {
// Default implementation doesn't need to do anything.
}
}
/// Type of the frame unwind information.