I am writing my first pass in LLVM.
I need to collect the threadId in each kernel call and then associate that with the corresponding load/store calls.
I am stuck at extracting the threadId.
LLVM intrinsic for thread ID declaration:
; What is my ID? %id = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() readnone nounwind
So in the above LLVM IR instruction @llvm.nvvm.read.ptx.sreg.tid.* is the operand 1, is that right? And then is %id operand 0?
So I need to check for an instruction with the operand type matching above expression and then extract operand 0.
Is my understanding right?