[llvm-dev] Disassembler/InstPrinter problem with implict output register.

Dominique Torette via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 1 03:35:57 PDT 2017


Hi,

I'm defining the instructions for a microcontroller.
Most of the instructions have two explicit input registers, but the output register is implicit for a given instruction.
For example, the output register for FADD instruction is FA_ROUTADD  while the output register for the FMUL instruction is FA_ROUTMUL.
But the FA_ROUTADD nor the FA_ROUTMUL appears in the assembler syntax for the instruction.

def       FADD_A_rr       : CLPFPU_A_rr_Inst<0b0000000101,
                                                (ins FPUaRegisterOperand:$RegA,FPUaRegisterOperand:$RegB),
                                                (outs FPUaROUTRegisterClass:$FA_ROUTADD),
                                                [RFLAGA],
                                                "fadd_a $RegA,$RegB",
                                                [(set f32:$FA_ROUTADD, (fadd f32:$RegA, f32:$RegB))] >;

def       FMUL_A_rr        : CLPFPU_A_rr_Inst<0b0000001101,
                                                (ins FPUaRegisterOperand:$RegA,FPUaRegisterOperand:$RegB),
                                                (outs FPUaROUTRegisterClass:$FA_ROUTMUL),
                                                [RFLAGA],
                                                "fmul_a $RegA,$RegB",
                                                [(set f32:$FA_ROUTMUL, (fmul f32:$RegA, f32:$RegB))] >;

The TableGen generated code consider these two instructions as three operands instructions.
In the MCInst data structure, RegA and RegB are respectively the second and third operands.
The place for the first operand seems to be reserved for the implicit output register.
If I understand the need for such implicit register information, it is not clear for me, when and who will populate this first operand.

My problem is that the default generated disassembler for now populate the RegA and RegB in the first and second operands.
While the InstPrinter try to print the second and the third operands.

What is the most elegant way to address this issue? Any suggestions are welcome.

Regards,           Dominique Torette.







[http://www.spacebel.be/wp-content/uploads/2011/06/image-sign-sbp.jpg]

Dominique Torette
System Architect
Rue des Chasseurs Ardennais - Liège Science Park - B-4031 Angleur
Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20
www.spacebel.be<http://www.spacebel.be/>



 ------------------------------------------------------------------------------

E-MAIL DISCLAIMER

The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.

SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.

SPACEBEL denies all liability where E-mail is used for private use.

SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.
 -------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170801/f8931f9f/attachment.html>


More information about the llvm-dev mailing list