[llvm] [AMDGPU] Add an asm directive to track code_object_version (PR #76267)

Scott Linder via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 16:24:58 PST 2024


================
@@ -123,45 +124,32 @@ bool isHsaAbi(const MCSubtargetInfo &STI) {
   return STI.getTargetTriple().getOS() == Triple::AMDHSA;
 }
 
-std::optional<uint8_t> getHsaAbiVersion(const MCSubtargetInfo *STI) {
-  if (STI && STI->getTargetTriple().getOS() != Triple::AMDHSA)
-    return std::nullopt;
-
-  switch (AmdhsaCodeObjectVersion) {
-  case 4:
-    return ELF::ELFABIVERSION_AMDGPU_HSA_V4;
-  case 5:
-    return ELF::ELFABIVERSION_AMDGPU_HSA_V5;
-  default:
-    report_fatal_error(Twine("Unsupported AMDHSA Code Object Version ") +
-                       Twine(AmdhsaCodeObjectVersion));
+unsigned getCodeObjectVersion(const Module &M) {
----------------
slinder1 wrote:

Nit: If anything has the `AMDHSA` qualifier it seems like they all ought to? It is a bit wordy everywhere, but it isn't used too often so I think consistency is better than brevity.

https://github.com/llvm/llvm-project/pull/76267


More information about the llvm-commits mailing list