mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
compiler: add the //go:noinline pragma
This is directly useful to avoid some unsafety around runtime.alloc and should be useful in general. This pragma has the same form as in the main Go compiler: https://github.com/golang/go/issues/12312
This commit is contained in:
committed by
Ron Evans
parent
c66d979ba3
commit
7ed6b45149
@@ -56,6 +56,10 @@ const (
|
||||
// //go:inline). The compiler will be more likely to inline this function,
|
||||
// but it is not a guarantee.
|
||||
InlineHint
|
||||
|
||||
// Don't inline, just like the GCC noinline attribute. Signalled using
|
||||
// //go:noinline.
|
||||
InlineNone
|
||||
)
|
||||
|
||||
// Create and initialize a new *Program from a *ssa.Program.
|
||||
@@ -227,6 +231,8 @@ func (f *Function) parsePragmas() {
|
||||
f.exported = true
|
||||
case "//go:inline":
|
||||
f.inline = InlineHint
|
||||
case "//go:noinline":
|
||||
f.inline = InlineNone
|
||||
case "//go:interrupt":
|
||||
if len(parts) != 2 {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user