[swift-dev] High-level SIL Optimization: How do I get a FuncRef from the stdlib?

Ben Ng me at benng.me
Tue Nov 15 19:17:24 CST 2016


Good evening, folks.

I’ve been working on a high-level SIL optimization pass that replaces an application of the `+=` function with an application of `Array.concat(A: Element)`. I’m blocked because I can’t figure out how to get a FuncRef to `Array.append` from the SILTransform.

I’ve tried getting the stdlib module from the ASTContext, and looking through the visible decls, but the function that I want isn’t there. The next thing I was going to try was recursively looking through the imports, but I thought I’d stop to do a sanity check with the mailing list.

It seems like even if I did succeed in getting a FuncRef to the generic `Array.append`, I’d still need to figure out how to get the specialized version, and add the appropriate declaration to the SIL. It also feels wrong that I’m depending on stuff in the AST from a SILTransform.

Thanks,

Ben


More information about the swift-dev mailing list