[LLVMdev] [lldb-dev] Reusing LLVM Mips instruction info in lldb

Ahmed Bougacha ahmed.bougacha at gmail.com
Tue Feb 24 13:35:45 PST 2015


On Tue, Feb 24, 2015 at 1:19 PM, Keno Fischer
<kfischer at college.harvard.edu> wrote:
> The basic problem is the following. In, LLDB I get an instruction from the
> target and then I ask the LLVM disassembler to disassemble it for me.
> Depending on the instruction and what the arguments are, I can now construct
> an unwind plan. I get an MCInst back from the disassembler, so what I want
> to do is sth like:
>
> if (Inst.getOpcode() == Mips::Addiu || Inst.getOpcode() == Mips::DAddiu) {
> // This is an addiu instruction, look at the registers and construct the
> unwind plan
> }
>
> but that enum is the one that's tablegen'd. I guess a possible interface
> would be to ask for the opcode of an instruction by name? Seems somewhat
> ugly though.

Equally ugly (and subject to silent breakage) would be to match the
opcode names, as given by MCInstrInfo::getName.

-Ahmed



More information about the llvm-dev mailing list