Is there a way to get a SILValue from an Expr or Stmt? Maybe via a SILLocation? I am trying to create a call to a function from SILGenPattern. I am using lookupInSwiftModule
to get the function declaration, but I cannot figure out how to create a call to the function with only the Expr pointer I have access to.
I don't know a lot about SIL, but I think you need to call SILGenFunction::emitApplyMethod
to emit a function call.
Thanks! Trying that now.
@suyashsrijan I played with that for a while but it seems to only work for methods. I could not generator a call to a function outside of a class/struct (no self). Any other ideas? Seems like there should be a similar function to emit a more general function call. Thanks for the help.
I was able to use createApply
to apply the function and emitRValueAsSingleValue
to get SILValues.