@@ -1856,15 +1856,7 @@ func (b *builder) createBuiltin(argTypes []types.Type, argValues []llvm.Value, c
1856
1856
//
1857
1857
// This is also where compiler intrinsics are implemented.
1858
1858
func (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.
1868
1860
if fn := instr .StaticCallee (); fn != nil {
1869
1861
// Direct function call, either to a named or anonymous (directly
1870
1862
// 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)
1900
1892
return llvm .ConstInt (b .ctx .Int8Type (), panicStrategy , false ), nil
1901
1893
case name == "runtime/interrupt.New" :
1902
1894
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
1903
1898
case name == "internal/abi.FuncPCABI0" :
1904
1899
retval := b .createDarwinFuncPCABI0Call (instr )
1905
1900
if ! retval .IsNil () {
1906
1901
return retval , nil
1907
1902
}
1908
1903
}
1904
+ }
1909
1905
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 {
1910
1916
calleeType , callee = b .getFunction (fn )
1911
1917
info := b .getFunctionInfo (fn )
1912
1918
if callee .IsNil () {
0 commit comments