1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

417 Commits

Author SHA1 Message Date
Robert Widmann
58b3cf78df [llgo] Move SetSubprogram
Summary: Fixes the bots - I moved LLVMSetSubprogram into the DIBuilder bindings, so the Go bindings need to move as well.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45402

llvm-svn: 329505
2018-04-07 16:26:59 +00:00
Robert Widmann
e88501d956 [LLVM-C] Move DIBuilder Bindings For Block Scopes
Summary: Move LLVMDIBuilderCreateFunction , LLVMDIBuilderCreateLexicalBlock, and LLVMDIBuilderCreateLexicalBlockFile from Go to LLVM-C.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark, harlanhaskins

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D45352

llvm-svn: 329488
2018-04-07 06:07:55 +00:00
Harlan Haskins
ee938eb427 Fix Go IR test for changes in DIBuilder API
llvm-svn: 329021
2018-04-02 21:45:35 +00:00
Harlan Haskins
5b6ae512c2 Add C API bindings for DIBuilder 'Type' APIs
This patch adds a set of unstable C API bindings to the DIBuilder interface for
creating structure, function, and aggregate types.

This patch also removes the existing implementations of these functions from
the Go bindings and updates the Go API to fit the new C APIs.

llvm-svn: 328953
2018-04-02 00:17:40 +00:00
Benjamin Kramer
024c9be02b Unbreak the build of the go bindings after r328839.
llvm-svn: 328916
2018-03-31 07:41:25 +00:00
Chandler Carruth
b57954b7ab [bindings/go] Add a missing , in the test code to fix a go compile
failure.

llvm-svn: 327771
2018-03-17 15:12:52 +00:00
Oren Ben Simhon
3960b83ba4 [X86] Added support for nocf_check attribute for indirect Branch Tracking
X86 Supports Indirect Branch Tracking (IBT) as part of Control-Flow Enforcement Technology (CET).
IBT instruments ENDBR instructions used to specify valid targets of indirect call / jmp.
The `nocf_check` attribute has two roles in the context of X86 IBT technology:
	1. Appertains to a function - do not add ENDBR instruction at the beginning of the function.
	2. Appertains to a function pointer - do not track the target function of this pointer by adding nocf_check prefix to the indirect-call instruction.

This patch implements `nocf_check` context for Indirect Branch Tracking.
It also auto generates `nocf_check` prefixes before indirect branchs to jump tables that are guarded by range checks.

Differential Revision: https://reviews.llvm.org/D41879

llvm-svn: 327767
2018-03-17 13:29:46 +00:00
Reid Kleckner
e307bb0d2f [LLVM-C] [bindings/go] Add C and Golang bindings for COMDAT
Patch by Ben Clayton

Differential Revision: https://reviews.llvm.org/D44086

llvm-svn: 327551
2018-03-14 18:33:53 +00:00
Eric Christopher
5d4eef4d9b Because of CVE-2018-6574, some compiler options and linker options are restricted to prevent arbitrary code execution.
https://github.com/golang/go/issues/23672

By this change, building a Go code with LLVM Go bindings causes a compilation error as follows.

  go build llvm.org/llvm/bindings/go/llvm: invalid flag in #cgo LDFLAGS: -Wl,-headerpad_max_install_names

llvm-go tool generates cgo LDFLAGS directive from `llvm-config --ldflags` and it contains -Wl,option options. But -Wl,option is banned by default. To avoid this problem, we need to set $CGO_LDFLAGS_ALLOW environment variable to notify a compiler that the flags should be allowed.

  $ export CGO_LDFLAGS_ALLOW='-Wl,(-search_paths_first|-headerpad_max_install_names)'

By default for go 1.10 and go 1.9.5 these options should appear in the accepted set of options, however, if you're running into the error it's useful to have this documented.

Patch by Ryuichi Hayashida

llvm-svn: 325946
2018-02-23 20:12:24 +00:00
Hiroshi Inoue
7f54536b89 [NFC] fix trivial typos in comments and documents
"in in" -> "in", "on on" -> "on" etc.

llvm-svn: 323508
2018-01-26 08:15:29 +00:00
Andrew Wilkins
7c025ca15b [bindings/go] fix vet errors
Fix "go vet" errors, which will be
run automatically with "go test" as
of Go 1.10.

Patch by Karsten Weiss!

