mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
all: move bootstrapping IR to Go runtime
This has the benefit of not requiring a 'runtime' IR file, so that complete relocatable files can be built without requiring input IR. This makes the compiler a lot easier to use without the Makefile. Code size is not affected.
This commit is contained in:
@@ -35,7 +35,8 @@ type Program struct {
|
||||
type Function struct {
|
||||
fn *ssa.Function
|
||||
llvmFn llvm.Value
|
||||
linkName string // go:linkname pragma
|
||||
linkName string // go:linkname or go:export pragma
|
||||
exported bool // go:export
|
||||
nobounds bool // go:nobounds pragma
|
||||
blocking bool // calculated by AnalyseBlockingRecursive
|
||||
flag bool // used by dead code elimination
|
||||
@@ -178,11 +179,22 @@ func (f *Function) parsePragmas() {
|
||||
if hasUnsafeImport(f.fn.Pkg.Pkg) {
|
||||
f.nobounds = true
|
||||
}
|
||||
case "//go:export":
|
||||
if len(parts) != 2 {
|
||||
continue
|
||||
}
|
||||
f.linkName = parts[1]
|
||||
f.exported = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return true iff this function is externally visible.
|
||||
func (f *Function) IsExported() bool {
|
||||
return f.exported
|
||||
}
|
||||
|
||||
// Return the link name for this function.
|
||||
func (f *Function) LinkName() string {
|
||||
if f.linkName != "" {
|
||||
|
||||
Reference in New Issue
Block a user