For approximative tracing like you seems to seek for, we are using “debug location”: every operation has these and they flow through the pipeline. Ultimately when using LLVM they end up in Dwarf potentially.
For very fine grain and precise tracing I proposed this recently: [RFC] Introduce the concept of IR listeners in MLIR