TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

Add get_alignment to BasicValue and BasicValueEnum #394

Open amjoshuamichael opened 1 year ago

amjoshuamichael commented 1 year ago

Is your feature request related to a problem? Please describe. I would like to check the alignment of types once they have been lowered to BasicValueEnums.

Describe the solution you'd like ArrayType, FloatType, IntType, PointerType, StructType, and VectorType all have get_alignment methods, with the same function signature as size_of:

pub fn size_of(self) -> IntValue<'ctx>
pub fn get_alignment(self) -> IntValue<'ctx>

which is implemented on the BasicValue trait. I would like get_alignment to be a function of BasicValue, the same way size_of is.

amjoshuamichael commented 1 year ago

const_array would be great to have on BasicValue as well.