mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 08:14:12 +00:00
Use rspirv::dr::Function's def_id convenience method. (#397)
This commit is contained in:
parent
69b94bb6f9
commit
810ba5d1e4
@ -26,7 +26,7 @@ fn spread_roots(module: &Module, rooted: &mut HashSet<Word>) -> bool {
|
||||
}
|
||||
}
|
||||
for func in &module.functions {
|
||||
if rooted.contains(&func.def.as_ref().unwrap().result_id.unwrap()) {
|
||||
if rooted.contains(&func.def_id().unwrap()) {
|
||||
for inst in &func.def {
|
||||
any |= root(inst, rooted);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ fn kill_linkage_instructions(module: &mut Module, rewrite_rules: &HashMap<u32, u
|
||||
// drop imported functions
|
||||
module
|
||||
.functions
|
||||
.retain(|f| !rewrite_rules.contains_key(&f.def.as_ref().unwrap().result_id.unwrap()));
|
||||
.retain(|f| !rewrite_rules.contains_key(&f.def_id().unwrap()));
|
||||
|
||||
// drop imported variables
|
||||
module.types_global_values.retain(|v| {
|
||||
|
@ -17,7 +17,7 @@ pub fn inline(module: &mut Module) {
|
||||
let functions = module
|
||||
.functions
|
||||
.iter()
|
||||
.map(|f| (f.def.as_ref().unwrap().result_id.unwrap(), f.clone()))
|
||||
.map(|f| (f.def_id().unwrap(), f.clone()))
|
||||
.collect();
|
||||
let disallowed_argument_types = compute_disallowed_argument_types(module);
|
||||
let void = module
|
||||
@ -32,7 +32,7 @@ pub fn inline(module: &mut Module) {
|
||||
module.functions.retain(|f| {
|
||||
if should_inline(&disallowed_argument_types, f) {
|
||||
// TODO: We should insert all defined IDs in this function.
|
||||
dropped_ids.insert(f.def.as_ref().unwrap().result_id.unwrap());
|
||||
dropped_ids.insert(f.def_id().unwrap());
|
||||
false
|
||||
} else {
|
||||
true
|
||||
|
@ -43,7 +43,7 @@ pub fn structurize(
|
||||
builder: &mut builder,
|
||||
};
|
||||
|
||||
let func_id = func.function().def.as_ref().unwrap().result_id.unwrap();
|
||||
let func_id = func.function().def_id().unwrap();
|
||||
|
||||
let loop_control = match unroll_loops_decorations.get(&func_id) {
|
||||
Some(UnrollLoopsDecoration {}) => LoopControl::UNROLL,
|
||||
|
@ -176,7 +176,7 @@ pub fn remove_zombies(sess: &Session, module: &mut Module) {
|
||||
if env::var("PRINT_ZOMBIE").is_ok() {
|
||||
for f in &module.functions {
|
||||
if let Some(reason) = is_zombie(f.def.as_ref().unwrap(), &zombies) {
|
||||
let name_id = f.def.as_ref().unwrap().result_id.unwrap();
|
||||
let name_id = f.def_id().unwrap();
|
||||
let name = module.debugs.iter().find(|inst| {
|
||||
inst.class.opcode == Op::Name && inst.operands[0].unwrap_id_ref() == name_id
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user