[llvm-dev] Passing inormation from pass to lowering

David Greene via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 1 09:33:37 PDT 2020

Felix Berlakovich via llvm-dev <llvm-dev at lists.llvm.org> writes:

> I have written a ModulePass that calculates various things and adds
> custom metadata attributes to certain instructions. Depending on the
> attributes, I would like to change the machine code of these
> instructions. For example, I would like to replace certain calls with
> jumps, but as far as I can tell the IR metadata is not accessible
> anymore on the level of machine instructions (e.g. in the
> AsmPrinter). What is the best way to pass the information calculated
> by the pass (e.g the attributes) to the part where the target specific
> instructions are emitted?

This is something I have wanted for quite some time.  It would be really
useful to have a Machine IR metadata facility.  In the past I have
hacked things in in various ways but a more general solution would be

Would others be interested in such a facility?  I can't promise that I
can devote a ton of time to it right now but it is something I might
look at in the future if there is enough interest and/or it would be
accepted upstream.  If it's not likely to be accepted upstream I don't
want to spend a lot of time on it, obviously.


More information about the llvm-dev mailing list