use existing base pointer constant

This commit is contained in:
Folkert 2023-06-01 19:46:52 +02:00
parent e7791443e6
commit 7546726866
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 1 additions and 14 deletions

View file

@ -458,11 +458,6 @@ impl CallConv<AArch64GeneralReg, AArch64FloatReg, AArch64Assembler> for AArch64C
}
impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
#[inline(always)]
fn base_pointer() -> AArch64GeneralReg {
AArch64GeneralReg::FP
}
#[inline(always)]
fn abs_reg64_reg64(buf: &mut Vec<'_, u8>, dst: AArch64GeneralReg, src: AArch64GeneralReg) {
cmp_reg64_imm12(buf, src, 0);

View file

@ -150,8 +150,6 @@ pub enum CompareOperation {
/// Generally, I prefer explicit sources, as opposed to dst being one of the sources. Ex: `x = x + y` would be `add x, x, y` instead of `add x, y`.
/// dst should always come before sources.
pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
fn base_pointer() -> GeneralReg;
fn abs_reg64_reg64(buf: &mut Vec<'_, u8>, dst: GeneralReg, src: GeneralReg);
fn abs_freg64_freg64(
buf: &mut Vec<'_, u8>,
@ -3001,8 +2999,7 @@ impl<
);
// index into the table
let base_pointer = ASM::base_pointer();
ASM::add_reg64_reg64_reg64(&mut self.buf, dst_reg, dst_reg, base_pointer);
ASM::add_reg64_reg64_reg64(&mut self.buf, dst_reg, dst_reg, CC::BASE_PTR_REG);
// load the 16-bit value at the pointer
ASM::mov_reg16_mem16_offset32(&mut self.buf, dst_reg, dst_reg, table_offset);

View file

@ -1139,11 +1139,6 @@ where
}
impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
#[inline(always)]
fn base_pointer() -> X86_64GeneralReg {
X86_64GeneralReg::RBP
}
// These functions should map to the raw assembly functions below.
// In some cases, that means you can just directly call one of the direct assembly functions.
#[inline(always)]