This is the mail archive of the 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]

[PATCH, M32C] : Special page vector table implementation


I have implemented the special page vector behavior for M16C and M32C 
targets. Please find attached the patch and ChangeLog along with this 

The "function_vector" attribute is implemented to declare a special 
page subroutine call function. Use of this attribute will reduce the 
code size by 2 bytes per each call generated to the subroutine. The 
argument to the attribute is the vector number entry from the special 
page vector table which contains the 16 low-order bits of the 
subroutine's entry address. Each vector table has special page number 
(18 to 255) which are to be used by JSRS instruction. Jump address of 
the routines is generated by adding 0F0000H (in case of M16C targets) 
or FF0000H (in case of M32C targets), to the 2 byte addresses set in 
the vector table. Therefore, user needs to ensure that all the special 
page vector routines should get mapped within the address range 
0F0000H to 0FFFFFH (for M16C) and FF0000H to FFFFFFH (for M32C).

In the following example, instruction "jsrs #18" gets generated instead
 of a regular instruction "jsr.a _foo". Therefore for each call to the
 function "foo", 2 bytes are saved.

void foo (void) __attribute__((function_vector(18)));
void foo (void)
void bar (void)

If functions are defined in one file and are called in another file,
then user has to write this attribute declaration in both files.

Please note that, this attribute is ignored for R8C target.

No new regressions found.
The patch is tested on GCC-4.2-20060722 snapshot.

I have tested it on M16C and M32C target hardwares and GDB debugger 
also. It is working fine on hardware.
In GDB debugger, it is working fine for M16C target, however it is 
giving problem for M32C target. It is not entering into the expected 
subroutines using "JSRS" instruction and always jumping to the address

2006-07-28  Jayant Sonar  <>

	* config/m32c/m32c.c 
	(m32c_encode_section_info): New
	(function_vector_handler): New
	(current_function_special_page_vector): New
	(m32c_special_page_vector_p): New.
	* config/m32c/m32c-protos.h (m32c_special_page_vector_p): 
	* config/m32c/ Added instruction JSRS for functions 
	with	attribute "function_vector".
	* doc/extend.texi (function_vector): Added description 
	for M16C, M32C targets.

Jayant Sonar
KPIT Cummins Infosystems Ltd,
Pune (INDIA) 

Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C
 and M32C series. 
The following site also offers free technical support to its users. 
Visit for details. 
Latest versions of KPIT GNU tools were released on June 1, 2006.

Attachment: special_page_vect_patch.tar.gz
Description: special_page_vect_patch.tar.gz

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