Skip to content

Commit

Permalink
Switch to LLVM 9
Browse files Browse the repository at this point in the history
  • Loading branch information
aykevl committed Nov 13, 2019
1 parent 37e93e3 commit bad6d01
Show file tree
Hide file tree
Showing 30 changed files with 97 additions and 124 deletions.
11 changes: 5 additions & 6 deletions IRBindings.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- IRBindings.cpp - Additional bindings for ir ------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down Expand Up @@ -51,15 +50,15 @@ void LLVMSetMetadata2(LLVMValueRef Inst, unsigned KindID, LLVMMetadataRef MD) {
unwrap<Instruction>(Inst)->setMetadata(KindID, N);
}

void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Bref, unsigned Line,
void LLVMGoSetCurrentDebugLocation(LLVMBuilderRef Bref, unsigned Line,
unsigned Col, LLVMMetadataRef Scope,
LLVMMetadataRef InlinedAt) {
unwrap(Bref)->SetCurrentDebugLocation(
DebugLoc::get(Line, Col, Scope ? unwrap<MDNode>(Scope) : nullptr,
InlinedAt ? unwrap<MDNode>(InlinedAt) : nullptr));
}

LLVMDebugLocMetadata LLVMGetCurrentDebugLocation2(LLVMBuilderRef Bref) {
LLVMDebugLocMetadata LLVMGoGetCurrentDebugLocation(LLVMBuilderRef Bref) {
const auto& Loc = unwrap(Bref)->getCurrentDebugLocation();
const auto* InlinedAt = Loc.getInlinedAt();
const LLVMDebugLocMetadata md{
Expand Down
11 changes: 5 additions & 6 deletions IRBindings.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- IRBindings.h - Additional bindings for IR ----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down Expand Up @@ -44,11 +43,11 @@ void LLVMAddNamedMetadataOperand2(LLVMModuleRef M, const char *name,
LLVMMetadataRef Val);
void LLVMSetMetadata2(LLVMValueRef Inst, unsigned KindID, LLVMMetadataRef MD);

void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Bref, unsigned Line,
void LLVMGoSetCurrentDebugLocation(LLVMBuilderRef Bref, unsigned Line,
unsigned Col, LLVMMetadataRef Scope,
LLVMMetadataRef InlinedAt);

struct LLVMDebugLocMetadata LLVMGetCurrentDebugLocation2(LLVMBuilderRef Bref);
struct LLVMDebugLocMetadata LLVMGoGetCurrentDebugLocation(LLVMBuilderRef Bref);

#ifdef __cplusplus
}
Expand Down
10 changes: 5 additions & 5 deletions InstrumentationBindings.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- InstrumentationBindings.cpp - instrumentation bindings -------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand All @@ -16,6 +15,7 @@
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"

Expand All @@ -26,7 +26,7 @@ void LLVMAddAddressSanitizerFunctionPass(LLVMPassManagerRef PM) {
}

void LLVMAddAddressSanitizerModulePass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createAddressSanitizerModulePass());
unwrap(PM)->add(createModuleAddressSanitizerLegacyPassPass());
}

void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
Expand Down
7 changes: 3 additions & 4 deletions InstrumentationBindings.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- InstrumentationBindings.h - instrumentation bindings -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ all: help

COMPONENTS = all-targets analysis asmparser asmprinter bitreader bitwriter codegen core coroutines debuginfodwarf executionengine instrumentation interpreter ipo irreader linker mc mcjit objcarcopts option profiledata scalaropts support target

VERSION=8.0.0
VERSION=9.0.0
VERSION_MAJOR=$(firstword $(subst ., ,$(VERSION)))

SRCDIR=llvm-$(VERSION)
Expand Down
9 changes: 4 additions & 5 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This library provides bindings to a system-installed LLVM.

Currently supported:

