[core] codegen: Rename TupleValue::{store,load} -> {insert,extract}

Better matches the underlying operation.
This commit is contained in:
David Mak 2025-02-10 11:07:01 +08:00
parent 2df22e29f7
commit 69542c38a2
3 changed files with 8 additions and 4 deletions

View File

@ -138,7 +138,7 @@ impl<'ctx> TupleType<'ctx> {
let mut value = self.construct(name);
for (i, val) in values.into_iter().enumerate() {
value.store_element(ctx, i as u32, val);
value.insert_element(ctx, i as u32, val);
}
value

View File

@ -106,7 +106,7 @@ pub fn parse_numpy_int_sequence<'ctx, G: CodeGenerator + ?Sized>(
for i in 0..input_seq.get_type().num_elements() {
// Get the i-th element off of the tuple and load it into `result`.
let int = input_seq.load_element(ctx, i).into_int_value();
let int = input_seq.extract_element(ctx, i).into_int_value();
let int = ctx.builder.build_int_s_extend_or_bit_cast(int, llvm_usize, "").unwrap();
unsafe {

View File

@ -45,7 +45,7 @@ impl<'ctx> TupleValue<'ctx> {
}
/// Stores a value into the tuple element at the given `index`.
pub fn store_element(
pub fn insert_element(
&mut self,
ctx: &CodeGenContext<'ctx, '_>,
index: u32,
@ -63,7 +63,11 @@ impl<'ctx> TupleValue<'ctx> {
}
/// Loads a value from the tuple element at the given `index`.
pub fn load_element(&self, ctx: &CodeGenContext<'ctx, '_>, index: u32) -> BasicValueEnum<'ctx> {
pub fn extract_element(
&self,
ctx: &CodeGenContext<'ctx, '_>,
index: u32,
) -> BasicValueEnum<'ctx> {
ctx.builder
.build_extract_value(
self.value,