Add TargetIsa::map_dwarf_register; fixes #1471

This exposes the functionality of `fde::map_reg` on the `TargetIsa` trait, avoiding compilation errors on architectures where register mapping is not yet supported. The change is conditially compiled under the `unwind` feature.
This commit is contained in:
Andrew Brown
2020-04-08 14:17:59 -07:00
parent c4e90f729c
commit 6fd0451bc3
7 changed files with 39 additions and 28 deletions

View File

@@ -2,6 +2,7 @@
use crate::binemit::{FrameUnwindOffset, FrameUnwindSink, Reloc};
use crate::ir::{FrameLayoutChange, Function};
use crate::isa::fde::RegisterMappingError;
use crate::isa::{CallConv, RegUnit, TargetIsa};
use alloc::vec::Vec;
use core::convert::TryInto;
@@ -10,7 +11,6 @@ use gimli::write::{
FrameDescriptionEntry, FrameTable, Result, Writer,
};
use gimli::{Encoding, Format, LittleEndian, Register, X86_64};
use thiserror::Error;
pub type FDERelocEntry = (FrameUnwindOffset, Reloc);
@@ -137,16 +137,6 @@ pub fn map_reg(
}
}
#[derive(Error, Debug)]
pub enum RegisterMappingError {
#[error("unable to find bank for register info")]
MissingBank,
#[error("register mapping is currently only implemented for x86_64")]
UnsupportedArchitecture,
#[error("unsupported register bank: {0}")]
UnsupportedRegisterBank(&'static str),
}
fn to_cfi(
isa: &dyn TargetIsa,
change: &FrameLayoutChange,