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.
Adds some constructors and moves the code to the header file. Uses some of the new constructors.
A big problem with the source are the different strategies used for otherwise similar classes.
E.g. a IrField registers itself with the VarDeclaration. Same is required for IrParameter, but
in this case it is done by the caller.