1
Fork 0

Switch to the LLVMBuildGEPWithNoWrapFlags API

This API allows us to set the nuw flag as well.
This commit is contained in:
Nikita Popov 2025-02-19 10:55:36 +01:00
parent 3b022d8cee
commit 5e9d8a7d55
3 changed files with 36 additions and 12 deletions

View file

@ -954,6 +954,17 @@ bitflags! {
}
}
// These values **must** match with LLVMGEPNoWrapFlags
bitflags! {
#[repr(transparent)]
#[derive(Default)]
pub struct GEPNoWrapFlags : c_uint {
const InBounds = 1 << 0;
const NUSW = 1 << 1;
const NUW = 1 << 2;
}
}
unsafe extern "C" {
pub type ModuleBuffer;
}
@ -1454,21 +1465,14 @@ unsafe extern "C" {
pub(crate) fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
pub(crate) fn LLVMBuildGEP2<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Pointer: &'a Value,
Indices: *const &'a Value,
NumIndices: c_uint,
Name: *const c_char,
) -> &'a Value;
pub(crate) fn LLVMBuildInBoundsGEP2<'a>(
pub(crate) fn LLVMBuildGEPWithNoWrapFlags<'a>(
B: &Builder<'a>,
Ty: &'a Type,
Pointer: &'a Value,
Indices: *const &'a Value,
NumIndices: c_uint,
Name: *const c_char,
Flags: GEPNoWrapFlags,
) -> &'a Value;
// Casts