fix regalloc

This commit is contained in:
Chris Fallin 2022-11-30 17:28:18 -08:00
parent 75d4323c4d
commit 38591d90a3
No known key found for this signature in database
GPG key ID: 31649E4FE65EB465

View file

@ -3,7 +3,7 @@
use crate::backend::treeify::Trees; use crate::backend::treeify::Trees;
use crate::cfg::CFGInfo; use crate::cfg::CFGInfo;
use crate::entity::{EntityRef, EntityVec, PerEntity}; use crate::entity::{EntityVec, PerEntity};
use crate::ir::{Block, FunctionBody, Local, Type, Value, ValueDef}; use crate::ir::{Block, FunctionBody, Local, Type, Value, ValueDef};
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use std::collections::{hash_map::Entry, HashMap}; use std::collections::{hash_map::Entry, HashMap};
@ -187,10 +187,12 @@ impl<'a> Context<'a> {
range.end range.end
); );
// If the value is an arg, ignore; these already have // If the value is an arg on block0, ignore; these
// fixed locations. // already have fixed locations.
if value.index() < self.body.n_params { if let &ValueDef::BlockParam(b, _, _) = &self.body.values[value] {
continue; if b == self.body.entry {
continue;
}
} }
// Try getting a local from the freelist; if not, // Try getting a local from the freelist; if not,