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]

Generating complex ASM output


Hi all,

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")}";

2) Safely allocate a new string, write the operands into that string, and
return the string. I could use a static string, but will this be safe -
how long must the string retain its contents before being overwritten by
another pattern match and assembly generation?

Thanks,

 Dan.

===============================================================================
Dan Towner                           |
                                     |
Computer Science Department          | Email: D.W.Towner@bristol.ac.uk
University of Bristol                | Web:   http://www.cs.bris.ac.uk/~towner
Merchant Venturers Building          | Phone: 44 (0)117 954 5256
Woodland Road, Bristol, UK           |
BS8 1UB                              |
===============================================================================


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