nak,nouveau: adjust function/method signatures to better match convention
v2: restore `to_cssa()` naming Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34372>
This commit is contained in:
@@ -902,7 +902,7 @@ impl<'a> InstrBuilder<'a> {
|
||||
}
|
||||
|
||||
impl InstrBuilder<'_> {
|
||||
pub fn as_vec(self) -> Vec<Box<Instr>> {
|
||||
pub fn into_vec(self) -> Vec<Box<Instr>> {
|
||||
match self.instrs {
|
||||
MappedInstrs::None => Vec::new(),
|
||||
MappedInstrs::One(i) => vec![i],
|
||||
@@ -910,7 +910,7 @@ impl InstrBuilder<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_mapped_instrs(self) -> MappedInstrs {
|
||||
pub fn into_mapped_instrs(self) -> MappedInstrs {
|
||||
self.instrs
|
||||
}
|
||||
}
|
||||
@@ -944,13 +944,13 @@ impl<'a> SSAInstrBuilder<'a> {
|
||||
}
|
||||
|
||||
impl SSAInstrBuilder<'_> {
|
||||
pub fn as_vec(self) -> Vec<Box<Instr>> {
|
||||
self.b.as_vec()
|
||||
pub fn into_vec(self) -> Vec<Box<Instr>> {
|
||||
self.b.into_vec()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn as_mapped_instrs(self) -> MappedInstrs {
|
||||
self.b.as_mapped_instrs()
|
||||
pub fn into_mapped_instrs(self) -> MappedInstrs {
|
||||
self.b.into_mapped_instrs()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3826,7 +3826,7 @@ impl<'a> ShaderFromNir<'a> {
|
||||
let bb = BasicBlock {
|
||||
label: self.get_block_label(nb),
|
||||
uniform: !nb.divergent,
|
||||
instrs: b.as_vec(),
|
||||
instrs: b.into_vec(),
|
||||
};
|
||||
self.cfg.add_node(nb.index, bb);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ impl<'a> TestShaderBuilder<'a> {
|
||||
let start_block = BasicBlock {
|
||||
label: label_alloc.alloc(),
|
||||
uniform: true,
|
||||
instrs: b.as_vec(),
|
||||
instrs: b.into_vec(),
|
||||
};
|
||||
|
||||
TestShaderBuilder {
|
||||
@@ -187,7 +187,7 @@ impl<'a> TestShaderBuilder<'a> {
|
||||
let block = BasicBlock {
|
||||
label: self.label,
|
||||
uniform: true,
|
||||
instrs: self.b.as_vec(),
|
||||
instrs: self.b.into_vec(),
|
||||
};
|
||||
|
||||
let mut cfg = CFGBuilder::new();
|
||||
|
||||
@@ -112,7 +112,7 @@ impl RegFile {
|
||||
/// Returns the uniform form of this register file, if any. For `GPR` and
|
||||
/// `UGPR, this returns `UGPR` and for `Pred` and `UPred`, this returns
|
||||
/// `UPred`.
|
||||
pub fn to_uniform(&self) -> Option<RegFile> {
|
||||
pub fn to_uniform(self) -> Option<RegFile> {
|
||||
match self {
|
||||
RegFile::GPR | RegFile::UGPR => Some(RegFile::UGPR),
|
||||
RegFile::Pred | RegFile::UPred => Some(RegFile::UPred),
|
||||
@@ -121,11 +121,11 @@ impl RegFile {
|
||||
}
|
||||
|
||||
/// Returns warp-wide version of this register file.
|
||||
pub fn to_warp(&self) -> RegFile {
|
||||
pub fn to_warp(self) -> RegFile {
|
||||
match self {
|
||||
RegFile::GPR | RegFile::UGPR => RegFile::GPR,
|
||||
RegFile::Pred | RegFile::UPred => RegFile::Pred,
|
||||
RegFile::Carry | RegFile::Bar | RegFile::Mem => *self,
|
||||
RegFile::Carry | RegFile::Bar | RegFile::Mem => self,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ impl Shader<'_> {
|
||||
let mut b = SSAInstrBuilder::new(sm, &mut f.ssa_alloc);
|
||||
legalize_instr(sm, &mut b, bl, bu, &pinned, ip, &mut instr);
|
||||
b.push_instr(instr);
|
||||
instrs.append(&mut b.as_vec());
|
||||
instrs.append(&mut b.into_vec());
|
||||
}
|
||||
b.instrs = instrs;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ impl LowerCopySwap {
|
||||
}));
|
||||
}
|
||||
self.lower_r2ur(&mut b, r2ur);
|
||||
b.as_mapped_instrs()
|
||||
b.into_mapped_instrs()
|
||||
}
|
||||
Op::Copy(copy) => {
|
||||
debug_assert!(instr.pred.is_true());
|
||||
@@ -273,7 +273,7 @@ impl LowerCopySwap {
|
||||
}));
|
||||
}
|
||||
self.lower_copy(&mut b, copy);
|
||||
b.as_mapped_instrs()
|
||||
b.into_mapped_instrs()
|
||||
}
|
||||
Op::Swap(swap) => {
|
||||
debug_assert!(instr.pred.is_true());
|
||||
@@ -285,7 +285,7 @@ impl LowerCopySwap {
|
||||
}));
|
||||
}
|
||||
self.lower_swap(&mut b, swap);
|
||||
b.as_mapped_instrs()
|
||||
b.into_mapped_instrs()
|
||||
}
|
||||
_ => MappedInstrs::One(instr),
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ fn lower_par_copy(pc: OpParCopy, sm: &dyn ShaderModel) -> MappedInstrs {
|
||||
}
|
||||
}
|
||||
|
||||
b.as_mapped_instrs()
|
||||
b.into_mapped_instrs()
|
||||
}
|
||||
|
||||
impl Shader<'_> {
|
||||
|
||||
@@ -73,7 +73,7 @@ impl Shader<'_> {
|
||||
});
|
||||
*ssa = w;
|
||||
});
|
||||
let mut v = b.as_vec();
|
||||
let mut v = b.into_vec();
|
||||
v.insert(0, instr);
|
||||
MappedInstrs::Many(v)
|
||||
} else {
|
||||
@@ -90,7 +90,7 @@ impl Shader<'_> {
|
||||
}
|
||||
});
|
||||
b.push_instr(instr);
|
||||
b.as_mapped_instrs()
|
||||
b.into_mapped_instrs()
|
||||
}
|
||||
} else {
|
||||
propagated_r2ur |= propagate_r2ur(&mut instr, &r2ur);
|
||||
|
||||
@@ -59,7 +59,7 @@ impl MthdHeader {
|
||||
unsafe { &mut *(bits as *mut u32 as *mut MthdHeader) }
|
||||
}
|
||||
|
||||
fn to_bits(self) -> u32 {
|
||||
fn into_bits(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
|
||||
@@ -183,11 +183,11 @@ impl Push {
|
||||
if bits <= 0x1fff {
|
||||
self.last_inc = usize::MAX;
|
||||
let header = MthdHeader::new_immd(bits as u16, subc, addr);
|
||||
self.mem.push(header.to_bits());
|
||||
self.mem.push(header.into_bits());
|
||||
} else {
|
||||
self.last_inc = self.mem.len();
|
||||
let header = MthdHeader::new(MthdType::NInc, subc, addr, 1);
|
||||
self.mem.push(header.to_bits());
|
||||
self.mem.push(header.into_bits());
|
||||
self.mem.push(bits);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user