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
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.