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@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to