On 03/28/2012 09:10 AM, Ajinkya Dhobale wrote:
Hi Jeff,

Thank you for replying to the post.

How is this different than the function vector support that is
already in GCC for the H8/300 series processors?

Current H8/300 implementation of function vector seems inappropriate.
This patch fixes following problems from it.

1. Attribute syntax:
The function vector attribute is expected to accept one argument i.e.
vector number.

Ref: http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-
calling-functions-through-the-function-vector-on-H8_002f300_002c-
M16C_002c-M32C-and-SH2A-processors-2525

However, with H8/300 target, it does not accept any argument and test case 
compilation fails with an error message:
error: wrong number of arguments specified for function_vector attribute

This patch fixes this problem.
Ok. So the fundamental difference is your version of function_vector is programmer directed. ie, the programmer explicitly assigns slots for functions to call through the function vector.

The existing implementation relies upon the linker to handle assignment of a specific slot.

The problem with installing your patch as-is is it will break existing code which utilizes the linker driven assignment of slots.

ISTM that you either need to use a different attribute name or find a way to make the argument optional.


2. Addressing mode support:
Currently, even for function vectors, GCC generates instruction 'jsr'
in absolute addressing mode which is incorrect. Instead of that, it should be 
generating 'jsr' in indirect memory addressing mode (@@aa:8).

I think you need to investigate further since functions marked with the attribute should be called through the function vector.

When the linker assigns the slot, the proper syntax is jsr <name>:8

Obviously for the programmer assigned slots, you'll need to use a different syntax. But simply removing the linker assigned slot support is wrong.

Jeff

Reply via email to