mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.simd] cmd/compile: generate function body for bodyless intrinsics
For a compiler intrinsic, if it is used in a non-call context, e.g. as a function pointer, currently it requires fallback implementation (e.g. assembly code for atomic operations), otherwise it will result in a build failure. The fallback implementation needs to be maintained and tested, albeit rarely used in practice. Also, for SIMD, we're currently adding a large number of compiler intrinsics without providing fallback implementations (we might in the future). As methods, it is not unlikely that they are used in a non-call context, e.g. referenced from the type descriptor. This CL lets the compiler generate the function body for bodyless intrinsics. The compiler already recognizes a call to the function as an intrinsic and can directly generate code for it. So we just fill in the body with a call to the same function. Change-Id: I2636e3128f28301c9abaf2b48bc962ab56e7d1a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/683096 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
a8669c78f5
commit
88c013d6ff
5 changed files with 110 additions and 17 deletions
|
|
@ -1022,6 +1022,9 @@ func StaticCalleeName(n Node) *Name {
|
|||
// IsIntrinsicCall reports whether the compiler back end will treat the call as an intrinsic operation.
|
||||
var IsIntrinsicCall = func(*CallExpr) bool { return false }
|
||||
|
||||
// IsIntrinsicSym reports whether the compiler back end will treat a call to this symbol as an intrinsic operation.
|
||||
var IsIntrinsicSym = func(*types.Sym) bool { return false }
|
||||
|
||||
// SameSafeExpr checks whether it is safe to reuse one of l and r
|
||||
// instead of computing both. SameSafeExpr assumes that l and r are
|
||||
// used in the same statement or expression. In order for it to be
|
||||
|
|
@ -1140,6 +1143,14 @@ func ParamNames(ft *types.Type) []Node {
|
|||
return args
|
||||
}
|
||||
|
||||
func RecvParamNames(ft *types.Type) []Node {
|
||||
args := make([]Node, ft.NumRecvs()+ft.NumParams())
|
||||
for i, f := range ft.RecvParams() {
|
||||
args[i] = f.Nname.(*Name)
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
// MethodSym returns the method symbol representing a method name
|
||||
// associated with a specific receiver type.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue