mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 06:31:02 +00:00
use native stack alignment size
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -8,6 +8,9 @@ pub const BYTE_LENGTH_BYTE: usize = 1;
|
|||||||
/// The x86 word byte-length.
|
/// The x86 word byte-length.
|
||||||
pub const BYTE_LENGTH_X32: usize = 4;
|
pub const BYTE_LENGTH_X32: usize = 4;
|
||||||
|
|
||||||
|
/// Native stack alignment size in bytes
|
||||||
|
pub const BYTE_LENGTH_STACK_ALIGN: usize = 16;
|
||||||
|
|
||||||
/// The x86_64 word byte-length.
|
/// The x86_64 word byte-length.
|
||||||
pub const BYTE_LENGTH_X64: usize = 8;
|
pub const BYTE_LENGTH_X64: usize = 8;
|
||||||
|
|
||||||
|
|||||||
@@ -634,7 +634,7 @@ where
|
|||||||
///
|
///
|
||||||
/// Builds a stack allocation instruction.
|
/// Builds a stack allocation instruction.
|
||||||
///
|
///
|
||||||
/// Sets the alignment to 256 bits.
|
/// Sets the alignment to 128 bits.
|
||||||
///
|
///
|
||||||
pub fn build_alloca<T: BasicType<'ctx> + Clone + Copy>(
|
pub fn build_alloca<T: BasicType<'ctx> + Clone + Copy>(
|
||||||
&self,
|
&self,
|
||||||
@@ -645,7 +645,7 @@ where
|
|||||||
self.basic_block()
|
self.basic_block()
|
||||||
.get_last_instruction()
|
.get_last_instruction()
|
||||||
.expect("Always exists")
|
.expect("Always exists")
|
||||||
.set_alignment(revive_common::BYTE_LENGTH_FIELD as u32)
|
.set_alignment(revive_common::BYTE_LENGTH_STACK_ALIGN as u32)
|
||||||
.expect("Alignment is valid");
|
.expect("Alignment is valid");
|
||||||
Pointer::new(r#type, AddressSpace::Stack, pointer)
|
Pointer::new(r#type, AddressSpace::Stack, pointer)
|
||||||
}
|
}
|
||||||
@@ -757,7 +757,7 @@ where
|
|||||||
self.basic_block()
|
self.basic_block()
|
||||||
.get_last_instruction()
|
.get_last_instruction()
|
||||||
.expect("Always exists")
|
.expect("Always exists")
|
||||||
.set_alignment(revive_common::BYTE_LENGTH_FIELD as u32)
|
.set_alignment(revive_common::BYTE_LENGTH_STACK_ALIGN as u32)
|
||||||
.expect("Alignment is valid");
|
.expect("Alignment is valid");
|
||||||
|
|
||||||
Ok(value)
|
Ok(value)
|
||||||
@@ -851,7 +851,7 @@ where
|
|||||||
AddressSpace::Stack => {
|
AddressSpace::Stack => {
|
||||||
let instruction = self.builder.build_store(pointer.value, value).unwrap();
|
let instruction = self.builder.build_store(pointer.value, value).unwrap();
|
||||||
instruction
|
instruction
|
||||||
.set_alignment(revive_common::BYTE_LENGTH_FIELD as u32)
|
.set_alignment(revive_common::BYTE_LENGTH_STACK_ALIGN as u32)
|
||||||
.expect("Alignment is valid");
|
.expect("Alignment is valid");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1548,7 +1548,7 @@ where
|
|||||||
if argument.is_pointer_value() {
|
if argument.is_pointer_value() {
|
||||||
call_site_value.set_alignment_attribute(
|
call_site_value.set_alignment_attribute(
|
||||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||||
revive_common::BYTE_LENGTH_FIELD as u32,
|
revive_common::BYTE_LENGTH_STACK_ALIGN as u32,
|
||||||
);
|
);
|
||||||
call_site_value.add_attribute(
|
call_site_value.add_attribute(
|
||||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||||
@@ -1630,7 +1630,7 @@ where
|
|||||||
{
|
{
|
||||||
call_site_value.set_alignment_attribute(
|
call_site_value.set_alignment_attribute(
|
||||||
inkwell::attributes::AttributeLoc::Return,
|
inkwell::attributes::AttributeLoc::Return,
|
||||||
revive_common::BYTE_LENGTH_FIELD as u32,
|
revive_common::BYTE_LENGTH_STACK_ALIGN as u32,
|
||||||
);
|
);
|
||||||
call_site_value.add_attribute(
|
call_site_value.add_attribute(
|
||||||
inkwell::attributes::AttributeLoc::Return,
|
inkwell::attributes::AttributeLoc::Return,
|
||||||
|
|||||||
Reference in New Issue
Block a user