llvm-svn: 321509
2017-12-28 04:10:09 +00:00
Sam McCall
d52c727761 Update go bindings to use new functions from rL317135.
This fixes duplicate symbol problems.

llvm-svn: 317195
2017-11-02 10:22:26 +00:00
Eric Christopher
621393c457 Revert "Remove some of the go specific C bindings for debug info now that they've been migrated into the main C API."
This reverts commits r317151 and 317152

llvm-svn: 317154
2017-11-02 01:46:49 +00:00
Eric Christopher
fa1c1be7d3 Fix for go bindings header to match previous commit.
llvm-svn: 317152
2017-11-02 01:25:00 +00:00
Eric Christopher
13ca1b1cd4 Remove some of the go specific C bindings for debug info now that they've been migrated into the main C API.
Fixes a go bindings breakage after r317135.

llvm-svn: 317151
2017-11-02 01:24:12 +00:00
Aaron Ballman
1dbcb12601 Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people.
Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1

llvm-svn: 315854
2017-10-15 14:32:27 +00:00
Don Hinton
16622c817e [dump] Remove NDEBUG from test to enable dump methods [NFC]
Summary:
Add LLVM_FORCE_ENABLE_DUMP cmake option, and use it along with
LLVM_ENABLE_ASSERTIONS to set LLVM_ENABLE_DUMP.

Remove NDEBUG and only use LLVM_ENABLE_DUMP to enable dump methods.

Move definition of LLVM_ENABLE_DUMP from config.h to llvm-config.h so
it'll be picked up by public headers.

Differential Revision: https://reviews.llvm.org/D38406

