Llvm Pass for instrumenting code at the Assembly level

Hello All,

I am new to using llvm and writing llvm passes.
I am trying to write an llvm pass to instrument assembly code.
More specifically I would like to inject instructions after call instructions. (I am targetting x86 architecture)

I am unable to find specific examples of such passes that create and insert instructions.

If anyone has any resources, examples or paths I can explore It will be very helpful.

Thank you in advance.

Here’s an example to inject instruction before call: [X86] Support ``-mindirect-branch-cs-prefix`` for call and jmp to ind… · llvm/llvm-project@6f867f9 · GitHub

Thank you for your response. I checked it out but unfortunately, that’s not what I am trying to do.
Ideally, I am just trying to write an llvm pass to go through the instructions and insert a couple of instructions after each call instruction.

An example of inserting noops before return in a pass: llvm-project/X86PadShortFunction.cpp at main · llvm/llvm-project · GitHub

Thank you !! I will check it out !!