This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Generating complex ASM output
- From: Peter Barada <pbarada at mail dot wm dot sps dot mot dot com>
- To: towner at cs dot bris dot ac dot uk
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 13 Mar 2002 10:59:53 -0500
- Subject: Re: Generating complex ASM output
- References: <Pine.GSO.4.33.0203131534340.9633-100000@tao>
>I have a number of instruction patterns whose operands are rather
>complicated. Whilst it might be possible to generate operand codes to
>output these operands in different ways, I am looking for a way which is
>easier. Is it possible to:
>
>1) Output the assembly directly to the output file. For example:
> (define_insn "*patternName"
> [pattern matching]
> ""
> "*{
> if (operand[0] == something) fprintf(asmFile,"foo");
> else fprintf(asmFile, "bar")}";
Yes, but not using printf. The function to use is asm_output_insn().
grep for it in gcc/config/*./*.md to see how it is used in define_insn
patterns.
If you have only use output_asm_insn in your pattern, then return a
null string. Again, you'll see this in the .md files.
You may want to look at pushing the complication into the functions
that PRINT_OPERAND and PRINT_OPERAND_ADDRESS call instead of the
patterns since it localizes the complexity of the operands into one
place, as well lets you use them in multiple patterns.
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)