From 0e34f999da1f405c24ff6cb7592f2dee218f8f88 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Tue, 8 Aug 2017 21:17:33 +0000 Subject: [PATCH] [mips] Enable `long_call/short_call` attributes on MIPS64 This change enables `long_call/short_call/far/near` attributes on MIPS64 targets. Differential revision: https://reviews.llvm.org/D36208 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310418 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Attr.td | 17 +++++++++-------- test/CodeGen/long-call-attr.c | 1 + test/Sema/attr-long-call.c | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 70f6b62aca..22eaa1d494 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -264,7 +264,8 @@ class TargetArch arches> { } def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>; def TargetAVR : TargetArch<["avr"]>; -def TargetMips : TargetArch<["mips", "mipsel"]>; +def TargetMips32 : TargetArch<["mips", "mipsel"]>; +def TargetAnyMips : TargetArch<["mips", "mipsel", "mips64", "mips64el"]>; def TargetMSP430 : TargetArch<["msp430"]>; def TargetX86 : TargetArch<["x86"]>; def TargetAnyX86 : TargetArch<["x86", "x86_64"]>; @@ -1160,13 +1161,13 @@ def MSP430Interrupt : InheritableAttr, TargetSpecificAttr { let Documentation = [Undocumented]; } -def Mips16 : InheritableAttr, TargetSpecificAttr { +def Mips16 : InheritableAttr, TargetSpecificAttr { let Spellings = [GCC<"mips16">]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [Undocumented]; } -def MipsInterrupt : InheritableAttr, TargetSpecificAttr { +def MipsInterrupt : InheritableAttr, TargetSpecificAttr { // NOTE: If you add any additional spellings, ARMInterrupt's, // MSP430Interrupt's and AnyX86Interrupt's spellings must match. let Spellings = [GNU<"interrupt">]; @@ -1182,19 +1183,19 @@ def MipsInterrupt : InheritableAttr, TargetSpecificAttr { let Documentation = [MipsInterruptDocs]; } -def MicroMips : InheritableAttr, TargetSpecificAttr { +def MicroMips : InheritableAttr, TargetSpecificAttr { let Spellings = [GCC<"micromips">]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [MicroMipsDocs]; } -def MipsLongCall : InheritableAttr, TargetSpecificAttr { +def MipsLongCall : InheritableAttr, TargetSpecificAttr { let Spellings = [GCC<"long_call">, GCC<"far">]; let Subjects = SubjectList<[Function]>; let Documentation = [MipsLongCallStyleDocs]; } -def MipsShortCall : InheritableAttr, TargetSpecificAttr { +def MipsShortCall : InheritableAttr, TargetSpecificAttr { let Spellings = [GCC<"short_call">, GCC<"near">]; let Subjects = SubjectList<[Function]>; let Documentation = [MipsShortCallStyleDocs]; @@ -1276,13 +1277,13 @@ def NoInline : InheritableAttr { let Documentation = [Undocumented]; } -def NoMips16 : InheritableAttr, TargetSpecificAttr { +def NoMips16 : InheritableAttr, TargetSpecificAttr { let Spellings = [GCC<"nomips16">]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [Undocumented]; } -def NoMicroMips : InheritableAttr, TargetSpecificAttr { +def NoMicroMips : InheritableAttr, TargetSpecificAttr { let Spellings = [GCC<"nomicromips">]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [MicroMipsDocs]; diff --git a/test/CodeGen/long-call-attr.c b/test/CodeGen/long-call-attr.c index e1e528b347..82433caf76 100644 --- a/test/CodeGen/long-call-attr.c +++ b/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); diff --git a/test/Sema/attr-long-call.c b/test/Sema/attr-long-call.c index b6a828f912..cd3de1bf9e 100644 --- a/test/Sema/attr-long-call.c +++ b/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}} -- 2.40.0