1
Fork 0

Rename prefix_chunk to prefix_chunk_size

This commit is contained in:
bjorn3 2020-11-15 10:12:10 +01:00
parent 39b8b2b623
commit 6a5f537fb9
3 changed files with 7 additions and 7 deletions

View file

@ -158,7 +158,7 @@ impl LlvmType for CastTarget {
.prefix
.iter()
.flat_map(|option_kind| {
option_kind.map(|kind| Reg { kind, size: self.prefix_chunk }.llvm_type(cx))
option_kind.map(|kind| Reg { kind, size: self.prefix_chunk_size }.llvm_type(cx))
})
.chain((0..rest_count).map(|_| rest_ll_unit))
.collect();

View file

@ -137,7 +137,7 @@ where
let rest_size = size - Size::from_bytes(8) * prefix_index as u64;
arg.cast_to(CastTarget {
prefix,
prefix_chunk: Size::from_bytes(8),
prefix_chunk_size: Size::from_bytes(8),
rest: Uniform { unit: Reg::i64(), total: rest_size },
});
}

View file

@ -203,7 +203,7 @@ impl Uniform {
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct CastTarget {
pub prefix: [Option<RegKind>; 8],
pub prefix_chunk: Size,
pub prefix_chunk_size: Size,
pub rest: Uniform,
}
@ -215,7 +215,7 @@ impl From<Reg> for CastTarget {
impl From<Uniform> for CastTarget {
fn from(uniform: Uniform) -> CastTarget {
CastTarget { prefix: [None; 8], prefix_chunk: Size::ZERO, rest: uniform }
CastTarget { prefix: [None; 8], prefix_chunk_size: Size::ZERO, rest: uniform }
}
}
@ -223,13 +223,13 @@ impl CastTarget {
pub fn pair(a: Reg, b: Reg) -> CastTarget {
CastTarget {
prefix: [Some(a.kind), None, None, None, None, None, None, None],
prefix_chunk: a.size,
prefix_chunk_size: a.size,
rest: Uniform::from(b),
}
}
pub fn size<C: HasDataLayout>(&self, cx: &C) -> Size {
(self.prefix_chunk * self.prefix.iter().filter(|x| x.is_some()).count() as u64)
(self.prefix_chunk_size * self.prefix.iter().filter(|x| x.is_some()).count() as u64)
.align_to(self.rest.align(cx))
+ self.rest.total
}
@ -237,7 +237,7 @@ impl CastTarget {
pub fn align<C: HasDataLayout>(&self, cx: &C) -> Align {
self.prefix
.iter()
.filter_map(|x| x.map(|kind| Reg { kind, size: self.prefix_chunk }.align(cx)))
.filter_map(|x| x.map(|kind| Reg { kind, size: self.prefix_chunk_size }.align(cx)))
.fold(cx.data_layout().aggregate_align.abi.max(self.rest.align(cx)), |acc, align| {
acc.max(align)
})