Lele Ma via llvm-dev
2019-Nov-21 02:36 UTC
[llvm-dev] [Machine IR] Analyzing Assembly Source Code in MIR passes
Dear LLVM developers, My goal is to write LLVM Machine IR (MIR) passes to analyze the assembly source code. But it seems I need to find a way to translate the handwritten assembly code into MIR format first. Is there any materials, or any modules in LLVM source code, that can help to translate assembly code into LLVM MIR for analysis? Or is there any easier ways to analyze assembly code in MIR passes without translating it? Best Regards, Lele Ma -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191120/0629bdee/attachment.html>
Nicolai Hähnle via llvm-dev
2019-Nov-25 13:19 UTC
[llvm-dev] [Machine IR] Analyzing Assembly Source Code in MIR passes
On Thu, Nov 21, 2019 at 3:37 AM Lele Ma via llvm-dev <llvm-dev at lists.llvm.org> wrote:> My goal is to write LLVM Machine IR (MIR) passes to analyze the assembly source code. But it seems I need to find a way to translate the handwritten assembly code into MIR format first. > > Is there any materials, or any modules in LLVM source code, that can help to translate assembly code into LLVM MIR for analysis? > > Or is there any easier ways to analyze assembly code in MIR passes without translating it?MachineIR is designed for code generation, not for general assembly representation. MIR is even not necessarily able to represent all assembly instructions that a target's hardware supports. The disassembler produces MCInsts, and if you wanted to go from there back to MachineIR, you'd have to write your own target-specific code to do so. Cheers, Nicolai> > Best Regards, > Lele Ma > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.
Aaron Smith via llvm-dev
2019-Nov-25 14:15 UTC
[llvm-dev] [Machine IR] Analyzing Assembly Source Code in MIR passes
Llvm-mctoll will raise a binary back to LLVM IR. Not exactly what you want but it might be something you can leverage. https://github.com/microsoft/llvm-mctoll On Mon, Nov 25, 2019 at 1:19 PM Nicolai Hähnle via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Thu, Nov 21, 2019 at 3:37 AM Lele Ma via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > My goal is to write LLVM Machine IR (MIR) passes to analyze the assembly > source code. But it seems I need to find a way to translate the handwritten > assembly code into MIR format first. > > > > Is there any materials, or any modules in LLVM source code, that can > help to translate assembly code into LLVM MIR for analysis? > > > > Or is there any easier ways to analyze assembly code in MIR passes > without translating it? > > MachineIR is designed for code generation, not for general assembly > representation. MIR is even not necessarily able to represent all > assembly instructions that a target's hardware supports. The > disassembler produces MCInsts, and if you wanted to go from there back > to MachineIR, you'd have to write your own target-specific code to do > so. > > Cheers, > Nicolai > > > > > > > Best Regards, > > Lele Ma > > > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > > -- > Lerne, wie die Welt wirklich ist, > aber vergiss niemals, wie sie sein sollte. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191125/ece156b3/attachment.html>