[llvm-dev] MachineInstr to byte or MCInst pass?

Gaël Jobin via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 19 07:59:00 PDT 2016


Don't want to seems rude, my email client dropped the first line...

So, hi everyone !!!

(see my previous email below)

On Wed, 2016-10-19 at 15:55 +0200, Gaël Jobin via llvm-dev wrote:
> I was playing with the ARM backend, more precisely with
> MachineFunction
> pass. I was wondering if there's a way to have the binary
> representation (ARM instruction) of a MachineInstr object. I assumed
> that it was not possible... Then, I saw the
> LowerARMMachineInstrToMCInst and tried to look at the MCInst instead.
> It seems that ARMMCCodeEmitter::encodeInstruction is using
> getBinaryCodeForInst() function that do exactly the job.
> 
> So, is it possible to retrieve the real ARM instruction (binary) from
> a
> MachineInstr? (even if I guess no...)
> 
> Second question, at the lowering stage between MachineInstr and
> MCInst,
> I noticed (in the ARM case) that the transformation is like simply
> copying the opcode and operands, plus a bit of encoding (imm, etc).
> Is
> it possible to do the lowering manually for a specific MachineInstr
> in
> order to retrieve the binary representation? Or, at least, to call
> LowerARMMachineInstrToMCInst manually?
> 
> Third and last question, regarding the MC layer, is it possible to
> have
> some passes to do transformation at the MC layer? If yes, where can I
> register such a pass? Also, what is possible/not possible to do in
> such
> a pass and what kind of pass already exist there?
> 
> Thank's for your help.
> 
> Regards,
> Gael
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> 



More information about the llvm-dev mailing list