[swift-dev] Create SILType from GenericTypeParamType

Slava Pestov spestov at apple.com
Mon Dec 11 16:40:19 CST 2017


There are two things that need to happen here, first the generic type parameter needs to be substituted with a concrete type, then it needs to be “lowered” to a SIL type.

You can try something like this,

GenericTypeParamType *paramTy = …;
SILFunction *F = …;
SILType T = F->getModule().Types.getLoweredType(F->mapTypeIntoContext(paramTy));

But we would need more details to understand what you’re doing.

Slava

> On Dec 11, 2017, at 2:30 PM, Raj Barik via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi,
> 
> I am trying to create a new generic function in the Swift compiler (as part of a pass). Although I am able to create the generic function signature fairly easily, I do not find an easy way to create a SILType from a GenericTypeParamType, which is needed to be passed to createFunctionArgument. Any help/suggestion?
> 
> Best,
> Raj
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev



More information about the swift-dev mailing list