remove usage of llvm memory attributes

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus
2024-05-02 08:33:49 +02:00
parent 85bd888f48
commit 9fc24af355
3 changed files with 2 additions and 16 deletions
@@ -6,7 +6,6 @@ use serde::Serialize;
/// The LLVM attribute.
/// In order to check the real order in a new major version of LLVM, find the `Attributes.inc` file
/// inside of the LLVM build directory. This order is actually generated during the building.
/// FIXME: Generate this in build.rs?
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Attribute {
Unused = 0,
@@ -82,7 +81,7 @@ pub enum Attribute {
Writable = 70,
WriteOnly = 71,
ZExt = 72,
//LastEnumAttr = 72,
// LastEnumAttr = 72,
// FirstTypeAttr = 73,
ByRef = 73,
ByVal = 74,
@@ -117,12 +116,7 @@ impl TryFrom<&str> for Attribute {
"OptimizeForSize" => Ok(Attribute::OptimizeForSize),
"NoInline" => Ok(Attribute::NoInline),
"WillReturn" => Ok(Attribute::WillReturn),
"WriteOnly" => Ok(Attribute::WriteOnly),
"ReadNone" => Ok(Attribute::ReadNone),
"ReadOnly" => Ok(Attribute::ReadOnly),
"NoReturn" => Ok(Attribute::NoReturn),
// FIXME: Not in Attributes.inc
//"InaccessibleMemOnly" => Ok(Attribute::InaccessibleMemOnly),
"MustProgress" => Ok(Attribute::MustProgress),
_ => Err(value.to_owned()),
}
@@ -410,13 +410,6 @@ impl<'ctx> LLVMRuntime<'ctx> {
Some(inkwell::module::Linkage::External),
);
Function::set_default_attributes(llvm, system_request, optimizer);
Function::set_attributes(
llvm,
system_request,
//vec![Attribute::ArgMemOnly, Attribute::ReadOnly],
vec![],
false,
);
let external_call_arguments: Vec<inkwell::types::BasicMetadataTypeEnum> = vec![
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
@@ -128,6 +128,7 @@ impl<'ctx> Function<'ctx> {
) {
for attribute_kind in attributes.into_iter() {
match attribute_kind {
Attribute::Memory => todo!("`memory` attributes are not yet implemented"),
attribute_kind @ Attribute::AlwaysInline if force => {
let is_optimize_none_set = declaration
.value
@@ -251,8 +252,6 @@ impl<'ctx> Function<'ctx> {
vec![
Attribute::MustProgress,
Attribute::NoUnwind,
// FIXME: LLVM complains about ReadNone being not valid for fns
// Attribute::ReadNone,
Attribute::WillReturn,
],
false,