Skip to content

Commit

Permalink
Rebase via merge. 'ir/fix-register-allocation' rebased on 'origin/main'.
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-hartl committed Mar 29, 2024
1 parent a142d52 commit 7c4498e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ir/crates/back/src/codegen/machine/function/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<TM: TargetMachine> FunctionBuilder<TM> {
}
PseudoOp::Phi(dest, operands) => {
self.function.basic_blocks[mbb_id].add_phi(*dest, operands.iter().map(
|(reg, bb)| (*reg, self.bb_mapping[bb])
|(reg, bb)| (*reg, self.bb_mapping[bb])
).collect());
}
PseudoOp::Def(reg) => {
Expand Down
8 changes: 4 additions & 4 deletions ir/crates/back/src/codegen/machine/function/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,25 @@ impl Cfg {
}

/// Traverses the cfg using a post order depth first traversal
pub fn dfs_postorder(&self) -> impl Iterator<Item = BasicBlockId> + '_ {
pub fn dfs_postorder(&self) -> impl Iterator<Item=BasicBlockId> + '_ {
DfsPostOrder::new(&self.graph, self.entry_node())
.iter(&self.graph)
.map(|node| self.node_to_block_map[&node])
}

pub fn bfs(&self) -> impl Iterator<Item = BasicBlockId> + '_ {
pub fn bfs(&self) -> impl Iterator<Item=BasicBlockId> + '_ {
Bfs::new(&self.graph, self.entry_node())
.iter(&self.graph)
.map(|node| self.node_to_block_map[&node])
}

pub fn predecessors(&self, bb: BasicBlockId) -> impl Iterator<Item = BasicBlockId> + '_ {
pub fn predecessors(&self, bb: BasicBlockId) -> impl Iterator<Item=BasicBlockId> + '_ {
self.graph
.neighbors_directed(self.block_to_node_map[&bb], Direction::Incoming)
.map(|node| self.node_to_block_map[&node])
}

pub fn successors(&self, bb: BasicBlockId) -> impl Iterator<Item = BasicBlockId> + '_ {
pub fn successors(&self, bb: BasicBlockId) -> impl Iterator<Item=BasicBlockId> + '_ {
self.graph
.neighbors(self.block_to_node_map[&bb])
.map(|node| self.node_to_block_map[&node])
Expand Down
2 changes: 1 addition & 1 deletion ir/crates/back/src/codegen/selection_dag/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'func, TM: TargetMachine> Builder<'func, TM> {
let mapped = self.map_vreg(reg, func);
// Ensure that the temp reg and arg reg will be placed in the same location => we can trivially remove the phi instruction later on
self.function.tie_vreg(mapped, mapped_arg);
// Using defined_in here is fine, because the reg that we use here is always defined in the immediate pred of bb_id
// Using defined_in here is fine, because the reg that we use here is always defined in the immediate pred of bb_id
(Register::Virtual(mapped), func.cfg.vreg(reg).defined_in)
})
.collect_vec();
Expand Down

0 comments on commit 7c4498e

Please sign in to comment.