[PATCH] D76263: AMDGPU: Initial, crude support for indirect calls

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 16 22:00:35 PDT 2020


sameerds added a comment.

Here's what I understood what this change is doing, based on just interpreting the names in the code for their English meaning: with this change, it is possible to call a function pointer. You can see a valid swappc in the caller, and the in/out arguments will be setup properly.

I understand that the register/stack usage for the callee is ignored. But assuming it happens to be valid, what else is required to declare that the call will actually work?



================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:2942-2944
+  } else {
+    Ops.push_back(DAG.getTargetConstant(0, DL, MVT::i64));
+  }
----------------
I might be mistaken: Is this just emitting a call to nul if the symbol is not found? Does GSD here potentially represent a function pointer??


================
Comment at: llvm/test/CodeGen/AMDGPU/indirect-call.ll:198
+
+; define void @test_indirect_call_vgpr_ptr_arg(void(i32)* %fptr) {
+;   call void %fptr(i32 123)
----------------
Should have one more test where the parameter passed to the callee is not an immediate.


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

https://reviews.llvm.org/D76263





More information about the llvm-commits mailing list