r175936 - Revert r175912, "Add support for coldcc to clang" at John's request.

Peter Collingbourne peter at pcc.me.uk
Fri Feb 22 16:06:19 PST 2013


Author: pcc
Date: Fri Feb 22 18:06:18 2013
New Revision: 175936

URL: http://llvm.org/viewvc/llvm-project?rev=175936&view=rev
Log:
Revert r175912, "Add support for coldcc to clang" at John's request.

Removed:
    cfe/trunk/test/CodeGen/coldcc.c
Modified:
    cfe/trunk/docs/LanguageExtensions.rst
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/include/clang/Basic/Attr.td
    cfe/trunk/include/clang/Basic/Specifiers.h
    cfe/trunk/include/clang/Basic/TargetInfo.h
    cfe/trunk/lib/AST/DumpXML.cpp
    cfe/trunk/lib/AST/Type.cpp
    cfe/trunk/lib/AST/TypePrinter.cpp
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Fri Feb 22 18:06:18 2013
@@ -1970,12 +1970,3 @@ Clang implements two kinds of checks wit
    In this case Clang does not warn because the format string ``s`` and
    the corresponding arguments are annotated.  If the arguments are
    incorrect, the caller of ``foo`` will receive a warning.
-
-LLVM-Specific Calling Conventions
-=================================
-
-Clang supports `LLVM's coldcc calling convention
-<http://llvm.org/docs/LangRef.html#calling-conventions>`_ via the ``coldcc``
-GNU-style attribute, or the ``clang::coldcc`` C++11 attribute.  However,
-this calling convention is not guaranteed to be ABI compatible between
-different versions of the compiler.

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Feb 22 18:06:18 2013
@@ -2674,7 +2674,6 @@ enum CXCallingConv {
   CXCallingConv_AAPCS_VFP = 7,
   CXCallingConv_PnaclCall = 8,
   CXCallingConv_IntelOclBicc = 9,
-  CXCallingConv_Cold = 10,
 
   CXCallingConv_Invalid = 100,
   CXCallingConv_Unexposed = 200

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Feb 22 18:06:18 2013
@@ -3323,7 +3323,6 @@ public:
     // No operand.
     attr_noreturn,
     attr_cdecl,
-    attr_coldcc,
     attr_fastcall,
     attr_stdcall,
     attr_thiscall,

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Feb 22 18:06:18 2013
@@ -277,10 +277,6 @@ def Cold : InheritableAttr {
   let Spellings = [GNU<"cold">, CXX11<"gnu", "cold">];
 }
 
-def ColdCC : InheritableAttr {
-  let Spellings = [GNU<"coldcc">, CXX11<"clang", "coldcc">];
-}
-
 def Common : InheritableAttr {
   let Spellings = [GNU<"common">, CXX11<"gnu", "common">];
 }

Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Fri Feb 22 18:06:18 2013
@@ -188,7 +188,6 @@ namespace clang {
   enum CallingConv {
     CC_Default,
     CC_C,           // __attribute__((cdecl))
-    CC_Cold,        // __attribute__((coldcc))
     CC_X86StdCall,  // __attribute__((stdcall))
     CC_X86FastCall, // __attribute__((fastcall))
     CC_X86ThisCall, // __attribute__((thiscall))
@@ -199,10 +198,6 @@ namespace clang {
     CC_IntelOclBicc // __attribute__((intel_ocl_bicc))
   };
 
-  inline bool isTargetSpecific(CallingConv CC) {
-    return CC >= CC_X86StdCall;
-  }
-
 } // end namespace clang
 
 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Fri Feb 22 18:06:18 2013
@@ -754,7 +754,13 @@ public:
   /// and be substituted with the default calling convention, or (someday)
   /// produce an error (such as using thiscall on a non-instance function).
   virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {
-    return CCCR_Warning;
+    switch (CC) {
+      default:
+        return CCCR_Warning;
+      case CC_C:
+      case CC_Default:
+        return CCCR_OK;
+    }
   }
 
 protected:

Modified: cfe/trunk/lib/AST/DumpXML.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DumpXML.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DumpXML.cpp (original)
+++ cfe/trunk/lib/AST/DumpXML.cpp Fri Feb 22 18:06:18 2013
@@ -925,7 +925,6 @@ struct XMLDumper : public XMLDeclVisitor
     case CC_AAPCS_VFP: return set("cc", "aapcs_vfp");
     case CC_PnaclCall: return set("cc", "pnaclcall");
     case CC_IntelOclBicc: return set("cc", "intel_ocl_bicc");
-    case CC_Cold: return set("cc", "coldcc");
     }
   }
 

Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Fri Feb 22 18:06:18 2013
@@ -1547,7 +1547,6 @@ StringRef FunctionType::getNameForCallCo
     llvm_unreachable("no name for default cc");
 
   case CC_C: return "cdecl";
