Commit Graph

91 Commits

Author SHA1 Message Date
whitequark
b52e8dcdd1 [bindings/go] Add coroutine passes
Add Go bindings for CoroEarly, CoroSplit, CoroElide and CoroCleanup.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340148 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-19 23:40:05 +00:00
whitequark
8bf9e9a017 [C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType
Added DIFlags in LLVMDIBuilderCreateBasicType to add optional DWARF
attributes, such as DW_AT_endianity.

Patch by Chirag Patel.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340146 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-19 23:39:47 +00:00
Robert Widmann
07e5114430 [LLVM-C] Consolidate llgo's DIBuilder Bindings
Summary: Move and correct LLVMDIBuilderCreateTypedef.  This is the last API in DIBuilderBindings.h, so it is being removed and the C API will now be re-exported from IRBindings.h.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332041 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 21:10:06 +00:00
Robert Widmann
4240051252 [LLVM-C] Move DIBuilder Bindings For Temporary MDNodes
Summary: Move LLVMTemporaryMDNode and LLVMMetadataReplaceAllUsesWith to the C bindings and add LLVMDeleteTemporaryMDNode for deleting non-RAUW'ed temporary nodes.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332010 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10 18:09:53 +00:00
Robert Widmann
778613a69e [LLVM-C] Correct types in Go bindings
Summary: Fixes a test failure introduced in rL331114.

Reviewers: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331850 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 06:45:28 +00:00
David Bolvansky
3847aa02de [bindings/go] Add Go bindings for volatile loads/stores
Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331530 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-04 15:14:00 +00:00
Benjamin Kramer
068c967842 [bindings] Fix dibuilder go bindings after r331114.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331171 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 12:48:45 +00:00
Robert Widmann
bffba319b2 [LLVM-C] DIBuilder Bindings For Variable Expressions
Summary: Add DIBuilder bindings for (global) variable expressions, variable value expressions, and debug value intrinsic insertion.

Reviewers: harlanhaskins, deadalnix, whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 22:31:49 +00:00
Robert Widmann
cd997a7a91 [LLVM-C] DIBuilderBindings for Subrange and Arrays
Summary: Move Go bindings for subranges and DINode arrays.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330594 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 14:29:33 +00:00
Robert Widmann
aec06286e3 [LLVM-C] Add DIBuilder Bindings For Variable Creation
Summary: Wrap LLVMDIBuilderCreateAutoVariable, LLVMDIBuilderCreateParameterVariable, LLVMDIBuilderCreateExpression, and move and correct LLVMDIBuilderInsertDeclareBefore and LLVMDIBuilderInsertDeclareAtEnd from the Go bindings to the C bindings.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: harlanhaskins, whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330555 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-22 19:24:44 +00:00
Robert Widmann
5c87b2ea7b [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329505 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-07 16:26:59 +00:00
Robert Widmann
bc866fee81 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329488 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-07 06:07:55 +00:00
Harlan Haskins
755a219640 Fix Go IR test for changes in DIBuilder API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329021 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 21:45:35 +00:00
Harlan Haskins
80548aa3fb 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328953 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-02 00:17:40 +00:00
Benjamin Kramer
1ab1a1257f Unbreak the build of the go bindings after r328839.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328916 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-31 07:41:25 +00:00
Chandler Carruth
2901b0fdfc [bindings/go] Add a missing , in the test code to fix a go compile
failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327771 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 15:12:52 +00:00
Oren Ben Simhon
10c992c085 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327767 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17 13:29:46 +00:00
Reid Kleckner
862ea57eb6 [LLVM-C] [bindings/go] Add C and Golang bindings for COMDAT
Patch by Ben Clayton

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327551 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 18:33:53 +00:00
Eric Christopher
a4a3d37831 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325946 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 20:12:24 +00:00
Hiroshi Inoue
8040eab589 [NFC] fix trivial typos in comments and documents
"in in" -> "in", "on on" -> "on" etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323508 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 08:15:29 +00:00
Andrew Wilkins
bcc357919c [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!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321509 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28 04:10:09 +00:00
Sam McCall
6a45ba3f6b Update go bindings to use new functions from rL317135.
This fixes duplicate symbol problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317195 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02 10:22:26 +00:00
Eric Christopher
77c58f0a98 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02 01:46:49 +00:00
Eric Christopher
526d784ae2 Fix for go bindings header to match previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317152 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02 01:25:00 +00:00
Eric Christopher
4347cad0bf 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317151 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02 01:24:12 +00:00
Adrian Prantl
e29c97eccc Update the Go bindings for r309426 (remove offset from llvm.dbg.value)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309448 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28 22:44:44 +00:00
Andrew Wilkins
6a72c57525 [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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304968 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 07:32:29 +00:00
Benjamin Kramer
1ec650ee5f [go bindings] Rmove duplicated conversion function definitions after r300843.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20 19:06:11 +00:00
Amaury Sechet
603e72e193 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17 11:52:54 +00:00
Andrew Wilkins
903a962209 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299185 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 04:59:57 +00:00
Konstantin Zhuravlyov
2cee5cc825 [DebugInfo] Emit address space with DW_AT_address_class attribute for pointer and reference types
Differential Revision: https://reviews.llvm.org/D29670


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297320 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-08 23:55:44 +00:00
Andrew Wilkins
733bbece62 Go binding: Add methods for missing PassManagerBuilder C APIs
Patch by Ryuichi Hayashida!

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295420 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 05:41:05 +00:00
Daniel Jasper
a7bd1c6059 Fix go bindings after r289702 (hopefully, don't really know how to build
them, build.sh seems to be broken).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289775 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 06:54:29 +00:00
Amaury Sechet
d1894a13cc Fix go binding to adapt the new attribute API
https://reviews.llvm.org/D26339

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 10:11:02 +00:00
David L. Jones
2dd5f7e327 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-07 18:38:49 +00:00
Daniel Jasper
cb096f0a4e Also delete the go side of the bindings deleted in r286085/r286086.
Also delete a comment I forgot to delete.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-06 23:21:22 +00:00
Daniel Jasper
5183128797 Delete one more function that needs to go after r286062.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286086 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-06 21:20:45 +00:00
Daniel Jasper
671c411040 Remove functions from go bindings that have been deleted in r286062.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286085 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-06 21:02:14 +00:00
Benjamin Kramer
f00b7830dc [Go bindings] Update for r284678 API changes.
Alignment moved from createBasicType to createAutoVariable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284707 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 09:14:39 +00:00
Victor Leschuk
58be60c483 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 14:31:22 +00:00
Leny Kholodov
01dd3d966f Formatting with clang-format patch r280700
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-06 17:03:02 +00:00
Leny Kholodov
7ba15530ab Fix for Bindings/Go/go.test after patch r280700
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280711 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-06 15:03:54 +00:00
Andrew Wilkins
255ca4be00 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263530 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 05:04:06 +00:00
Amaury Sechet
d0aed13e56 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 00:22:02 +00:00
Haojian Wu
268499a1a2 Remove LLVMGetTargetMachineData in go-binding.
Summary:
LLVMGetTargetMachineData has been removed, and LLVMGetDataLayout is
suggested to use. The LLVMGetDataLayout is exposed in go bindings.
So it's safe to remove the function.

Reviewers: bkramer

Subscribers: llvm-commits, axw

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260670 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 11:35:11 +00:00
Rafael Espindola
8d184ad258 Deprecate a few C APIs.
This deprecates:
* LLVMParseBitcode
* LLVMParseBitcodeInContext
* LLVMGetBitcodeModuleInContext
* LLVMGetBitcodeModule

They are replaced with the functions with a 2 suffix which do not record
a diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 23:46:42 +00:00
Eric Christopher
cca8dbee4e Reorganize the C API headers to improve build times.
Type specific declarations have been moved to Type.h and error handling
routines have been moved to ErrorHandling.h. Both are included in Core.h
so nothing should change for projects directly including the headers,
but transitive dependencies may be affected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255965 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 01:46:52 +00:00
Rafael Espindola
d912be98f8 Change linkInModule to take a std::unique_ptr.
Passing in a std::unique_ptr should help find errors when the module
is used after being linked into another module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 23:16:33 +00:00
Peter Collingbourne
5f220beefc DI: Reverse direction of subprogram -> function edge.
Previously, subprograms contained a metadata reference to the function they
described. Because most clients need to get or set a subprogram for a given
function rather than the other way around, this created unneeded inefficiency.

For example, many passes needed to call the function llvm::makeSubprogramMap()
to build a mapping from functions to subprograms, and the IR linker needed to
fix up function references in a way that caused quadratic complexity in the IR
linking phase of LTO.

This change reverses the direction of the edge by storing the subprogram as
function-level metadata and removing DISubprogram's function field.

Since this is an IR change, a bitcode upgrade has been provided.

Fixes PR23367. An upgrade script for textual IR for out-of-tree clients is
attached to the PR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 22:03:56 +00:00
Eric Christopher
6f565c0e97 Remove DIFile from createSubroutineType.
Patch by Amaury Sechet with a small modification by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250374 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 06:56:10 +00:00