]> granicus.if.org Git - clang/commitdiff
Remove support for pnaclcall attribute
authorDerek Schuff <dschuff@google.com>
Wed, 28 Jan 2015 20:24:52 +0000 (20:24 +0000)
committerDerek Schuff <dschuff@google.com>
Wed, 28 Jan 2015 20:24:52 +0000 (20:24 +0000)
Summary:
It was used for interoperability with PNaCl's calling conventions, but
it's no longer needed.

Also Remove NaCl*ABIInfo which just existed to delegate to either the portable
or native ABIInfo, and remove checkCallingConvention which was now a no-op
override.

Reviewers: jvoung

Subscribers: jfb, llvm-commits

Differential Revision: http://reviews.llvm.org/D7206

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227362 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
include/clang-c/Index.h
include/clang/AST/Type.h
include/clang/Basic/Attr.td
include/clang/Basic/Specifiers.h
lib/AST/Type.cpp
lib/AST/TypePrinter.cpp
lib/Basic/Targets.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/TargetInfo.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaType.cpp
test/CodeGen/arm-pnaclcall.c [deleted file]
test/CodeGen/x86_64-arguments-nacl.c
test/Sema/callingconv.c
tools/libclang/CXType.cpp

index 925d0bfd0925168a5d7dc4e98fa483c498d2d911..ac8ce1c85ef8ef17d9fbbb39894d7976e2a8ba48 100644 (file)
@@ -2854,7 +2854,7 @@ enum CXCallingConv {
   CXCallingConv_X86Pascal = 5,
   CXCallingConv_AAPCS = 6,
   CXCallingConv_AAPCS_VFP = 7,
-  CXCallingConv_PnaclCall = 8,
+  /* Value 8 was PnaclCall, but it was never used, so it could safely be re-used. */
   CXCallingConv_IntelOclBicc = 9,
   CXCallingConv_X86_64Win64 = 10,
   CXCallingConv_X86_64SysV = 11,
index 1bda01fee8ad83282c4f8f272fbfc6112c70f7f0..0800348a941d5b6e345c21ab675a434054998f89 100644 (file)
@@ -3472,7 +3472,6 @@ public:
     attr_thiscall,
     attr_pascal,
     attr_vectorcall,
-    attr_pnaclcall,
     attr_inteloclbicc,
     attr_ms_abi,
     attr_sysv_abi,
index 8323c8f2b2ac534e53e76cfa0a2ce72b0758808c..a5450f91efe0689299c08f137a986be055d3fef2 100644 (file)
@@ -1141,12 +1141,6 @@ def Packed : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
-def PnaclCall : InheritableAttr {
-  let Spellings = [GNU<"pnaclcall">];
-//  let Subjects = [Function, ObjCMethod];
-  let Documentation = [Undocumented];
-}
-
 def IntelOclBicc : InheritableAttr {
   let Spellings = [GNU<"intel_ocl_bicc">];
 //  let Subjects = [Function, ObjCMethod];
index 180785b3525c771d91f219af5e7e0055e832f786..7569c16412b222a469af36b838a30f1cf00ab2bb 100644 (file)
@@ -209,7 +209,6 @@ namespace clang {
     CC_X86_64SysV,  // __attribute__((sysv_abi))
     CC_AAPCS,       // __attribute__((pcs("aapcs")))
     CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
-    CC_PnaclCall,   // __attribute__((pnaclcall))
     CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
     CC_SpirFunction, // default for OpenCL functions on SPIR target
     CC_SpirKernel    // inferred for OpenCL kernels on SPIR target
index cfa7389db6ad41a9090bbbd95ed1e44b70fcfe36..ace5fc373a5b83a32a53a31eb9df85d4be877a3b 100644 (file)
@@ -1586,7 +1586,6 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) {
   case CC_X86_64SysV: return "sysv_abi";
   case CC_AAPCS: return "aapcs";
   case CC_AAPCS_VFP: return "aapcs-vfp";
-  case CC_PnaclCall: return "pnaclcall";
   case CC_IntelOclBicc: return "intel_ocl_bicc";
   case CC_SpirFunction: return "spir_function";
   case CC_SpirKernel: return "spir_kernel";
@@ -1938,7 +1937,6 @@ bool AttributedType::isCallingConv() const {
   case attr_pascal:
   case attr_ms_abi:
   case attr_sysv_abi:
-  case attr_pnaclcall:
   case attr_inteloclbicc:
     return true;
   }
index b874dd0b4c24b96768fcd6ac8c623423cdee830f..0f6a2a8ed07a3d9b09961e91db387435fa770d2c 100644 (file)
@@ -685,9 +685,6 @@ void TypePrinter::printFunctionProtoAfter(const FunctionProtoType *T,
     case CC_AAPCS_VFP:
       OS << " __attribute__((pcs(\"aapcs-vfp\")))";
       break;
-    case CC_PnaclCall:
-      OS << " __attribute__((pnaclcall))";
-      break;
     case CC_IntelOclBicc:
       OS << " __attribute__((intel_ocl_bicc))";
       break;
@@ -1257,7 +1254,6 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
    OS << ')';
    break;
   }
-  case AttributedType::attr_pnaclcall: OS << "pnaclcall"; break;
   case AttributedType::attr_inteloclbicc: OS << "inteloclbicc"; break;
   }
   OS << "))";
index 3443ec944ad9b48b6794188866b8c0c2ef3d0dee..5153103b40fd53ad5d456ca82f302ae3f2c18820 100644 (file)
@@ -686,11 +686,6 @@ public:
       this->DescriptionString = "e-p:32:32-i64:64";
     }
   }
