aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.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/Bitcode/Writer/BitcodeWriter.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/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 339fae04..26994b1 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1052,6 +1052,18 @@ void ModuleBitcodeWriter::writeTypeTable() {
TypeVals.push_back(true);
break;
}
+ case Type::TargetExtTyID: {
+ TargetExtType *TET = cast<TargetExtType>(T);
+ Code = bitc::TYPE_CODE_TARGET_TYPE;
+ writeStringRecord(Stream, bitc::TYPE_CODE_STRUCT_NAME, TET->getName(),
+ StructNameAbbrev);
+ TypeVals.push_back(TET->getNumTypeParameters());
+ for (Type *InnerTy : TET->type_params())
+ TypeVals.push_back(VE.getTypeID(InnerTy));
+ for (unsigned IntParam : TET->int_params())
+ TypeVals.push_back(IntParam);
+ break;
+ }
case Type::TypedPointerTyID:
llvm_unreachable("Typed pointers cannot be added to IR modules");
}