MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / add_blockparams

Method add_blockparams

src/debug_utils/generic_function/arbitrary.rs:338–365  ·  view source on GitHub ↗

Adds incoming block parameters to blocks that allow them.

(&mut self)

Source from the content-addressed store, hash-verified

336
337 /// Adds incoming block parameters to blocks that allow them.
338 fn add_blockparams(&mut self) -> Result<()> {
339 // Entry points cannot have blockparams.
340 for block in self.func.blocks.keys() {
341 if self.func.entry_points.contains(&block) {
342 continue;
343 }
344 // Blockparams are only allowed if we have multiple predecessors.
345 if self.func.blocks[block].preds.len() <= 1 {
346 continue;
347 }
348 let can_add_indirect_remats = self.domtree.immediate_dominator(block).is_some();
349
350 // Define some values for incoming blockparams.
351 for _ in 0..self
352 .u
353 .int_in_range(self.config.blockparams_per_block.clone())?
354 {
355 let bank = RegBank::new(self.u.choose_index(self.reginfo.num_banks())?);
356 let value = self.new_value(bank)?;
357 if can_add_indirect_remats && !self.u.arbitrary()? {
358 self.add_indirect_remat(value, block, true)?;
359 }
360 self.func.blocks[block].block_params_in.push(value);
361 }
362 }
363
364 Ok(())
365 }
366
367 /// Generate the contents of a basic block.
368 ///

Callers 1

arbitrary_with_configMethod · 0.80

Calls 11

is_someMethod · 0.80
immediate_dominatorMethod · 0.80
cloneMethod · 0.80
num_banksMethod · 0.80
new_valueMethod · 0.80
add_indirect_rematMethod · 0.80
pushMethod · 0.80
keysMethod · 0.45
containsMethod · 0.45
lenMethod · 0.45
arbitraryMethod · 0.45

Tested by

no test coverage detected