From 9fc24af355cbb3993c174dbc5a14ac42a1f40a47 Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 2 May 2024 08:33:49 +0200 Subject: [PATCH] remove usage of llvm memory attributes Signed-off-by: xermicus --- crates/llvm-context/src/eravm/context/attribute.rs | 8 +------- .../src/eravm/context/function/llvm_runtime.rs | 7 ------- crates/llvm-context/src/eravm/context/function/mod.rs | 3 +-- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/crates/llvm-context/src/eravm/context/attribute.rs b/crates/llvm-context/src/eravm/context/attribute.rs index 4602b59..3601580 100644 --- a/crates/llvm-context/src/eravm/context/attribute.rs +++ b/crates/llvm-context/src/eravm/context/attribute.rs @@ -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()), } diff --git a/crates/llvm-context/src/eravm/context/function/llvm_runtime.rs b/crates/llvm-context/src/eravm/context/function/llvm_runtime.rs index 0fb3026..66c7e22 100644 --- a/crates/llvm-context/src/eravm/context/function/llvm_runtime.rs +++ b/crates/llvm-context/src/eravm/context/function/llvm_runtime.rs @@ -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 = vec![ llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32) diff --git a/crates/llvm-context/src/eravm/context/function/mod.rs b/crates/llvm-context/src/eravm/context/function/mod.rs index 62cb3d1..323dd4f 100644 --- a/crates/llvm-context/src/eravm/context/function/mod.rs +++ b/crates/llvm-context/src/eravm/context/function/mod.rs @@ -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,