14 Commits

Author SHA1 Message Date
Nikita Popov
979c275097
[IR] Store Triple in Module (NFC) (#129868)
The module currently stores the target triple as a string. This means
that any code that wants to actually use the triple first has to
instantiate a Triple, which is somewhat expensive. The change in #121652
caused a moderate compile-time regression due to this. While it would be
easy enough to work around, I think that architecturally, it makes more
sense to store the parsed Triple in the module, so that it can always be
directly queried.

For this change, I've opted not to add any magic conversions between
std::string and Triple for backwards-compatibilty purses, and instead
write out needed Triple()s or str()s explicitly. This is because I think
a decent number of them should be changed to work on Triple as well, to
avoid unnecessary conversions back and forth.

The only interesting part in this patch is that the default triple is
Triple("") instead of Triple() to preserve existing behavior. The former
defaults to using the ELF object format instead of unknown object
format. We should fix that as well.
2025-03-06 10:27:47 +01:00
Vassil Vassilev
a72d7eea54
[clang-repl] Simplify the value printing logic to enable out-of-process. (#107737)
This patch improves the design of the IncrementalParser and Interpreter
classes. Now the incremental parser is only responsible for building the
partial translation unit declaration and the AST, while the Interpreter
fills in the lower level llvm::Module and other JIT-related
infrastructure. Finally the Interpreter class now orchestrates the AST
and the LLVM IR with the IncrementalParser and IncrementalExecutor
classes.

The design improvement allows us to rework some of the logic that
extracts an interpreter value into the clang::Value object. The new
implementation simplifies use-cases which are used for out-of-process
execution by allowing interpreter to be inherited or customized with an
clang::ASTConsumer.

This change will enable completing the pretty printing work which is in
llvm/llvm-project#84769
2024-09-23 12:00:43 +02:00
Stefan Gränitz
647d2728c4 [clang-repl] Fix SetUp in CodeCompletionTest fixture (#93816)
And sort out some unused headers
2024-05-30 17:03:21 +02:00
Stefan Gränitz
a871470a0d
[clang-repl] Introduce common fixture class in unittests (NFC) (#93816)
Reduce code bloat by checking test requirements in a common test fixture
2024-05-30 16:15:12 +02:00
Stefan Gränitz
98f9bb384a [clang-repl] Check host JIT support in all tests that create an Interpreter (#84758) 2024-05-28 13:54:09 +02:00
Stefan Gränitz
cb7995a130
[clang-repl] Set up executor implicitly to account for init PTUs (#84758)
Until now the IncrExecutor was created lazily on the first execution
request. In order to process the PTUs that come from initialization, we
have to do it upfront implicitly.
2024-05-28 11:22:49 +02:00
bahareh-farhadi
8c6e0459c4
[zOS] Turn CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT on for zOS (#87797)
PR
[https://github.com/llvm/llvm-project/pull/84461](https://github.com/llvm/llvm-project/pull/84461)
disabled `clang/unittests/Interpreter/InterpreterExtensionsTest.cpp` for
AIX by turning on `CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT`.
This PR turns `CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT` on for
zOS as well, since LLJIT cannot be created on zOS either.

Co-authored-by: Bahareh <bahareh.farhadi@ibm.com>
2024-04-08 08:35:28 -04:00
Stefan Gränitz
13078cbc3e [clang-repl] Skip cross-JIT tests if specified target is not available (#84461) 2024-03-25 11:50:21 +01:00
Stefan Gränitz
0cf4788d9d
[clang-repl] Factor out CreateJITBuilder() and allow specialization in derived classes (#84461)
The LLJITBuilder interface provides a very convenient way to configure
the ORCv2 JIT engine. IncrementalExecutor already used it internally to
construct the JIT, but didn't provide external access. This patch lifts
control of the creation process to the Interpreter and allows injection
of a custom instance through the extended interface. The Interpreter's
default behavior remains unchanged and the IncrementalExecutor remains
an implementation detail.
2024-03-25 09:44:25 +01:00
Jake Egan
424e0a825f
[ClangRepl] Add missing hashtag
Hashtag missing from commit 960b4aa6dab69125778f230c4c94f2d19c96cc87
2024-03-13 09:57:31 -04:00
Jake Egan
960b4aa6da
[AIX][ClangRepl] Disable new test on AIX
This new test fails on the AIX bot with error `LLVM ERROR: Incompatible object format!`. Disable for now to investigate.

Same as 86337beca2e6f939127cd3e088ec80c0cf4a0a64.
2024-03-13 09:54:35 -04:00
Stefan Gränitz
d73c2d5df2 Fix unittest after #84460: only applicable if the platform supports JIT 2024-03-12 23:14:23 +01:00
Stefan Gränitz
bde7a6b791
[clang-repl] Expose CreateExecutor() and ResetExecutor() in extended Interpreter interface (#84460)
IncrementalExecutor is an implementation detail of the Interpreter. In
order to test extended features properly, we must be able to setup and
tear down the executor manually.
2024-03-12 13:55:38 +01:00
Stefan Gränitz
ec2875ce26
[clang-repl] Expose RuntimeInterfaceBuilder to allow customization (#83126)
RuntimeInterfaceBuilder wires up JITed expressions with the hardcoded
Interpreter runtime. It's used only for value printing right now, but it
is not limited to that. The default implementation focuses on an
evaluation process where the Interpreter has direct access to the memory
of JITed expressions (in-process execution or shared memory).

We need a different approach to support out-of-process evaluation or
variations of the runtime. It seems reasonable to expose a minimal
interface for it. The new RuntimeInterfaceBuilder is an abstract base
class in the public header. For that, the TypeVisitor had to become a
component (instead of inheriting from it). FindRuntimeInterface() was
adjusted to return an instance of the RuntimeInterfaceBuilder and it can
be overridden from derived classes.
2024-03-11 12:15:11 +01:00