i've read some papers said that he changed the go source file to llvm ir using llgo.
but i found that llgo is not maintained .
i follow its instruction steps and build the gollvm and llvm-goc successfully.
But something confuse me that is i can not import external package while using llvm-goc to dump llvm ir.
For example, i've tried dump the code below to llvm-ir,
===
package main
import (
"fmt"
"test/testg"
)
func add(x, y int) int {
return x + y
}
func main() {
var c = testg.Color{}
a := 5000
//b := 4
fmt.Println(add(a, c.C))
}
===
But llvm-goc returns errors:
===
./main.go:5:15: error: import file 'test/testg' not found
./main.go:14:24: error: expected ';' or '}' or newline
./main.go:15:5: error: expected declaration
./main.go:17:5: error: expected declaration
./main.go:18:1: error: expected declaration
./main.go:14:13: error: reference to undefined name 'testg'
===
I wonder whether the llvm-goc can use external packages? Or is there anyway to dump llvm-ir from go source file ?