github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/inline/inlheur/testdata/props/acrosscall.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // DO NOT EDIT (use 'go test -v -update-expected' instead.)
     6  // See github.com/go-asm/go/cmd/compile/inline/inlheur/testdata/props/README.txt
     7  // for more information on the format of this file.
     8  // <endfilepreamble>
     9  package params
    10  
    11  // acrosscall.go T_feeds_indirect_call_via_call_toplevel 19 0 1
    12  // ParamFlags
    13  //   0 ParamFeedsIndirectCall
    14  // <endpropsdump>
    15  // {"Flags":0,"ParamFlags":[8],"ResultFlags":null}
    16  // callsite: acrosscall.go:20:12|0 flagstr "" flagval 0 score 60 mask 0 maskstr ""
    17  // <endcallsites>
    18  // <endfuncpreamble>
    19  func T_feeds_indirect_call_via_call_toplevel(f func(int)) {
    20  	callsparam(f)
    21  }
    22  
    23  // acrosscall.go T_feeds_indirect_call_via_call_conditional 31 0 1
    24  // ParamFlags
    25  //   0 ParamMayFeedIndirectCall
    26  // <endpropsdump>
    27  // {"Flags":0,"ParamFlags":[16],"ResultFlags":null}
    28  // callsite: acrosscall.go:33:13|0 flagstr "" flagval 0 score 60 mask 0 maskstr ""
    29  // <endcallsites>
    30  // <endfuncpreamble>
    31  func T_feeds_indirect_call_via_call_conditional(f func(int)) {
    32  	if G != 101 {
    33  		callsparam(f)
    34  	}
    35  }
    36  
    37  // acrosscall.go T_feeds_conditional_indirect_call_via_call_toplevel 45 0 1
    38  // ParamFlags
    39  //   0 ParamMayFeedIndirectCall
    40  // <endpropsdump>
    41  // {"Flags":0,"ParamFlags":[16],"ResultFlags":null}
    42  // callsite: acrosscall.go:46:23|0 flagstr "" flagval 0 score 64 mask 0 maskstr ""
    43  // <endcallsites>
    44  // <endfuncpreamble>
    45  func T_feeds_conditional_indirect_call_via_call_toplevel(f func(int)) {
    46  	callsparamconditional(f)
    47  }
    48  
    49  // acrosscall.go T_feeds_if_via_call 57 0 1
    50  // ParamFlags
    51  //   0 ParamFeedsIfOrSwitch
    52  // <endpropsdump>
    53  // {"Flags":0,"ParamFlags":[32],"ResultFlags":null}
    54  // callsite: acrosscall.go:58:9|0 flagstr "" flagval 0 score 8 mask 0 maskstr ""
    55  // <endcallsites>
    56  // <endfuncpreamble>
    57  func T_feeds_if_via_call(x int) {
    58  	feedsif(x)
    59  }
    60  
    61  // acrosscall.go T_feeds_if_via_call_conditional 69 0 1
    62  // ParamFlags
    63  //   0 ParamMayFeedIfOrSwitch
    64  // <endpropsdump>
    65  // {"Flags":0,"ParamFlags":[64],"ResultFlags":null}
    66  // callsite: acrosscall.go:71:10|0 flagstr "" flagval 0 score 8 mask 0 maskstr ""
    67  // <endcallsites>
    68  // <endfuncpreamble>
    69  func T_feeds_if_via_call_conditional(x int) {
    70  	if G != 101 {
    71  		feedsif(x)
    72  	}
    73  }
    74  
    75  // acrosscall.go T_feeds_conditional_if_via_call 83 0 1
    76  // ParamFlags
    77  //   0 ParamMayFeedIfOrSwitch
    78  // <endpropsdump>
    79  // {"Flags":0,"ParamFlags":[64],"ResultFlags":null}
    80  // callsite: acrosscall.go:84:20|0 flagstr "" flagval 0 score 12 mask 0 maskstr ""
    81  // <endcallsites>
    82  // <endfuncpreamble>
    83  func T_feeds_conditional_if_via_call(x int) {
    84  	feedsifconditional(x)
    85  }
    86  
    87  // acrosscall.go T_multifeeds1 97 0 1
    88  // ParamFlags
    89  //   0 ParamFeedsIndirectCall|ParamMayFeedIndirectCall
    90  //   1 ParamNoInfo
    91  // <endpropsdump>
    92  // {"Flags":0,"ParamFlags":[24,0],"ResultFlags":null}
    93  // callsite: acrosscall.go:98:12|0 flagstr "" flagval 0 score 60 mask 0 maskstr ""
    94  // callsite: acrosscall.go:99:23|1 flagstr "" flagval 0 score 64 mask 0 maskstr ""
    95  // <endcallsites>
    96  // <endfuncpreamble>
    97  func T_multifeeds1(f1, f2 func(int)) {
    98  	callsparam(f1)
    99  	callsparamconditional(f1)
   100  }
   101  
   102  // acrosscall.go T_acrosscall_returnsconstant 110 0 1
   103  // ResultFlags
   104  //   0 ResultAlwaysSameConstant
   105  // <endpropsdump>
   106  // {"Flags":0,"ParamFlags":null,"ResultFlags":[8]}
   107  // callsite: acrosscall.go:111:24|0 flagstr "" flagval 0 score 2 mask 0 maskstr ""
   108  // <endcallsites>
   109  // <endfuncpreamble>
   110  func T_acrosscall_returnsconstant() int {
   111  	return returnsconstant()
   112  }
   113  
   114  // acrosscall.go T_acrosscall_returnsmem 122 0 1
   115  // ResultFlags
   116  //   0 ResultIsAllocatedMem
   117  // <endpropsdump>
   118  // {"Flags":0,"ParamFlags":null,"ResultFlags":[2]}
   119  // callsite: acrosscall.go:123:19|0 flagstr "" flagval 0 score 2 mask 0 maskstr ""
   120  // <endcallsites>
   121  // <endfuncpreamble>
   122  func T_acrosscall_returnsmem() *int {
   123  	return returnsmem()
   124  }
   125  
   126  // acrosscall.go T_acrosscall_returnscci 134 0 1
   127  // ResultFlags
   128  //   0 ResultIsConcreteTypeConvertedToInterface
   129  // <endpropsdump>
   130  // {"Flags":0,"ParamFlags":null,"ResultFlags":[4]}
   131  // callsite: acrosscall.go:135:19|0 flagstr "" flagval 0 score 7 mask 0 maskstr ""
   132  // <endcallsites>
   133  // <endfuncpreamble>
   134  func T_acrosscall_returnscci() I {
   135  	return returnscci()
   136  }
   137  
   138  // acrosscall.go T_acrosscall_multiret 144 0 1
   139  // <endpropsdump>
   140  // {"Flags":0,"ParamFlags":[0],"ResultFlags":[0]}
   141  // callsite: acrosscall.go:146:25|0 flagstr "" flagval 0 score 2 mask 0 maskstr ""
   142  // <endcallsites>
   143  // <endfuncpreamble>
   144  func T_acrosscall_multiret(q int) int {
   145  	if q != G {
   146  		return returnsconstant()
   147  	}
   148  	return 0
   149  }
   150  
   151  // acrosscall.go T_acrosscall_multiret2 158 0 1
   152  // <endpropsdump>
   153  // {"Flags":0,"ParamFlags":[0],"ResultFlags":[0]}
   154  // callsite: acrosscall.go:160:25|0 flagstr "" flagval 0 score 2 mask 0 maskstr ""
   155  // callsite: acrosscall.go:162:25|1 flagstr "" flagval 0 score 2 mask 0 maskstr ""
   156  // <endcallsites>
   157  // <endfuncpreamble>
   158  func T_acrosscall_multiret2(q int) int {
   159  	if q == G {
   160  		return returnsconstant()
   161  	} else {
   162  		return returnsconstant()
   163  	}
   164  }
   165  
   166  func callsparam(f func(int)) {
   167  	f(2)
   168  }
   169  
   170  func callsparamconditional(f func(int)) {
   171  	if G != 101 {
   172  		f(2)
   173  	}
   174  }
   175  
   176  func feedsif(x int) int {
   177  	if x != 101 {
   178  		return 42
   179  	}
   180  	return 43
   181  }
   182  
   183  func feedsifconditional(x int) int {
   184  	if G != 101 {
   185  		if x != 101 {
   186  			return 42
   187  		}
   188  	}
   189  	return 43
   190  }
   191  
   192  func returnsconstant() int {
   193  	return 42
   194  }
   195  
   196  func returnsmem() *int {
   197  	return new(int)
   198  }
   199  
   200  func returnscci() I {
   201  	var q Q
   202  	return q
   203  }
   204  
   205  type I interface {
   206  	Foo()
   207  }
   208  
   209  type Q int
   210  
   211  func (q Q) Foo() {
   212  }
   213  
   214  var G int