[PATCH] D148283: [ExecutionEngine] Support TargetExtType in Interpreter
Wenju He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 18:19:55 PDT 2023
wenju created this revision.
wenju added a reviewer: jcranmer-intel.
Herald added a subscriber: hiraditya.
Herald added a project: All.
wenju requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When llvm Interpreter is used to execute bitcode, it shall be able to handle TargetExtType.
https://reviews.llvm.org/D148283
Files:
llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -878,6 +878,12 @@
report_fatal_error(OS.str());
}
+ if (auto *TETy = dyn_cast<TargetExtType>(C->getType())) {
+ assert(TETy->hasProperty(TargetExtType::HasZeroInit) && C->isNullValue() &&
+ "TargetExtType only supports null constant value");
+ C = Constant::getNullValue(TETy->getLayoutType());
+ }
+
// Otherwise, we have a simple constant.
GenericValue Result;
switch (C->getType()->getTypeID()) {
@@ -1017,6 +1023,9 @@
void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
GenericValue *Ptr, Type *Ty) {
+ if (auto *TETy = dyn_cast<TargetExtType>(Ty))
+ Ty = TETy->getLayoutType();
+
const unsigned StoreBytes = getDataLayout().getTypeStoreSize(Ty);
switch (Ty->getTypeID()) {
@@ -1068,6 +1077,9 @@
void ExecutionEngine::LoadValueFromMemory(GenericValue &Result,
GenericValue *Ptr,
Type *Ty) {
+ if (auto *TETy = dyn_cast<TargetExtType>(Ty))
+ Ty = TETy->getLayoutType();
+
const unsigned LoadBytes = getDataLayout().getTypeStoreSize(Ty);
switch (Ty->getTypeID()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148283.513404.patch
Type: text/x-patch
Size: 1395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/f1b24235/attachment.bin>
More information about the llvm-commits
mailing list