cl: builtin llgo tag

This commit is contained in:
Li Jie
2024-09-04 10:07:22 +08:00
parent 3ce9567f62
commit e9aaf8e0af
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) {
flags, patterns, verbose := ParseArgs(args, buildFlags)
flags = append(flags, "-tags", "llgo")
cfg := &packages.Config{
Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile,
BuildFlags: flags,