[PATCH] D128853: [Interpreter] Pass target features to JIT
Jonas Hahnfeld via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 29 13:33:33 PDT 2022
Hahnfeld created this revision.
Hahnfeld added a reviewer: v.g.vassilev.
Herald added subscribers: luke957, luismarques, s.egerton, PkmX, simoncook, arichardson.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This is required to support RISC-V where the '+d' target feature
indicates the presence of the D instruction set extension, which
changes to the Hard-float 'd' ABI.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128853
Files:
clang/lib/Interpreter/IncrementalExecutor.cpp
clang/lib/Interpreter/IncrementalExecutor.h
clang/lib/Interpreter/Interpreter.cpp
Index: clang/lib/Interpreter/Interpreter.cpp
===================================================================
--- clang/lib/Interpreter/Interpreter.cpp
+++ clang/lib/Interpreter/Interpreter.cpp
@@ -213,10 +213,10 @@
llvm::Error Interpreter::Execute(PartialTranslationUnit &T) {
assert(T.TheModule);
if (!IncrExecutor) {
- const llvm::Triple &Triple =
- getCompilerInstance()->getASTContext().getTargetInfo().getTriple();
+ const clang::TargetInfo &TI =
+ getCompilerInstance()->getASTContext().getTargetInfo();
llvm::Error Err = llvm::Error::success();
- IncrExecutor = std::make_unique<IncrementalExecutor>(*TSCtx, Err, Triple);
+ IncrExecutor = std::make_unique<IncrementalExecutor>(*TSCtx, Err, TI);
if (Err)
return Err;
Index: clang/lib/Interpreter/IncrementalExecutor.h
===================================================================
--- clang/lib/Interpreter/IncrementalExecutor.h
+++ clang/lib/Interpreter/IncrementalExecutor.h
@@ -15,7 +15,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Triple.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include <memory>
@@ -32,6 +31,7 @@
namespace clang {
struct PartialTranslationUnit;
+struct TargetInfo;
class IncrementalExecutor {
using CtorDtorIterator = llvm::orc::CtorDtorIterator;
@@ -45,7 +45,7 @@
enum SymbolNameKind { IRName, LinkerName };
IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC, llvm::Error &Err,
- const llvm::Triple &Triple);
+ const clang::TargetInfo &TI);
~IncrementalExecutor();
llvm::Error addModule(PartialTranslationUnit &PTU);
Index: clang/lib/Interpreter/IncrementalExecutor.cpp
===================================================================
--- clang/lib/Interpreter/IncrementalExecutor.cpp
+++ clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -12,6 +12,8 @@
#include "IncrementalExecutor.h"
+#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/TargetOptions.h"
#include "clang/Interpreter/PartialTranslationUnit.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
@@ -28,12 +30,13 @@
IncrementalExecutor::IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC,
llvm::Error &Err,
- const llvm::Triple &Triple)
+ const clang::TargetInfo &TI)
: TSCtx(TSC) {
using namespace llvm::orc;
llvm::ErrorAsOutParameter EAO(&Err);
- auto JTMB = JITTargetMachineBuilder(Triple);
+ auto JTMB = JITTargetMachineBuilder(TI.getTriple());
+ JTMB.addFeatures(TI.getTargetOpts().Features);
if (auto JitOrErr = LLJITBuilder().setJITTargetMachineBuilder(JTMB).create())
Jit = std::move(*JitOrErr);
else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128853.441151.patch
Type: text/x-patch
Size: 2877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220629/81b9760e/attachment.bin>
More information about the cfe-commits
mailing list