mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-23 22:21:05 +00:00
remove usage of llvm memory attributes
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -6,7 +6,6 @@ use serde::Serialize;
|
|||||||
/// The LLVM attribute.
|
/// The LLVM attribute.
|
||||||
/// In order to check the real order in a new major version of LLVM, find the `Attributes.inc` file
|
/// 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.
|
/// 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)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub enum Attribute {
|
pub enum Attribute {
|
||||||
Unused = 0,
|
Unused = 0,
|
||||||
@@ -82,7 +81,7 @@ pub enum Attribute {
|
|||||||
Writable = 70,
|
Writable = 70,
|
||||||
WriteOnly = 71,
|
WriteOnly = 71,
|
||||||
ZExt = 72,
|
ZExt = 72,
|
||||||
//LastEnumAttr = 72,
|
// LastEnumAttr = 72,
|
||||||
// FirstTypeAttr = 73,
|
// FirstTypeAttr = 73,
|
||||||
ByRef = 73,
|
ByRef = 73,
|
||||||
ByVal = 74,
|
ByVal = 74,
|
||||||
@@ -117,12 +116,7 @@ impl TryFrom<&str> for Attribute {
|
|||||||
"OptimizeForSize" => Ok(Attribute::OptimizeForSize),
|
"OptimizeForSize" => Ok(Attribute::OptimizeForSize),
|
||||||
"NoInline" => Ok(Attribute::NoInline),
|
"NoInline" => Ok(Attribute::NoInline),
|
||||||
"WillReturn" => Ok(Attribute::WillReturn),
|
"WillReturn" => Ok(Attribute::WillReturn),
|
||||||
"WriteOnly" => Ok(Attribute::WriteOnly),
|
|
||||||
"ReadNone" => Ok(Attribute::ReadNone),
|
|
||||||
"ReadOnly" => Ok(Attribute::ReadOnly),
|
|
||||||
"NoReturn" => Ok(Attribute::NoReturn),
|
"NoReturn" => Ok(Attribute::NoReturn),
|
||||||
// FIXME: Not in Attributes.inc
|
|
||||||
//"InaccessibleMemOnly" => Ok(Attribute::InaccessibleMemOnly),
|
|
||||||
"MustProgress" => Ok(Attribute::MustProgress),
|
"MustProgress" => Ok(Attribute::MustProgress),
|
||||||
_ => Err(value.to_owned()),
|
_ => Err(value.to_owned()),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,13 +410,6 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
|||||||
Some(inkwell::module::Linkage::External),
|
Some(inkwell::module::Linkage::External),
|
||||||
);
|
);
|
||||||
Function::set_default_attributes(llvm, system_request, optimizer);
|
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![
|
let external_call_arguments: Vec<inkwell::types::BasicMetadataTypeEnum> = vec![
|
||||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_FIELD as u32)
|
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() {
|
for attribute_kind in attributes.into_iter() {
|
||||||
match attribute_kind {
|
match attribute_kind {
|
||||||
|
Attribute::Memory => todo!("`memory` attributes are not yet implemented"),
|
||||||
attribute_kind @ Attribute::AlwaysInline if force => {
|
attribute_kind @ Attribute::AlwaysInline if force => {
|
||||||
let is_optimize_none_set = declaration
|
let is_optimize_none_set = declaration
|
||||||
.value
|
.value
|
||||||
@@ -251,8 +252,6 @@ impl<'ctx> Function<'ctx> {
|
|||||||
vec![
|
vec![
|
||||||
Attribute::MustProgress,
|
Attribute::MustProgress,
|
||||||
Attribute::NoUnwind,
|
Attribute::NoUnwind,
|
||||||
// FIXME: LLVM complains about ReadNone being not valid for fns
|
|
||||||
// Attribute::ReadNone,
|
|
||||||
Attribute::WillReturn,
|
Attribute::WillReturn,
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
|
|||||||
Reference in New Issue
Block a user