public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH H8300] Add function_vector attribute
@ 2012-03-26 14:18 Ajinkya Dhobale
  2012-03-26 15:31 ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: Ajinkya Dhobale @ 2012-03-26 14:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jayant R. Sonar

[-- Attachment #1: Type: text/plain, Size: 1897 bytes --]

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.dhobale@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 #2: h8300-func-vect.patch --]
[-- Type: application/octet-stream, Size: 7304 bytes --]

diff -upr old-gcc/config/h8300/h8300.c gcc/config/h8300/h8300.c
--- old-gcc/config/h8300/h8300.c	2012-03-16 12:54:58.000000000 +0530
+++ gcc/config/h8300/h8300.c	2012-03-19 17:55:33.000000000 +0530
@@ -91,6 +91,7 @@ static const char *cond_string (enum rtx
 static unsigned int h8300_asm_insn_count (const char *);
 static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
 static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int, bool *);
+static tree h8300_handle_function_vector_attribute (tree *, tree, tree, int, bool *);
 static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, bool *);
 static void h8300_print_operand_address (FILE *, rtx);
 static void h8300_print_operand (FILE *, rtx, int);
@@ -1335,6 +1336,7 @@ h8300_rtx_costs (rtx x, int code, int ou
 \f
 /* Documentation for the machine specific operand escapes:
 
+   'B' print jsr operand
    'E' like s but negative.
    'F' like t but negative.
    'G' constant just the negative
@@ -1408,6 +1410,63 @@ h8300_print_operand (FILE *file, rtx x, 
 
   switch (code)
     {
+    case 'B':
+      switch (GET_CODE (x))
+        {
+        case MEM:
+          {
+            rtx inside = XEXP (x, 0);
+            if (GET_CODE (inside) == SYMBOL_REF
+                && (SYMBOL_REF_FLAGS (inside) & SYMBOL_FLAG_FUNCVEC_FUNCTION))
+              {
+                int func_vect_num;
+                tree t;
+                t = SYMBOL_REF_DECL (inside);
+         
+                func_vect_num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (
+                                                  lookup_attribute (
+                                                   "function_vector",
+                                                    DECL_ATTRIBUTES (t)))));
+                fprintf (file, "@@%d:8", (func_vect_num & 0xff));
+              }
+            else if (GET_CODE (inside) == SYMBOL_REF)
+              {
+                fprintf (file, "@");
+                assemble_name (file, XSTR (inside, 0));
+              }
+            else if (GET_CODE (inside) == REG)
+              {
+                fprintf (file, "@");
+            
+                if (TARGET_H8300)
+                  fprintf (file, "%s", names_big[REGNO (inside)]);
+                else
+                  fprintf (file, "%s", names_extended[REGNO (inside)]);
+              } 
+            else if (GET_CODE (inside) == CONST_INT)
+              {
+                fprintf (file,"@");
+            
+                if (TARGET_H8300 | TARGET_NORMAL_MODE)
+                  fprintf (file, "%d", XINT (inside, 0) & 0xffff);
+                else
+                  fprintf (file, "%d", XINT (inside, 0) & 0xffffff);
+              }     
+            else if (GET_CODE (inside) == CONST 
+                     && GET_CODE (XEXP (inside, 0)) == PLUS 
+                     && GET_CODE (XEXP (XEXP (inside, 0), 0)) == SYMBOL_REF)
+              {
+                fprintf (file, "@");
+                assemble_name (file, XSTR (XEXP (XEXP (inside, 0), 0), 0));
+                fprintf (file, "+%d", XINT (XEXP (XEXP (inside, 0), 1), 0));
+              }   
+          }
+          break;
+    
+        default:
+          abort ();
+        }
+      break;
     case 'E':
       switch (GET_CODE (x))
 	{
@@ -5371,8 +5430,8 @@ static const struct attribute_spec h8300
     h8300_handle_fndecl_attribute, false },
   { "monitor",           0, 0, true,  false, false,
     h8300_handle_fndecl_attribute, false },
-  { "function_vector",   0, 0, true,  false, false,
-    h8300_handle_fndecl_attribute, false },
+  { "function_vector",   1, 1, true,  false, false,
+    h8300_handle_function_vector_attribute, false },
   { "eightbit_data",     0, 0, true,  false, false,
     h8300_handle_eightbit_data_attribute, false },
   { "tiny_data",         0, 0, true,  false, false,
@@ -5398,7 +5457,31 @@ h8300_handle_fndecl_attribute (tree *nod
 
   return NULL_TREE;
 }
+/* Handle a "function_vector" attribute; arguments as in
+   struct attribute_spec.handler.  */
 
+static tree
+h8300_handle_function_vector_attribute (tree *node, tree name,
+                                        tree args ATTRIBUTE_UNUSED,
+                                        int flags ATTRIBUTE_UNUSED,
+                                        bool *no_add_attrs)
+{
+  if (TREE_CODE (*node) != FUNCTION_DECL)
+    {
+      warning (OPT_Wattributes, "%qE attribute only applies to functions",
+                name);
+      *no_add_attrs = true;
+    }
+  else if (TREE_CODE (TREE_VALUE (args)) != INTEGER_CST)
+    {
+      /* The argument must be a constant integer.  */
+      warning (OPT_Wattributes, "%qE attribute argument not an integer constant",
+               name);
+      *no_add_attrs = true;
+    }
+  return NULL_TREE;
+}
+	
 /* Handle an "eightbit_data" attribute; arguments as in
    struct attribute_spec.handler.  */
 static tree
diff -upr old-gcc/config/h8300/h8300.md gcc/config/h8300/h8300.md
--- old-gcc/config/h8300/h8300.md	2012-03-16 12:54:58.000000000 +0530
+++ gcc/config/h8300/h8300.md	2012-03-16 12:56:52.000000000 +0530
@@ -2489,14 +2489,7 @@
   [(call (match_operand:QI 0 "call_insn_operand" "or")
 	 (match_operand:HI 1 "general_operand" "g"))]
   ""
-  "*
-{
-  if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
-      && SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
-    return \"jsr\\t@%0:8\";
-  else
-    return \"jsr\\t%0\";
-}"
+  "jsr	%B0"
   [(set_attr "type" "call")
    (set (attr "length")
 	(if_then_else (match_operand:QI 0 "small_call_insn_operand" "")
@@ -2513,14 +2506,7 @@
 	(call (match_operand:QI 1 "call_insn_operand" "or")
 	      (match_operand:HI 2 "general_operand" "g")))]
   ""
-  "*
-{
-  if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-      && SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
-    return \"jsr\\t@%1:8\";
-  else
-    return \"jsr\\t%1\";
-}"
+  "jsr	%B1"
   [(set_attr "type" "call")
    (set (attr "length")
 	(if_then_else (match_operand:QI 0 "small_call_insn_operand" "")
diff -upr old-gcc/doc/extend.texi gcc/doc/extend.texi
--- old-gcc/doc/extend.texi	2012-03-16 12:55:45.000000000 +0530
+++ gcc/doc/extend.texi	2012-03-16 12:56:52.000000000 +0530
@@ -2651,13 +2651,17 @@ The target may also allow additional typ
 @xref{Target Format Checks,,Format Checks Specific to Particular
 Target Machines}.
 
-@item function_vector
+@item function_vector (@var{vector_address})
 @cindex calling functions through the function vector on H8/300, M16C, M32C and SH2A processors
 Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
 function should be called through the function vector.  Calling a
 function through the function vector will reduce code size, however;
 the function vector has a limited size (maximum 128 entries on the H8/300
 and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector.
+The "@var{vector_address}" is the vector location in the range from 0 to 255.
+Compiler uses 2 bytes instead of 4 bytes to call a function declared with this
+attribute. For this compiler uses memory indirect call using jsr @@aa:8 
+instruction.
 
 In SH2A target, this attribute declares a function to be called using the
 TBR relative addressing mode.  The argument to this attribute is the entry

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH H8300] Add function_vector attribute
  2012-03-26 14:18 [PATCH H8300] Add function_vector attribute Ajinkya Dhobale
@ 2012-03-26 15:31 ` Jeff Law
  2012-03-28 15:10   ` Ajinkya Dhobale
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2012-03-26 15:31 UTC (permalink / raw)
  To: Ajinkya Dhobale; +Cc: gcc-patches, Jayant R. Sonar

On 03/26/2012 08:18 AM, Ajinkya Dhobale wrote:
> 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:
[ ... ]
How is this different than the function vector support that is already 
in GCC for the H8/300 series processors?

Jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH H8300] Add function_vector attribute
  2012-03-26 15:31 ` Jeff Law
@ 2012-03-28 15:10   ` Ajinkya Dhobale
  2012-03-29 20:13     ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: Ajinkya Dhobale @ 2012-03-28 15:10 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, Jayant R. Sonar

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.

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).

This patch fixes this problem as well.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH H8300] Add function_vector attribute
  2012-03-28 15:10   ` Ajinkya Dhobale
@ 2012-03-29 20:13     ` Jeff Law
  2012-04-05  6:04       ` Ajinkya Dhobale
                         ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jeff Law @ 2012-03-29 20:13 UTC (permalink / raw)
  To: Ajinkya Dhobale; +Cc: gcc-patches, Jayant R. Sonar

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH H8300] Add function_vector attribute
  2012-03-29 20:13     ` Jeff Law
@ 2012-04-05  6:04       ` Ajinkya Dhobale
  2012-04-30 12:28       ` [Ping] " Ajinkya Dhobale
  2012-05-21 14:07       ` [Ping 2] " Ajinkya Dhobale
  2 siblings, 0 replies; 7+ messages in thread
From: Ajinkya Dhobale @ 2012-04-05  6:04 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, Jayant R. Sonar

[-- Attachment #1: Type: text/plain, Size: 2025 bytes --]

Hello Jeff,

>> So the fundamental difference is your version of function_vector is 
>> programmer directed.

Yes, programmer will need to assign function vector number manually 
during declaration of the attribute.

>> 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

Even I was looking for same. However, when I checked the object dump of
the generated binary it had 'jsr' instruction in absolute addressing format.

Generated assembly was like:
mov.w   r7,r6  
jsr     @_foo  
mov.w   @r7+,r6

And object dump of output file was like:
0d 76           mov.w   r7,r6
5e 00 02 30     jsr     @0x230:24
6d 76           mov.w   @r7+,r6

Do I need to pass any additional command line options during compilation 
to generate 'jsr' in format 'jsr <name>:8'?

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

Because of the 'jsr' generated in absolute addressing format, 
I thought current implementation might be broken and hence I modified it.
However, if current implementation is to be kept as is then I will prefer
making argument passing optional. In that case, I will repost the modified 
patch.

Meanwhile, I have modified the previous patch for following two things:
1. Initially I was generating 'jsr' as 'jsr @@vect-number:8'.
However, I found it was not working on hardware. 

H8 programming manuals mention, 'jsr' instruction in memory indirect 
format expects 8-bit absolute address to be encoded in instruction code. 
Hence I modified the patch to generate it as: 
'jsr @@<vect-number x pointer size>:8'.

Now it is working appropriately on hardware.

2. In H8, pointer size is 2 bytes in 'normal' CPU mode and 4 bytes in 
other modes. I modified the patch to vary 'jsr' destination generation 
accordingly.

Thanks and Regards,
Ajinkya


[-- Attachment #2: modified-h8300-func-vect.patch --]
[-- Type: application/octet-stream, Size: 8034 bytes --]

diff -upr orig-gcc/config/h8300/h8300.c gcc/config/h8300/h8300.c
--- orig-gcc/config/h8300/h8300.c	2012-04-04 18:29:36.000000000 +0530
+++ gcc/config/h8300/h8300.c	2012-04-04 19:35:34.000000000 +0530
@@ -91,6 +91,7 @@ static const char *cond_string (enum rtx
 static unsigned int h8300_asm_insn_count (const char *);
 static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
 static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int, bool *);
+static tree h8300_handle_function_vector_attribute (tree *, tree, tree, int, bool *);
 static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, bool *);
 static void h8300_print_operand_address (FILE *, rtx);
 static void h8300_print_operand (FILE *, rtx, int);
@@ -1335,6 +1336,7 @@ h8300_rtx_costs (rtx x, int code, int ou
 \f
 /* Documentation for the machine specific operand escapes:
 
+   'B' print jsr operand
    'E' like s but negative.
    'F' like t but negative.
    'G' constant just the negative
@@ -1408,6 +1410,68 @@ h8300_print_operand (FILE *file, rtx x, 
 
   switch (code)
     {
+    case 'B':
+      switch (GET_CODE (x))
+        {
+        case MEM:
+          {
+            rtx inside = XEXP (x, 0);
+            if (GET_CODE (inside) == SYMBOL_REF
+                && (SYMBOL_REF_FLAGS (inside) & SYMBOL_FLAG_FUNCVEC_FUNCTION))
+              {
+                int func_vect_num;
+                tree t;
+                t = SYMBOL_REF_DECL (inside);
+         
+                func_vect_num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (
+                                                  lookup_attribute (
+                                                   "function_vector",
+                                                    DECL_ATTRIBUTES (t)))));
+                if (TARGET_NORMAL_MODE)
+                  func_vect_num*=2;
+                else
+                  func_vect_num*=4;               
+ 
+                fprintf (file, "@@%d:8", (func_vect_num & 0xff));
+              }
+            else if (GET_CODE (inside) == SYMBOL_REF)
+              {
+                fprintf (file, "@");
+                assemble_name (file, XSTR (inside, 0));
+              }
+            else if (GET_CODE (inside) == REG)
+              {
+                fprintf (file, "@");
+            
+                if (TARGET_H8300)
+                  fprintf (file, "%s", names_big[REGNO (inside)]);
+                else
+                  fprintf (file, "%s", names_extended[REGNO (inside)]);
+              } 
+            else if (GET_CODE (inside) == CONST_INT)
+              {
+                fprintf (file,"@");
+            
+                if (TARGET_H8300 | TARGET_NORMAL_MODE)
+                  fprintf (file, "%d", XINT (inside, 0) & 0xffff);
+                else
+                  fprintf (file, "%d", XINT (inside, 0) & 0xffffff);
+              }     
+            else if (GET_CODE (inside) == CONST 
+                     && GET_CODE (XEXP (inside, 0)) == PLUS 
+                     && GET_CODE (XEXP (XEXP (inside, 0), 0)) == SYMBOL_REF)
+              {
+                fprintf (file, "@");
+                assemble_name (file, XSTR (XEXP (XEXP (inside, 0), 0), 0));
+                fprintf (file, "+%d", XINT (XEXP (XEXP (inside, 0), 1), 0));
+              }   
+          }
+          break;
+    
+        default:
+          abort ();
+        }
+      break;
     case 'E':
       switch (GET_CODE (x))
 	{
@@ -5371,8 +5435,8 @@ static const struct attribute_spec h8300
     h8300_handle_fndecl_attribute, false },
   { "monitor",           0, 0, true,  false, false,
     h8300_handle_fndecl_attribute, false },
-  { "function_vector",   0, 0, true,  false, false,
-    h8300_handle_fndecl_attribute, false },
+  { "function_vector",   1, 1, true,  false, false,
+    h8300_handle_function_vector_attribute, false },
   { "eightbit_data",     0, 0, true,  false, false,
     h8300_handle_eightbit_data_attribute, false },
   { "tiny_data",         0, 0, true,  false, false,
@@ -5398,7 +5462,49 @@ h8300_handle_fndecl_attribute (tree *nod
 
   return NULL_TREE;
 }
+/* Handle a "function_vector" attribute; arguments as in
+   struct attribute_spec.handler.  */
+
+static tree
+h8300_handle_function_vector_attribute (tree *node, tree name,
+                                        tree args ATTRIBUTE_UNUSED,
+                                        int flags ATTRIBUTE_UNUSED,
+                                        bool *no_add_attrs)
+{
+  int func_vect_num;
 
+  func_vect_num =  TREE_INT_CST_LOW(TREE_VALUE (args));
+
+  if (TREE_CODE (*node) != FUNCTION_DECL)
+    {
+      warning (OPT_Wattributes, "%qE attribute only applies to functions",
+                name);
+      *no_add_attrs = true;
+    }
+  else if (TREE_CODE (TREE_VALUE (args)) != INTEGER_CST)
+    {
+      /* The argument must be a constant integer.  */
+      warning (OPT_Wattributes, "%qE attribute argument not an integer constant",
+               name);
+      *no_add_attrs = true;
+    }
+
+  if (TARGET_NORMAL_MODE && func_vect_num > 127)
+    {
+      warning (OPT_Wattributes, "%qE attribute argument should be between 0 to 127 for Normal Mode, directive ignored", 
+               name);
+      *no_add_attrs = true;
+    }
+  else if(!TARGET_NORMAL_MODE && func_vect_num > 63)
+    {
+      warning (OPT_Wattributes, "%qE attribute argument should be between 0 to 63, directive ignored", 
+               name);
+      *no_add_attrs = true;
+    }
+
+  return NULL_TREE;
+}
+	
 /* Handle an "eightbit_data" attribute; arguments as in
    struct attribute_spec.handler.  */
 static tree
diff -upr orig-gcc/config/h8300/h8300.md gcc/config/h8300/h8300.md
--- orig-gcc/config/h8300/h8300.md	2012-04-04 18:29:36.000000000 +0530
+++ gcc/config/h8300/h8300.md	2012-04-03 21:31:46.000000000 +0530
@@ -2489,14 +2489,7 @@
   [(call (match_operand:QI 0 "call_insn_operand" "or")
 	 (match_operand:HI 1 "general_operand" "g"))]
   ""
-  "*
-{
-  if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
-      && SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
-    return \"jsr\\t@%0:8\";
-  else
-    return \"jsr\\t%0\";
-}"
+  "jsr	%B0"
   [(set_attr "type" "call")
    (set (attr "length")
 	(if_then_else (match_operand:QI 0 "small_call_insn_operand" "")
@@ -2513,14 +2506,7 @@
 	(call (match_operand:QI 1 "call_insn_operand" "or")
 	      (match_operand:HI 2 "general_operand" "g")))]
   ""
-  "*
-{
-  if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-      && SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
-    return \"jsr\\t@%1:8\";
-  else
-    return \"jsr\\t%1\";
-}"
+  "jsr	%B1"
   [(set_attr "type" "call")
    (set (attr "length")
 	(if_then_else (match_operand:QI 0 "small_call_insn_operand" "")
diff -upr orig-gcc/doc/extend.texi gcc/doc/extend.texi
--- orig-gcc/doc/extend.texi	2012-04-04 18:29:47.000000000 +0530
+++ gcc/doc/extend.texi	2012-04-03 21:31:46.000000000 +0530
@@ -2651,13 +2651,17 @@ The target may also allow additional typ
 @xref{Target Format Checks,,Format Checks Specific to Particular
 Target Machines}.
 
-@item function_vector
+@item function_vector (@var{vector_address})
 @cindex calling functions through the function vector on H8/300, M16C, M32C and SH2A processors
 Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
 function should be called through the function vector.  Calling a
 function through the function vector will reduce code size, however;
 the function vector has a limited size (maximum 128 entries on the H8/300
 and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector.
+The "@var{vector_address}" is the vector location in the range from 0 to 255.
+Compiler uses 2 bytes instead of 4 bytes to call a function declared with this
+attribute. For this compiler uses memory indirect call using jsr @@aa:8 
+instruction.
 
 In SH2A target, this attribute declares a function to be called using the
 TBR relative addressing mode.  The argument to this attribute is the entry
Only in gcc/: tags

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Ping] [PATCH H8300] Add function_vector attribute
  2012-03-29 20:13     ` Jeff Law
  2012-04-05  6:04       ` Ajinkya Dhobale
@ 2012-04-30 12:28       ` Ajinkya Dhobale
  2012-05-21 14:07       ` [Ping 2] " Ajinkya Dhobale
  2 siblings, 0 replies; 7+ messages in thread
From: Ajinkya Dhobale @ 2012-04-30 12:28 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, Jayant R. Sonar

Hi,

This is a ping for the patch that add 'function_vector' attribute for 
H8300 targets: 
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00250.html

The patch has been updated to address Jeff's comments which can be referred
at: http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01884.html

Please review the patch.

Thanks & Regards,
Ajinkya Dhobale
KPIT Cummins, Pune.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Ping 2] [PATCH H8300] Add function_vector attribute
  2012-03-29 20:13     ` Jeff Law
  2012-04-05  6:04       ` Ajinkya Dhobale
  2012-04-30 12:28       ` [Ping] " Ajinkya Dhobale
@ 2012-05-21 14:07       ` Ajinkya Dhobale
  2 siblings, 0 replies; 7+ messages in thread
From: Ajinkya Dhobale @ 2012-05-21 14:07 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, Jayant R. Sonar

PING 2:

This is a ping for the patch that add 'function_vector' attribute for 
H8300 targets: 
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00250.html

The patch has been updated to address Jeff's comments which can be referred
at: http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01884.html

Please review the patch.

Thanks & Regards,
Ajinkya Dhobale
KPIT Cummins, Pune.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-21 14:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26 14:18 [PATCH H8300] Add function_vector attribute Ajinkya Dhobale
2012-03-26 15:31 ` Jeff Law
2012-03-28 15:10   ` Ajinkya Dhobale
2012-03-29 20:13     ` Jeff Law
2012-04-05  6:04       ` Ajinkya Dhobale
2012-04-30 12:28       ` [Ping] " Ajinkya Dhobale
2012-05-21 14:07       ` [Ping 2] " Ajinkya Dhobale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).