Turns out that since the change to use DMD's symbol emission
logic a few releases back we didn't actually ever emit code
for the extra modules. Thus, all the effort for the extra
semantic passes went to waste.
If we want to implement DMD-style cross-module inlining, we
need to add the extra semantic3s back in, and then iterate
over all the non-root modules with a codegen visitor that
only emits symbols as available_externally.
We probably won't need the availableExternally members if
we start with a clean design in the new symbol emission
framework. Thus, remove everything in the meantime. This
will make some release builds a bit faster, and should not
negatively affect generated code.
This finally fixes the performance regression due to missing
inlining after the switch to the DMD-style symbol emission
logic (what later became FuncDeclaration::needsCodegen).
In my tests, this slightly increased compile times in release
mode (~7% for a set of small-ish programs) due to the extra
codegen. The impact is that small because we were doing all the
extra semantic{2, 3}s anyway (only to throw their results away)
and still get to avoid the LLVM backend. The performance gains
are, depending on the benchmark, spectacular, as this was
responsible for things like std.array.front not getting inlined.
If the mangled name is viewed as the name emitted into IR code then the mangled name of an intrinsic is the intrinsic's name.
The name is unique because of the `llvm.` prefix. The only point is that overloaded intrinsics must be resolved earlier.
This commit moves the resolution of oveloaded intrinsics into the semantic analysis pass. The
Otherwise, we may end up with a wrong enclosing statement. It could
happen if a try-finally is rewritten as a try-catch (see NrvoWalker).
In this case, enclosingScopeExit will still point to the old unused
try-finally.
The performance impact should be completely immeasurable,
but the main benefit is that this makes IR dumps slightly
nicer to look at (as the redundant "empty:" labels are
now omitted entirely).
If the comment about this function is still right (can be called recursively) then the assignment
to irFty should be done after all functions are called.
Takes advantage of move assignment, too.