forked from M-Labs/nac3
[core] codegen: Rename TupleValue::{store,load} -> {insert,extract}
Better matches the underlying operation.
This commit is contained in:
parent
2df22e29f7
commit
69542c38a2
@ -138,7 +138,7 @@ impl<'ctx> TupleType<'ctx> {
|
|||||||
|
|
||||||
let mut value = self.construct(name);
|
let mut value = self.construct(name);
|
||||||
for (i, val) in values.into_iter().enumerate() {
|
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
|
value
|
||||||
|
@ -106,7 +106,7 @@ pub fn parse_numpy_int_sequence<'ctx, G: CodeGenerator + ?Sized>(
|
|||||||
|
|
||||||
for i in 0..input_seq.get_type().num_elements() {
|
for i in 0..input_seq.get_type().num_elements() {
|
||||||
// Get the i-th element off of the tuple and load it into `result`.
|
// 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();
|
let int = ctx.builder.build_int_s_extend_or_bit_cast(int, llvm_usize, "").unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -45,7 +45,7 @@ impl<'ctx> TupleValue<'ctx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stores a value into the tuple element at the given `index`.
|
/// Stores a value into the tuple element at the given `index`.
|
||||||
pub fn store_element(
|
pub fn insert_element(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &CodeGenContext<'ctx, '_>,
|
ctx: &CodeGenContext<'ctx, '_>,
|
||||||
index: u32,
|
index: u32,
|
||||||
@ -63,7 +63,11 @@ impl<'ctx> TupleValue<'ctx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a value from the tuple element at the given `index`.
|
/// 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
|
ctx.builder
|
||||||
.build_extract_value(
|
.build_extract_value(
|
||||||
self.value,
|
self.value,
|
||||||
|
Loading…
Reference in New Issue
Block a user