pub enum RelaxationKind {
NoOp,
ReplaceWithNop,
CallToJal,
Hi20ToCLui,
Hi20Delete,
Lo12Rs1ToZero,
}Variants§
NoOp
Leave the instruction alone. Used when we only want to change the kind of relocation used.
ReplaceWithNop
Replace with nop
CallToJal
Rewrite auipc+jalr to jal.
Hi20ToCLui
Rewrite 4-byte lui rd, imm to 2-byte c.lui rd, nzimm.
Hi20Delete
Delete the lui instruction entirely when %hi(value) is zero.
Lo12Rs1ToZero
Rewrite the rs1 field of an I-type or S-type instruction from the deleted lui’s rd to
x0.
Implementations§
Source§impl RelaxationKind
impl RelaxationKind
pub fn apply( self, section_bytes: &mut [u8], offset_in_section: &mut u64, _addend: &mut i64, )
pub fn next_modifier(&self) -> RelocationModifier
Sourcepub fn hi20_is_zero(value: u64) -> bool
pub fn hi20_is_zero(value: u64) -> bool
Returns true if the HI20 value is zero, meaning the lui instruction can be deleted
entirely and the following LO12 instruction’s rs1 changed to x0.
Sourcepub fn hi20_fits_clui(value: u64) -> bool
pub fn hi20_fits_clui(value: u64) -> bool
Returns true if the HI20 value (i.e. (value + 0x800) >> 12) fits in the
c.lui 6-bit signed non-zero immediate range: [-32, -1] ∪ [1, 31].
Sourcepub fn rd_valid_for_clui(rd: u32) -> bool
pub fn rd_valid_for_clui(rd: u32) -> bool
Returns true if the rd register is valid for c.lui.
Sourcepub fn clui_rel_info() -> RelocationKindInfo
pub fn clui_rel_info() -> RelocationKindInfo
Returns the RelocationKindInfo to use when a HI20 relocation has been relaxed to c.lui.
Trait Implementations§
Source§impl Clone for RelaxationKind
impl Clone for RelaxationKind
Source§fn clone(&self) -> RelaxationKind
fn clone(&self) -> RelaxationKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RelaxationKind
impl Debug for RelaxationKind
Source§impl PartialEq for RelaxationKind
impl PartialEq for RelaxationKind
Source§fn eq(&self, other: &RelaxationKind) -> bool
fn eq(&self, other: &RelaxationKind) -> bool
self and other values to be equal, and is used by ==.