-  typename Target::CallingConvCheckResult checkCallingConvention(
-      CallingConv CC) const override {
-    return CC == CC_PnaclCall ? Target::CCCR_OK :
-        Target::checkCallingConvention(CC);
-  }
 };
 } // end anonymous namespace.
 
index 905f5c31a32beec6a4845ee6c420fbbda88e3b3e..6515d14f8bbb1f0eb8dcd909ec182bddcd637b34 100644 (file)
@@ -135,9 +135,6 @@ static CallingConv getCallingConventionForDecl(const Decl *D, bool IsWindows) {
   if (PcsAttr *PCS = D->getAttr<PcsAttr>())
     return (PCS->getPCS() == PcsAttr::AAPCS ? CC_AAPCS : CC_AAPCS_VFP);
 
-  if (D->hasAttr<PnaclCallAttr>())
-    return CC_PnaclCall;
-
   if (D->hasAttr<IntelOclBiccAttr>())
     return CC_IntelOclBicc;
 
index 25d7d57bad30952469da68b0337aee785d6b72db..8c28dc7e79e084748c2770f66bae6ccbf9567771 100644 (file)
@@ -3092,23 +3092,11 @@ llvm::Value *WinX86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
 
 namespace {
 
-class NaClX86_64ABIInfo : public ABIInfo {
- public:
-  NaClX86_64ABIInfo(CodeGen::CodeGenTypes &CGT, bool HasAVX)
-      : ABIInfo(CGT), PInfo(CGT), NInfo(CGT, HasAVX) {}
-  void computeInfo(CGFunctionInfo &FI) const override;
-  llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
-                         CodeGenFunction &CGF) const override;
- private:
-  PNaClABIInfo PInfo;  // Used for generating calls with pnaclcall callingconv.
-  X86_64ABIInfo NInfo; // Used for everything else.
-};
-
 class NaClX86_64TargetCodeGenInfo : public TargetCodeGenInfo  {
   bool HasAVX;
  public:
    NaClX86_64TargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, bool HasAVX)
-       : TargetCodeGenInfo(new NaClX86_64ABIInfo(CGT, HasAVX)), HasAVX(HasAVX) {
+       : TargetCodeGenInfo(new X86_64ABIInfo(CGT, HasAVX)), HasAVX(HasAVX) {
    }
    unsigned getOpenMPSimdDefaultAlignment(QualType) const override {
      return HasAVX ? 32 : 16;
@@ -3117,21 +3105,6 @@ class NaClX86_64TargetCodeGenInfo : public TargetCodeGenInfo  {
 
 }
 
-void NaClX86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const {
-  if (FI.getASTCallingConvention() == CC_PnaclCall)
-    PInfo.computeInfo(FI);
-  else
-    NInfo.computeInfo(FI);
-}
-
-llvm::Value *NaClX86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
-                                          CodeGenFunction &CGF) const {
-  // Always use the native convention; calling pnacl-style varargs functions
-  // is unuspported.
-  return NInfo.EmitVAArg(VAListAddr, Ty, CGF);
-}
-
-
 // PowerPC-32
 namespace {
 /// PPC32_SVR4_ABIInfo - The 32-bit PowerPC ELF (SVR4) ABI information.
@@ -5098,39 +5071,11 @@ llvm::Value *ARMABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
 }
 
 namespace {
-
-class NaClARMABIInfo : public ABIInfo {
- public:
-  NaClARMABIInfo(CodeGen::CodeGenTypes &CGT, ARMABIInfo::ABIKind Kind)
-      : ABIInfo(CGT), PInfo(CGT), NInfo(CGT, Kind) {}
-  void computeInfo(CGFunctionInfo &FI) const override;
-  llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
-                         CodeGenFunction &CGF) const override;
- private:
-  PNaClABIInfo PInfo; // Used for generating calls with pnaclcall callingconv.
-  ARMABIInfo NInfo; // Used for everything else.
-};
-
 class NaClARMTargetCodeGenInfo : public TargetCodeGenInfo  {
  public:
   NaClARMTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT, ARMABIInfo::ABIKind Kind)
-      : TargetCodeGenInfo(new NaClARMABIInfo(CGT, Kind)) {}
+      : TargetCodeGenInfo(new ARMABIInfo(CGT, Kind)) {}
 };
-
-}
-
-void NaClARMABIInfo::computeInfo(CGFunctionInfo &FI) const {
-  if (FI.getASTCallingConvention() == CC_PnaclCall)
-    PInfo.computeInfo(FI);
-  else
-    static_cast<const ABIInfo&>(NInfo).computeInfo(FI);
-}
-
-llvm::Value *NaClARMABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
-                                       CodeGenFunction &CGF) const {
-  // Always use the native convention; calling pnacl-style varargs functions
-  // is unsupported.
-  return static_cast<const ABIInfo&>(NInfo).EmitVAArg(VAListAddr, Ty, CGF);
 }
 
 //===----------------------------------------------------------------------===//
