Hi,

Please find the attached "h8300-func-vect.patch" that adds 
'function_vector' attribute for H8300 target.

I have taken the reference from previously posted patch for GCC-3.4.2:
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02529.html

I have updated functionality of the attribute to GCC-4.7.0 source. 
Can someone please review the patch and let me know if there should be 
any modifications in it?

I will briefly mention about 'function_vector' attribute.
For test code:

void foo (void)
{
}
void bar (void)
{
    foo();
}

For regular function call, compiler generates code as:
_bar:
        mov.w   r6,@-r7
        mov.w   r7,r6
        jsr     @_foo   [length=4]
        mov.w   @r7+,r6
        rts

Using 'function_vector' attribute, code is generated as:
_bar:
        mov.w   r6,@-r7
        mov.w   r7,r6
        jsr     @@ vector_number:8 [length=2]
        mov.w   @r7+,r6
        rts

I have built the toolchain with 'c' language enabled and did the 
regression testing. Results are fine. I could not build the toolchain 
for 'c++' language as GCC-4.7.0 build fails for it for H8300 target.

======================================================================
ChangeLog:
2012-26-03 Ajinkya Dhobale <ajinkya.dhob...@kpitcummins.com>

        * config/h8300/h8300.c
        (h8300_handle_function_vector_attribute): New function.
        (print_operand): 'B', new print_operand switch case for jsr
        instruction.
        (h8300_attrib): Redefined for argument and new function.

        * config/h8300/h8300.md
        (call): Changed assembly output to get processed by
        print_operand function.
        (call_value): Same as (call).

        * doc/extend.texi
        (function_vector): Added description for H8300 target.
=======================================================================

Thanks & Regards,
Ajinkya Dhobale
KPIT Cummins Infosystems Ltd,
Pune (INDIA)

Attachment: h8300-func-vect.patch
Description: h8300-func-vect.patch

Reply via email to