Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 31d4d78

Browse files
committed
Move to upstream LLVM bindings
1 parent 56a3c30 commit 31d4d78

25 files changed

+38
-41
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ before_install:
1010
- sudo $APT_GET install mercurial git subversion cmake gcc-4.8 g++-4.8
1111
- export CXX=g++-4.8 CC=gcc-4.8
1212
install:
13-
- go get -d github.com/go-llvm/llvm
14-
- $(go list -f '{{.Dir}}' github.com/go-llvm/llvm)/update_llvm.sh -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host
13+
- go get -d llvm.org/llvm/bindings/go/llvm
14+
- $(go list -f '{{.Dir}}' llvm.org/llvm/bindings/go/llvm)/../build.sh -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host
1515
- make install prefix=`pwd`/.install
1616
script:
1717
- make check-llgo check-libgo

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
j = 1
22
prefix = /usr/local
33
bootstrap = quick
4-
gollvmdir = $(shell go list -f '{{.Dir}}' github.com/go-llvm/llvm)
4+
gollvmdir = $(shell go list -f '{{.Dir}}' llvm.org/llvm/bindings/go/llvm)
55
llvmdir = $(gollvmdir)/workdir/llvm_build
66

77
bootstrap: workdir/.bootstrap-stamp
@@ -21,10 +21,12 @@ workdir/.bootstrap-stamp: workdir/.build-libgodeps-stamp bootstrap.sh build/*.go
2121
workdir/.build-libgodeps-stamp: workdir/.update-clang-stamp workdir/.update-libgo-stamp bootstrap.sh
2222
./bootstrap.sh libgodeps -j$(j)
2323

24-
workdir/.update-clang-stamp: update_clang.sh $(gollvmdir)/llvm_dep.go
24+
workdir/.update-clang-stamp: update_clang.sh alwaysrun
2525
./update_clang.sh
2626

2727
workdir/.update-libgo-stamp: update_libgo.sh
2828
./update_libgo.sh
2929

3030
.SUFFIXES:
31+
32+
alwaysrun:

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ To build and install llgo:
2828

2929
# Ensure $GOPATH is set.
3030
go get -d github.com/go-llvm/llgo/cmd/gllgo
31-
cd $GOPATH/src/github.com/go-llvm/llvm
32-
./update_llvm.sh -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host
33-
cd ../llgo
31+
$GOPATH/src/llvm.org/llvm/bindings/go/build.sh -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host
32+
cd $GOPATH/src/github.com/go-llvm/llgo
3433
make install prefix=/path/to/prefix j=N # where N is the number of cores on your machine.
3534

3635
# Running

cmd/gllgo/gllgo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
"github.com/go-llvm/llgo/debug"
2424
"github.com/go-llvm/llgo/irgen"
25-
"github.com/go-llvm/llvm"
25+
"llvm.org/llvm/bindings/go/llvm"
2626
)
2727

2828
func report(err error) {

debug/debug.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"code.google.com/p/go.tools/go/types"
1616
"code.google.com/p/go.tools/go/types/typeutil"
1717

18-
"github.com/go-llvm/llvm"
18+
"llvm.org/llvm/bindings/go/llvm"
1919
)
2020

2121
const (
@@ -160,7 +160,8 @@ func (d *DIBuilder) Declare(b llvm.Builder, v ssa.Value, llv llvm.Value, paramIn
160160
ArgNo: paramIndex + 1,
161161
Type: d.DIType(v.Type()),
162162
})
163-
d.builder.InsertDeclareAtEnd(llv, localVar, b.GetInsertBlock())
163+
expr := d.builder.CreateExpression(nil)
164+
d.builder.InsertDeclareAtEnd(llv, localVar, expr, b.GetInsertBlock())
164165
}
165166

166167
// Value creates an llvm.dbg.value call for the specified register value.

irgen/annotations.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"code.google.com/p/go.tools/go/loader"
99
"code.google.com/p/go.tools/go/ssa"
1010
"code.google.com/p/go.tools/go/types"
11-
"github.com/go-llvm/llvm"
1211
"go/ast"
1312
"go/token"
13+
"llvm.org/llvm/bindings/go/llvm"
1414
)
1515

1616
// processAnnotations takes an *ssa.Package and a

irgen/attribute.go

+1-9
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package irgen
66

77
import (
88
"fmt"
9-
"github.com/go-llvm/llvm"
109
"go/ast"
10+
"llvm.org/llvm/bindings/go/llvm"
1111
"strings"
1212
)
1313

@@ -89,10 +89,6 @@ func parseLinkageAttribute(value string) linkageAttribute {
8989
switch strings.ToLower(field) {
9090
case "private":
9191
result |= linkageAttribute(llvm.PrivateLinkage)
92-
case "linker_private":
93-
result |= linkageAttribute(llvm.LinkerPrivateLinkage)
94-
case "linker_private_weak":
95-
result |= linkageAttribute(llvm.LinkerPrivateWeakLinkage)
9692
case "internal":
9793
result |= linkageAttribute(llvm.InternalLinkage)
9894
case "available_externally":
@@ -113,10 +109,6 @@ func parseLinkageAttribute(value string) linkageAttribute {
113109
result |= linkageAttribute(llvm.WeakODRLinkage)
114110
case "external":
115111
result |= linkageAttribute(llvm.ExternalLinkage)
116-
case "dllimport":
117-
result |= linkageAttribute(llvm.DLLImportLinkage)
118-
case "dllexport":
119-
result |= linkageAttribute(llvm.DLLExportLinkage)
120112
}
121113
}
122114
return result

irgen/builtins.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
9+
"llvm.org/llvm/bindings/go/llvm"
1010
)
1111

1212
func (fr *frame) callCap(arg *govalue) *govalue {

irgen/cabi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package irgen
22

33
import (
44
"code.google.com/p/go.tools/go/types"
5-
"github.com/go-llvm/llvm"
5+
"llvm.org/llvm/bindings/go/llvm"
66
)
77

88
type abiArgInfo int

irgen/call.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
9+
"llvm.org/llvm/bindings/go/llvm"
1010
)
1111

1212
// createCall emits the code for a function call,

irgen/channels.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
9+
"llvm.org/llvm/bindings/go/llvm"
1010
)
1111

1212
// makeChan implements make(chantype[, size])

irgen/compiler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
llgobuild "github.com/go-llvm/llgo/build"
1717
"github.com/go-llvm/llgo/debug"
18-
"github.com/go-llvm/llvm"
18+
"llvm.org/llvm/bindings/go/llvm"
1919

2020
"code.google.com/p/go.tools/go/gccgoimporter"
2121
"code.google.com/p/go.tools/go/importer"

irgen/errors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package irgen
66

77
import (
8-
"github.com/go-llvm/llvm"
8+
"llvm.org/llvm/bindings/go/llvm"
99
)
1010

1111
const (

irgen/indirect.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package irgen
77
import (
88
"code.google.com/p/go.tools/go/ssa"
99
"code.google.com/p/go.tools/go/types"
10-
"github.com/go-llvm/llvm"
10+
"llvm.org/llvm/bindings/go/llvm"
1111
)
1212

1313
// createThunk creates a thunk from a

irgen/interfaces.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
9+
"llvm.org/llvm/bindings/go/llvm"
1010
)
1111

1212
// interfaceMethod returns a function and receiver pointer for the specified

irgen/maps.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
9+
"llvm.org/llvm/bindings/go/llvm"
1010
)
1111

1212
// makeMap implements make(maptype[, initial space])

irgen/runtime.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
"code.google.com/p/go.tools/go/types"
1111

12-
"github.com/go-llvm/llvm"
12+
"llvm.org/llvm/bindings/go/llvm"
1313
)
1414

1515
type runtimeFnInfo struct {

irgen/slice.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
9+
"llvm.org/llvm/bindings/go/llvm"
1010
)
1111

1212
// makeSlice allocates a new slice with the optional length and capacity,

irgen/ssa.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"code.google.com/p/go.tools/go/ssa/ssautil"
1616
"code.google.com/p/go.tools/go/types"
1717
"github.com/go-llvm/llgo/ssaopt"
18-
"github.com/go-llvm/llvm"
18+
"llvm.org/llvm/bindings/go/llvm"
1919
)
2020

2121
// A globalInit is used to temporarily store a global's initializer until

irgen/strings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package irgen
66

77
import (
88
"code.google.com/p/go.tools/go/types"
9-
"github.com/go-llvm/llvm"
109
"go/token"
10+
"llvm.org/llvm/bindings/go/llvm"
1111
)
1212

1313
func (fr *frame) concatenateStrings(lhs, rhs *govalue) *govalue {

irgen/targets.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"fmt"
99
"strings"
1010

11-
"github.com/go-llvm/llvm"
11+
"llvm.org/llvm/bindings/go/llvm"
1212
)
1313

1414
// PNaClTriple is the LLVM target triple that should be used to compile

irgen/typemap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"code.google.com/p/go.tools/go/ssa/ssautil"
2121
"code.google.com/p/go.tools/go/types"
2222
"code.google.com/p/go.tools/go/types/typeutil"
23-
"github.com/go-llvm/llvm"
23+
"llvm.org/llvm/bindings/go/llvm"
2424
)
2525

2626
type MethodResolver interface {

irgen/utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package irgen
22

33
import (
44
"code.google.com/p/go.tools/go/types"
5-
"github.com/go-llvm/llvm"
5+
"llvm.org/llvm/bindings/go/llvm"
66
)
77

88
func (fr *frame) loadOrNull(cond, ptr llvm.Value, ty types.Type) *govalue {

irgen/value.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"code.google.com/p/go.tools/go/exact"
99
"code.google.com/p/go.tools/go/types"
1010
"fmt"
11-
"github.com/go-llvm/llvm"
1211
"go/token"
12+
"llvm.org/llvm/bindings/go/llvm"
1313
)
1414

1515
// govalue contains an LLVM value and a Go type,

update_clang.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66

77
llgodir=$(dirname "$0")
88
llgodir=$(cd "$llgodir" && pwd)
9-
gollvmdir=$(go list -f '{{.Dir}}' github.com/go-llvm/llvm)
9+
gollvmdir=$(go list -f '{{.Dir}}' llvm.org/llvm/bindings/go/llvm)
1010

11-
llvmrev=$(grep run_update_llvm_sh_to_get_revision_ $gollvmdir/llvm_dep.go | \
12-
sed -E -e 's/.*run_update_llvm_sh_to_get_revision_([0-9]+.*)/\1/g')
11+
llvmrev=$(cd $gollvmdir && (svn info || git svn info) | grep '^Revision:' | cut -d' ' -f2)
1312

1413
workdir=$llgodir/workdir
1514
clangdir=$workdir/clang
1615
clang_builddir=$workdir/clang_build
1716

17+
if [ "$llvmrev" = "$(cat $workdir/.update-clang-stamp 2>/dev/null)" ] ; then
18+
exit 0
19+
fi
20+
1821
mkdir -p $workdir
1922
svn co -r $llvmrev https://llvm.org/svn/llvm-project/cfe/trunk $clangdir
2023
mkdir -p $clang_builddir
@@ -29,4 +32,4 @@ else
2932
make -C $clang_builddir -j4 clang
3033
fi
3134

32-
touch $workdir/.update-clang-stamp
35+
echo $llvmrev > $workdir/.update-clang-stamp

0 commit comments

Comments
 (0)