* LLVM 8 from [apt.llvm.org](http://apt.llvm.org/) on Debian.
* LLVM 9 from [apt.llvm.org](http://apt.llvm.org/) on Debian.

## Usage

Expand Down Expand Up @@ -32,10 +32,9 @@ newer version of LLVM.
Most of the files are extracted from the LLVM source tree, specifically all
\*.go, \*.cpp, and \*.h files come directly from
[bindings/go/llvm](https://github.com/llvm-mirror/llvm/tree/release_80/bindings/go/llvm)
in the LLVM source tree. They are all released under the [University of
Illinois/NCSA Open Source License](http://releases.llvm.org/8.0.0/LICENSE.TXT)
which is a permissive BSD-like license. Check upstream LLVM for detailed
copyright information.
in the LLVM source tree. They are all released under the [Apache License 2.0
(with LLVM exceptions)](http://releases.llvm.org/9.0.0/LICENSE.TXT). Check
upstream LLVM for detailed copyright information.

This README, the backports\* files, and the Makefile are separate from LLVM but
are licensed under the same license.
7 changes: 3 additions & 4 deletions SupportBindings.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- SupportBindings.cpp - Additional bindings for support --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions SupportBindings.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- SupportBindings.h - Additional bindings for Support ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions analysis.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- analysis.go - Bindings for analysis --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions bitreader.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- bitreader.go - Bindings for bitreader ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions bitwriter.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- bitwriter.go - Bindings for bitwriter ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions dibuilder.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- dibuilder.go - Bindings for DIBuilder ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions executionengine.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- executionengine.go - Bindings for executionengine ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions executionengine_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- executionengine_test.go - Tests for executionengine ----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
11 changes: 5 additions & 6 deletions ir.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- ir.go - Bindings for ir --------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down Expand Up @@ -1302,11 +1301,11 @@ type DebugLoc struct {
InlinedAt Metadata
}
func (b Builder) SetCurrentDebugLocation(line, col uint, scope, inlinedAt Metadata) {
C.LLVMSetCurrentDebugLocation2(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C)
C.LLVMGoSetCurrentDebugLocation(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C)
}
// Get current debug location. Please do not call this function until setting debug location with SetCurrentDebugLocation()
func (b Builder) GetCurrentDebugLocation() (loc DebugLoc) {
md := C.LLVMGetCurrentDebugLocation2(b.C)
md := C.LLVMGoGetCurrentDebugLocation(b.C)
loc.Line = uint(md.Line)
loc.Col = uint(md.Col)
loc.Scope = Metadata{C: md.Scope}
Expand Down
12 changes: 5 additions & 7 deletions ir_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- ir_test.go - Tests for ir ------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down Expand Up @@ -31,7 +30,7 @@ func testAttribute(t *testing.T, name string) {
fn.AddFunctionAttr(attr)
newattr := fn.GetEnumFunctionAttribute(kind)
if attr != newattr {
t.Errorf("got attribute mask %d, want %d", newattr, attr)
t.Errorf("got attribute %p, want %p", newattr.C, attr.C)
}

text := mod.String()
Expand All @@ -42,7 +41,7 @@ func testAttribute(t *testing.T, name string) {
fn.RemoveEnumFunctionAttribute(kind)
newattr = fn.GetEnumFunctionAttribute(kind)
if !newattr.IsNil() {
t.Errorf("got attribute mask %d, want 0", newattr)
t.Errorf("got attribute %p, want 0", newattr.C)
}
}

Expand All @@ -52,7 +51,6 @@ func TestAttributes(t *testing.T) {
"sanitize_address",
"alwaysinline",
"builtin",
"byval",
"convergent",
"inalloca",
"inlinehint",
Expand Down
7 changes: 3 additions & 4 deletions linker.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- linker.go - Bindings for linker ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
4 changes: 2 additions & 2 deletions llvm_config_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package llvm

// Automatically generated by `make config BUILDDIR=`, do not edit.

// #cgo CPPFLAGS: -I/usr/local/opt/llvm@8/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo CPPFLAGS: -I/usr/local/opt/llvm@9/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo CXXFLAGS: -std=c++11
// #cgo LDFLAGS: -L/usr/local/opt/llvm@8/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM -lz -lcurses -lm -lxml2 -L/usr/local/opt/libffi/lib -lffi
// #cgo LDFLAGS: -L/usr/local/opt/llvm@9/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM -lz -lcurses -lm -lxml2 -L/usr/local/opt/libffi/lib -lffi
import "C"

type (run_build_sh int)
4 changes: 2 additions & 2 deletions llvm_config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package llvm

// Automatically generated by `make config BUILDDIR=`, do not edit.

// #cgo CPPFLAGS: -I/usr/lib/llvm-8/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo CPPFLAGS: -I/usr/lib/llvm-9/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
// #cgo CXXFLAGS: -std=c++11
// #cgo LDFLAGS: -L/usr/lib/llvm-8/lib -lLLVM-8
// #cgo LDFLAGS: -L/usr/lib/llvm-9/lib -lLLVM-9
import "C"

type (run_build_sh int)
7 changes: 3 additions & 4 deletions llvm_dep.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- llvm_dep.go - creates LLVM dependency ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions string.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- string.go - Stringer implementation for Type -----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions string_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- string_test.go - test Stringer implementation for Type -------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
7 changes: 3 additions & 4 deletions support.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//===- support.go - Bindings for support ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
Expand Down
Loading

0 comments on commit bad6d01

Please sign in to comment.