조일용
2013-Feb-20 01:44 UTC
[LLVMdev] Question about accessing coprocesser register in prologue
An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130220/a080958f/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: 201302201044290_44YDXKW4.gif Type: image/gif Size: 14036 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130220/a080958f/attachment.gif>
Tim Northover
2013-Feb-20 07:41 UTC
[LLVMdev] Question about accessing coprocesser register in prologue
Hi,> The assembly that I want to add into prologue is something like this > > mrc p15, 0, r0, c13, c0, 3 > > I tried it using BuildMI() but couldn't find a register symbol which is > matched with the cp-register on the register table(ARMGenRegisterInfo.inc).If you look at MRC's definition in ARMInstrInfo.td, most of the operands are just immediates rather than registers as far as LLVM is concerned. Also, assembling an instruction gives: $ echo "mrc p15, 0, r0, c13, c0, 3" | llvm-mc -arch=arm -show-inst mrc p15, #0, r0, c13, c0, #3 @ <MCInst #247 MRC @ <MCOperand Reg:60> @ <MCOperand Imm:15> @ <MCOperand Imm:0> @ <MCOperand Imm:13> @ <MCOperand Imm:0> @ <MCOperand Imm:3> @ <MCOperand Imm:14> @ <MCOperand Reg:0>> The last two operands are the usual predication every ARM instruction gets, so this confirms that your BuildMI should be: AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::MRC), ARM::R0) .addImm(15).addImm(0).addImm(13).addImm(0).addImm(3)); Remember that r0 might be in use for a function argument though! Hope this helps. Tim.