I'd like to handle all subdir() invocations in the frontend, and have a complete tree for the MIR level, I think the best thing to do is have a pass that converts
subdir('foo', if_found : foo_dep)
into
if foo_dep.found()
subdir('foo')
endif
This means we can have the full tree available, and use dead code elimination to get rid of it if we don't need it.
for arrays this is more complicated, as meson doesn't have an all(), I could, however have an all() implementation in my AST level code, and have HIR deal with that, or I could reduce it to something like:
use = true
foreach d : foo_deps
if not d.found()
use = false
break
endif
endforeach
if use
subdir('foo')
endif
Which is advantageous because the subdir() can be lowered away in the AST leve, but the if use would be resolved in the MIR level.
I'd like to handle all subdir() invocations in the frontend, and have a complete tree for the MIR level, I think the best thing to do is have a pass that converts
into
This means we can have the full tree available, and use dead code elimination to get rid of it if we don't need it.
for arrays this is more complicated, as meson doesn't have an
all()
, I could, however have anall()
implementation in my AST level code, and have HIR deal with that, or I could reduce it to something like:Which is advantageous because the subdir() can be lowered away in the AST leve, but the
if use
would be resolved in the MIR level.