MCPcopy Create free account
hub / github.com/chc4/lineiform / regalloc

Method regalloc

tangle/src/ir.rs:148–185  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

146 }
147
148 pub fn regalloc(&mut self) {
149 for r in self.regions.node_weights_mut() {
150 if r.idx == self.master_region {
151 continue;
152 }
153 r.apply_constraints();
154 r.attach_ports();
155 r.propogate_state_edges();
156 r.observe_state_outputs();
157 let mut virt_map: VirtualRegisterMap = HashMap::new();
158 r.connect_block_params(&mut virt_map, self.owner.as_ref().unwrap());
159 println!("propogated state edges");
160
161 //r.move_constants_to_operands();
162 r.remove_nops(self.owner.as_mut().unwrap());
163 // Create virtual register storages for all nodes and ports
164 r.create_virtual_registers(&mut virt_map, self.owner.as_mut().unwrap());
165 r.create_dependencies(); // we have to re-add node dependencies for the inserted movs
166
167 let mut patterner = PatternManager::default();
168 patterner.run(self.owner.as_ref().unwrap(), r, &mut virt_map);
169 //let runner = PassRunner;
170 //runner.run(r);
171 //panic!();
172
173 println!("created virtual registers");
174 r.annotate_port_times_and_hints(&mut virt_map);
175 println!("annoated port times and hints");
176 r.allocate_physical_for_virtual(&mut virt_map);
177 println!("allocated physical registers for virtual register");
178 //r.replace_virtual_with_backing(&mut virt_map);
179 //println!("replacing virtual registers with physical registers");
180 // Create a dependency graph for registers
181 //let dg = r.create_register_dependencies();
182 patterner.virt_map = virt_map;
183 r.patterns = Some(patterner);
184 }
185 }
186
187 pub fn validate(&mut self) {
188 // This is currently worse than useless

Callers 2

compile_fnMethod · 0.80
function_inc_regallocFunction · 0.80

Calls 11

apply_constraintsMethod · 0.80
attach_portsMethod · 0.80
propogate_state_edgesMethod · 0.80
observe_state_outputsMethod · 0.80
connect_block_paramsMethod · 0.80
remove_nopsMethod · 0.80
create_dependenciesMethod · 0.80
runMethod · 0.80

Tested by 1

function_inc_regallocFunction · 0.64