index c083e9ed6cef5561117c6ff502fdbb9e56e3596f..22df62bb7317fa51f756a4583c3fe8edd4021c73 100644 (file)
@@ -3331,11 +3331,6 @@ static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) {
                        Attr.getAttributeSpellingListIndex()));
     return;
   }
-  case AttributeList::AT_PnaclCall:
-    D->addAttr(::new (S.Context)
-               PnaclCallAttr(Attr.getRange(), S.Context,
-                             Attr.getAttributeSpellingListIndex()));
-    return;
   case AttributeList::AT_IntelOclBicc:
     D->addAttr(::new (S.Context)
                IntelOclBiccAttr(Attr.getRange(), S.Context,
@@ -3392,7 +3387,6 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
     Diag(attr.getLoc(), diag::err_invalid_pcs);
     return true;
   }
-  case AttributeList::AT_PnaclCall: CC = CC_PnaclCall; break;
   case AttributeList::AT_IntelOclBicc: CC = CC_IntelOclBicc; break;
   default: llvm_unreachable("unexpected attribute kind");
   }
@@ -4668,7 +4662,6 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
   case AttributeList::AT_MSABI:
   case AttributeList::AT_SysVABI:
   case AttributeList::AT_Pcs:
-  case AttributeList::AT_PnaclCall:
   case AttributeList::AT_IntelOclBicc:
     handleCallConvAttr(S, D, Attr);
     break;
index 5624f709c9aae73e253eebb89f19c6859bfda98c..73ecc5aaee25f8f15ecf47c3a9068bd95a01b25c 100644 (file)
@@ -112,7 +112,6 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr,
     case AttributeList::AT_SysVABI: \
     case AttributeList::AT_Regparm: \
     case AttributeList::AT_Pcs: \
-    case AttributeList::AT_PnaclCall: \
     case AttributeList::AT_IntelOclBicc
 
 // Microsoft-specific type qualifiers.
