[PATCH] D74527: AMDGPU/GlobalISel: Support llvm.trap intrinsic

Mahesha S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 09:10:51 PST 2020


hsmhsm marked an inline comment as done.
hsmhsm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp:1114-1131
+  } else {
+    // Pass queue pointer to trap handler as input
+    // Reference: https://llvm.org/docs/AMDGPUUsage.html#trap-handler-abi
+    unsigned RegNo =
+        MF->getInfo<SIMachineFunctionInfo>()->getQueuePtrUserSGPR();
+    assert(RegNo != AMDGPU::NoRegister);
+    Register SrcReg = Register(RegNo);
----------------
arsenm wrote:
> I would factor all of this into a helper function. This is also basically identical to AMDGPULegalizerInfo::loadInputValue, so you could just move this handling into the legalizer
I think, there is no straightforward way to use Legalizer within IRTranslator? 

I can do STI.getLegalizerInfo(), but it won't help to call AMDGPULegalizerInfo::loadInputValue() as it is not a general virtually callable API, but, it is a kind of helper function specific to AMDGPU. 

I again need to explicitly cast STI.getLegalizerInfo() into AMDGPULegalizerInfo*, in order to loadInputValue(). I am not sure, if it is something worth doing it here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74527





More information about the llvm-commits mailing list