This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Generating complex ASM output



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]