LLVM 16: Switch to using MemoryEffects
This commit is contained in:
parent
47c008e440
commit
c15cfc91c4
8 changed files with 67 additions and 12 deletions
|
@ -183,7 +183,6 @@ pub enum AttributeKind {
|
|||
OptimizeNone = 24,
|
||||
ReturnsTwice = 25,
|
||||
ReadNone = 26,
|
||||
InaccessibleMemOnly = 27,
|
||||
SanitizeHWAddress = 28,
|
||||
WillReturn = 29,
|
||||
StackProtectReq = 30,
|
||||
|
@ -590,6 +589,15 @@ pub enum ChecksumKind {
|
|||
SHA256,
|
||||
}
|
||||
|
||||
/// LLVMRustMemoryEffects
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub enum MemoryEffects {
|
||||
None,
|
||||
ReadOnly,
|
||||
InaccessibleMemOnly,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
type Opaque;
|
||||
}
|
||||
|
@ -1175,6 +1183,7 @@ extern "C" {
|
|||
pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
|
||||
pub fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute;
|
||||
pub fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute;
|
||||
pub fn LLVMRustCreateMemoryEffectsAttr(C: &Context, effects: MemoryEffects) -> &Attribute;
|
||||
|
||||
// Operations on functions
|
||||
pub fn LLVMRustGetOrInsertFunction<'a>(
|
||||
|
|
|
@ -185,6 +185,13 @@ impl AttributeKind {
|
|||
}
|
||||
}
|
||||
|
||||
impl MemoryEffects {
|
||||
/// Create an LLVM Attribute with these memory effects.
|
||||
pub fn create_attr(self, llcx: &Context) -> &Attribute {
|
||||
unsafe { LLVMRustCreateMemoryEffectsAttr(llcx, self) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_section(llglobal: &Value, section_name: &str) {
|
||||
let section_name_cstr = CString::new(section_name).expect("unexpected CString error");
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue