Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _lldb/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export LLDB_PATH

# Default package path
export DEFAULT_PACKAGE_PATH="./_lldb/lldbtest"
export LLDB_TEST_OPTLEVEL="${LLDB_TEST_OPTLEVEL:--O0}"

# Function to build the project
build_project() {
Expand All @@ -44,7 +45,7 @@ build_project() {
return 1
fi

LLGO_DEBUG_SYMBOLS=1 llgo build -o "debug.out" . || {
LLGO_DEBUG_SYMBOLS=1 llgo build "${LLDB_TEST_OPTLEVEL}" -o "debug.out" . || {
local ret=$?
cd "$current_dir" || return
return $ret
Expand Down
8 changes: 6 additions & 2 deletions cl/_testdata/apkg/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ source_filename = "github.com/goplus/llgo/cl/_testdata/apkg"

@"github.com/goplus/llgo/cl/_testdata/apkg.init$guard" = global i1 false, align 1

define double @"github.com/goplus/llgo/cl/_testdata/apkg.Max"(double %0, double %1) {
; Function Attrs: null_pointer_is_valid
define double @"github.com/goplus/llgo/cl/_testdata/apkg.Max"(double %0, double %1) #0 {
_llgo_0:
%2 = fcmp ogt double %0, %1
br i1 %2, label %_llgo_1, label %_llgo_2
Expand All @@ -15,7 +16,8 @@ _llgo_2: ; preds = %_llgo_0
ret double %1
}

define void @"github.com/goplus/llgo/cl/_testdata/apkg.init"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/apkg.init"() #0 {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testdata/apkg.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
Expand All @@ -27,3 +29,5 @@ _llgo_1: ; preds = %_llgo_0
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

attributes #0 = { null_pointer_is_valid }
14 changes: 10 additions & 4 deletions cl/_testdata/cpkg/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,29 @@ source_filename = "github.com/goplus/llgo/cl/_testdata/cpkg"
@"github.com/goplus/llgo/cl/_testdata/cpkg.init$guard" = global i1 false, align 1
@llvm.compiler.used = appending global [2 x ptr] [ptr @Double, ptr @add], section "llvm.metadata"

define double @Double(double %0) {
; Function Attrs: null_pointer_is_valid
define double @Double(double %0) #0 {
_llgo_0:
%1 = fmul double 2.000000e+00, %0
ret double %1
}

define i64 @add(i64 %0, i64 %1) {
; Function Attrs: null_pointer_is_valid
define i64 @add(i64 %0, i64 %1) #0 {
_llgo_0:
%2 = call i64 @"github.com/goplus/llgo/cl/_testdata/cpkg.add"(i64 %0, i64 %1)
ret i64 %2
}

define i64 @"github.com/goplus/llgo/cl/_testdata/cpkg.add"(i64 %0, i64 %1) {
; Function Attrs: null_pointer_is_valid
define i64 @"github.com/goplus/llgo/cl/_testdata/cpkg.add"(i64 %0, i64 %1) #0 {
_llgo_0:
%2 = add i64 %0, %1
ret i64 %2
}

define void @"github.com/goplus/llgo/cl/_testdata/cpkg.init"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/cpkg.init"() #0 {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testdata/cpkg.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
Expand All @@ -34,3 +38,5 @@ _llgo_1: ; preds = %_llgo_0
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

attributes #0 = { null_pointer_is_valid }
26 changes: 18 additions & 8 deletions cl/_testdata/cpkgimp/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ source_filename = "github.com/goplus/llgo/cl/_testdata/cpkgimp"

@"github.com/goplus/llgo/cl/_testdata/cpkgimp.init$guard" = global i1 false, align 1

define void @"github.com/goplus/llgo/cl/_testdata/cpkgimp.init"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/cpkgimp.init"() #0 {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testdata/cpkgimp.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
Expand All @@ -17,7 +18,8 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

define void @"github.com/goplus/llgo/cl/_testdata/cpkgimp.main"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/cpkgimp.main"() #0 {
_llgo_0:
%0 = call i64 @add(i64 1, i64 2)
%1 = call double @Double(double 3.140000e+00)
Expand All @@ -28,14 +30,22 @@ _llgo_0:
ret void
}

declare void @"github.com/goplus/llgo/cl/_testdata/cpkg.init"()
; Function Attrs: null_pointer_is_valid
declare void @"github.com/goplus/llgo/cl/_testdata/cpkg.init"() #0

declare i64 @add(i64, i64)
; Function Attrs: null_pointer_is_valid
declare i64 @add(i64, i64) #0

declare double @Double(double)
; Function Attrs: null_pointer_is_valid
declare double @Double(double) #0

declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
; Function Attrs: null_pointer_is_valid
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64) #0

declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
; Function Attrs: null_pointer_is_valid
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8) #0

declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double)
; Function Attrs: null_pointer_is_valid
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double) #0

attributes #0 = { null_pointer_is_valid }
23 changes: 16 additions & 7 deletions cl/_testdata/embedunexport/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,33 @@ source_filename = "github.com/goplus/llgo/cl/_testdata/embedunexport"
@"github.com/goplus/llgo/cl/_testdata/embedunexport.init$guard" = global i1 false, align 1
@0 = private unnamed_addr constant [8 x i8] c"modified", align 1

define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testdata/embedunexport.(*Base).Name"(ptr %0) {
; Function Attrs: null_pointer_is_valid
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testdata/embedunexport.(*Base).Name"(ptr %0) #0 {
_llgo_0:
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testdata/embedunexport.Base", ptr %0, i32 0, i32 0
%2 = load %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr %1, align 8
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" %2
}

define void @"github.com/goplus/llgo/cl/_testdata/embedunexport.(*Base).setName"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.String" %1) {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/embedunexport.(*Base).setName"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.String" %1) #0 {
_llgo_0:
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testdata/embedunexport.Base", ptr %0, i32 0, i32 0
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %1, ptr %2, align 8
ret void
}

define ptr @"github.com/goplus/llgo/cl/_testdata/embedunexport.NewBase"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %0) {
; Function Attrs: null_pointer_is_valid
define ptr @"github.com/goplus/llgo/cl/_testdata/embedunexport.NewBase"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %0) #0 {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testdata/embedunexport.Base", ptr %1, i32 0, i32 0
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %0, ptr %2, align 8
ret ptr %1
}

define void @"github.com/goplus/llgo/cl/_testdata/embedunexport.Use"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %0) {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/embedunexport.Use"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %0) #0 {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %0)
%2 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %0, 0
Expand All @@ -44,7 +48,8 @@ _llgo_0:
ret void
}

define void @"github.com/goplus/llgo/cl/_testdata/embedunexport.init"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/embedunexport.init"() #0 {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testdata/embedunexport.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
Expand All @@ -57,6 +62,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
; Function Attrs: null_pointer_is_valid
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64) #0

declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
; Function Attrs: null_pointer_is_valid
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface") #0

attributes #0 = { null_pointer_is_valid }
11 changes: 8 additions & 3 deletions cl/_testdata/fncall/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ source_filename = "github.com/goplus/llgo/cl/_testdata/fncall"

@"github.com/goplus/llgo/cl/_testdata/fncall.init$guard" = global i1 false, align 1

define void @"github.com/goplus/llgo/cl/_testdata/fncall.init"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/fncall.init"() #0 {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testdata/fncall.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
Expand All @@ -16,13 +17,15 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

define void @"github.com/goplus/llgo/cl/_testdata/fncall.main"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/fncall.main"() #0 {
_llgo_0:
%0 = call i64 @"github.com/goplus/llgo/cl/_testdata/fncall.max"(i64 1, i64 2)
ret void
}

define i64 @"github.com/goplus/llgo/cl/_testdata/fncall.max"(i64 %0, i64 %1) {
; Function Attrs: null_pointer_is_valid
define i64 @"github.com/goplus/llgo/cl/_testdata/fncall.max"(i64 %0, i64 %1) #0 {
_llgo_0:
%2 = icmp sgt i64 %0, %1
br i1 %2, label %_llgo_1, label %_llgo_2
Expand All @@ -33,3 +36,5 @@ _llgo_1: ; preds = %_llgo_0
_llgo_2: ; preds = %_llgo_0
ret i64 %1
}

attributes #0 = { null_pointer_is_valid }
41 changes: 27 additions & 14 deletions cl/_testdata/foo/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ source_filename = "github.com/goplus/llgo/cl/_testdata/foo"
@"github.com/goplus/llgo/cl/_testdata/foo.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88$fields" = weak_odr constant [1 x %"github.com/goplus/llgo/runtime/abi.StructField"] [%"github.com/goplus/llgo/runtime/abi.StructField" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 1 }, ptr @_llgo_int, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false }], align 8
@6 = private unnamed_addr constant [4 x i8] c"load", align 1

define %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.Bar"() {
; Function Attrs: null_pointer_is_valid
define %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.Bar"() #0 {
_llgo_0:
%0 = alloca { i64 }, align 8
call void @llvm.memset(ptr %0, i8 0, i64 8, i1 false)
Expand All @@ -40,7 +41,8 @@ _llgo_0:
ret %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5
}

define %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.F"() {
; Function Attrs: null_pointer_is_valid
define %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.F"() #0 {
_llgo_0:
%0 = alloca { i64 }, align 8
call void @llvm.memset(ptr %0, i8 0, i64 8, i1 false)
Expand All @@ -53,7 +55,8 @@ _llgo_0:
ret %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5
}

define ptr @"github.com/goplus/llgo/cl/_testdata/foo.Foo.Pb"(%"github.com/goplus/llgo/cl/_testdata/foo.Foo" %0) {
; Function Attrs: null_pointer_is_valid
define ptr @"github.com/goplus/llgo/cl/_testdata/foo.Foo.Pb"(%"github.com/goplus/llgo/cl/_testdata/foo.Foo" %0) #0 {
_llgo_0:
%1 = alloca %"github.com/goplus/llgo/cl/_testdata/foo.Foo", align 8
call void @llvm.memset(ptr %1, i8 0, i64 16, i1 false)
Expand All @@ -63,26 +66,30 @@ _llgo_0:
ret ptr %3
}

define ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Foo).Pb"(ptr %0) {
; Function Attrs: null_pointer_is_valid
define ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Foo).Pb"(ptr %0) #0 {
_llgo_0:
%1 = load %"github.com/goplus/llgo/cl/_testdata/foo.Foo", ptr %0, align 8
%2 = call ptr @"github.com/goplus/llgo/cl/_testdata/foo.Foo.Pb"(%"github.com/goplus/llgo/cl/_testdata/foo.Foo" %1)
ret ptr %2
}

define void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load"(ptr %0) {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load"(ptr %0) #0 {
_llgo_0:
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 4 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
ret void
}

define void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame"(ptr %0) {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame"(ptr %0) #0 {
_llgo_0:
ret void
}

define void @"github.com/goplus/llgo/cl/_testdata/foo.init"() {
; Function Attrs: null_pointer_is_valid
define void @"github.com/goplus/llgo/cl/_testdata/foo.init"() #0 {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testdata/foo.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
Expand All @@ -96,28 +103,34 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #1

declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.structequal"(ptr, ptr, ptr)
; Function Attrs: null_pointer_is_valid
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.structequal"(ptr, ptr, ptr) #0

declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.memequalptr"(ptr, ptr)
; Function Attrs: null_pointer_is_valid
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.memequalptr"(ptr, ptr) #0

define linkonce i1 @"__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr"(ptr %0, ptr %1, ptr %2) {
_llgo_0:
%3 = tail call i1 @"github.com/goplus/llgo/runtime/internal/runtime.memequalptr"(ptr %1, ptr %2)
ret i1 %3
}

declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.memequal64"(ptr, ptr)
; Function Attrs: null_pointer_is_valid
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.memequal64"(ptr, ptr) #0

define linkonce i1 @"__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequal64"(ptr %0, ptr %1, ptr %2) {
_llgo_0:
%3 = tail call i1 @"github.com/goplus/llgo/runtime/internal/runtime.memequal64"(ptr %1, ptr %2)
ret i1 %3
}

declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
; Function Attrs: null_pointer_is_valid
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String") #0

declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
; Function Attrs: null_pointer_is_valid
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8) #0

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #0 = { null_pointer_is_valid }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
Loading
Loading