+2017-09-12 Simon Atanasyan <simon.atanasyan@imgtec.com>
+
+ * config/mips/mips.c (mips_attribute_table): Add 'short_call'
+ attribute.
+ (mips_near_type_p): Add 'short_call' attribute as a synonym
+ for 'near'.
+ * doc/extend.texi (short_call): Document new function attribute.
+
2017-09-12 Jakub Jelinek <jakub@redhat.com>
PR target/82112
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
om_diagnostic } */
{ "long_call", 0, 0, false, true, true, NULL, false },
+ { "short_call", 0, 0, false, true, true, NULL, false },
{ "far", 0, 0, false, true, true, NULL, false },
{ "near", 0, 0, false, true, true, NULL, false },
/* We would really like to treat "mips16" and "nomips16" as type
return *slot;
}
\f
-/* Predicates to test for presence of "near" and "far"/"long_call"
+/* Predicates to test for presence of "near"/"short_call" and "far"/"long_call"
attributes on the given TYPE. */
static bool
mips_near_type_p (const_tree type)
{
- return lookup_attribute ("near", TYPE_ATTRIBUTES (type)) != NULL;
+ return (lookup_attribute ("short_call", TYPE_ATTRIBUTES (type)) != NULL
+ || lookup_attribute ("near", TYPE_ATTRIBUTES (type)) != NULL);
}
static bool
@end smallexample
@item long_call
+@itemx short_call
@itemx near
@itemx far
@cindex indirect calls, MIPS
@cindex @code{long_call} function attribute, MIPS
+@cindex @code{short_call} function attribute, MIPS
@cindex @code{near} function attribute, MIPS
@cindex @code{far} function attribute, MIPS
These attributes specify how a particular function is called on MIPS@.
command-line switch. The @code{long_call} and @code{far} attributes are
synonyms, and cause the compiler to always call
the function by first loading its address into a register, and then using
-the contents of that register. The @code{near} attribute has the opposite
-effect; it specifies that non-PIC calls should be made using the more
+the contents of that register. The @code{short_call} and @code{near}
+attributes are synonyms, and have the opposite
+effect; they specify that non-PIC calls should be made using the more
efficient @code{jal} instruction.
@item mips16
+2017-09-12 Simon Atanasyan <simon.atanasyan@imgtec.com>
+
+ * gcc.target/mips/near-far-1.c: Add check for 'short_call'
+ attribute.
+ * gcc.target/mips/near-far-2.c: Likewise.
+ * gcc.target/mips/near-far-3.c: Likewise.
+ * gcc.target/mips/near-far-4.c: Likewise.
+
2017-09-12 Jakub Jelinek <jakub@redhat.com>
PR target/82112
extern int long_call_func () __attribute__((long_call));
extern int far_func () __attribute__((far));
+extern int short_call_func () __attribute__((short_call));
extern int near_func () __attribute__((near));
extern int normal_func ();
{
return (long_call_func ()
+ far_func ()
+ + short_call_func ()
+ near_func ()
+ normal_func ());
}
/* { dg-final { scan-assembler-not "\tjal\tlong_call_func\n" } } */
/* { dg-final { scan-assembler-not "\tjal\tfar_func\n" } } */
+/* { dg-final { scan-assembler "\t(jal(|s)|balc)\tshort_call_func\n" } } */
/* { dg-final { scan-assembler "\t(jal(|s)|balc)\tnear_func\n" } } */
/* { dg-final { scan-assembler-not "\tjal\tnormal_func\n" } } */
extern int long_call_func () __attribute__((long_call));
extern int far_func () __attribute__((far));
+extern int short_call_func () __attribute__((short_call));
extern int near_func () __attribute__((near));
extern int normal_func ();
{
return (long_call_func ()
+ far_func ()
+ + short_call_func ()
+ near_func ()
+ normal_func ());
}
/* { dg-final { scan-assembler-not "\tjal(|s)\tlong_call_func\n" } } */
/* { dg-final { scan-assembler-not "\tjal(|s)\tfar_func\n" } } */
+/* { dg-final { scan-assembler "\t(jal(|s)|balc)\tshort_call_func\n" } } */
/* { dg-final { scan-assembler "\t(jal(|s)|balc)\tnear_func\n" } } */
/* { dg-final { scan-assembler "\t(jal(|s)|balc)\tnormal_func\n" } } */
NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far));
+NOMIPS16 extern int short_call_func () __attribute__((short_call));
NOMIPS16 extern int near_func () __attribute__((near));
NOMIPS16 extern int normal_func ();
NOMIPS16 int test2 () { return far_func (); }
NOMIPS16 int test3 () { return near_func (); }
NOMIPS16 int test4 () { return normal_func (); }
+NOMIPS16 int test5 () { return short_call_func (); }
/* { dg-final { scan-assembler-not "\tj\tlong_call_func\n" } } */
/* { dg-final { scan-assembler-not "\tj\tfar_func\n" } } */
/* { dg-final { scan-assembler "\t(j(|al|als)|b(|al)c)\tnear_func\n" } } */
/* { dg-final { scan-assembler-not "\tj\tnormal_func\n" } } */
+/* { dg-final { scan-assembler "\t(j(|al|als)|b(|al)c)\tshort_call_func\n" } } */
NOMIPS16 extern int long_call_func () __attribute__((long_call));
NOMIPS16 extern int far_func () __attribute__((far));
+NOMIPS16 extern int short_call_func () __attribute__((short_call));
NOMIPS16 extern int near_func () __attribute__((near));
NOMIPS16 extern int normal_func ();
NOMIPS16 int test2 () { return far_func (); }
NOMIPS16 int test3 () { return near_func (); }
NOMIPS16 int test4 () { return normal_func (); }
+NOMIPS16 int test5 () { return short_call_func (); }
/* { dg-final { scan-assembler-not "\tj\tlong_call_func\n" } } */
/* { dg-final { scan-assembler-not "\tj\tfar_func\n" } } */
/* { dg-final { scan-assembler "\t(j(|al|als)|b(|al)c)\tnear_func\n" } } */
/* { dg-final { scan-assembler "\t(j(|al|als)|b(|al)c)\tnormal_func\n" } } */
+/* { dg-final { scan-assembler "\t(j(|al|als)|b(|al)c)\tshort_call_func\n" } } */