atanasyan updated this revision to Diff 109528.
atanasyan retitled this revision from "[mips] Enable target-specific attributes 
for MIPS64" to "[mips] Enable `long_call/short_call` attributes on MIPS64".
atanasyan edited the summary of this revision.
atanasyan added a comment.

Simplify and reduce the patch. Keep `mips16`, `micromips`, and `interrupt` 
attributes handling unchanged. The only MIPS specific attributes supported on 
MIPS64 targets are `long_call/short_call/far/near`.


Repository:
  rL LLVM

https://reviews.llvm.org/D36208

Files:
  include/clang/Basic/Attr.td
  test/CodeGen/long-call-attr.c
  test/Sema/attr-long-call.c


Index: test/Sema/attr-long-call.c
===================================================================
--- test/Sema/attr-long-call.c
+++ test/Sema/attr-long-call.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple mips-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple mips64-linux-gnu -fsyntax-only -verify %s
 
 __attribute__((long_call(0))) void foo1();  // expected-error {{'long_call' 
attribute takes no arguments}}
 __attribute__((short_call(0))) void foo9();  // expected-error {{'short_call' 
attribute takes no arguments}}
Index: test/CodeGen/long-call-attr.c
===================================================================
--- test/CodeGen/long-call-attr.c
+++ test/CodeGen/long-call-attr.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm  -o  - %s | FileCheck %s
+// RUN: %clang_cc1 -triple mips64-linux-gnu -emit-llvm  -o  - %s | FileCheck %s
 
 void __attribute__((long_call)) foo1 (void);
 void __attribute__((short_call)) foo4 (void);
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -265,6 +265,7 @@
 def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
 def TargetAVR : TargetArch<["avr"]>;
 def TargetMips : TargetArch<["mips", "mipsel"]>;
+def TargetAnyMips : TargetArch<["mips", "mipsel", "mips64", "mips64el"]>;
 def TargetMSP430 : TargetArch<["msp430"]>;
 def TargetX86 : TargetArch<["x86"]>;
 def TargetAnyX86 : TargetArch<["x86", "x86_64"]>;
@@ -1188,13 +1189,13 @@
   let Documentation = [MicroMipsDocs];
 }
 
-def MipsLongCall : InheritableAttr, TargetSpecificAttr<TargetMips> {
+def MipsLongCall : InheritableAttr, TargetSpecificAttr<TargetAnyMips> {
   let Spellings = [GCC<"long_call">, GCC<"far">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [MipsLongCallStyleDocs];
 }
 
-def MipsShortCall : InheritableAttr, TargetSpecificAttr<TargetMips> {
+def MipsShortCall : InheritableAttr, TargetSpecificAttr<TargetAnyMips> {
   let Spellings = [GCC<"short_call">, GCC<"near">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [MipsShortCallStyleDocs];


Index: test/Sema/attr-long-call.c
===================================================================
--- test/Sema/attr-long-call.c
+++ test/Sema/attr-long-call.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple mips-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple mips64-linux-gnu -fsyntax-only -verify %s
 
 __attribute__((long_call(0))) void foo1();  // expected-error {{'long_call' attribute takes no arguments}}
 __attribute__((short_call(0))) void foo9();  // expected-error {{'short_call' attribute takes no arguments}}
Index: test/CodeGen/long-call-attr.c
===================================================================
--- test/CodeGen/long-call-attr.c
+++ test/CodeGen/long-call-attr.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm  -o  - %s | FileCheck %s
+// RUN: %clang_cc1 -triple mips64-linux-gnu -emit-llvm  -o  - %s | FileCheck %s
 
 void __attribute__((long_call)) foo1 (void);
 void __attribute__((short_call)) foo4 (void);
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -265,6 +265,7 @@
 def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
 def TargetAVR : TargetArch<["avr"]>;
 def TargetMips : TargetArch<["mips", "mipsel"]>;
+def TargetAnyMips : TargetArch<["mips", "mipsel", "mips64", "mips64el"]>;
 def TargetMSP430 : TargetArch<["msp430"]>;
 def TargetX86 : TargetArch<["x86"]>;
 def TargetAnyX86 : TargetArch<["x86", "x86_64"]>;
@@ -1188,13 +1189,13 @@
   let Documentation = [MicroMipsDocs];
 }
 
-def MipsLongCall : InheritableAttr, TargetSpecificAttr<TargetMips> {
+def MipsLongCall : InheritableAttr, TargetSpecificAttr<TargetAnyMips> {
   let Spellings = [GCC<"long_call">, GCC<"far">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [MipsLongCallStyleDocs];
 }
 
-def MipsShortCall : InheritableAttr, TargetSpecificAttr<TargetMips> {
+def MipsShortCall : InheritableAttr, TargetSpecificAttr<TargetAnyMips> {
   let Spellings = [GCC<"short_call">, GCC<"near">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [MipsShortCallStyleDocs];
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to