[PATCH] D135202: [IR] Add a target extension type to LLVM.

Zixuan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 22:59:45 PST 2023


zixuan-wu added inline comments.


================
Comment at: llvm/lib/IR/Type.cpp:854
+  if (Name.startswith("spirv.")) {
+    return TargetTypeInfo(Type::getInt8PtrTy(C, 0), TargetExtType::HasZeroInit,
+                          TargetExtType::CanBeGlobal);
----------------
jcranmer-intel wrote:
> zixuan-wu wrote:
> > Is there anymore better code structure to separate target-specific code to get TargetTypeInfo such as individual hook?
> In principle, it is possible to provide target hooks that could let individual targets define their own TargetTypeInfo tables. However, there is a bit of a layering issue: the information needed is too verbose to stuff into a datalayout string, and the existing target hooks aren't in a place where they can make it to DataLayout (who needs to know the size) or Verifier (for the other properties). Something new would have to be added, and it's not clear that it provides significant advantages over a hardcoded list for now.
It's OK for me to evolve or iterate the hardcoded problem later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135202/new/

https://reviews.llvm.org/D135202



More information about the llvm-commits mailing list