[llvm-dev] How to understand LLVM-C API?

Peng Yu via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 18 10:53:01 PST 2019


I am learning LLVM-C API (I don't plan to learn the C++ API at this
moment.). I am able to get this example to compile and run.


However, I don't understand the usage of LLVMReplaceAllUsesWith().

    // replace all uses of the old instruction with the new one
    LLVMReplaceAllUsesWith(instruction, replacementValue);

How can a value replace an instruction?

The reference is not helpful either. It shows both OldVal, NewVal are
just LLVMValueRef,  why an instruction can be used as a value?


In general, the reference generated by doxygen is not good for
learning and the type hierarchy is too complex. Is there any more
effective materials for learning the C API.



More information about the llvm-dev mailing list