A question regarding emitting additional info to an insn
Michael Meissner
meissner@linux.vnet.ibm.com
Thu Nov 13 23:31:00 GMT 2008
On Thu, Nov 13, 2008 at 06:01:27PM +0200, Revital1 Eres wrote:
>
> Hello,
>
> I want print additional information for each branch insn which will be
> used by the linker (for the SPU software i-cache), for example:
>
> brsl $lr,foo@info
>
> and I wonder what is the best way to implement it in GCC.
>
> I defined a new note (in reg-notes.def) which can be attached to each
> branch (using add_reg_note ()) and holds that info. I now want to print
> the information of that note when emitting the branch, but I am not
> sure exactly how to do that. Should I change the instruction template
> to use the reg-notes?
Unfortunately, it is harder than it should be. The approach I would take is
define FINAL_SCAN_INSN to set a global variable to the loop level, based on the
notes being present or 0 if the note is not present. At present,
FINAL_SCAN_INSN is not defined for the SPU.
Then I would define PRINT_OPERAND_PUNCT_VALID_P to add a new punctuation
character, such as '*' which will print the thing you want if the note is
there, or nothing if it isn't. For example, here is the i386 version which
adds 4 special formats:
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
((CODE) == '*' || (CODE) == '+' || (CODE) == '&' || (CODE) == ';')
Then in print_operand, add a new case statement for '*' to do what you want.
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com
More information about the Gcc
mailing list