aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorJoshua Cranmer <joshua.cranmer@intel.com>2022-12-20 11:02:11 -0500
committerJoshua Cranmer <joshua.cranmer@intel.com>2022-12-20 11:02:11 -0500
commite6b02214c68df2c9f826e02310c9352ac652e456 (patch)
tree81280c3f2a940610cd7f2e55393ac618a56c4025 /llvm/lib/IR/Function.cpp
parente43924a75145d2f9e722f74b673145c3e62bfd07 (diff)
downloadllvm-e6b02214c68df2c9f826e02310c9352ac652e456.zip
llvm-e6b02214c68df2c9f826e02310c9352ac652e456.tar.gz
llvm-e6b02214c68df2c9f826e02310c9352ac652e456.tar.bz2
[IR] Add a target extension type to LLVM.
Target-extension types represent types that need to be preserved through optimization, but otherwise are not introspectable by target-independent optimizations. This patch doesn't add any uses of these types by an existing backend, it only provides basic infrastructure such that these types would work correctly. Reviewed By: nikic, barannikov88 Differential Revision: https://reviews.llvm.org/D135202
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index cd66eeb..c39e3ea 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -941,6 +941,15 @@ static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType) {
Result += "nx";
Result += "v" + utostr(EC.getKnownMinValue()) +
getMangledTypeStr(VTy->getElementType(), HasUnnamedType);
+ } else if (TargetExtType *TETy = dyn_cast<TargetExtType>(Ty)) {
+ Result += "t";
+ Result += TETy->getName();
+ for (Type *ParamTy : TETy->type_params())
+ Result += "_" + getMangledTypeStr(ParamTy, HasUnnamedType);
+ for (unsigned IntParam : TETy->int_params())
+ Result += "_" + utostr(IntParam);
+ // Ensure nested target extension types are distinguishable.
+ Result += "t";
} else if (Ty) {
switch (Ty->getTypeID()) {
default: llvm_unreachable("Unhandled type");