aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine
AgeCommit message (Collapse)AuthorFilesLines
8 days[ExecutionEngine] Use std::tie for a lexicographical comparison (NFC) (#160007)Kazu Hirata1-3/+2
2025-09-09[JITLink][RISC-V] Support R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 (#153778)Zhijin Zeng2-2/+43
Support bolt instrument the elf binary which has exception handling table. Fixes #153775
2025-09-09MC: Use Triple form of lookupTarget in more places (#157591)Matt Arsenault1-14/+11
2025-09-08MC: Add Triple overloads for more MC constructors (#157321)Matt Arsenault1-3/+3
Avoids more Triple->string->Triple round trip. This is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908
2025-08-22[llvm] Remove unused includes of SmallSet.h (NFC) (#154893)Kazu Hirata1-1/+0
We just replaced SmallSet<T *, N> with SmallPtrSet<T *, N>, bypassing the redirection found in SmallSet.h. With that, we no longer need to include SmallSet.h in many files.
2025-08-22[ExecutionEngine] Remove an unnecessary cast (NFC) (#154890)Kazu Hirata1-1/+1
getTargetFlags() already returns TargetFlagsType.
2025-08-18[llvm] Replace SmallSet with SmallPtrSet (NFC) (#154068)Kazu Hirata1-1/+1
This patch replaces SmallSet<T *, N> with SmallPtrSet<T *, N>. Note that SmallSet.h "redirects" SmallSet to SmallPtrSet for pointer element types: template <typename PointeeType, unsigned N> class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {}; We only have 140 instances that rely on this "redirection", with the vast majority of them under llvm/. Since relying on the redirection doesn't improve readability, this patch replaces SmallSet with SmallPtrSet for pointer element types.
2025-08-16[ExecutionEngine] Remove unnecessary casts (NFC) (#153931)Kazu Hirata1-4/+3
getLoadAddressWithOffset() and getLoadAddress() already return uint64_t.
2025-08-14[ORC] Add cloneExternalModuleToContext API.Lang Hames1-30/+63
cloneExternalModuleToContext can be used to clone an LLVM module onto a given ThreadSafeContext. Callers of this function are responsible for ensuring exclusive access to the source module and its LLVMContext.
2025-08-09[ExecutionEngine] Remove an unnecessary cast (NFC) (#152836)Kazu Hirata1-1/+1
getValue() already returns uint64_t.
2025-08-04[llvm] Use llvm::iterator_range::empty (NFC) (#151905)Kazu Hirata3-3/+3
2025-08-02[ExecutionEngine] Remove an unnecessary cast (NFC) (#151798)Kazu Hirata1-1/+1
value() already returns uint64_t.
2025-07-29[ExecutionEngine] Remove an unnecessary cast (NFC) (#151082)Kazu Hirata1-2/+1
BaseObj is already of const MachOObjectFile &.
2025-07-26[ExecutionEngine] Remove unnecessary casts (NFC) (#150785)Kazu Hirata1-11/+10
getArch() already returns Triple::ArchType.
2025-07-21[RuntimeDyld][LoongArch] Support large code model (#148584)Ami-zhang1-6/+51
Co-authored-by: Weining Lu <luweining@loongson.cn>
2025-07-11[support] Add packed_endian_specific_integral::value() (#147974)Pavel Labath1-4/+3
They are already implicitly convertible to the underlying type, but that doesn't work in some contexts, and it can be useful to get the underlying value without needing the remember/guess the right type. I converted a couple of call sites to demonstrate usefulness, but there's likely more of them. I know at least of at least a few in LLDB, but I don't want to make this a cross-project patch.
2025-07-07[Orc] Fix error handling in `ORCPlatformSupport::initialize` (#144637)SahilPatidar1-6/+9
Previously, `result` was checked before handling the `Error` returned by `callSPSWrapper`. If `Error` was `success` but `result` indicated failure, the original `Error` was silently dropped, triggering an assertion failure for unhandled `Error`. This patch ensures the `Error` is checked and returned before inspecting `result`, preventing assertion failures. Co-authored-by: Anutosh Bhat <andersonbhat491@gmail.com>
2025-07-04[llvm] Use llvm::fill instead of std::fill(NFC) (#146911)Austin1-6/+3
Use llvm::fill instead of std::fill
2025-07-03[ORC] Add cloneToContext: Clone Module to a given ThreadSafeContext (#146852)Lang Hames1-34/+46
This is a generalization of the existing cloneToNewContext operation: rather than cloning the given module into a new ThreadSafeContext it clones it into any given ThreadSafeContext. The given ThreadSafeContext is locked to ensure that the cloning operation is safe.
2025-07-03[ORC] Fix file header comment formatting. NFC.Lang Hames1-2/+1
2025-07-03[ORC] Replace ThreadSafeContext::getContext with withContextDo. (#146819)Lang Hames3-8/+8
This removes ThreadSafeContext::Lock, ThreadSafeContext::getLock, and ThreadSafeContext::getContext, and replaces them with a ThreadSafeContext::withContextDo method (and const override). The new method can be used to access an existing ThreadSafeContext-wrapped LLVMContext in a safe way: ThreadSafeContext TSCtx = ... ; TSCtx.withContextDo([](LLVMContext *Ctx) { // this closure has exclusive access to Ctx. }); The new API enforces correct locking, whereas the old APIs relied on manual locking (which almost no in-tree code preformed, relying instead on incidental exclusive access to the ThreadSafeContext).
2025-06-28[ExecutionEngine] Remove unnecessary casts (NFC) (#146218)Kazu Hirata5-5/+5
R and K are already of Edge::Kind in all these cases.
2025-06-26[llvm] Use a new constructor of ArrayRef (NFC) (#146008)Kazu Hirata2-3/+2
ArrayRef now has a new constructor that takes a parameter whose type has data() and size(). This patch migrates: ArrayRef<T>(X.data(), X.size() to: ArrayRef<T>(X)
2025-06-27[ORC] Add read operations to orc::MemoryAccess. (#145834)Lang Hames4-20/+191
This commit adds operations to orc::MemoryAccess for reading basic types (uint8_t, uint16_t, uint32_t, uint64_t, pointers, buffers, and strings) from executor memory. The InProcessMemoryAccess and EPCGenericMemoryAccess implementations are updated to support the new operations.
2025-06-26[ORC] Extract MemoryAccess from ExecutorProcessControl, break up header. ↵Lang Hames6-215/+244
(#145671) This moves the MemoryAccess interface out of the ExecutorProcessControl class and splits implementation classes InProcessMemoryManager and SelfExecutorProcessControl out of ExecutorProcessControl.h and into their own headers.
2025-06-25[ORC] Sink DynamicLibrary.h header include into ExecutorProcessControl.cpp.Lang Hames1-0/+1
This include is only used for implementation, so shouldn't be in the public header.
2025-06-24[ORC] Drop unused LinkGraphLinkingLayer::Plugin::notifyLoaded method. (#145457)Lang Hames1-6/+0
This method was included in the original Plugin API as a counterpart to JITEventListener::notifyLoaded but was never used.
2025-06-23[JITLink] Include target addend in out-of-range error (#145423)Maksim Panchenko1-9/+15
When JITLink reports an out-of-range error, the underlying reason could be hidden from the user if it's due to an excessively large target addend. Add non-zero target addend to the message for clarity.
2025-06-24[ORC] DLLImportDefinitionGenerator should use LookupKind::Static.Lang Hames1-2/+2
LookupKind::DLSym should only be used for lookups issued on behalf of the ORC runtime's emulated dlsym operation. This should fix a bug where ORC runtime clients are unable to access functions exported by the runtime. https://github.com/llvm/llvm-project/issues/145296
2025-06-23[ORC] Fix potential stack corruption in Platform::lookupInitSymbols.Lang Hames1-1/+1
We can't exit early when on error here as some threads may still be holding references to LookupMutex. Since we don't need high performance in the error case the easy solution is to drop the early-exit in the error case and wait for all tasks to complete before returning the error. Thanks to Jameson Nash for spotting this bug!
2025-06-21[ORC] Apply MachO::CPU_SUBTYPE_MASK to comparison in getDylibInterfac… ↵Lang Hames1-1/+2
(#145154) …eFromDylib. When comparing CPU subtypes from slices in a MachO universal binary we need to apply the MachO::CPU_SUBTYPE_MASK to mask out any flags in the high bits, otherwise we might fail to correctly match a slice and return a spurious "does not contain slice" error. rdar://153913779
2025-06-19[llvm] Remove unused includes (NFC) (#144941)Kazu Hirata2-4/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-06-11[llvm] Use std::tie to implement operator< (NFC) (#143728)Kazu Hirata1-9/+3
std::tie facilitates lexicographical comparisons through std::tuple's built-in operator<.
2025-06-05[llvm] Ensure newline at the end of files (NFC) (#143061)Kazu Hirata1-1/+1
Without newlines at the end, git diff would display: No newline at end of file
2025-06-06Pass memory buffer to RuntimeDyld::MemoryManager factory (#142930)Karlo Basioli3-13/+18
`RTDyldObjectLinkingLayer` is currently creating a memory manager without any parameters. In this PR I am passing the MemoryBuffer that will be emitted to the MemoryManager so that the user can use it to configure the behaviour of the MemoryManager.
2025-06-03[llvm] annotate interfaces in llvm/ExecutionEngine for DLL export (#140809)Andrew Rogers3-19/+20
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/ExecutionEngine` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS on Linux: - Add `LLVM_ABI_FRIEND` to friend member functions declared with `LLVM_ABI` - Add `LLVM_ABI` to a subset of private class methods and fields that require export - Add `LLVM_ABI` to a small number of symbols that require export but are not declared in headers - Add `LLVM_ABI` to a number of `extern "C"` methods that IDS missed because they're implicitly exported ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2025-05-29[ORC][MachO] Remove misused MachOPlatform::BootstrapInfo::Mutex member.Lang Hames1-4/+4
MachOPlatform::BootstrapInfo::Mutex was meant to be used to synchronize access to the MachOPlatform::BootstrapInfo::ActiveGraphs member, but the latter was also modified under the MachOPlatform::PlatformMutex (in MachOPlatform::MachOPlatformPlugin::modifyPassConfig), leading to a data race. There have been external reports (rdar://151041549) of deadlocks on the MachOPlatform::BootstrapInfo::CV condition variable that are consistent with corruption of the ActiveGraphs member (though alternative explanations for the reported behavior exist, and it has been too rare in practice to verify). This patch removes the misused MachOPlatform::BootstrapInfo::Mutex member and synchronizes all accesses to ActiveGraphs using MachOPlatform::PlatformMutex instead. Since ActiveGraphs is only used during bootstrap the performance impact of this should be negligible. rdar://151041549 - possible fix.
2025-05-28Re-apply "[ORC] Add optional context string to duplicate symbol definition..."Lang Hames2-5/+14
This reapplies b0979b8c65d, which was reverted in 370aecb9572 due to bot failures. The failures were caused by typos in the testcase that are fixed in this patch.
2025-05-27[ORC] Refactor visit-members in StaticLibraryDefinitionGenerator. (#141546)Lang Hames6-92/+182
This refactor was motivated by two bugs identified in out-of-tree builds: 1. Some implementations of the VisitMembersFunction type (often used to implement special loading semantics, e.g. -all_load or -ObjC) were assuming that buffers for archive members were null-terminated, which they are not in general. This was triggering occasional assertions. 2. Archives may include multiple members with the same file name, e.g. when constructed by appending files with the same name: % llvm-ar crs libfoo.a foo.o % llvm-ar q libfoo.a foo.o % llvm-ar t libfoo.a foo.o foo.o While confusing, these members may be safe to link (provided that they're individually valid and don't define duplicate symbols). In ORC however, the archive member name may be used to construct an ORC initializer symbol, which must also be unique. In that case the duplicate member names lead to a duplicate definition error even if the members define unrelated symbols. In addition to these bugs, StaticLibraryDefinitionGenerator had grown a collection of all member buffers (ObjectFilesMap), a BumpPtrAllocator that was redundantly storing synthesized archive member names (these are copied into the MemoryBuffers created for each Object, but were never freed in the allocator), and a set of COFF-specific import files. To fix the bugs above and simplify StaticLibraryDefinitionGenerator this patch makes the following changes: 1. StaticLibraryDefinitionGenerator::VisitMembersFunction is generalized to take a reference to the containing archive, and the index of the member within the archive. It now returns an Expected<bool> indicating whether the member visited should be treated as loadable, not loadable, or as invalidating the entire archive. 2. A static StaticLibraryDefinitionGenerator::createMemberBuffer method is added which creates MemoryBuffers with unique names of the form `<archive-name>[<index>](<member-name>)`. This defers construction of member names until they're loaded, allowing the BumpPtrAllocator (with its redundant name storage) to be removed. 3. The ObjectFilesMap (symbol name -> memory-buffer-ref) is replaced with a SymbolToMemberIndexMap (symbol name -> index) which should be smaller and faster to construct. 4. The 'loadability' result from VisitMemberFunctions is now taken into consideration when building the SymbolToMemberIndexMap so that members that have already been loaded / filtered out can be skipped, and do not take up any ongoing space. 5. The COFF ImportedDynamicLibraries member is moved out into the COFFImportFileScanner utility, which can be used as a VisitMemberFunction. This fixes the bugs described above; and should lower memory consumption slightly, especially for archives with many files and / or symbol where most files are eventually loaded.
2025-05-27[ORC] Remove COFFPlatform::DylibsToPreload. NFC.Lang Hames1-0/+1
DylibsToPreload is only used in the constructor. This patch makes it a local variable.
2025-05-24[ORC] Remove some ancient debugging output.Lang Hames1-3/+1
2025-05-20Revert "[llvm][NFC] Use `llvm::sort()`" (#140668)Iris Shi2-4/+3
2025-05-17[llvm][NFC] Use `llvm::sort()` (#140335)Iris Shi2-3/+4
2025-05-15[llvm] Use std::optional::value_or (NFC) (#140014)Kazu Hirata1-1/+1
2025-05-09Revert "[ORC] Add optional context string to duplicate symbol definition ↵JP Lehr2-14/+5
errors." Broke buildbots: https://lab.llvm.org/buildbot/#/builders/10/builds/5025 This reverts commit b0979b8c65d76cc1897e97b9ad091d8d99abdd18.
2025-05-09[ORC] Add optional context string to duplicate symbol definition errors.Lang Hames2-5/+14
The context string can be added to indicate the source of the duplicate definition. E.g. if the context is set to "foo2.o", then: "Duplicate definition of symbol 'foo'" becomes "In foo2.o, duplicate definition of symbol 'foo'". The JITDylib::defineImpl method is updated to use the name of the MaterializationUnit being added as the context string for duplicate definition errors. The JITDylib::defineMaterializing method is updated to use "defineMaterializing operation" as the conext string.
2025-05-08[JITLink][x86] Update StubsTest unit test for rename in b972164f381.Lang Hames1-2/+2
2025-05-08[JITLink] Rename 'i386' namespace and files to 'x86'.Lang Hames5-70/+70
When building on i386, both clang and gcc define a builtin 'i386' macro (see discussion in https://github.com/llvm/llvm-project/pull/137063). This causes build errors in the JITLink/i386 backend when attempting to build LLVM on i386. This commit renames the 'i386' backend (namespaces, APIs and files) to 'x86' to avoid this issue.
2025-05-08[JITLink][i386] Drop EdgeKind_i386 qualification when using enum values.Lang Hames1-20/+19
We don't need to explicitly qualify these values.
2025-05-08[JITLink][i386] Get rid of EdgeKind_i386::None.Lang Hames2-7/+7
R_386_NONE ELF edges should be handled by skipping the relocation, rather than adding no-op edges to the LinkGraph.