nak: Accurately set num_gprs

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand
2023-06-15 18:14:02 -05:00
committed by Marge Bot
parent e25bbc9b7b
commit 2fd0a2e207
2 changed files with 8 additions and 5 deletions

View File

@@ -1016,7 +1016,10 @@ impl AssignRegs {
}
}
pub fn run(&mut self, f: &mut Function) {
pub fn run(&mut self, s: &mut Shader) {
assert!(s.functions.len() == 1);
let f = &mut s.functions[0];
let cfg = CFG::for_function(f);
let live = SimpleLiveness::for_function(f, &cfg);
let max_live = live.calc_max_live(f, &cfg);
@@ -1037,6 +1040,8 @@ impl AssignRegs {
}
});
s.num_gprs = num_regs[RegFile::GPR];
for b in &mut f.blocks {
let bl = live.block_live(b.id);
@@ -1065,8 +1070,6 @@ impl AssignRegs {
impl Shader {
pub fn assign_regs(&mut self) {
for f in &mut self.functions {
AssignRegs::new(self.sm).run(f);
}
AssignRegs::new(self.sm).run(self);
}
}

View File

@@ -3858,7 +3858,7 @@ impl Shader {
pub fn new(sm: u8) -> Shader {
Shader {
sm: sm,
num_gprs: RegFile::GPR.num_regs(sm),
num_gprs: 0,
tls_size: 0,
functions: Vec::new(),
}