llvm-svn: 315590
2017-10-12 16:16:06 +00:00
Adrian Prantl
296b3499de Update the Go bindings for r309426 (remove offset from llvm.dbg.value)
llvm-svn: 309448
2017-07-28 22:44:44 +00:00
Michal Gorny
96875d923f [OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG
Account for the possibility of LLVMDumpType() not being available with
NDEBUG in the OCaml bindings. If it is not built into LLVM, make
the dump function raise an exception.

Since rL293359, the dump functions are built only if either NDEBUG is
not defined, or LLVM_ENABLE_DUMP is defined. As a result, if the dump
functions are not built in LLVM, the dynamic OCaml libraries fail to
load due to undefined LLVMDumpType symbol.

Differential Revision: https://reviews.llvm.org/D35899

llvm-svn: 309321
2017-07-27 21:13:25 +00:00
Mandeep Singh Grang
4137c9c02a [NFC] Remove multiple semicolons
Reviewers: bogner, whitequark, mgrang

Reviewed By: mgrang

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34785

llvm-svn: 306613
2017-06-28 23:15:16 +00:00
Andrew Wilkins
db2a769c11 [Go] Subtypes function
This patch adds LLVMGetSubtypes to Go API (as Type.Subtypes), tests included.

Patch by Ekaterina Vaartis!

Differential Revision: https://reviews.llvm.org/D33901

llvm-svn: 304968
2017-06-08 07:32:29 +00:00
whitequark
97186e1387 [LLVM-C] [OCaml] Expose Type::subtypes.
The C functions added are LLVMGetNumContainedTypes and
LLVMGetSubtypes.

The OCaml function added is Llvm.subtypes.

Patch by Ekaterina Vaartis.

Differential Revision: https://reviews.llvm.org/D33677

llvm-svn: 304709
2017-06-05 11:49:52 +00:00
Benjamin Kramer
712bee7e04 [go bindings] Rmove duplicated conversion function definitions after r300843.
llvm-svn: 300872
2017-04-20 19:06:11 +00:00
Amaury Sechet
5cbde7845f Introducing LLVMMetadataRef
Summary:
This seems like an uncontroversial first step toward providing access to the metadata hierarchy that now exists in LLVM. This should allow for good debug info support from C.

Future plans are to deprecate API that take mixed bags of values and metadata (mainly the LLVMMDNode family of functions) and migrate the rest toward the use of LLVMMetadataRef.

Once this is in place, mapping of DIBuilder will be able to start.

Reviewers: mehdi_amini, echristo, whitequark, jketema, Wallbraker

Reviewed By: Wallbraker

Subscribers: Eugene.Zelenko, axw, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D19448

llvm-svn: 300447
2017-04-17 11:52:54 +00:00
Andrew Wilkins
1d34613c6f Go binding: Add GetCurrentDebugLocation to obtain debug location from builder
Summary:

Currently Go binding only has SetCurrentDebugLocation method.
I added GetCurrentDebugLocation method to IRBuilder instance.

I added this because I want to save current debug location, change debug location temporary and restore the saved one finally.
This is useful when source location jumps and goes back after while LLVM IR generation.

I also added tests for this to ir_test.go.
I confirmed that all test passed with this patch based on r298890

Patch by Ryuichi Hayashida!

Differential Revision: https://reviews.llvm.org/D31415

llvm-svn: 299185
2017-03-31 04:59:57 +00:00
Konstantin Zhuravlyov
086cf9de9d [DebugInfo] Emit address space with DW_AT_address_class attribute for pointer and reference types
Differential Revision: https://reviews.llvm.org/D29670

llvm-svn: 297320
2017-03-08 23:55:44 +00:00
Andrew Wilkins
35ccd53b9c Go binding: Add methods for missing PassManagerBuilder C APIs
Patch by Ryuichi Hayashida!

Differential Revision: http://reviews.llvm.org/D30042

llvm-svn: 295420
2017-02-17 05:41:05 +00:00
Daniel Jasper
b695aa5e48 Fix go bindings after r289702 (hopefully, don't really know how to build
them, build.sh seems to be broken).

llvm-svn: 289775
2016-12-15 06:54:29 +00:00
Amaury Sechet
9416bb4ccb Fix go binding to adapt the new attribute API
https://reviews.llvm.org/D26339

llvm-svn: 287328
2016-11-18 10:11:02 +00:00
whitequark
73caa383e6 [OCaml] Adapt to the new attribute C API.
llvm-svn: 286705
2016-11-12 03:38:30 +00:00
David L. Jones
f2ffb620a9 Remove Go Attribute type that was deleted from the C API in r286062.
Summary:
The C++ side of the Go bindings were updated in r286085, r286086, and r286087,
but those did not remove this type.

Reviewers: djasper

Subscribers: axw

Differential Revision: https://reviews.llvm.org/D26337

llvm-svn: 286131
2016-11-07 18:38:49 +00:00
Daniel Jasper
7bf94da7e9 Also delete the go side of the bindings deleted in r286085/r286086.
Also delete a comment I forgot to delete.

llvm-svn: 286087
2016-11-06 23:21:22 +00:00
Daniel Jasper
1101a6ca6a Delete one more function that needs to go after r286062.
llvm-svn: 286086
2016-11-06 21:20:45 +00:00
Daniel Jasper
0251c97802 Remove functions from go bindings that have been deleted in r286062.
llvm-svn: 286085
2016-11-06 21:02:14 +00:00
Benjamin Kramer
152d4ca7be [Go bindings] Update for r284678 API changes.
Alignment moved from createBasicType to createAutoVariable.

llvm-svn: 284707
2016-10-20 09:14:39 +00:00
Victor Leschuk
7f37d10b43 DebugInfo: change alignment type from uint64_t to uint32_t to save space.
In futher patches we shall have alignment field added to DIVariable family
and switching from uint64_t to uint32_t will save 4 bytes per variable.

Differential Revision: https://reviews.llvm.org/D25620

llvm-svn: 284482
2016-10-18 14:31:22 +00:00
Michal Gorny
51dd7d27dc cmake: Install the OCaml libraries into a more correct path
Add a OCAML_INSTALL_PATH variable that can be used to control
the install path for OCaml libraries. The new variable defaults to
${OCAML_STDLIB_PATH}, i.e. the OCaml library path obtained from
the OCaml compiler. Install libraries into "llvm" subdirectory.

This fixes two issues:

1. OCaml library directories differ between systems, and 'lib/ocaml' is
incorrect e.g. on amd64 Gentoo where OCaml is installed
in 'lib64/ocaml'. Therefore, obtain the library path from the OCaml
compiler using 'ocamlc -where' (which is already used to set
OCAML_STDLIB_PATH), which is the method used commonly in OCaml packages.

2. The top-level directory is reserved for the standard library, and has
precedence over local directory in search path. As a result, OCaml
preferred the files installed along with previous LLVM version over the
source tree when building a new version, resulting in two versions being
mixed during the build. The new layout is used commonly by other OCaml
packages, and findlib is able to find the LLVM libraries successfully.

Bug: https://bugs.gentoo.org/559134
Bug: https://bugs.gentoo.org/559624

Differential Revision: https://reviews.llvm.org/D24354

llvm-svn: 282895
2016-09-30 18:34:23 +00:00
Leny Kholodov
f831870521 Formatting with clang-format patch r280700
llvm-svn: 280716
2016-09-06 17:03:02 +00:00
Leny Kholodov
7f7b35c8e2 Fix for Bindings/Go/go.test after patch r280700
llvm-svn: 280711
2016-09-06 15:03:54 +00:00
Peter Zotov
faa562f2ae [CMake] [OCaml] Allow building OCaml bindings out of tree.
That is, add build system support for building the OCaml bindings
against preinstalled LLVM libraries. This is important for package
managers such as OPAM, because OCaml libraries need to be built
against a specific OCaml compiler installation.

llvm-svn: 280642
2016-09-05 01:42:22 +00:00
Peter Zotov
4463b30765 [OCaml] Add functions for accessing metadata nodes.
Patch by Xinyu Zhuang.

Differential Revision: http://reviews.llvm.org/D19309

llvm-svn: 273370
2016-06-22 03:30:24 +00:00
David Majnemer
c6df3d773b Remove the ScalarReplAggregates pass
Nearly all the changes to this pass have been done while maintaining and
updating other parts of LLVM.  LLVM has had another pass, SROA, which
has superseded ScalarReplAggregates for quite some time.

Differential Revision: http://reviews.llvm.org/D21316

llvm-svn: 272737
2016-06-15 00:19:09 +00:00
Mehdi Amini
ea195a382e Remove every uses of getGlobalContext() in LLVM (but the C API)
At the same time, fixes InstructionsTest::CastInst unittest: yes
you can leave the IR in an invalid state and exit when you don't
destroy the context (like the global one), no longer now.

This is the first part of http://reviews.llvm.org/D19094

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266379
2016-04-14 21:59:01 +00:00
Jeroen Ketema
a08e626221 [OCaml] Expose the LLVM diagnostic handler
Differential Revision: http://reviews.llvm.org/D18891

llvm-svn: 265897
2016-04-10 13:55:53 +00:00
Jeroen Ketema
50c69e8bdb [OCaml] Use LLVMCreateMessage with constant strings when calling llvm_raise
The llvm_string_of_message function, called by llvm_raise, calls
LLVMDisposeMessage, which expects the message to be dynamically
allocated; it fails freeing the message otherwise. So always
dynamically allocate with LLVMCreateMessage.

Differential Revision: http://reviews.llvm.org/D18675

llvm-svn: 265116
2016-04-01 07:56:17 +00:00
Jeroen Ketema
a7ee2dacd4 [OCaml] Reinstate data_layout
Expose LLVMCreateTargetMachineData as data_layout.

As r263530 did for go. From that commit: "LLVMGetTargetDataLayout was
removed from the C API, and then TargetMachine.TargetData was removed.
Later, LLVMCreateTargetMachineData was added to the C API"

Differential Revision: http://reviews.llvm.org/D18677

llvm-svn: 265115
2016-04-01 07:54:24 +00:00
Jeroen Ketema
5864b435c4 Silence warnings in OCaml bindings
* LLVMDisposeMessage lives in llvm-c/Core.h, include this file where necessary
* LLVMAddTargetData has been removed, follow suit in the bindings

Differential Revision: http://reviews.llvm.org/D18633

llvm-svn: 265001
2016-03-31 08:39:42 +00:00
Andrew Wilkins
9169d59160 bindings/go: reinstate TargetMachine.TargetData
Summary:
LLVMGetTargetDataLayout was removed from the C API,
and then TargetMachine.TargetData was removed. Later,
LLVMCreateTargetMachineData was added to the C API,
and we now expose this via the Go API.

Reviewers: deadalnix, pcc

Subscribers: cierniak, llvm-commits, axw

Differential Revision: http://reviews.llvm.org/D18173

llvm-svn: 263530
2016-03-15 05:04:06 +00:00
Amaury Sechet
c4e8893256 Kill LLVMAddTargetData
Summary: It's red, it's dead.

Reviewers: joker.eph, Wallbraker, echristo

Subscribers: llvm-commits, axw

Differential Revision: http://reviews.llvm.org/D17282

llvm-svn: 260919
2016-02-16 00:22:02 +00:00
Benjamin Kramer
f375282672 Remove LLVMGetTargetMachineData leftovers.
llvm-svn: 260720
2016-02-12 20:26:46 +00:00