summaryrefslogtreecommitdiffstats
path: root/llvm/bindings/go
Commit message (Collapse)AuthorAgeFilesLines
...
* Go bindings: introduce llvm.TemporaryMDNode.Peter Collingbourne2014-12-133-0/+13
| | | | llvm-svn: 224178
* Go bindings: introduce Metadata.ReplaceAllUsesWith.Peter Collingbourne2014-12-133-0/+16
| | | | llvm-svn: 224177
* Go bindings: expose the Metadata type.Peter Collingbourne2014-12-136-266/+338
| | | | | | | Also modifies SetCurrentDebugLocation to take individual arguments rather than an MDNode. llvm-svn: 224176
* Go bindings: remove contextless metadata bindings.Peter Collingbourne2014-12-131-11/+0
| | | | llvm-svn: 224175
* IR: Split Metadata from ValueDuncan P. N. Exon Smith2014-12-091-24/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split `Metadata` away from the `Value` class hierarchy, as part of PR21532. Assembly and bitcode changes are in the wings, but this is the bulk of the change for the IR C++ API. I have a follow-up patch prepared for `clang`. If this breaks other sub-projects, I apologize in advance :(. Help me compile it on Darwin I'll try to fix it. FWIW, the errors should be easy to fix, so it may be simpler to just fix it yourself. This breaks the build for all metadata-related code that's out-of-tree. Rest assured the transition is mechanical and the compiler should catch almost all of the problems. Here's a quick guide for updating your code: - `Metadata` is the root of a class hierarchy with three main classes: `MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from the `Value` class hierarchy. It is typeless -- i.e., instances do *not* have a `Type`. - `MDNode`'s operands are all `Metadata *` (instead of `Value *`). - `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively. If you're referring solely to resolved `MDNode`s -- post graph construction -- just use `MDNode*`. - `MDNode` (and the rest of `Metadata`) have only limited support for `replaceAllUsesWith()`. As long as an `MDNode` is pointing at a forward declaration -- the result of `MDNode::getTemporary()` -- it maintains a side map of its uses and can RAUW itself. Once the forward declarations are fully resolved RAUW support is dropped on the ground. This means that uniquing collisions on changing operands cause nodes to become "distinct". (This already happened fairly commonly, whenever an operand went to null.) If you're constructing complex (non self-reference) `MDNode` cycles, you need to call `MDNode::resolveCycles()` on each node (or on a top-level node that somehow references all of the nodes). Also, don't do that. Metadata cycles (and the RAUW machinery needed to construct them) are expensive. - An `MDNode` can only refer to a `Constant` through a bridge called `ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`). As a side effect, accessing an operand of an `MDNode` that is known to be, e.g., `ConstantInt`, takes three steps: first, cast from `Metadata` to `ConstantAsMetadata`; second, extract the `Constant`; third, cast down to `ConstantInt`. The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have metadata schema owners transition away from using `Constant`s when the type isn't important (and they don't care about referring to `GlobalValue`s). In the meantime, I've added transitional API to the `mdconst` namespace that matches semantics with the old code, in order to avoid adding the error-prone three-step equivalent to every call site. If your old code was: MDNode *N = foo(); bar(isa <ConstantInt>(N->getOperand(0))); baz(cast <ConstantInt>(N->getOperand(1))); bak(cast_or_null <ConstantInt>(N->getOperand(2))); bat(dyn_cast <ConstantInt>(N->getOperand(3))); bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4))); you can trivially match its semantics with: MDNode *N = foo(); bar(mdconst::hasa <ConstantInt>(N->getOperand(0))); baz(mdconst::extract <ConstantInt>(N->getOperand(1))); bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2))); bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3))); bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4))); and when you transition your metadata schema to `MDInt`: MDNode *N = foo(); bar(isa <MDInt>(N->getOperand(0))); baz(cast <MDInt>(N->getOperand(1))); bak(cast_or_null <MDInt>(N->getOperand(2))); bat(dyn_cast <MDInt>(N->getOperand(3))); bay(dyn_cast_or_null<MDInt>(N->getOperand(4))); - A `CallInst` -- specifically, intrinsic instructions -- can refer to metadata through a bridge called `MetadataAsValue`. This is a subclass of `Value` where `getType()->isMetadataTy()`. `MetadataAsValue` is the *only* class that can legally refer to a `LocalAsMetadata`, which is a bridged form of non-`Constant` values like `Argument` and `Instruction`. It can also refer to any other `Metadata` subclass. (I'll break all your testcases in a follow-up commit, when I propagate this change to assembly.) llvm-svn: 223802
* Add bindings for the rest of the MCJIT options that we previouslyEric Christopher2014-12-022-0/+15
| | | | | | | had support for. We're still missing a binding for an MCJIT memory manager. llvm-svn: 223153
* Reformat with gofmt.Eric Christopher2014-11-261-1/+1
| | | | llvm-svn: 222806
* Make SetMCJITOptimizationLevel more of a method and pass optionsEric Christopher2014-11-262-5/+5
| | | | | | as a reference. Move closer to the type. llvm-svn: 222805
* Make sure that the go bindings call LLVMInitializeMCJITCompilerOptionsEric Christopher2014-11-262-12/+16
| | | | | | | so that they initialize the code generation model to the correct (non-zero) default model. llvm-svn: 222804
* Go bindings: add DIBuilder.InsertValueAtEndPeter Collingbourne2014-11-253-2/+27
| | | | | | | | | | | | Expose llvm::DIBuilder::insertDbgValueIntrinsic as DIBuilder.InsertValueAtEnd in the Go bindings, to support attaching debug metadata to register values. Patch by Andrew Wilkins! Differential Revision: http://reviews.llvm.org/D6374 llvm-svn: 222790
* Expose LLVM version string via macro in llvm-config.h, and modify Go bindingsPeter Collingbourne2014-11-192-4/+19
| | | | | | to make use of it. llvm-svn: 222307
* Add llvm-go tool.Peter Collingbourne2014-10-231-41/+5
| | | | | | | | | | | | This tool lets us build LLVM components within the tree by setting up a $GOPATH that resembles a tree fetched in the normal way with "go get". It is intended that components such as the Go frontend will be built in-tree using this tool. Differential Revision: http://reviews.llvm.org/D5902 llvm-svn: 220462
* Go: add binding for LLVMSetUnnamedAddr.Peter Collingbourne2014-10-221-0/+1
| | | | llvm-svn: 220416
* Fix bashism in build.sh.Peter Collingbourne2014-10-171-1/+1
| | | | llvm-svn: 220027
* Initial version of Go bindings.Peter Collingbourne2014-10-1631-0/+4263
This code is based on the existing LLVM Go bindings project hosted at: https://github.com/go-llvm/llvm Note that all contributors to the gollvm project have agreed to relicense their changes under the LLVM license and submit them to the LLVM project. Differential Revision: http://reviews.llvm.org/D5684 llvm-svn: 219976
OpenPOWER on IntegriCloud