diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2021-05-21 06:19:10 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2021-05-21 08:16:42 +0000 |
commit | 49f9532165f0cc0485a7da84662ebf63d155652c (patch) | |
tree | 2946a6a9d12841a2907efe4051bb75289d0672fb /clang/lib/Interpreter/Interpreter.cpp | |
parent | 2348b5c943198ffedb3494b8443ae172ba96c00e (diff) | |
download | llvm-49f9532165f0cc0485a7da84662ebf63d155652c.zip llvm-49f9532165f0cc0485a7da84662ebf63d155652c.tar.gz llvm-49f9532165f0cc0485a7da84662ebf63d155652c.tar.bz2 |
[clang-repl] Tell the LLJIT the exact target triple we use.
Some systems use a different data layout. For instance, s390x the layout of
machines with vector registers is different from the ones without. In such
cases, the JIT will automatically detect the vector registers and go out of
sync.
This patch tells the JIT what is the target triple of the generated code so that
both ends are in sync.
Discussion available in https://reviews.llvm.org/D96033. Thanks to @uweigand for
helping understand the issue.
Differential revision https://reviews.llvm.org/D102756
Diffstat (limited to 'clang/lib/Interpreter/Interpreter.cpp')
-rw-r--r-- | clang/lib/Interpreter/Interpreter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 79acb5b..711a5e9 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -16,6 +16,7 @@ #include "IncrementalExecutor.h" #include "IncrementalParser.h" +#include "clang/AST/ASTContext.h" #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/ModuleBuilder.h" #include "clang/CodeGen/ObjectFilePCHContainerOperations.h" @@ -204,8 +205,11 @@ llvm::Expected<Transaction &> Interpreter::Parse(llvm::StringRef Code) { llvm::Error Interpreter::Execute(Transaction &T) { assert(T.TheModule); if (!IncrExecutor) { + const llvm::Triple &Triple = + getCompilerInstance()->getASTContext().getTargetInfo().getTriple(); llvm::Error Err = llvm::Error::success(); - IncrExecutor = std::make_unique<IncrementalExecutor>(*TSCtx, Err); + IncrExecutor = std::make_unique<IncrementalExecutor>(*TSCtx, Err, Triple); + if (Err) return Err; } |