[llvm-dev] Passing inormation from pass to lowering

Sam Parker via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 27 06:02:58 PDT 2020


Hi Felix,

I would try to replicate your call with an intrinsic and jump to the trampoline. There's a vararg_ty that can be used for your intrinsic type declaration, but I haven't used it myself.


Sam Parker

Compilation Tools Engineer | Arm

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

Arm.com

________________________________
From: Felix Berlakovich <felix at berlakovich.at>
Sent: 27 March 2020 12:54
To: Sam Parker <Sam.Parker at arm.com>; llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org>
Subject: AW: Passing inormation from pass to lowering


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



Felix



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?



Regards,

Sam



Sam Parker

Compilation Tools Engineer | Arm

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

Arm.com

________________________________

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



Hi!



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?



Regards



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


More information about the llvm-dev mailing list