summaryrefslogtreecommitdiffstats
path: root/llvm/bindings
Commit message (Collapse)AuthorAgeFilesLines
...
* DebugInfo: Delete old subclasses of DITypeDuncan P. N. Exon Smith2015-04-201-25/+17
| | | | | | | | | | | Delete subclasses of (the already deleted) `DIType` in favour of directly using pointers from the `Metadata` hierarchy. While `DICompositeType` wraps `MDCompositeTypeBase` and `DIDerivedType` wraps `MDDerivedTypeBase`, most uses of each really meant the more specific `MDCompositeType` and `MDDerivedType`. llvm-svn: 235351
* DebugInfo: Remove DIDescriptor from the DIBuilder APIDuncan P. N. Exon Smith2015-04-161-20/+16
| | | | | | | | | | | | | | | | As a step toward killing `DIDescriptor` and its subclasses, remove it from the `DIBuilder` API. Replace the subclasses with appropriate pointers from the new debug info hierarchy. There are a couple of possible surprises in type choices for out-of-tree frontends: - Subroutine types: `MDSubroutineType`, not `MDCompositeTypeBase`. - Composite types: `MDCompositeType`, not `MDCompositeTypeBase`. - Scopes: `MDScope`, not `MDNode`. - Generic debug info nodes: `DebugNode`, not `MDNode`. This is part of PR23080. llvm-svn: 235111
* DebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()Duncan P. N. Exon Smith2015-04-151-4/+12
| | | | | | | | | | | | | | | | | | | | | Change `DIBuilder::insertDeclare()` and `insertDbgValueIntrinsic()` to take an `MDLocation*`/`DebugLoc` parameter which it attaches to the created intrinsic. Assert at creation time that the `scope:` field's subprogram matches the variable's. There's a matching `clang` commit to use the API. The context for this is PR22778, which is removing the `inlinedAt:` field from `MDLocalVariable`, instead deferring to the `!dbg` location attached to the debug info intrinsic. The best way to ensure we always have a `!dbg` attachment is to require one at creation time. I'll be adding verifier checks next, but this API change is the best way to shake out frontend bugs. Note: I added an `llvm_unreachable()` in `bindings/go` and passed in `nullptr` for the `DebugLoc`. The `llgo` folks will eventually need to pass a valid `DebugLoc` here. llvm-svn: 235041
* Go bindings: make various DIBuilder arguments optional.Peter Collingbourne2015-04-081-15/+19
| | | | | | | | | | | r234262 changed some code in DIBuilderBindings.cpp to use the unwrap function to unwrap debug metadata. The problem with this is that unwrap asserts that its argument is non-null, which is not what we want in a number of places in DIBuilder where the argument is optional. This change makes certain arguments optional by adding null checks in places where it is required, fixing the llgo build. llvm-svn: 234428
* IR: Remove MDTupleTypedArrayWrapper::operator MDTuple*()Duncan P. N. Exon Smith2015-04-071-2/+2
| | | | | | | | | | | | Remove `MDTupleTypedArrayWrapper::operator MDTuple*()`, since it causes ambiguity (at least in some [1] compilers [2]) when using indexes to `MDTupleTypedArrayWrapper::operator[](unsigned)` that are convertible to (but not the same as) `unsigned`. [1]: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2308 [2]: http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/4442 llvm-svn: 234326
* bindings/go: Stop using DIDescriptor::is*() and auto-castingDuncan P. N. Exon Smith2015-04-071-32/+29
| | | | | | Go bindings edition of r234255. llvm-svn: 234262
* Go bindings: use MDNode::replaceAllUsesWith instead of ↵Peter Collingbourne2015-03-051-3/+2
| | | | | | | | | MDTuple::replaceAllUsesWith. Fixes llgo following Duncan's changes to debug info in r231082. llgo needs to replace composite types, which are no longer represented using MDTuple. llvm-svn: 231416
* Restore LLVMLinkModules C API until it is properly deprecated.Juergen Ributzka2015-03-021-1/+1
| | | | | | | | | | | Add the enum "LLVMLinkerMode" back for backwards-compatibility and add the linker mode parameter back to the "LLVMLinkModules" function. The paramter is ignored and has no effect. Patch provided by: Filip Pizlo Reviewed by: Rafael and Sean llvm-svn: 230988
* bindings/go: expose DIBuilder::createReplaceableCompositeTypeAndrew Wilkins2015-03-023-0/+49
| | | | | | | | | | | | | | | | | Summary: We extend the DIBuilder type, adding a method for creating replaceable composite types. This is necessary for creating debug info describing self-referential types. Reviewers: pcc Reviewed By: pcc Subscribers: axw, llvm-commits Differential Revision: http://reviews.llvm.org/D7851 llvm-svn: 230951
* [PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth2015-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". llvm-svn: 229094
* Re-sort the #include lines in bindings and examples which I managed toChandler Carruth2015-02-135-6/+2
| | | | | | miss previously. llvm-svn: 229089
* [OCaml] Add Llvm.build_empty_phi.Peter Zotov2015-02-063-0/+17
| | | | llvm-svn: 228395
* SpecialCaseList: Add support for parsing multiple input files.Alexey Samsonov2015-02-043-8/+16
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change allows users to create SpecialCaseList objects from multiple local files. This is needed to implement a proper support for -fsanitize-blacklist flag (allow users to specify multiple blacklists, in addition to default blacklist, see PR22431). DFSan can also benefit from this change, as DFSan instrumentation pass now accepts ABI-lists both from -fsanitize-blacklist= and -mllvm -dfsan-abilist flags. Go bindings are fixed accordingly. Test Plan: regression test suite Reviewers: pcc Subscribers: llvm-commits, axw, kcc Differential Revision: http://reviews.llvm.org/D7367 llvm-svn: 228155
* IR: Return unique_ptr from MDNode::getTemporary()Duncan P. N. Exon Smith2015-01-191-2/+3
| | | | | | | | | | | | Change `MDTuple::getTemporary()` and `MDLocation::getTemporary()` to return (effectively) `std::unique_ptr<T, MDNode::deleteTemporary>`, and clean up call sites. (For now, `DIBuilder` call sites just call `release()` immediately.) There's an accompanying change in each of clang and polly to use the new API. llvm-svn: 226504
* IR: Remove MDNodeFwdDeclDuncan P. N. Exon Smith2015-01-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove `MDNodeFwdDecl` (as promised in r226481). Aside from API changes, there's no real functionality change here. `MDNode::getTemporary()` now forwards to `MDTuple::getTemporary()`, which returns a tuple with `isTemporary()` equal to true. The main point is that we can now add temporaries of other `MDNode` subclasses, needed for PR22235 (I introduced `MDNodeFwdDecl` in the first place because I didn't recognize this need, and thought they were only needed to handle forward references). A few things left out of (or highlighted by) this commit: - I've had to remove the (few) uses of `std::unique_ptr<>` to deal with temporaries, since the destructor is no longer public. `getTemporary()` should probably return the equivalent of `std::unique_ptr<T, MDNode::deleteTemporary>`. - `MDLocation::getTemporary()` doesn't exist yet (worse, it actually does exist, but does the wrong thing: `MDNode::getTemporary()` is inherited and returns an `MDTuple`). - `MDNode` now only has one subclass, `UniquableMDNode`, and the distinction between them is actually somewhat confusing. I'll fix those up next. llvm-svn: 226501
* [OCaml] Allow out-of-tree builds of LLVM bindings.Peter Zotov2015-01-131-2/+9
| | | | | | | | | | | | In order to use this feature, configure LLVM as usual, but then build and install it as: make all install SYSTEM_LLVM_CONFIG=llvm-config where llvm-config is the llvm-config binary installed on your system (possibly llvm-config-VERSION on e.g. Debian). llvm-svn: 225787
* [OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.Peter Zotov2015-01-131-4/+10
| | | | | | | | | | | | | | | As a result, installations of LLVM in non-standard locations will not require passing custom -ccopt -L flags when building the binary, nor absolute paths would be embedded in the cma/cmxa files. Additionally, the executables will not require changes to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still has to be set for ocamlc without -custom. See http://caml.inria.fr/mantis/view.php?id=6642. Note that the patch is approved, but not merged yet. It will be released in 4.03 and likely 4.02. llvm-svn: 225778
* [OCaml] [cmake] Use LLVM_LIBRARY_DIR instead of LLVM_LIBRARY_OUTPUT_INTDIR.Peter Zotov2014-12-302-4/+4
| | | | | | | | The latter variable is internal. Original patch by Ramkumar Ramachandra <artagnon@gmail.com> llvm-svn: 224977
* [OCaml] Expose Llvm_executionengine.get_{global_value,function}_address.Peter Zotov2014-12-243-15/+40
| | | | | | | | | Patch by Ramkumar Ramachandra <artagnon@gmail.com>. Also remove Llvm_executionengine.get_pointer_to_global, as it is actually deprecated and didn't appear in a stable release. llvm-svn: 224801
* Finish removing DestroySource.Rafael Espindola2014-12-234-27/+7
| | | | | | Fixes pr21901. llvm-svn: 224782
* [OCaml] PR22014: OCaml bindings didn't link to libLLVM-*.so with -Wl,--as-neededPeter Zotov2014-12-231-2/+2
| | | | | | Patch by Evangelos Foutras <evangelos@foutrelis.com>. llvm-svn: 224766
* Go bindings: introduce Value.ConstantAsMetadata.Peter Collingbourne2014-12-133-0/+10
| | | | llvm-svn: 224179
* 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
* [OCaml] Add Llvm.mdnull.Peter Zotov2014-12-023-0/+9
| | | | | | Patch by Gideon Smeding <gideon.smeding@3ds.com>. llvm-svn: 223129
* [OCaml] Move Llvm.clone_module to its own Llvm_transform_utils module.Peter Zotov2014-12-0112-7/+94
| | | | | | | This way most code won't link this (substantially large) library, if compiled statically with LLVM. llvm-svn: 223072
* [OCaml] [cmake] Add CMake buildsystem for OCaml.Peter Zotov2014-12-0116-0/+114
| | | | | | Closes PR15325. llvm-svn: 223071
* 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
* [OCaml] Fix mismatched CAMLparam/CAMLreturn.Peter Zotov2014-11-031-4/+3
| | | | | | | Also, revert r221142--it was an incorrect fix to this bug which fixed tests by accident. llvm-svn: 221149
* [OCaml] Add -g on DEBUG_SYMBOLS=1, not ENABLE_OPTIMIZED.Peter Zotov2014-11-031-1/+1
| | | | | | Thanks echristo for pointing this out. llvm-svn: 221145
* [OCaml] Don't use deprecated non-caml_namespaced functions.Peter Zotov2014-11-031-7/+7
| | | | llvm-svn: 221143
* [OCaml] Initialize local roots prior to raising.Peter Zotov2014-11-031-3/+4
| | | | | | On 4.02, the OCaml unwinder otherwise gets confused and segfaults. llvm-svn: 221142
* [OCaml] Core package should depend on LLVMTransformUtils for LLVMCloneModule.Peter Zotov2014-11-031-1/+1
| | | | llvm-svn: 221141
* [OCaml] Fix ocamlc -custom builds when configured as --enable-shared.Peter Zotov2014-11-031-2/+3
| | | | llvm-svn: 221140
* [OCaml] Avoid embedding absolute paths into executables.Peter Zotov2014-11-031-14/+14
| | | | | | | | | | | | Bindings built out-of-tree, e.g. via OPAM, should append a line to META.llvm like the following: linkopts = "-cclib -L$libdir -cclib -Wl,-rpath,$libdir" where $libdir is the lib/ directory where LLVM libraries are installed. llvm-svn: 221139
* [OCaml] Don't build stub libraries twice.Peter Zotov2014-11-031-0/+3
| | | | | | | The default Makefile.rules BUILD_ARCHIVE machinery was unintentionally enabled. llvm-svn: 221138
* [OCaml] META: remove exists_if(toplevel).Peter Zotov2014-11-032-2/+0
| | | | | | | ocamlfind ignores the predicates in this case, making the package unavailable for batch compilation as well. llvm-svn: 221136
* [OCaml] ExecutionEngine package should not depend on interpreter.Peter Zotov2014-11-031-1/+1
| | | | | | Interpreter support was removed in r220957. llvm-svn: 221135
* [OCaml] Ensure consistent naming.Peter Zotov2014-10-316-3/+3
| | | | | | | | | Specifically: * Directories match module names. * Test names match module names. * The language is called "OCaml", not "Ocaml". llvm-svn: 220958
* [OCaml] Rework Llvm_executionengine using ctypes.Peter Zotov2014-10-316-527/+145
| | | | | | | | | | | | | | | | | | | | | | | | Since JIT->MCJIT migration, most of the ExecutionEngine interface became deprecated and/or broken. This especially affected the OCaml bindings, as runFunction is no longer available, and unlike in C, it is not possible to coerce a pointer to a function and call it in OCaml. In practice, LLVM 3.5 shipped completely unusable Llvm_executionengine. The GenericValue interface and runFunction were essentially a poor man's FFI. As such, this interface was removed and instead a dependency on ctypes >=0.3 added, which handled platform-specific aspects of accessing data and calling functions. The new interface does not expose JIT (which is a shim around MCJIT), as well as the interpreter (which can't handle a lot of valid IR). Llvm_executionengine.add_global_mapping is currently unusable due to PR20656. llvm-svn: 220957
* [OCaml] Expose LLVMCloneModule.Peter Zotov2014-10-302-0/+4
| | | | llvm-svn: 220903
* [OCaml] Expose LLVM{Get,Set}DLLStorageClass.Peter Zotov2014-10-303-0/+37
| | | | llvm-svn: 220902
OpenPOWER on IntegriCloud