-  case CC_Cold: return "coldcc";
   case CC_X86StdCall: return "stdcall";
   case CC_X86FastCall: return "fastcall";
   case CC_X86ThisCall: return "thiscall";

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Fri Feb 22 18:06:18 2013
@@ -626,9 +626,6 @@ void TypePrinter::printFunctionProtoAfte
   case CC_C:
     OS << " __attribute__((cdecl))";
     break;
-  case CC_Cold:
-    OS << " __attribute__((coldcc))";
-    break;
   case CC_X86StdCall:
     OS << " __attribute__((stdcall))";
     break;
@@ -1159,7 +1156,6 @@ void TypePrinter::printAttributedAfter(c
 
   case AttributedType::attr_noreturn: OS << "noreturn"; break;
   case AttributedType::attr_cdecl: OS << "cdecl"; break;
-  case AttributedType::attr_coldcc: OS << "coldcc"; break;
   case AttributedType::attr_fastcall: OS << "fastcall"; break;
   case AttributedType::attr_stdcall: OS << "stdcall"; break;
   case AttributedType::attr_thiscall: OS << "thiscall"; break;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Feb 22 18:06:18 2013
@@ -1933,7 +1933,8 @@ public:
     // We accept all non-ARM calling conventions
     return (CC == CC_X86ThisCall ||
             CC == CC_X86FastCall ||
-            CC == CC_X86StdCall ||
+            CC == CC_X86StdCall || 
+            CC == CC_C || 
             CC == CC_X86Pascal ||
             CC == CC_IntelOclBicc) ? CCCR_OK : CCCR_Warning;
   }
