mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 16:21:05 +00:00
Update code base to use LLVM 21
This commit is contained in:
@@ -8,7 +8,7 @@ use serde::Serialize;
|
||||
/// inside of the LLVM build directory. This order is actually generated during the building.
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum Attribute {
|
||||
Unused = 0,
|
||||
// FirstEnumAttr = 1,
|
||||
AllocAlign = 1,
|
||||
AllocatedPointer = 2,
|
||||
AlwaysInline = 3,
|
||||
@@ -16,92 +16,107 @@ pub enum Attribute {
|
||||
Cold = 5,
|
||||
Convergent = 6,
|
||||
CoroDestroyOnlyWhenComplete = 7,
|
||||
DeadOnUnwind = 8,
|
||||
DisableSanitizerInstrumentation = 9,
|
||||
FnRetThunkExtern = 10,
|
||||
Hot = 11,
|
||||
ImmArg = 12,
|
||||
InReg = 13,
|
||||
InlineHint = 14,
|
||||
JumpTable = 15,
|
||||
MinSize = 16,
|
||||
MustProgress = 17,
|
||||
Naked = 18,
|
||||
Nest = 19,
|
||||
NoAlias = 20,
|
||||
NoBuiltin = 21,
|
||||
NoCallback = 22,
|
||||
NoCapture = 23,
|
||||
NoCfCheck = 24,
|
||||
NoDuplicate = 25,
|
||||
NoFree = 26,
|
||||
NoImplicitFloat = 27,
|
||||
NoInline = 28,
|
||||
NoMerge = 29,
|
||||
NoProfile = 30,
|
||||
NoRecurse = 31,
|
||||
NoRedZone = 32,
|
||||
NoReturn = 33,
|
||||
NoSanitizeBounds = 34,
|
||||
NoSanitizeCoverage = 35,
|
||||
NoSync = 36,
|
||||
NoUndef = 37,
|
||||
NoUnwind = 38,
|
||||
NonLazyBind = 39,
|
||||
NonNull = 40,
|
||||
NullPointerIsValid = 41,
|
||||
OptForFuzzing = 42,
|
||||
OptimizeForDebugging = 43,
|
||||
OptimizeForSize = 44,
|
||||
OptimizeNone = 45,
|
||||
PresplitCoroutine = 46,
|
||||
ReadNone = 47,
|
||||
ReadOnly = 48,
|
||||
Returned = 49,
|
||||
ReturnsTwice = 50,
|
||||
SExt = 51,
|
||||
SafeStack = 52,
|
||||
SanitizeAddress = 53,
|
||||
SanitizeHWAddress = 54,
|
||||
SanitizeMemTag = 55,
|
||||
SanitizeMemory = 56,
|
||||
SanitizeThread = 57,
|
||||
ShadowCallStack = 58,
|
||||
SkipProfile = 59,
|
||||
Speculatable = 60,
|
||||
SpeculativeLoadHardening = 61,
|
||||
StackProtect = 62,
|
||||
StackProtectReq = 63,
|
||||
StackProtectStrong = 64,
|
||||
StrictFP = 65,
|
||||
SwiftAsync = 66,
|
||||
SwiftError = 67,
|
||||
SwiftSelf = 68,
|
||||
WillReturn = 69,
|
||||
Writable = 70,
|
||||
WriteOnly = 71,
|
||||
ZExt = 72,
|
||||
// LastEnumAttr = 72,
|
||||
// FirstTypeAttr = 73,
|
||||
ByRef = 73,
|
||||
ByVal = 74,
|
||||
ElementType = 75,
|
||||
InAlloca = 76,
|
||||
Preallocated = 77,
|
||||
StructRet = 78,
|
||||
// LastTypeAttr = 78,
|
||||
// FirstIntAttr = 79,
|
||||
Alignment = 79,
|
||||
AllocKind = 80,
|
||||
AllocSize = 81,
|
||||
Dereferenceable = 82,
|
||||
DereferenceableOrNull = 83,
|
||||
Memory = 84,
|
||||
NoFPClass = 85,
|
||||
StackAlignment = 86,
|
||||
UWTable = 87,
|
||||
VScaleRange = 88,
|
||||
// LastIntAttr = 88,
|
||||
CoroElideSafe = 8,
|
||||
DeadOnReturn = 9,
|
||||
DeadOnUnwind = 10,
|
||||
DisableSanitizerInstrumentation = 11,
|
||||
FnRetThunkExtern = 12,
|
||||
Hot = 13,
|
||||
HybridPatchable = 14,
|
||||
ImmArg = 15,
|
||||
InReg = 16,
|
||||
InlineHint = 17,
|
||||
JumpTable = 18,
|
||||
MinSize = 19,
|
||||
MustProgress = 20,
|
||||
Naked = 21,
|
||||
Nest = 22,
|
||||
NoAlias = 23,
|
||||
NoBuiltin = 24,
|
||||
NoCallback = 25,
|
||||
NoCfCheck = 26,
|
||||
NoDivergenceSource = 27,
|
||||
NoDuplicate = 28,
|
||||
NoExt = 29,
|
||||
NoFree = 30,
|
||||
NoImplicitFloat = 31,
|
||||
NoInline = 32,
|
||||
NoMerge = 33,
|
||||
NoProfile = 34,
|
||||
NoRecurse = 35,
|
||||
NoRedZone = 36,
|
||||
NoReturn = 37,
|
||||
NoSanitizeBounds = 38,
|
||||
NoSanitizeCoverage = 39,
|
||||
NoSync = 40,
|
||||
NoUndef = 41,
|
||||
NoUnwind = 42,
|
||||
NonLazyBind = 43,
|
||||
NonNull = 44,
|
||||
NullPointerIsValid = 45,
|
||||
OptForFuzzing = 46,
|
||||
OptimizeForDebugging = 47,
|
||||
OptimizeForSize = 48,
|
||||
OptimizeNone = 49,
|
||||
PresplitCoroutine = 50,
|
||||
ReadNone = 51,
|
||||
ReadOnly = 52,
|
||||
Returned = 53,
|
||||
ReturnsTwice = 54,
|
||||
SExt = 55,
|
||||
SafeStack = 56,
|
||||
SanitizeAddress = 57,
|
||||
SanitizeHWAddress = 58,
|
||||
SanitizeMemTag = 59,
|
||||
SanitizeMemory = 60,
|
||||
SanitizeNumericalStability = 61,
|
||||
SanitizeRealtime = 62,
|
||||
SanitizeRealtimeBlocking = 63,
|
||||
SanitizeThread = 64,
|
||||
SanitizeType = 65,
|
||||
ShadowCallStack = 66,
|
||||
SkipProfile = 67,
|
||||
Speculatable = 68,
|
||||
SpeculativeLoadHardening = 69,
|
||||
StackProtect = 70,
|
||||
StackProtectReq = 71,
|
||||
StackProtectStrong = 72,
|
||||
StrictFP = 73,
|
||||
SwiftAsync = 74,
|
||||
SwiftError = 75,
|
||||
SwiftSelf = 76,
|
||||
WillReturn = 77,
|
||||
Writable = 78,
|
||||
WriteOnly = 79,
|
||||
ZExt = 80,
|
||||
//LastEnumAttr = 80,
|
||||
//FirstTypeAttr = 81,
|
||||
ByRef = 81,
|
||||
ByVal = 82,
|
||||
ElementType = 83,
|
||||
InAlloca = 84,
|
||||
Preallocated = 85,
|
||||
StructRet = 86,
|
||||
//LastTypeAttr = 86,
|
||||
//FirstIntAttr = 87,
|
||||
Alignment = 87,
|
||||
AllocKind = 88,
|
||||
AllocSize = 89,
|
||||
Captures = 90,
|
||||
Dereferenceable = 91,
|
||||
DereferenceableOrNull = 92,
|
||||
Memory = 93,
|
||||
NoFPClass = 94,
|
||||
StackAlignment = 95,
|
||||
UWTable = 96,
|
||||
VScaleRange = 97,
|
||||
//LastIntAttr = 97,
|
||||
//FirstConstantRangeAttr = 98,
|
||||
Range = 98,
|
||||
//LastConstantRangeAttr = 98,
|
||||
//FirstConstantRangeListAttr = 99,
|
||||
Initializes = 99,
|
||||
//LastConstantRangeListAttr = 99,
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for Attribute {
|
||||
|
||||
@@ -838,8 +838,7 @@ impl<'ctx> Context<'ctx> {
|
||||
.builder()
|
||||
.build_call(intrinsic, &[value.into()], "call_byte_swap")?
|
||||
.try_as_basic_value()
|
||||
.left()
|
||||
.unwrap())
|
||||
.unwrap_basic())
|
||||
}
|
||||
|
||||
/// Builds a GEP instruction.
|
||||
@@ -912,7 +911,7 @@ impl<'ctx> Context<'ctx> {
|
||||
)
|
||||
.unwrap()
|
||||
.try_as_basic_value()
|
||||
.left()
|
||||
.basic()
|
||||
}
|
||||
|
||||
/// Builds a call to the runtime API `import`, where `import` is a "getter" API.
|
||||
@@ -950,7 +949,7 @@ impl<'ctx> Context<'ctx> {
|
||||
)
|
||||
.unwrap();
|
||||
self.modify_call_site_value(arguments, call_site_value, function);
|
||||
call_site_value.try_as_basic_value().left()
|
||||
call_site_value.try_as_basic_value().basic()
|
||||
}
|
||||
|
||||
/// Sets the alignment to `1`, since all non-stack memory pages have such alignment.
|
||||
@@ -1082,13 +1081,7 @@ impl<'ctx> Context<'ctx> {
|
||||
|
||||
Ok(call_site_value
|
||||
.try_as_basic_value()
|
||||
.left()
|
||||
.unwrap_or_else(|| {
|
||||
panic!(
|
||||
"revive runtime function {} should return a value",
|
||||
<PolkaVMSbrkFunction as RuntimeFunction>::NAME,
|
||||
)
|
||||
})
|
||||
.unwrap_basic()
|
||||
.into_pointer_value())
|
||||
}
|
||||
|
||||
@@ -1277,7 +1270,7 @@ impl<'ctx> Context<'ctx> {
|
||||
call_site_value.add_attribute(
|
||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||
self.llvm
|
||||
.create_enum_attribute(Attribute::NoCapture as u32, 0),
|
||||
.create_enum_attribute(Attribute::Captures as u32, 0), // captures(none)
|
||||
);
|
||||
call_site_value.add_attribute(
|
||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||
|
||||
@@ -275,6 +275,6 @@ pub fn count_leading_zeros<'ctx>(
|
||||
"clz",
|
||||
)?
|
||||
.try_as_basic_value()
|
||||
.left()
|
||||
.basic()
|
||||
.expect("the llvm.ctlz should return a value"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user