|
|
|
@ -274,7 +274,6 @@ pub fn spirv_meta(module: &mut Module) -> Vec<(Option<String>, Vec<String>)> {
|
|
|
|
|
}
|
|
|
|
|
ops.push((Some(op.0), vec![op.1]));
|
|
|
|
|
}
|
|
|
|
|
// Push OpFunctionType
|
|
|
|
|
ops.push((
|
|
|
|
|
Some(name.clone()),
|
|
|
|
|
vec!["OpTypeFunction".to_string(), return_type.clone()],
|
|
|
|
@ -475,6 +474,7 @@ pub fn compile_ast_ssa(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn compile_fun_ssa(module: &mut Module, ops: &Vec<(Option<String>, String)>) {
|
|
|
|
|
let mut label_counter = Box::new(0);
|
|
|
|
|
for fun in module.functions.iter_mut() {
|
|
|
|
|
assert!(fun.ast.is_some());
|
|
|
|
|
let ast = fun.ast.as_mut().unwrap();
|
|
|
|
@ -515,6 +515,17 @@ pub fn compile_fun_ssa(module: &mut Module, ops: &Vec<(Option<String>, String)>)
|
|
|
|
|
for c in &constants {
|
|
|
|
|
out_pre.push((Some(fix_name(&c.0.clone())), c.1.clone()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO non-void type
|
|
|
|
|
out_pre.push((
|
|
|
|
|
Some(fix_name(&fun.name)),
|
|
|
|
|
format!("OpFunction %void None %l_{}", fun.name),
|
|
|
|
|
));
|
|
|
|
|
out_pre.push((
|
|
|
|
|
Some(format!("%n_{}", label_counter.to_string())),
|
|
|
|
|
"OpLabel".to_string(),
|
|
|
|
|
));
|
|
|
|
|
*label_counter += 1;
|
|
|
|
|
let mut out_ops = out_pre.clone();
|
|
|
|
|
for op in out_op {
|
|
|
|
|
if op.0.is_some() {
|
|
|
|
|