@@ -3026,7 +3027,9 @@ public:
   }
 
   virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {
-    return CC == CC_IntelOclBicc ? CCCR_OK : CCCR_Warning;
+    return (CC == CC_Default ||
+            CC == CC_C || 
+            CC == CC_IntelOclBicc) ? CCCR_OK : CCCR_Warning;
   }
 
   virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const {

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Feb 22 18:06:18 2013
@@ -37,7 +37,6 @@ using namespace CodeGen;
 static unsigned ClangCallConvToLLVMCallConv(CallingConv CC) {
   switch (CC) {
   default: return llvm::CallingConv::C;
-  case CC_Cold: return llvm::CallingConv::Cold;
   case CC_X86StdCall: return llvm::CallingConv::X86_StdCall;
   case CC_X86FastCall: return llvm::CallingConv::X86_FastCall;
   case CC_X86ThisCall: return llvm::CallingConv::X86_ThisCall;
@@ -136,9 +135,6 @@ CodeGenTypes::arrangeFreeFunctionType(Ca
 
 static CallingConv getCallingConventionForDecl(const Decl *D) {
   // Set the appropriate calling convention for the Function.
-  if (D->hasAttr<ColdCCAttr>())
-    return CC_Cold;
-
   if (D->hasAttr<StdCallAttr>())
     return CC_X86StdCall;
 

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Feb 22 18:06:18 2013
@@ -3859,11 +3859,6 @@ static void handleCallConvAttr(Sema &S,
   }
 
   switch (Attr.getKind()) {
-  case AttributeList::AT_ColdCC:
-    D->addAttr(::new (S.Context)
-               ColdCCAttr(Attr.getRange(), S.Context,
-                          Attr.getAttributeSpellingListIndex()));
-    return;
   case AttributeList::AT_FastCall:
     D->addAttr(::new (S.Context)
                FastCallAttr(Attr.getRange(), S.Context,
@@ -3944,7 +3939,6 @@ bool Sema::CheckCallingConvAttr(const At
   // move to TargetAttributesSema one day.
   switch (attr.getKind()) {
   case AttributeList::AT_CDecl: CC = CC_C; break;
-  case AttributeList::AT_ColdCC: CC = CC_Cold; break;
   case AttributeList::AT_FastCall: CC = CC_X86FastCall; break;
   case AttributeList::AT_StdCall: CC = CC_X86StdCall; break;
   case AttributeList::AT_ThisCall: CC = CC_X86ThisCall; break;
@@ -3977,9 +3971,6 @@ bool Sema::CheckCallingConvAttr(const At
   default: llvm_unreachable("unexpected attribute kind");
   }
 
-  if (!isTargetSpecific(CC))
-    return false;
-
   const TargetInfo &TI = Context.getTargetInfo();
   TargetInfo::CallingConvCheckResult A = TI.checkCallingConvention(CC);
   if (A == TargetInfo::CCCR_Warning) {
@@ -4783,7 +4774,6 @@ static void ProcessInheritableDeclAttr(S
     break;
   case AttributeList::AT_StdCall:
   case AttributeList::AT_CDecl:
-  case AttributeList::AT_ColdCC:
   case AttributeList::AT_FastCall:
   case AttributeList::AT_ThisCall:
   case AttributeList::AT_Pascal:

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Feb 22 18:06:18 2013
@@ -100,7 +100,6 @@ static void diagnoseBadTypeAttribute(Sem
 #define FUNCTION_TYPE_ATTRS_CASELIST \
     case AttributeList::AT_NoReturn: \
     case AttributeList::AT_CDecl: \
-    case AttributeList::AT_ColdCC: \
     case AttributeList::AT_FastCall: \
     case AttributeList::AT_StdCall: \
     case AttributeList::AT_ThisCall: \
@@ -3104,8 +3103,6 @@ static AttributeList::Kind getAttrListKi
     return AttributeList::AT_NoReturn;
   case AttributedType::attr_cdecl:
     return AttributeList::AT_CDecl;
-  case AttributedType::attr_coldcc:
-    return AttributeList::AT_ColdCC;
   case AttributedType::attr_fastcall:
     return AttributeList::AT_FastCall;
   case AttributedType::attr_stdcall:

Removed: cfe/trunk/test/CodeGen/coldcc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/coldcc.c?rev=175935&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/coldcc.c (original)
+++ cfe/trunk/test/CodeGen/coldcc.c (removed)
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -Werror -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Werror -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple armv7-unknown-unknown -Werror -emit-llvm -o - %s | FileCheck %s
-
-void __attribute__((coldcc)) f1(void);
-
-void f2(void) {
-  f1();
-// CHECK: call coldcc void @f1()
-}
-
-// CHECK: declare coldcc void @f1()

Modified: cfe/trunk/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=175936&r1=175935&r2=175936&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXType.cpp (original)
+++ cfe/trunk/tools/libclang/CXType.cpp Fri Feb 22 18:06:18 2013
@@ -500,7 +500,6 @@ CXCallingConv clang_getFunctionTypeCalli
       TCALLINGCONV(AAPCS_VFP);
       TCALLINGCONV(PnaclCall);
       TCALLINGCONV(IntelOclBicc);
-      TCALLINGCONV(Cold);
     }
 #undef TCALLINGCONV
   }





More information about the cfe-commits mailing list