Refactor unwind; add FDE support. (#1320)
* Refactor unwind * add FDE support * use sink directly in emit functions * pref off all unwinding generation with feature
This commit is contained in:
@@ -155,6 +155,36 @@ pub trait CodeSink {
|
||||
fn add_stackmap(&mut self, _: &[Value], _: &Function, _: &dyn TargetIsa);
|
||||
}
|
||||
|
||||
/// Type of the frame unwind information.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum FrameUnwindKind {
|
||||
/// Windows fastcall unwinding (as in .pdata).
|
||||
Fastcall,
|
||||
/// FDE entry for libunwind (similar to .eh_frame format).
|
||||
Libunwind,
|
||||
}
|
||||
|
||||
/// Offset in frame unwind information buffer.
|
||||
pub type FrameUnwindOffset = usize;
|
||||
|
||||
/// Sink for frame unwind information.
|
||||
pub trait FrameUnwindSink {
|
||||
/// Get the current position.
|
||||
fn len(&self) -> FrameUnwindOffset;
|
||||
|
||||
/// Add bytes to the code section.
|
||||
fn bytes(&mut self, _: &[u8]);
|
||||
|
||||
/// Reserves bytes in the buffer.
|
||||
fn reserve(&mut self, _len: usize) {}
|
||||
|
||||
/// Add a relocation entry.
|
||||
fn reloc(&mut self, _: Reloc, _: FrameUnwindOffset);
|
||||
|
||||
/// Specified offset to main structure.
|
||||
fn set_entry_offset(&mut self, _: FrameUnwindOffset);
|
||||
}
|
||||
|
||||
/// Report a bad encoding error.
|
||||
#[cold]
|
||||
pub fn bad_encoding(func: &Function, inst: Inst) -> ! {
|
||||
|
||||
Reference in New Issue
Block a user