@@ -3448,8 +3447,6 @@ static AttributeList::Kind getAttrListKind(AttributedType::Kind kind) {
   case AttributedType::attr_pcs:
   case AttributedType::attr_pcs_vfp:
     return AttributeList::AT_Pcs;
-  case AttributedType::attr_pnaclcall:
-    return AttributeList::AT_PnaclCall;
   case AttributedType::attr_inteloclbicc:
     return AttributeList::AT_IntelOclBicc;
   case AttributedType::attr_ms_abi:
@@ -4478,8 +4475,6 @@ static AttributedType::Kind getCCTypeAttrKind(AttributeList &Attr) {
         .Case("aapcs", AttributedType::attr_pcs)
         .Case("aapcs-vfp", AttributedType::attr_pcs_vfp);
   }
-  case AttributeList::AT_PnaclCall:
-    return AttributedType::attr_pnaclcall;
   case AttributeList::AT_IntelOclBicc:
     return AttributedType::attr_inteloclbicc;
   case AttributeList::AT_MSABI:
diff --git a/test/CodeGen/arm-pnaclcall.c b/test/CodeGen/arm-pnaclcall.c
deleted file mode 100644 (file)
index 2faac1c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// RUN: %clang_cc1 -triple armv7-unknown-nacl-gnueabi \
-// RUN:   -ffreestanding -mfloat-abi hard -target-cpu cortex-a8 \
-// RUN:   -emit-llvm -w -o - %s | FileCheck %s
-
-// Test that functions with pnaclcall attribute generate portable bitcode
-// like the le32 arch target
-
-typedef struct {
-  int a;
-  int b;
-} s1;
-// CHECK-LABEL: define i32 @f48(%struct.s1* byval %s)
-int __attribute__((pnaclcall)) f48(s1 s) { return s.a; }
-
-// CHECK-LABEL: define void @f49(%struct.s1* noalias sret %agg.result)
-s1 __attribute__((pnaclcall)) f49() { s1 s; s.a = s.b = 1; return s; }
-
-union simple_union {
-  int a;
-  char b;
-};
-// Unions should be passed as byval structs
-// CHECK-LABEL: define void @f50(%union.simple_union* byval %s)
-void __attribute__((pnaclcall)) f50(union simple_union s) {}
-
-typedef struct {
-  int b4 : 4;
-  int b3 : 3;
-  int b8 : 8;
-} bitfield1;
-// Bitfields should be passed as byval structs
-// CHECK-LABEL: define void @f51(%struct.bitfield1* byval %bf1)
-void __attribute__((pnaclcall)) f51(bitfield1 bf1) {}
index 1c3f5b0c4a2f43701e6bcc949300200477dc24ab..cbfad1a1cb572059ebd63d5a764a96b1e60c6606 100644 (file)
@@ -90,31 +90,3 @@ void f9122143()
 {
   func(ss);
 }
-
-
-typedef struct {
-  int a;
-  int b;
-} s1;
-// CHECK-LABEL: define i32 @f48(%struct.s1* byval %s)
-int __attribute__((pnaclcall)) f48(s1 s) { return s.a; }
-
-// CHECK-LABEL: define void @f49(%struct.s1* noalias sret %agg.result)
-s1 __attribute__((pnaclcall)) f49() { s1 s; s.a = s.b = 1; return s; }
-
-union simple_union {
-  int a;
-  char b;
-};
-// Unions should be passed as byval structs
-// CHECK-LABEL: define void @f50(%union.simple_union* byval %s)
-void __attribute__((pnaclcall)) f50(union simple_union s) {}
-
-typedef struct {
-  int b4 : 4;
-  int b3 : 3;
-  int b8 : 8;
-} bitfield1;
-// Bitfields should be passed as byval structs
-// CHECK-LABEL: define void @f51(%struct.bitfield1* byval %bf1)
-void __attribute__((pnaclcall)) f51(bitfield1 bf1) {}
index 6a8be5ae050f7cae37500e34725d4b7d11a2dea2..c7a4821412cd2ae1b14370172ebb0779b40029de 100644 (file)
@@ -59,8 +59,6 @@ void __attribute__((cdecl)) ctest3() {}
 typedef __attribute__((stdcall)) void (*PROC)();
 PROC __attribute__((cdecl)) ctest4(const char *x) {}
 
-void __attribute__((pnaclcall)) pnaclfunc(float *a) {} // expected-warning {{calling convention 'pnaclcall' ignored for this target}}
-
 void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {}
 
 typedef void typedef_fun_t(int);
index 04778ddfbb45d5c2e7a8463cb42c139585cacfc4..4d526fbd59f64feb6d6c0ba761df6f6be883e218 100644 (file)
@@ -525,7 +525,6 @@ CXCallingConv clang_getFunctionTypeCallingConv(CXType X) {
       TCALLINGCONV(X86_64SysV);
       TCALLINGCONV(AAPCS);
       TCALLINGCONV(AAPCS_VFP);
-      TCALLINGCONV(PnaclCall);
       TCALLINGCONV(IntelOclBicc);
     case CC_SpirFunction: return CXCallingConv_Unexposed;
     case CC_SpirKernel: return CXCallingConv_Unexposed;