@@ -1856,15 +1856,7 @@ func (b *builder) createBuiltin(argTypes []types.Type, argValues []llvm.Value, c
18561856//
18571857// This is also where compiler intrinsics are implemented.
18581858func (b * builder ) createFunctionCall (instr * ssa.CallCommon ) (llvm.Value , error ) {
1859- var params []llvm.Value
1860- for _ , param := range instr .Args {
1861- params = append (params , b .getValue (param , getPos (instr )))
1862- }
1863-
1864- // Try to call the function directly for trivially static calls.
1865- var callee , context llvm.Value
1866- var calleeType llvm.Type
1867- exported := false
1859+ // See if this is an intrinsic function that is handled specially.
18681860 if fn := instr .StaticCallee (); fn != nil {
18691861 // Direct function call, either to a named or anonymous (directly
18701862 // applied) function call. If it is anonymous, it may be a closure.
@@ -1900,13 +1892,27 @@ func (b *builder) createFunctionCall(instr *ssa.CallCommon) (llvm.Value, error)
19001892 return llvm .ConstInt (b .ctx .Int8Type (), panicStrategy , false ), nil
19011893 case name == "runtime/interrupt.New" :
19021894 return b .createInterruptGlobal (instr )
1895+ case name == "runtime.exportedFuncPtr" :
1896+ _ , ptr := b .getFunction (instr .Args [0 ].(* ssa.Function ))
1897+ return b .CreatePtrToInt (ptr , b .uintptrType , "" ), nil
19031898 case name == "internal/abi.FuncPCABI0" :
19041899 retval := b .createDarwinFuncPCABI0Call (instr )
19051900 if ! retval .IsNil () {
19061901 return retval , nil
19071902 }
19081903 }
1904+ }
19091905
1906+ var params []llvm.Value
1907+ for _ , param := range instr .Args {
1908+ params = append (params , b .getValue (param , getPos (instr )))
1909+ }
1910+
1911+ // Try to call the function directly for trivially static calls.
1912+ var callee , context llvm.Value
1913+ var calleeType llvm.Type
1914+ exported := false
1915+ if fn := instr .StaticCallee (); fn != nil {
19101916 calleeType , callee = b .getFunction (fn )
19111917 info := b .getFunctionInfo (fn )
19121918 if callee .IsNil () {
0 commit comments