Merge pull request #765 from cpunion/builtin-llgo-tag

cl: builtin llgo tag
This commit is contained in:
xushiwei
2024-09-05 08:32:06 +08:00
committed by GitHub
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
//go:build llgo
// +build llgo
package llgotag
func Foo() {
}

View File

@@ -0,0 +1,22 @@
; ModuleID = 'llgotag'
source_filename = "llgotag"
@"llgotag.init$guard" = global i1 false, align 1
define void @llgotag.Foo() {
_llgo_0:
ret void
}
define void @llgotag.init() {
_llgo_0:
%0 = load i1, ptr @"llgotag.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"llgotag.init$guard", align 1
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

View File

@@ -121,6 +121,7 @@ const (
func Do(args []string, conf *Config) { func Do(args []string, conf *Config) {
flags, patterns, verbose := ParseArgs(args, buildFlags) flags, patterns, verbose := ParseArgs(args, buildFlags)
flags = append(flags, "-tags", "llgo")
cfg := &packages.Config{ cfg := &packages.Config{
Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile, Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile,
BuildFlags: flags, BuildFlags: flags,