[llvm-dev] Passing inormation from pass to lowering

Felix Berlakovich via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 27 05:54:36 PDT 2020

Hi Sam,

I think an intrinsic would be ideal, but I couldn't figure out how to replace calls with an arbitrary number of arguments with a call to an intrinsic. In particular, I would like to call a trampoline instead of the original function. The trampoline performs certain actions and then jumps to the original callee. Would I have to call the intrinsic with the original arguments and then perform a jump to the original function in the intrinsic?

Inlining is not possible unfortunately. I tried to use a IR branch instruction to jump the trampoline, but then the first basic block of the trampoline has a predecessor which is not allowed.

Thanks for your help


Von: Sam Parker <Sam.Parker at arm.com>
Gesendet: Freitag, 27. März 2020 12:47
An: llvm-dev at lists.llvm.org; Felix Berlakovich <felix at berlakovich.at>
Betreff: Re: Passing inormation from pass to lowering

Hi Felix,

Could you use intrinsics instead? Or modify the IR directly to inline and perform a br instead of a call?


Sam Parker

Compilation Tools Engineer | Arm

. . . . . . . . . . . . . . . . . . . . . . . . . . .


From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> on behalf of Felix Berlakovich via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>
Sent: 27 March 2020 08:28
To: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>
Subject: [llvm-dev] Passing inormation from pass to lowering


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?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200327/44616509/attachment.html>

More information about the llvm-dev mailing list