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

Michael Gottesman mgottesman at apple.com
Tue Nov 15 23:03:58 CST 2016



> On Nov 15, 2016, at 9:02 PM, Ben Ng <me at benng.me> wrote:
> 
> Hi Michael,
> 
> No, I did not. I don't see swift-dev in the cc line of your email... this might be an issue with the Inbox for iOS client that I'm using.

Ok! This happens sometimes (hit reply instead of reply-all or the like). +CC swift-dev.

> On Wed, Nov 16, 2016 at 12:01 AM Michael Gottesman <mgottesman at apple.com <mailto:mgottesman at apple.com>> wrote:
>> On Nov 15, 2016, at 8:54 PM, Ben Ng <me at benng.me <mailto:me at benng.me>> wrote:
>> 
>> Hi Michael,
>> 
>> It can probably be stuck in the Array Value Propagation pass since its pretty similar. Yes, it uses Array semantics. I isolated it in a separate file because it's my first time working on the Swift compiler and I wanted to keep the moving parts to a minimum.
> 
> Ok. I was just saying this transformation is small enough it probably makes sense not to have a pass just for it. That is all.
> 
>> 
>> Am I confusing the nouns? i.e Is a pass the same thing as a transform?
> 
> No you are not confusing anything. A pass is a transform. 
> 
> Also, did you remove swift-dev for a reason? Can I re-add?
> 
> Michael
> 
>> 
>> On Tue, Nov 15, 2016 at 11:49 PM Michael Gottesman <mgottesman at apple.com <mailto:mgottesman at apple.com>> wrote:
>> Question, is there any reason why you want to create a new pass? We already have array semantic ops. Maybe stick this there?
>> 
>> +CC Arnold who is more familiar with this area.
>> 
>> Sent from my iPhone
>> 
>> > On Nov 15, 2016, at 5:17 PM, Ben Ng via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
>> >
>> > 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
>> > _______________________________________________
>> > swift-dev mailing list
>> > swift-dev at swift.org <mailto:swift-dev at swift.org>
>> > https://lists.swift.org/mailman/listinfo/swift-dev <https://lists.swift.org/mailman/listinfo/swift-dev>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161115/b7e6005c/attachment.html>


More information about the swift-dev mailing list